Skip to content

Commit

Permalink
#2302: Fix commented code and pin papi version
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepebay committed Dec 12, 2024
1 parent 1175442 commit 5c0677c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
7 changes: 4 additions & 3 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fi

if test "$VT_PAPI_ENABLED" -eq 1 && "$VT_PERF_ENABLED" -eq 1
then
echo "Both PAPI and perf measurements are enabled; this isn't possible, please turn off one of these options. Exiting."
echo "Both PAPI and perf measurements are enabled; this is not supported. Please turn off one of these options. Exiting."
exit
fi

Expand All @@ -127,12 +127,13 @@ then
{ echo "papi already in lib... not downloading, building, and installing"; } 2>/dev/null
else
cd "${source_dir}/lib"
git clone --depth 1 https://github.com/icl-utk-edu/papi.git
papi_rev="papi-7-2-0b1-t"
git clone -b "${papi_rev}" --depth 1 https://github.com/icl-utk-edu/papi.git
cd papi/src
export PAPI_BUILD=${build_dir}/papi
mkdir -p "$PAPI_BUILD"
CC="${CC:-cc}" F77="${F77:-gfortran}" ./configure --prefix="$PAPI_BUILD/install"
make -j "${dashj}" && make install
make ${dashj} && make install
fi
fi

Expand Down
26 changes: 13 additions & 13 deletions cmake/load_perf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ if (vt_perf_enabled)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_SYSTEM_VERSION})
list(GET VERSION_LIST 0 KERNEL_MAJOR_VERSION)
if (KERNEL_MAJOR_VERSION GREATER_EQUAL 4)
# # check if a simple perf stat runs without issues
# execute_process(
# COMMAND "perf stat pwd"
# RESULT_VARIABLE PERF_STAT_RESULT
# OUTPUT_QUIET
# ERROR_QUIET
# )
# if (PERF_STAT_RESULT EQUAL 0)
# check if a simple perf stat runs without issues
execute_process(
COMMAND perf stat pwd
RESULT_VARIABLE PERF_STAT_RESULT
OUTPUT_QUIET
ERROR_QUIET
)
if (PERF_STAT_RESULT EQUAL 0)
message(STATUS "Perf measurements enabled.")
set(vt_perf_enabled "1")
set(vt_perf_found "1")
# else ()
# message(WARNING "Perf measurements enabled but couldn't run perf stat successfully. Disabling perf measurements.")
# set(vt_perf_enabled "0")
# set(vt_perf_found "0")
# endif ()
else ()
message(WARNING "Perf measurements enabled but couldn't run perf stat successfully. Disabling perf measurements.")
set(vt_perf_enabled "0")
set(vt_perf_found "0")
endif ()
else ()
message(WARNING "Perf measurements enabled but Kernel major version is less than 4. Disabling perf measurements.")
set(vt_perf_enabled "0")
Expand Down
8 changes: 4 additions & 4 deletions src/vt/context/runnable_context/lb_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ std::unordered_map<std::string, uint64_t> LBData::getPAPIMetrics() {
for (size_t i = 0; i < papiData_->native_events.size(); i++) {
papi_metrics[papiData_->native_events[i]] = papiData_->values[i];
}
papi_metrics[std::string("real_time")] = papiData_->end_real_usec - papiData_->start_real_usec;
papi_metrics[std::string("real_cycles")] = papiData_->end_real_cycles - papiData_->start_real_cycles;
papi_metrics[std::string("virt_time")] = papiData_->end_virt_usec - papiData_->start_virt_usec;
papi_metrics[std::string("virt_cycles")] = papiData_->end_virt_cycles - papiData_->start_virt_cycles;
papi_metrics["real_time"] = papiData_->end_real_usec - papiData_->start_real_usec;
papi_metrics["real_cycles"] = papiData_->end_real_cycles - papiData_->start_real_cycles;
papi_metrics["virt_time"] = papiData_->end_virt_usec - papiData_->start_virt_usec;
papi_metrics["virt_cycles"] = papiData_->end_virt_cycles - papiData_->start_virt_cycles;
return papi_metrics;
}
#endif
Expand Down
1 change: 0 additions & 1 deletion src/vt/context/runnable_context/papi_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct PAPIData {

// check if the environment variable is set
if (env_p == nullptr) {
fmt::print("Warning: Environment variabale VT_EVENTS not set, defaulting to instructions for the PAPI event set.\n");
native_events.push_back("PAPI_TOT_INS");
}
else {
Expand Down
1 change: 0 additions & 1 deletion src/vt/metrics/perf_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ PerfData::PerfData()

// Check if the environment variable is set
if (env_p == nullptr) {
// vtWarn("Warning: Environment variable VT_EVENTS not set, defaulting to 'instructions' for the perf event set.\n");
event_names_.push_back("instructions");
}
else {
Expand Down

0 comments on commit 5c0677c

Please sign in to comment.