Skip to content
Snippets Groups Projects
Unverified Commit 5e65a939 authored by Benjamin Cumming's avatar Benjamin Cumming Committed by GitHub
Browse files

profile multicore mechanism state and current calls individually (#492)

The built in profiler generates timings for state and current for individual multicore mechanisms.

Modcc generates and PE(advance_integrate_{state,current}_X) profiler calls (along with corresponding PL() for calls to multicore mechanism nrn_state and nrn_current API calls.

No timings are made for the gpu back end, which is not properly supported by the current profiling tools.
parent 64171e43
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,13 @@ using io::indent; ...@@ -14,6 +14,13 @@ using io::indent;
using io::popindent; using io::popindent;
using io::quote; using io::quote;
constexpr bool with_profiling() {
#ifdef ARB_HAVE_PROFILING
return true;
#else
return false;
#endif
}
void emit_procedure_proto(std::ostream&, ProcedureExpression*, const std::string& qualified = ""); void emit_procedure_proto(std::ostream&, ProcedureExpression*, const std::string& qualified = "");
void emit_simd_procedure_proto(std::ostream&, ProcedureExpression*, const std::string& qualified = ""); void emit_simd_procedure_proto(std::ostream&, ProcedureExpression*, const std::string& qualified = "");
...@@ -106,6 +113,9 @@ std::string emit_cpp_source(const Module& module_, const std::string& ns, simd_s ...@@ -106,6 +113,9 @@ std::string emit_cpp_source(const Module& module_, const std::string& ns, simd_s
"#include <" << arb_header_prefix() << "backends/multicore/mechanism.hpp>\n" "#include <" << arb_header_prefix() << "backends/multicore/mechanism.hpp>\n"
"#include <" << arb_header_prefix() << "math.hpp>\n"; "#include <" << arb_header_prefix() << "math.hpp>\n";
with_profiling() &&
out << "#include <" << arb_header_prefix() << "profiling/profiler.hpp>\n";
if (with_simd) { if (with_simd) {
out << "#include <" << arb_header_prefix() << "simd/simd.hpp>\n"; out << "#include <" << arb_header_prefix() << "simd/simd.hpp>\n";
} }
...@@ -306,11 +316,15 @@ std::string emit_cpp_source(const Module& module_, const std::string& ns, simd_s ...@@ -306,11 +316,15 @@ std::string emit_cpp_source(const Module& module_, const std::string& ns, simd_s
out << popindent << "}\n\n"; out << popindent << "}\n\n";
out << "void " << class_name << "::nrn_state() {\n" << indent; out << "void " << class_name << "::nrn_state() {\n" << indent;
with_profiling() && out << "PE(advance_integrate_state_" << name << ");\n";
emit_body(state_api); emit_body(state_api);
with_profiling() && out << "PL();\n";
out << popindent << "}\n\n"; out << popindent << "}\n\n";
out << "void " << class_name << "::nrn_current() {\n" << indent; out << "void " << class_name << "::nrn_current() {\n" << indent;
with_profiling() && out << "PE(advance_integrate_current_" << name << ");\n";
emit_body(current_api); emit_body(current_api);
with_profiling() && out << "PL();\n";
out << popindent << "}\n\n"; out << popindent << "}\n\n";
out << "void " << class_name << "::write_ions() {\n" << indent; out << "void " << class_name << "::write_ions() {\n" << indent;
......
...@@ -170,13 +170,13 @@ fvm_integration_result fvm_lowered_cell_impl<Backend>::integrate( ...@@ -170,13 +170,13 @@ fvm_integration_result fvm_lowered_cell_impl<Backend>::integrate(
state_->deliverable_events.mark_until_after(state_->time); state_->deliverable_events.mark_until_after(state_->time);
PL(); PL();
PE(advance_integrate_current); PE(advance_integrate_current_zero);
state_->zero_currents(); state_->zero_currents();
PL();
for (auto& m: mechanisms_) { for (auto& m: mechanisms_) {
m->deliver_events(); m->deliver_events();
m->nrn_current(); m->nrn_current();
} }
PL();
PE(advance_integrate_events); PE(advance_integrate_events);
state_->deliverable_events.drop_marked_events(); state_->deliverable_events.drop_marked_events();
...@@ -208,11 +208,9 @@ fvm_integration_result fvm_lowered_cell_impl<Backend>::integrate( ...@@ -208,11 +208,9 @@ fvm_integration_result fvm_lowered_cell_impl<Backend>::integrate(
// Integrate mechanism state. // Integrate mechanism state.
PE(advance_integrate_state);
for (auto& m: mechanisms_) { for (auto& m: mechanisms_) {
m->nrn_state(); m->nrn_state();
} }
PL();
// Update ion concentrations. // Update ion concentrations.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment