Update to use rocprofiler-sdk (#55)
- Renames the CMake option "ROCPROFSYS_USE_HIP" to "ROCPROFSYS_USE_ROCM" - Remove the "ROCPROFSYS_USE_ROCM_SMI option. Controlled with the "ROCPROFSYS_USE_ROCM" option, instead. - Runtime configuration can still toggle ROCPROFSYS_USE_ROCM_SMI to disable the sampling. - Rename ROCPROFSYS_HIP_VERSION macro to ROCPROFSYS_ROCM_VERSION and remove blocks for `ROCPROFSYS_ROCM_VERSION < 60000` - Remove ROCPROFSYS_USE_ROCTRACER and ROCPROFSYS_USE_ROCPROFILER - Update test cases - Update docker files and workflows to install cmake 3.21, which is required for the rocprofiler-sdk findPackage script. - Removed rocm-6.2 from workflows due to a rocprofiler-sdk API change.
Este cometimento está contido em:
cometido por
GitHub
ascendente
d3725df816
cometimento
88aa2d3cbe
@@ -1,17 +1,8 @@
|
||||
# executable RPATH
|
||||
|
||||
if(ROCPROFSYS_USE_ROCPROFILER
|
||||
AND rocprofiler_LIBRARY_DIR
|
||||
AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0
|
||||
AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH)
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}:${rocprofiler_LIBRARY_DIR}"
|
||||
)
|
||||
else()
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}"
|
||||
)
|
||||
endif()
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
# executables
|
||||
add_subdirectory(rocprof-sys-avail)
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
#include "api.hpp"
|
||||
#include "core/config.hpp"
|
||||
#include "core/gpu.hpp"
|
||||
#include "core/hip_runtime.hpp"
|
||||
#include "library/rocprofiler.hpp"
|
||||
#include "library/rocm.hpp"
|
||||
|
||||
#include <timemory/components.hpp>
|
||||
#include <timemory/components/definition.hpp>
|
||||
@@ -119,7 +118,7 @@ write_hw_counter_info(std::ostream&, const array_t<bool, N>& = {},
|
||||
namespace
|
||||
{
|
||||
// initialize HIP before main so that librocprof-sys is not HSA_TOOLS_LIB
|
||||
int gpu_count = rocprofsys::gpu::hip_device_count();
|
||||
int gpu_count = rocprofsys::gpu::device_count();
|
||||
|
||||
// statically allocated shared_ptrs to prevent use after free errors
|
||||
auto timemory_manager = tim::manager::master_instance();
|
||||
@@ -508,15 +507,15 @@ main(int argc, char** argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_ROCM > 0
|
||||
if(gpu_count > 0)
|
||||
{
|
||||
size_t _num_metrics = 0;
|
||||
try
|
||||
{
|
||||
// call to rocm_metrics() will add choices to ROCPROFSYS_ROCM_EVENTS setting
|
||||
// call to rocm_events() will add choices to ROCPROFSYS_ROCM_EVENTS setting
|
||||
// so always perform this call even if list of HW counters is not requested
|
||||
_num_metrics = rocprofsys::rocprofiler::rocm_metrics().size();
|
||||
_num_metrics = rocprofsys::rocm::rocm_events().size();
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
verbprintf(0, "Retrieving the GPU HW counters failed: %s", _e.what());
|
||||
@@ -615,9 +614,9 @@ main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
signal(SIGABRT, &dump_log_abort);
|
||||
signal(SIGSEGV, &dump_log_abort);
|
||||
signal(SIGQUIT, &dump_log_abort);
|
||||
// signal(SIGABRT, &dump_log_abort);
|
||||
// signal(SIGSEGV, &dump_log_abort);
|
||||
// signal(SIGQUIT, &dump_log_abort);
|
||||
|
||||
if(!os) os = &std::cout;
|
||||
|
||||
@@ -641,6 +640,8 @@ main(int argc, char** argv)
|
||||
}
|
||||
dump_log();
|
||||
|
||||
const_cast<std::shared_ptr<tim::settings>&>(tim::settings::shared_instance()).reset();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1076,7 +1077,7 @@ write_hw_counter_info(std::ostream& os, const array_t<bool, N>& options,
|
||||
|
||||
auto _papi_events = tim::papi::available_events_info();
|
||||
auto _rocm_events =
|
||||
(gpu_count > 0) ? rocprofsys::rocprofiler::rocm_metrics() : hwcounter_info_t{};
|
||||
(gpu_count > 0) ? rocprofsys::rocm::rocm_events() : hwcounter_info_t{};
|
||||
|
||||
if(alphabetical)
|
||||
{
|
||||
|
||||
@@ -339,7 +339,7 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
for(const auto* itr :
|
||||
{ "ROCPROFSYS_CONFIG", "ROCPROFSYS_MODE", "ROCPROFSYS_TRACE",
|
||||
"ROCPROFSYS_PROFILE", "ROCPROFSYS_USE_SAMPLING",
|
||||
"ROCPROFSYS_USE_PROCESS_SAMPLING", "ROCPROFSYS_USE_ROCTRACER",
|
||||
"ROCPROFSYS_USE_PROCESS_SAMPLING", "ROCPROFSYS_USE_ROCM",
|
||||
"ROCPROFSYS_USE_ROCM_SMI", "ROCPROFSYS_USE_KOKKOSP",
|
||||
"ROCPROFSYS_USE_OMPT", "ROCPROFSYS_USE", "ROCPROFSYS_OUTPUT" })
|
||||
{
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "library/components/fork_gotcha.hpp"
|
||||
#include "library/components/mpi_gotcha.hpp"
|
||||
#include "library/components/pthread_gotcha.hpp"
|
||||
#include "library/components/rocprofiler.hpp"
|
||||
#include "library/components/roctracer.hpp"
|
||||
|
||||
#include <timemory/components/definition.hpp>
|
||||
#include <timemory/enum.h>
|
||||
|
||||
@@ -752,10 +752,6 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
|
||||
parser.end_group();
|
||||
|
||||
#if ROCPROFSYS_HIP_VERSION > 0 && ROCPROFSYS_HIP_VERSION < 50300
|
||||
update_env(_env, "HSA_ENABLE_INTERRUPT", 0);
|
||||
#endif
|
||||
|
||||
auto _inpv = std::vector<char*>{};
|
||||
auto _outv = std::vector<char*>{};
|
||||
bool _hash = false;
|
||||
@@ -824,11 +820,6 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
add_default_env(_env, "ROCPROFSYS_USE_MPIP", true);
|
||||
#endif
|
||||
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0
|
||||
add_default_env(_env, "ROCPROFSYS_ROCTRACER_HIP_API", true);
|
||||
add_default_env(_env, "ROCPROFSYS_ROCTRACER_HSA_API", true);
|
||||
#endif
|
||||
|
||||
#if defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL > 0
|
||||
add_default_env(_env, "ROCPROFSYS_USE_RCCLP", true);
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,8 @@ target_link_libraries(
|
||||
timemory::timemory-extensions
|
||||
timemory::timemory-core)
|
||||
|
||||
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-instrument
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
|
||||
@@ -312,13 +312,25 @@ get_internal_basic_libs_impl()
|
||||
"liblzma.so" };
|
||||
|
||||
// shared libraries used by rocprof-sys
|
||||
const auto _omni_libs = strview_init_t{
|
||||
"libstdc++.so.6", "libgotcha.so", "libunwind-coredump.so",
|
||||
"libunwind-generic.so", "libunwind-ptrace.so", "libunwind-setjmp.so",
|
||||
"libunwind.so", "libunwind-x86_64.so", "librocm_smi64.so",
|
||||
"libroctx64.so", "librocmtools.so", "libroctracer64.so",
|
||||
"librocprofiler64.so", "libpapi.so", "libpfm.so"
|
||||
};
|
||||
const auto _omni_libs = strview_init_t{ "libstdc++.so.6",
|
||||
"libgotcha.so",
|
||||
"libunwind-coredump.so",
|
||||
"libunwind-generic.so",
|
||||
"libunwind-ptrace.so",
|
||||
"libunwind-setjmp.so",
|
||||
"libunwind.so",
|
||||
"libunwind-x86_64.so",
|
||||
"librocm_smi64.so",
|
||||
"libroctx64.so",
|
||||
"librocmtools.so",
|
||||
"libroctracer64.so",
|
||||
"librocprofiler64.so",
|
||||
"libpapi.so",
|
||||
"libpfm.so",
|
||||
"librocprofiler-register.so",
|
||||
"librocprofiler-sdk.so",
|
||||
"librocprofiler-sdk-roctx.so",
|
||||
"libamd_smi.so" };
|
||||
|
||||
// shared libraries potentially used by timemory
|
||||
const auto _3rdparty_libs = strview_init_t{ "libcaliper.so",
|
||||
|
||||
@@ -357,10 +357,12 @@ main(int argc, char** argv)
|
||||
itr.find("rocprof-sys") != std::string::npos ||
|
||||
itr.find("rocprofiler-systems") != std::string::npos ||
|
||||
std::regex_search(
|
||||
itr, std::regex{ "lib(dyninstAPI|stackwalk|pcontrol|patchAPI|parseAPI|"
|
||||
"instructionAPI|symtabAPI|dynDwarf|common|dynElf|tbb|"
|
||||
"tbbmalloc|tbbmalloc_proxy|gotcha|libunwind|roctracer|"
|
||||
"hsa-runtime|amdhip|rocm_smi)\\.(so|a)" }))
|
||||
itr, std::regex{
|
||||
"lib(dyninstAPI|stackwalk|pcontrol|patchAPI|parseAPI|"
|
||||
"instructionAPI|symtabAPI|dynDwarf|common|dynElf|tbb|tbbmalloc|"
|
||||
"tbbmalloc_proxy|gotcha|libunwind|roctracer64|hsa-runtime|amdhip|"
|
||||
"amd_comgr|rocm_smi64|rocprofiler64|rocprofiler-register|"
|
||||
"rocprofiler-sdk|rocprofiler-sdk-roctx|amd_smi)\\.(so|a)" }))
|
||||
{
|
||||
if(!find(filepath::dirname(itr), lib_search_paths))
|
||||
lib_search_paths.emplace_back(filepath::dirname(itr));
|
||||
|
||||
@@ -44,14 +44,6 @@
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
# define ROCPROFSYS_USE_ROCTRACER 0
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
# define ROCPROFSYS_USE_ROCPROFILER 0
|
||||
#endif
|
||||
|
||||
namespace color = tim::log::color;
|
||||
using namespace timemory::join;
|
||||
using tim::get_env;
|
||||
@@ -140,17 +132,6 @@ get_initial_environment()
|
||||
|
||||
update_env(_env, "ROCPROFSYS_USE_SAMPLING", (_mode != "causal"));
|
||||
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) || defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_env, "HSA_TOOLS_LIB", _dl_libpath);
|
||||
if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE"))
|
||||
update_env(_env, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1");
|
||||
#endif
|
||||
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_env, "ROCP_TOOL_LIB", _omni_libpath);
|
||||
if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_env, "ROCP_HSA_INTERCEPT", "1");
|
||||
#endif
|
||||
|
||||
#if defined(ROCPROFSYS_USE_OMPT)
|
||||
if(!getenv("OMP_TOOL_LIBRARIES"))
|
||||
update_env(_env, "OMP_TOOL_LIBRARIES", _dl_libpath, UPD_APPEND);
|
||||
@@ -357,14 +338,6 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
%{INDENT}% 0 avoid triggering the bug, potentially at the cost of reduced performance
|
||||
%{INDENT}% 1 do not modify how ROCm is notified about kernel completion)";
|
||||
|
||||
auto _realtime_reqs = (get_env("HSA_ENABLE_INTERRUPT", std::string{}, false).empty())
|
||||
? std::vector<std::string>{ "hsa-interrupt" }
|
||||
: std::vector<std::string>{};
|
||||
|
||||
#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0
|
||||
_realtime_reqs.clear();
|
||||
#endif
|
||||
|
||||
const auto* _trace_policy_desc =
|
||||
R"(Policy for new data when the buffer size limit is reached:
|
||||
%{INDENT}%- discard : new data is ignored
|
||||
@@ -720,7 +693,6 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
|
||||
parser.add_argument({ "--realtime" }, _realtime_desc)
|
||||
.min_count(0)
|
||||
.required(std::move(_realtime_reqs))
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("realtime");
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_REALTIME", true);
|
||||
@@ -741,10 +713,20 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
}
|
||||
});
|
||||
|
||||
std::set<std::string> _backend_choices = { "all", "kokkosp", "mpip",
|
||||
"ompt", "rcclp", "rocm-smi",
|
||||
"roctracer", "rocprofiler", "roctx",
|
||||
"mutex-locks", "spin-locks", "rw-locks" };
|
||||
std::set<std::string> _backend_choices = { "all",
|
||||
"kokkosp",
|
||||
"mpip",
|
||||
"ompt",
|
||||
"rcclp",
|
||||
"rocm-smi",
|
||||
"roctracer",
|
||||
"rocprofiler",
|
||||
"roctx",
|
||||
"mutex-locks",
|
||||
"spin-locks",
|
||||
"rw-locks",
|
||||
"rocprofiler-sdk",
|
||||
"rocm" };
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
_backend_choices.erase("mpip");
|
||||
@@ -758,17 +740,10 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
_backend_choices.erase("rcclp");
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
#if !defined(ROCPROFSYS_USE_ROCM)
|
||||
_backend_choices.erase("rocm");
|
||||
_backend_choices.erase("rocm-smi");
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
_backend_choices.erase("rocprofiler");
|
||||
_backend_choices.erase("rocprofiler-sdk");
|
||||
#endif
|
||||
|
||||
parser.start_group("BACKEND OPTIONS",
|
||||
@@ -784,11 +759,9 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
_update("ROCPROFSYS_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("ROCPROFSYS_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("ROCPROFSYS_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM", _v.count("rocm") > 0);
|
||||
_update("ROCPROFSYS_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
@@ -810,27 +783,18 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
_update("ROCPROFSYS_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("ROCPROFSYS_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("ROCPROFSYS_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM", _v.count("rocm") > 0);
|
||||
_update("ROCPROFSYS_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
|
||||
if(_v.count("all") > 0 ||
|
||||
(_v.count("roctracer") > 0 && _v.count("rocprofiler") > 0))
|
||||
{
|
||||
remove_env(_env, "HSA_TOOLS_LIB");
|
||||
remove_env(_env, "HSA_TOOLS_REPORT_LOAD_FAILURE");
|
||||
}
|
||||
|
||||
if(_v.count("all") > 0 || _v.count("rocprofiler") > 0)
|
||||
{
|
||||
remove_env(_env, "ROCP_TOOL_LIB");
|
||||
remove_env(_env, "ROCP_HSA_INTERCEPT");
|
||||
}
|
||||
// if(_v.count("all") > 0 || _v.count("rocprofiler") > 0)
|
||||
// {
|
||||
// remove_env(_env, "ROCP_TOOL_LIB");
|
||||
// remove_env(_env, "ROCP_HSA_INTERCEPT");
|
||||
// }
|
||||
|
||||
if(_v.count("all") > 0 || _v.count("ompt") > 0)
|
||||
remove_env(_env, "OMP_TOOL_LIBRARIES");
|
||||
@@ -850,18 +814,6 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
update_env(_env, "ROCPROFSYS_PAPI_EVENTS", _events);
|
||||
});
|
||||
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
parser
|
||||
.add_argument({ "-G", "--gpu-events" },
|
||||
"Set the GPU hardware counter events to record (ref: "
|
||||
"`rocprof-sys-avail -H -c GPU`)")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events =
|
||||
join(array_config{ "," }, p.get<std::vector<std::string>>("gpu-events"));
|
||||
update_env(_env, "ROCPROFSYS_ROCM_EVENTS", _events);
|
||||
});
|
||||
#endif
|
||||
|
||||
parser.start_group("MISCELLANEOUS OPTIONS", "");
|
||||
parser
|
||||
.add_argument({ "-i", "--inlines" },
|
||||
|
||||
Criar uma nova questão referindo esta
Bloquear um utilizador