From 1edad98955aa96b62e11f9e2bcc2ff59c9b0e535 Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Sat, 24 Sep 2016 10:44:43 +0200 Subject: [PATCH] Fix a couple of examples that failed to compile after recent api changes --- examples/1d_stencil/1d_stencil_4_repart.cpp | 7 ++++--- examples/1d_stencil/1d_stencil_4_throttle.cpp | 7 ++++--- examples/apex/apex_policy_engine_active_thread_count.cpp | 7 ++++--- .../performance_counters/papi_counters_basic_functions.cpp | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/examples/1d_stencil/1d_stencil_4_repart.cpp b/examples/1d_stencil/1d_stencil_4_repart.cpp index 859672aa7692..df170879670a 100644 --- a/examples/1d_stencil/1d_stencil_4_repart.cpp +++ b/examples/1d_stencil/1d_stencil_4_repart.cpp @@ -57,9 +57,9 @@ void setup_counters() { // We need to explicitly start all counters before we can use them. For // certain counters this could be a no-op, in which case start will return // 'false'. - performance_counter::start(id); + performance_counter::start(hpx::launch::sync, id); std::cout << "Counter " << counter_name << " initialized " << id << std::endl; - counter_value value = performance_counter::get_value(id); + counter_value value = performance_counter::get_value(hpx::launch::sync, id); std::cout << "Counter value " << value.get_value() << std::endl; counter_id = id; end_iteration_event = apex::register_custom_event("Repartition"); @@ -80,7 +80,8 @@ double get_counter_value() { return false; } try { - counter_value value1 = performance_counter::get_value(counter_id, true); + counter_value value1 = + performance_counter::get_value(hpx::launch::sync, counter_id, true); std::int64_t counter_value = value1.get_value(); std::cerr << "counter_value " << counter_value << std::endl; return (double)(counter_value); diff --git a/examples/1d_stencil/1d_stencil_4_throttle.cpp b/examples/1d_stencil/1d_stencil_4_throttle.cpp index c172a470bf9c..c8ae0f26de13 100644 --- a/examples/1d_stencil/1d_stencil_4_throttle.cpp +++ b/examples/1d_stencil/1d_stencil_4_throttle.cpp @@ -60,9 +60,9 @@ void setup_counters() { // We need to explicitly start all counters before we can use them. For // certain counters this could be a no-op, in which case start will return // 'false'. - performance_counter::start(id); + performance_counter::start(hpx::launch::sync, id); std::cout << "Counters initialized! " << id << std::endl; - counter_value value = performance_counter::get_value(id); + counter_value value = performance_counter::get_value(hpx::launch::sync, id); std::cout << "Active threads " << value.get_value() << std::endl; counter_id = id; } @@ -77,7 +77,8 @@ void setup_counters() { bool test_function(apex_context const& context) { if (!counters_initialized) return false; try { - counter_value value1 = performance_counter::get_value(counter_id); + counter_value value1 = + performance_counter::get_value(hpx::launch::sync, counter_id); apex::sample_value("thread_queue_length", value1.get_value()); return APEX_NOERROR; } diff --git a/examples/apex/apex_policy_engine_active_thread_count.cpp b/examples/apex/apex_policy_engine_active_thread_count.cpp index eba58904d1de..43f7d0d7fce4 100644 --- a/examples/apex/apex_policy_engine_active_thread_count.cpp +++ b/examples/apex/apex_policy_engine_active_thread_count.cpp @@ -79,9 +79,9 @@ void setup_counters() { // We need to explicitly start all counters before we can use them. For // certain counters this could be a no-op, in which case start will // return 'false'. - performance_counter::start(id); + performance_counter::start(hpx::launch::sync, id); std::cout << "Counters initialized! " << id << std::endl; - counter_value value = performance_counter::get_value(id); + counter_value value = performance_counter::get_value(hpx::launch::sync, id); std::cout << "Active threads " << value.get_value() << std::endl; counter_id = id; } @@ -117,7 +117,8 @@ bool test_function(apex_context const& context) { if (!counters_initialized) return false; try { //id_type id = get_counter_id(); - counter_value value1 = performance_counter::get_value(counter_id); + counter_value value1 = + performance_counter::get_value(hpx::launch::sync, counter_id); if (value1.get_value() % 2 == 1) { return APEX_NOERROR; } else { diff --git a/tests/regressions/performance_counters/papi_counters_basic_functions.cpp b/tests/regressions/performance_counters/papi_counters_basic_functions.cpp index 91e1fcc654d3..be9f8816452b 100644 --- a/tests/regressions/performance_counters/papi_counters_basic_functions.cpp +++ b/tests/regressions/performance_counters/papi_counters_basic_functions.cpp @@ -34,7 +34,7 @@ int hpx_main(boost::program_options::variables_map&) id_type id = get_counter(boost::str(cnt_name % prefix)); - performance_counter::start(id); + performance_counter::start(hpx::launch::sync, id); // perform n ops, active counter volatile size_t i; @@ -43,13 +43,13 @@ int hpx_main(boost::program_options::variables_map&) counter_value value1 = performance_counter::get_value(hpx::launch::sync, id); // stop the counter w/o resetting - performance_counter::stop(id); + performance_counter::stop(hpx::launch::sync,id); // perform n ops (should be uncounted) for (i = 0; i < n; i++) a=b+c; // get value and reset, and start again counter_value value2 = performance_counter::get_value(hpx::launch::sync, id, true); - performance_counter::start(id); + performance_counter::start(hpx::launch::sync, id); // perform 2*n ops, counted from 0 (or close to it) for (i = 0; i < 2*n; i++) a=b+c;