Skip to content

Commit

Permalink
Fixing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed May 3, 2024
1 parent cd83031 commit d860c19
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .jenkins/lsu/env-clang-12-apex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module load hwloc
module load openmpi
module load pwrapi/1.1.1
module load papi/7.0.1
module load otf2/3.0.3

export HPXRUN_RUNWRAPPER=srun
export CXX_STD="20"
Expand All @@ -29,5 +30,4 @@ configure_extra_options+=" -DHPX_WITH_APEX=ON"
configure_extra_options+=" -DHPX_WITH_FETCH_APEX=ON"
configure_extra_options+=" -DHPX_WITH_PAPI=ON"
configure_extra_options+=" -DAPEX_WITH_PAPI=ON"
#configure_extra_options+=" -DAPEX_WITH_OTF2=ON"
#configure_extra_options+=" -DOTF2_ROOT=${OTF2_ROOT}"
configure_extra_options+=" -DAPEX_WITH_OTF2=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
#include <unistd.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <unistd.h>
#include <vector>

#include <hpx/hpx.hpp>
Expand All @@ -17,13 +17,13 @@
#include <hpx/util/from_string.hpp>

///////////////////////////////////////////////////////////////////////////////
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;
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -91,29 +95,30 @@ int check_(int fd)
{
cnt.push_back(hpx::util::from_string<double>(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))
return 0;

// 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;
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -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]);
Expand Down
5 changes: 2 additions & 3 deletions libs/core/affinity/src/affinity_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace hpx::threads::policies::detail {
std::vector<mask_type> 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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion libs/core/resource_partitioner/src/detail_partitioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
4 changes: 2 additions & 2 deletions libs/core/runtime_local/src/runtime_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit d860c19

Please sign in to comment.