Skip to content
Snippets Groups Projects
Commit 487a65e9 authored by noraabiakar's avatar noraabiakar Committed by Benjamin Cumming
Browse files

Use correct profiling flag (#549)

Use correct profiling and mpi flags.
Fix profiler doc
parent af5fe62a
No related branches found
No related tags found
No related merge requests found
......@@ -156,6 +156,8 @@ Running the Profiler
--------------------
The profiler does not need to be started or stopped by the user.
It needs to be initialized before entering any profiling region.
It is initialized using the information provided by the simulation's thread pool.
At any point a summary of profiler region counts and times can be obtained,
and the profiler regions can be reset.
......@@ -168,6 +170,11 @@ and the profiler regions can be reset.
using namespace arb;
void main() {
execution_context context;
// Initialize the profiler with thread information from the execution context
profile::profiler_initialize(context.thread_pool);
PE(init);
// ...
PL();
......@@ -177,11 +184,11 @@ and the profiler regions can be reset.
PL();
// Print a summary of the profiler to stdout
std::cout << util::profiler_summary() << "\n";
std::cout << profile::profiler_summary() << "\n";
// Clear the profiler state, which can then be used to record
// profile information for a different part of the code.
util::profiler_clear();
profile::profiler_clear();
}
After a call to ``util::profiler_clear``, all counters and timers are set to zero.
......
......@@ -17,6 +17,7 @@
#include <arbor/recipe.hpp>
#include <arbor/simulation.hpp>
#include <arbor/threadinfo.hpp>
#include <arbor/version.hpp>
#include <aux/ioutil.hpp>
......@@ -33,11 +34,11 @@ namespace profile = arb::profile;
int main(int argc, char** argv) {
try {
arb::execution_context context;
#ifdef ARB_HAVE_MPI
#ifdef ARB_MPI_ENABLED
aux::with_mpi guard(&argc, &argv);
context.distributed = mpi_context(MPI_COMM_WORLD);
#endif
#ifdef ARB_HAVE_PROFILING
#ifdef ARB_PROFILE_ENABLED
profile::profiler_initialize(context.thread_pool);
#endif
const bool is_root = context.distributed.id()==0;
......
......@@ -194,7 +194,7 @@ int main(int argc, char** argv) {
with_mpi guard(argc, argv, false);
context.distributed = mpi_context(MPI_COMM_WORLD);
#endif
#ifdef ARB_HAVE_PROFILING
#ifdef ARB_PROFILE_ENABLED
profile::profiler_initialize(context.thread_pool);
#endif
arb::profile::meter_manager meters(&context.distributed);
......
......@@ -51,7 +51,7 @@ int main(int argc, char** argv) {
with_mpi guard(argc, argv, false);
context.distributed = mpi_context(MPI_COMM_WORLD);
#endif
#ifdef ARB_HAVE_PROFILING
#ifdef ARB_PROFILE_ENABLED
profile::profiler_initialize(context.thread_pool);
#endif
profile::meter_manager meters(&context.distributed);
......
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