diff --git a/components/performance_counters/papi/tests/regressions/papi_counters_active_interface.cpp b/components/performance_counters/papi/tests/regressions/papi_counters_active_interface.cpp index a2aa092ffa8e..63539d25e614 100644 --- a/components/performance_counters/papi/tests/regressions/papi_counters_active_interface.cpp +++ b/components/performance_counters/papi/tests/regressions/papi_counters_active_interface.cpp @@ -4,10 +4,10 @@ // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#include -#include #include +#include #include +#include #include #include @@ -17,13 +17,13 @@ #include /////////////////////////////////////////////////////////////////////////////// -const char *counter_name = "/papi{locality#0/worker-thread#0}/PAPI_SR_INS"; +const char* counter_name = "/papi{locality#0/worker-thread#0}/PAPI_SR_INS"; const size_t nstores = 1000000; /////////////////////////////////////////////////////////////////////////////// inline bool close_enough(double m, double ex, double perc) { - return 100.0*fabs(m-ex)/ex <= perc; + return 100.0 * fabs(m - ex) / ex <= perc; } /////////////////////////////////////////////////////////////////////////////// @@ -33,25 +33,29 @@ int hpx_main(hpx::program_options::variables_map&) // perform n stores, active counter volatile size_t i; - for (i = 0; i < nstores; i++) ; + for (i = 0; i < nstores; i = i + 1) + ; hpx::evaluate_active_counters(); // stop the counter w/o resetting hpx::stop_active_counters(); // perform n stores (should be uncounted) - for (i = 0; i < nstores; i++) ; + for (i = 0; i < nstores; i = i + 1) + ; // get value and reset, and start again hpx::evaluate_active_counters(true); hpx::start_active_counters(); // perform 2*n stores, counted from 0 (or close to it) - for (i = 0; i < 2*nstores; i++) ; + for (i = 0; i < 2 * nstores; i = i + 1) + ; hpx::evaluate_active_counters(); // perform another n stores, counted from 0 (or close to it) hpx::reset_active_counters(); - for (i = 0; i < nstores; i++) ; + for (i = 0; i < nstores; i = i + 1) + ; hpx::evaluate_active_counters(); return hpx::finalize(); @@ -75,14 +79,14 @@ int check_(int fd) pos = out.find(counter_name); if (pos != out.npos) - { // counter name found + { // counter name found out.erase(0, pos); pos = out.find('\n'); if (pos != out.npos) - { // this is complete line; extract counter value + { // this is complete line; extract counter value size_t cpos = out.rfind(',', pos); - std::cerr << out.substr(0, pos+1); - std::string value = out.substr(cpos+1, pos-cpos-1); + std::cerr << out.substr(0, pos + 1); + std::string value = out.substr(cpos + 1, pos - cpos - 1); if (value == "invalid") { cnt.push_back(-1.0); @@ -91,13 +95,15 @@ int check_(int fd) { cnt.push_back(hpx::util::from_string(value)); } - if (cnt.size() == 5) break; - out.erase(0, pos+1); + if (cnt.size() == 5) + break; + out.erase(0, pos + 1); } } } else - throw std::runtime_error("truncated input; didn't get all counter values"); + throw std::runtime_error( + "truncated input; didn't get all counter values"); } // bail out if perf counter isn't available ... if (close_enough(cnt[0], -1.0, 5.0)) @@ -105,15 +111,14 @@ int check_(int fd) // since printing affects the counts, the relative error bounds need to be // increased compared to the "basic_functions" test - bool pass = close_enough(cnt[0], nstores, 5.0) && - (cnt[1] >= cnt[0]) && close_enough(cnt[0], cnt[1], 5.0) && - close_enough(cnt[2], 2.0*cnt[0], 5.0) && + bool pass = close_enough(cnt[0], nstores, 5.0) && (cnt[1] >= cnt[0]) && + close_enough(cnt[0], cnt[1], 5.0) && + close_enough(cnt[2], 2.0 * cnt[0], 5.0) && close_enough(cnt[3], cnt[0], 5.0); + std::cerr << (pass ? "PASSED" : "FAILED") << ".\n"; - std::cerr << (pass? "PASSED": "FAILED") << ".\n"; - - return pass? 0: 1; + return pass ? 0 : 1; } /////////////////////////////////////////////////////////////////////////////// @@ -125,15 +130,16 @@ int main(int argc, char* argv[]) throw std::runtime_error("could not create pipe to stdout"); // Add the required counter command line option. - char **opt = new char *[argc+2]; - for (int i = 0; i < argc; i++) opt[i] = argv[i]; + char** opt = new char*[argc + 2]; + for (int i = 0; i < argc; i++) + opt[i] = argv[i]; char copt[256]; snprintf(copt, 256, "--hpx:print-counter=%s", counter_name); opt[argc] = copt; - opt[argc+1] = nullptr; + opt[argc + 1] = nullptr; // Run test in HPX domain. - hpx::start(argc+1, opt); + hpx::start(argc + 1, opt); // Collect and process the output. int rc = check_(pipefd[0]); diff --git a/libs/core/affinity/src/affinity_data.cpp b/libs/core/affinity/src/affinity_data.cpp index 2c41ccc0c85c..883cf881686b 100644 --- a/libs/core/affinity/src/affinity_data.cpp +++ b/libs/core/affinity/src/affinity_data.cpp @@ -24,7 +24,7 @@ namespace hpx::threads::policies::detail { std::vector const& masks) noexcept { std::size_t count = 0; - for (mask_cref_type const m : masks) + for (mask_cref_type m : masks) { if (threads::any(m)) ++count; @@ -268,8 +268,7 @@ namespace hpx::threads::policies::detail { for (std::size_t num_thread = 0; num_thread != num_threads_; ++num_thread) { - mask_cref_type const affinity_mask = - get_pu_mask(topo, num_thread); + mask_cref_type affinity_mask = get_pu_mask(topo, num_thread); if (threads::any(pu_mask & affinity_mask)) ++count; } diff --git a/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp b/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp index e88030e7370f..982bb8fe7eea 100644 --- a/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp +++ b/libs/core/compute_local/include/hpx/compute_local/host/numa_allocator.hpp @@ -117,7 +117,7 @@ namespace hpx::parallel::util { topo_.get_thread_affinity_mask_from_lva(&val); std::size_t thread_num = hpx::get_worker_thread_num(); - hpx::threads::mask_cref_type const thread_mask = + hpx::threads::mask_cref_type thread_mask = hpx::parallel::execution::get_pu_mask( executors_[i], topo_, thread_num); diff --git a/libs/core/resource_partitioner/src/detail_partitioner.cpp b/libs/core/resource_partitioner/src/detail_partitioner.cpp index 4ab48b3ffef1..efe4ab3f5e85 100644 --- a/libs/core/resource_partitioner/src/detail_partitioner.cpp +++ b/libs/core/resource_partitioner/src/detail_partitioner.cpp @@ -170,7 +170,7 @@ namespace hpx::resource::detail { os << "\"" << sched << "\" is running on PUs : \n"; - for (threads::mask_cref_type const assigned_pu : assigned_pus_) + for (threads::mask_cref_type assigned_pu : assigned_pus_) { os << hpx::threads::to_string(assigned_pu) << '\n'; } diff --git a/libs/core/runtime_local/src/runtime_local.cpp b/libs/core/runtime_local/src/runtime_local.cpp index 691a3d406221..526d9dd2cac8 100644 --- a/libs/core/runtime_local/src/runtime_local.cpp +++ b/libs/core/runtime_local/src/runtime_local.cpp @@ -1322,7 +1322,7 @@ namespace hpx { for (std::size_t i = 0; i != num_threads; ++i) { // print the mask for the current PU - threads::mask_cref_type const pu_mask = rp.get_pu_mask(i); + threads::mask_cref_type pu_mask = rp.get_pu_mask(i); if (!threads::any(pu_mask)) { @@ -1945,7 +1945,7 @@ namespace hpx { // FIXME: We don't set the affinity of the service threads on BG/Q, // as this is causing a hang (needs to be investigated) #if !defined(__bgq__) - threads::mask_cref_type const used_processing_units = + threads::mask_cref_type used_processing_units = thread_manager_->get_used_processing_units(); // --hpx:bind=none should disable all affinity definitions diff --git a/libs/core/thread_pools/include/hpx/thread_pools/scheduled_thread_pool_impl.hpp b/libs/core/thread_pools/include/hpx/thread_pools/scheduled_thread_pool_impl.hpp index 314862ee9b8e..3a76d0c28611 100644 --- a/libs/core/thread_pools/include/hpx/thread_pools/scheduled_thread_pool_impl.hpp +++ b/libs/core/thread_pools/include/hpx/thread_pools/scheduled_thread_pool_impl.hpp @@ -317,7 +317,7 @@ namespace hpx::threads::detail { { std::size_t global_thread_num = this->thread_offset_ + thread_num; - threads::mask_cref_type const mask = + threads::mask_cref_type mask = affinity_data_.get_pu_mask(topo, global_thread_num); // thread_num ordering: 1. threads of default pool @@ -436,7 +436,7 @@ namespace hpx::threads::detail { topology const& topo = create_topology(); // Set the affinity for the current thread. - threads::mask_cref_type const mask = + threads::mask_cref_type mask = affinity_data_.get_pu_mask(topo, global_thread_num); if (LHPX_ENABLED(debug))