From 487a65e9e8736f3ff1f1c254f5b21bcb82d20660 Mon Sep 17 00:00:00 2001
From: noraabiakar <nora.abiakar@gmail.com>
Date: Thu, 26 Jul 2018 13:46:56 +0200
Subject: [PATCH] Use correct profiling flag (#549)
Use correct profiling and mpi flags.
Fix profiler doc
---
doc/profiler.rst | 11 +++++++++--
example/bench/bench.cpp | 5 +++--
example/brunel/brunel_miniapp.cpp | 2 +-
example/miniapp/miniapp.cpp | 2 +-
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/doc/profiler.rst b/doc/profiler.rst
index afe9248f..6f0d0787 100644
--- a/doc/profiler.rst
+++ b/doc/profiler.rst
@@ -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.
diff --git a/example/bench/bench.cpp b/example/bench/bench.cpp
index 2c566e7b..f8934b73 100644
--- a/example/bench/bench.cpp
+++ b/example/bench/bench.cpp
@@ -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;
diff --git a/example/brunel/brunel_miniapp.cpp b/example/brunel/brunel_miniapp.cpp
index 45d82cb7..9de099c0 100644
--- a/example/brunel/brunel_miniapp.cpp
+++ b/example/brunel/brunel_miniapp.cpp
@@ -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);
diff --git a/example/miniapp/miniapp.cpp b/example/miniapp/miniapp.cpp
index a809a3f3..590cdcfb 100644
--- a/example/miniapp/miniapp.cpp
+++ b/example/miniapp/miniapp.cpp
@@ -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);
--
GitLab