Rename Omnitrace to ROCm Systems Profiler (#4)
The Omnitrace program is being renamed.
Full name: "ROCm Systems Profiler"
Package name: "rocprofiler-systems"
Binary / Library names: "rocprof-sys-*"
---------
Co-authored-by: Xuan Chen <xuchen@amd.com>
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: d07bf508a9]
Este cometimento está contido em:
1 ascendente
c444ba6131
cometimento
489eda995d
420 ficheiros modificados
+10418
-9914
Não existem ficheiros que correspondam à sua pesquisa
@@ -2,7 +2,7 @@ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_BUILD_LTO)
|
||||
if(ROCPROFSYS_BUILD_LTO)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
endif()
|
||||
|
||||
@@ -13,16 +13,16 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(bin)
|
||||
|
||||
if(OMNITRACE_USE_PYTHON)
|
||||
if(ROCPROFSYS_USE_PYTHON)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_BUILD_DEVELOPER)
|
||||
add_custom_target(omnitrace-precommit)
|
||||
foreach(_TARGET format-omnitrace-source format-omnitrace-cmake format-timemory-source
|
||||
format-timemory-cmake)
|
||||
if(ROCPROFSYS_BUILD_DEVELOPER)
|
||||
add_custom_target(rocprofiler-systems-precommit)
|
||||
foreach(_TARGET format-rocprofiler-systems-source format-rocprofiler-systems-cmake
|
||||
format-timemory-source format-timemory-cmake)
|
||||
if(TARGET ${_TARGET})
|
||||
add_dependencies(omnitrace-precommit ${_TARGET})
|
||||
add_dependencies(rocprofiler-systems-precommit ${_TARGET})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -1,27 +1,26 @@
|
||||
# executable RPATH
|
||||
|
||||
if(OMNITRACE_USE_ROCPROFILER
|
||||
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(OMNITRACE_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/omnitrace:${rocprofiler_LIBRARY_DIR}"
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}:${rocprofiler_LIBRARY_DIR}"
|
||||
)
|
||||
else()
|
||||
set(OMNITRACE_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/omnitrace"
|
||||
set(ROCPROFSYS_EXE_INSTALL_RPATH
|
||||
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# executables
|
||||
add_subdirectory(omnitrace-avail)
|
||||
add_subdirectory(omnitrace-causal)
|
||||
add_subdirectory(omnitrace-sample)
|
||||
add_subdirectory(omnitrace-instrument)
|
||||
add_subdirectory(omnitrace-run)
|
||||
# omnitrace-exe is deprecated
|
||||
add_subdirectory(omnitrace-exe)
|
||||
add_subdirectory(rocprof-sys-avail)
|
||||
add_subdirectory(rocprof-sys-causal)
|
||||
add_subdirectory(rocprof-sys-sample)
|
||||
add_subdirectory(rocprof-sys-instrument)
|
||||
add_subdirectory(rocprof-sys-run)
|
||||
|
||||
if(OMNITRACE_BUILD_TESTING OR "$ENV{OMNITRACE_CI}" MATCHES "[1-9]+|ON|on|y|yes")
|
||||
# tests
|
||||
if(ROCPROFSYS_BUILD_TESTING OR "$ENV{ROCPROFSYS_CI}" MATCHES "[1-9]+|ON|on|y|yes")
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
@@ -1,27 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-causal target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(
|
||||
omnitrace-causal
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-causal.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(omnitrace-causal PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(omnitrace-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
omnitrace-causal
|
||||
PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-common-library omnitrace::omnitrace-core)
|
||||
set_target_properties(
|
||||
omnitrace-causal PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}")
|
||||
|
||||
omnitrace_strip_target(omnitrace-causal)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-causal
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
@@ -1,23 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-exe target (deprecated 'omnitrace' executable, now 'omnitrace-instrument')
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(omnitrace-exe ${CMAKE_CURRENT_LIST_DIR}/omnitrace.cpp)
|
||||
|
||||
target_link_libraries(omnitrace-exe PRIVATE omnitrace::omnitrace-threading)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-exe
|
||||
PROPERTIES OUTPUT_NAME omnitrace
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
omnitrace_strip_target(omnitrace-exe)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-exe
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
@@ -1,60 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-instrument target (formerly omnitrace-exe target prior to 1.8.1)
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
|
||||
add_executable(omnitrace-instrument)
|
||||
|
||||
target_sources(
|
||||
omnitrace-instrument
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-instrument.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-instrument.hpp)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-instrument
|
||||
PRIVATE omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-dyninst
|
||||
omnitrace::omnitrace-compile-options
|
||||
omnitrace::omnitrace-compile-definitions
|
||||
omnitrace::omnitrace-sanitizer
|
||||
timemory::timemory-headers
|
||||
timemory::timemory-extensions
|
||||
timemory::timemory-core)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-instrument
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
if(OMNITRACE_BUILD_DYNINST)
|
||||
target_compile_definitions(omnitrace-instrument PRIVATE OMNITRACE_BUILD_DYNINST=1)
|
||||
endif()
|
||||
|
||||
add_target_flag_if_avail(omnitrace-instrument "-Wno-deprecated-declarations")
|
||||
|
||||
omnitrace_strip_target(omnitrace-instrument)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(DEBUG|Debug)")
|
||||
string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
target_compile_options(omnitrace-instrument PRIVATE ${_FLAGS})
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-instrument
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
@@ -1,28 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-run target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(
|
||||
omnitrace-run
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-run.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/omnitrace-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(omnitrace-run PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(omnitrace-run PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
omnitrace-run
|
||||
PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-common-library omnitrace::omnitrace-core
|
||||
omnitrace::omnitrace-sanitizer)
|
||||
set_target_properties(
|
||||
omnitrace-run PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}")
|
||||
|
||||
omnitrace_strip_target(omnitrace-run)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-run
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
@@ -1,25 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-sample target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(omnitrace-sample ${CMAKE_CURRENT_LIST_DIR}/omnitrace-sample.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(omnitrace-sample PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(omnitrace-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
omnitrace-sample
|
||||
PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-common-library)
|
||||
set_target_properties(
|
||||
omnitrace-sample PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}")
|
||||
|
||||
omnitrace_strip_target(omnitrace-sample)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-sample
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+16
-12
@@ -1,13 +1,13 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace-avail target
|
||||
# rocprofiler-systems-avail target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(omnitrace-avail)
|
||||
add_executable(rocprofiler-systems-avail)
|
||||
|
||||
target_sources(
|
||||
omnitrace-avail
|
||||
rocprofiler-systems-avail
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/avail.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/avail.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/common.cpp
|
||||
@@ -22,19 +22,23 @@ target_sources(
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info_type.hpp)
|
||||
|
||||
target_include_directories(omnitrace-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_compile_definitions(omnitrace-avail PRIVATE OMNITRACE_EXTERN_COMPONENTS=0)
|
||||
target_include_directories(rocprofiler-systems-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_compile_definitions(rocprofiler-systems-avail
|
||||
PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0)
|
||||
target_link_libraries(
|
||||
omnitrace-avail
|
||||
PRIVATE omnitrace::omnitrace-compile-definitions
|
||||
omnitrace::omnitrace-interface-library omnitrace::libomnitrace-static)
|
||||
rocprofiler-systems-avail
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::librocprofiler-systems-static)
|
||||
set_target_properties(
|
||||
omnitrace-avail PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}")
|
||||
rocprofiler-systems-avail
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail)
|
||||
|
||||
omnitrace_strip_target(omnitrace-avail)
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-avail)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-avail
|
||||
TARGETS rocprofiler-systems-avail
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -118,8 +118,8 @@ write_hw_counter_info(std::ostream&, const array_t<bool, N>& = {},
|
||||
|
||||
namespace
|
||||
{
|
||||
// initialize HIP before main so that libomnitrace is not HSA_TOOLS_LIB
|
||||
int gpu_count = omnitrace::gpu::hip_device_count();
|
||||
// initialize HIP before main so that librocprof-sys is not HSA_TOOLS_LIB
|
||||
int gpu_count = rocprofsys::gpu::hip_device_count();
|
||||
|
||||
// statically allocated shared_ptrs to prevent use after free errors
|
||||
auto timemory_manager = tim::manager::master_instance();
|
||||
@@ -137,8 +137,8 @@ main(int argc, char** argv)
|
||||
(void) timemory_hash_aliases; //
|
||||
|
||||
tim::unwind::set_bfd_verbose(3);
|
||||
tim::set_env("OMNITRACE_INIT_TOOLING", "OFF", 1);
|
||||
omnitrace_init_library();
|
||||
tim::set_env("ROCPROFSYS_INIT_TOOLING", "OFF", 1);
|
||||
rocprofsys_init_library();
|
||||
|
||||
std::set<std::string> _category_options = component_categories{}();
|
||||
{
|
||||
@@ -193,7 +193,7 @@ main(int argc, char** argv)
|
||||
|
||||
std::string file = {};
|
||||
|
||||
parser_t parser("omnitrace-avail");
|
||||
parser_t parser("rocprof-sys-avail");
|
||||
|
||||
parser.set_help_width(40);
|
||||
auto _cols = std::get<0>(tim::utility::console::get_columns());
|
||||
@@ -202,7 +202,7 @@ main(int argc, char** argv)
|
||||
std::min<int>(_cols - parser.get_help_width() - 8, 120));
|
||||
|
||||
parser.enable_help();
|
||||
parser.enable_version("omnitrace-avail", OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
parser.enable_version("rocprof-sys-avail", ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
|
||||
parser.start_group("DEBUG");
|
||||
|
||||
@@ -440,7 +440,7 @@ main(int argc, char** argv)
|
||||
"Dump a configuration to a specified file.")
|
||||
.max_count(1)
|
||||
.dtype("filename")
|
||||
.set_default(std::string{ "omnitrace-config" })
|
||||
.set_default(std::string{ "rocprof-sys-config" })
|
||||
.action([&_config_file](parser_t& _p) {
|
||||
auto _out =
|
||||
(_p.exists("output")) ? _p.get<std::string>("output") : std::string{};
|
||||
@@ -508,15 +508,15 @@ main(int argc, char** argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#if OMNITRACE_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
if(gpu_count > 0)
|
||||
{
|
||||
size_t _num_metrics = 0;
|
||||
try
|
||||
{
|
||||
// call to rocm_metrics() will add choices to OMNITRACE_ROCM_EVENTS setting
|
||||
// call to rocm_metrics() will add choices to ROCPROFSYS_ROCM_EVENTS setting
|
||||
// so always perform this call even if list of HW counters is not requested
|
||||
_num_metrics = omnitrace::rocprofiler::rocm_metrics().size();
|
||||
_num_metrics = rocprofsys::rocprofiler::rocm_metrics().size();
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
verbprintf(0, "Retrieving the GPU HW counters failed: %s", _e.what());
|
||||
@@ -556,7 +556,7 @@ main(int argc, char** argv)
|
||||
generate_config(_config_file, _config_fmts, options);
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
std::cerr << "[omnitrace-avail] " << _e.what() << std::endl;
|
||||
std::cerr << "[rocprof-sys-avail] " << _e.what() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
@@ -1076,7 +1076,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) ? omnitrace::rocprofiler::rocm_metrics() : hwcounter_info_t{};
|
||||
(gpu_count > 0) ? rocprofsys::rocprofiler::rocm_metrics() : hwcounter_info_t{};
|
||||
|
||||
if(alphabetical)
|
||||
{
|
||||
Ficheiro renomeado sem modificações.
+6
-6
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -52,14 +52,14 @@ str_vec_t category_regex_keys = {};
|
||||
str_set_t category_view = {};
|
||||
std::stringstream lerr{};
|
||||
|
||||
bool debug_msg = tim::get_env<bool>("OMNITRACE_DEBUG_AVAIL", settings::debug());
|
||||
bool debug_msg = tim::get_env<bool>("ROCPROFSYS_DEBUG_AVAIL", settings::debug());
|
||||
int32_t verbose_level =
|
||||
tim::get_env<int32_t>("OMNITRACE_VERBOSE_AVAIL", settings::verbose());
|
||||
tim::get_env<int32_t>("ROCPROFSYS_VERBOSE_AVAIL", settings::verbose());
|
||||
|
||||
// explicit setting names to exclude
|
||||
std::set<std::string> settings_exclude = {
|
||||
"OMNITRACE_ENVIRONMENT",
|
||||
"OMNITRACE_COMMAND_LINE",
|
||||
"ROCPROFSYS_ENVIRONMENT",
|
||||
"ROCPROFSYS_COMMAND_LINE",
|
||||
"cereal_class_version",
|
||||
"settings",
|
||||
};
|
||||
@@ -362,7 +362,7 @@ dump_log()
|
||||
void
|
||||
dump_log_abort(int _v)
|
||||
{
|
||||
fprintf(stderr, "\n[omnitrace-avail] Exiting with signal %i...\n", _v);
|
||||
fprintf(stderr, "\n[rocprof-sys-avail] Exiting with signal %i...\n", _v);
|
||||
debug_msg = true;
|
||||
dump_log();
|
||||
}
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -109,11 +109,11 @@ extern std::stringstream lerr;
|
||||
// explicit setting names to exclude
|
||||
extern std::set<std::string> settings_exclude;
|
||||
|
||||
// exclude some timemory settings which are not relevant to omnitrace
|
||||
// exact matches, e.g. OMNITRACE_BANNER
|
||||
// exclude some timemory settings which are not relevant to rocprof-sys
|
||||
// exact matches, e.g. ROCPROFSYS_BANNER
|
||||
extern std::string settings_rexclude_exact;
|
||||
|
||||
// leading matches, e.g. OMNITRACE_MPI_[A-Z_]+
|
||||
// leading matches, e.g. ROCPROFSYS_MPI_[A-Z_]+
|
||||
extern std::string settings_rexclude_begin;
|
||||
|
||||
constexpr size_t max_error_message_buffer_length = 4096;
|
||||
@@ -156,12 +156,12 @@ file_exists(const std::string&);
|
||||
if(debug_msg || verbose_level >= LEVEL) \
|
||||
{ \
|
||||
fprintf(stderr, "%s", tim::log::color::fatal()); \
|
||||
fprintf(stderr, "[omnitrace][avail] Error! " __VA_ARGS__); \
|
||||
fprintf(stderr, "[rocprof-sys][avail] Error! " __VA_ARGS__); \
|
||||
fprintf(stderr, "%s", tim::log::color::end()); \
|
||||
} \
|
||||
char _buff[max_error_message_buffer_length]; \
|
||||
snprintf(_buff, max_error_message_buffer_length, \
|
||||
"[omnitrace][avail] Error! " __VA_ARGS__); \
|
||||
"[rocprof-sys][avail] Error! " __VA_ARGS__); \
|
||||
throw std::runtime_error(std::string{ _buff }); \
|
||||
} \
|
||||
else \
|
||||
@@ -169,7 +169,7 @@ file_exists(const std::string&);
|
||||
if(debug_msg || verbose_level >= LEVEL) \
|
||||
{ \
|
||||
fprintf(stderr, "%s", tim::log::color::warning()); \
|
||||
fprintf(stderr, "[omnitrace][avail] Warning! " __VA_ARGS__); \
|
||||
fprintf(stderr, "[rocprof-sys][avail] Warning! " __VA_ARGS__); \
|
||||
fprintf(stderr, "%s", tim::log::color::end()); \
|
||||
} \
|
||||
} \
|
||||
@@ -182,7 +182,7 @@ file_exists(const std::string&);
|
||||
if(debug_msg || verbose_level >= LEVEL) \
|
||||
{ \
|
||||
fprintf(stderr, "%s", tim::log::color::info()); \
|
||||
fprintf(stderr, "[omnitrace][avail] " __VA_ARGS__); \
|
||||
fprintf(stderr, "[rocprof-sys][avail] " __VA_ARGS__); \
|
||||
fprintf(stderr, "%s", tim::log::color::end()); \
|
||||
} \
|
||||
fflush(stderr); \
|
||||
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
+23
-22
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -163,9 +163,9 @@ struct setting_serialization<tsettings<Tp>, custom_setting_serializer>
|
||||
template <typename... Tp>
|
||||
void push(type_list<Tp...>)
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(
|
||||
ROCPROFSYS_FOLD_EXPRESSION(
|
||||
settings::push_serialize_map_callback<Tp, custom_setting_serializer>());
|
||||
OMNITRACE_FOLD_EXPRESSION(
|
||||
ROCPROFSYS_FOLD_EXPRESSION(
|
||||
settings::push_serialize_data_callback<Tp, custom_setting_serializer>(
|
||||
type_list<std::string>{}));
|
||||
}
|
||||
@@ -173,9 +173,9 @@ void push(type_list<Tp...>)
|
||||
template <typename... Tp>
|
||||
void pop(type_list<Tp...>)
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(
|
||||
ROCPROFSYS_FOLD_EXPRESSION(
|
||||
settings::pop_serialize_map_callback<Tp, custom_setting_serializer>());
|
||||
OMNITRACE_FOLD_EXPRESSION(
|
||||
ROCPROFSYS_FOLD_EXPRESSION(
|
||||
settings::pop_serialize_data_callback<Tp, custom_setting_serializer>(
|
||||
type_list<std::string>{}));
|
||||
}
|
||||
@@ -245,7 +245,7 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
auto _serialize = [_settings](auto&& _ar) {
|
||||
_ar->setNextName(TIMEMORY_PROJECT_NAME);
|
||||
_ar->startNode();
|
||||
(*_ar)(cereal::make_nvp("version", std::string{ OMNITRACE_VERSION_STRING }));
|
||||
(*_ar)(cereal::make_nvp("version", std::string{ ROCPROFSYS_VERSION_STRING }));
|
||||
(*_ar)(cereal::make_nvp("date", tim::get_local_datetime("%F_%H.%M", &_time)));
|
||||
settings::serialize_settings(*_ar, *_settings);
|
||||
_ar->finishNode();
|
||||
@@ -260,12 +260,12 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
if(force_config)
|
||||
{
|
||||
if(settings::verbose() >= 1)
|
||||
std::cout << "[omnitrace-avail] File '" << _fname
|
||||
std::cout << "[rocprof-sys-avail] File '" << _fname
|
||||
<< "' exists. Overwrite force...\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "[omnitrace-avail] File '" << _fname
|
||||
std::cout << "[rocprof-sys-avail] File '" << _fname
|
||||
<< "' exists. Overwrite? " << std::flush;
|
||||
std::string _response = {};
|
||||
std::cin >> _response;
|
||||
@@ -276,7 +276,7 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
if(filepath::open(_ofs, _fname))
|
||||
{
|
||||
if(settings::verbose() >= 0)
|
||||
printf("[omnitrace-avail] Outputting %s configuration file '%s'...\n",
|
||||
printf("[rocprof-sys-avail] Outputting %s configuration file '%s'...\n",
|
||||
_type.c_str(), _fname.c_str());
|
||||
}
|
||||
else
|
||||
@@ -332,16 +332,16 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
{
|
||||
_settings->ordering();
|
||||
std::sort(_data.begin(), _data.end(), [](auto _lhs, auto _rhs) {
|
||||
auto _lomni = _lhs->get_categories().count("omnitrace") > 0;
|
||||
auto _romni = _rhs->get_categories().count("omnitrace") > 0;
|
||||
auto _lomni = _lhs->get_categories().count("rocprofsys") > 0;
|
||||
auto _romni = _rhs->get_categories().count("rocprofsys") > 0;
|
||||
if(_lomni && !_romni) return true;
|
||||
if(_romni && !_lomni) return false;
|
||||
for(const auto* itr :
|
||||
{ "OMNITRACE_CONFIG", "OMNITRACE_MODE", "OMNITRACE_TRACE",
|
||||
"OMNITRACE_PROFILE", "OMNITRACE_USE_SAMPLING",
|
||||
"OMNITRACE_USE_PROCESS_SAMPLING", "OMNITRACE_USE_ROCTRACER",
|
||||
"OMNITRACE_USE_ROCM_SMI", "OMNITRACE_USE_KOKKOSP",
|
||||
"OMNITRACE_USE_OMPT", "OMNITRACE_USE", "OMNITRACE_OUTPUT" })
|
||||
{ "ROCPROFSYS_CONFIG", "ROCPROFSYS_MODE", "ROCPROFSYS_TRACE",
|
||||
"ROCPROFSYS_PROFILE", "ROCPROFSYS_USE_SAMPLING",
|
||||
"ROCPROFSYS_USE_PROCESS_SAMPLING", "ROCPROFSYS_USE_ROCTRACER",
|
||||
"ROCPROFSYS_USE_ROCM_SMI", "ROCPROFSYS_USE_KOKKOSP",
|
||||
"ROCPROFSYS_USE_OMPT", "ROCPROFSYS_USE", "ROCPROFSYS_OUTPUT" })
|
||||
{
|
||||
if(_lhs->get_env_name().find(itr) == 0 &&
|
||||
_rhs->get_env_name().find(itr) != 0)
|
||||
@@ -351,7 +351,7 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
return false;
|
||||
}
|
||||
for(const auto* itr :
|
||||
{ "OMNITRACE_SUPPRESS_PARSING", "OMNITRACE_SUPPRESS_CONFIG" })
|
||||
{ "ROCPROFSYS_SUPPRESS_PARSING", "ROCPROFSYS_SUPPRESS_CONFIG" })
|
||||
{
|
||||
if(_lhs->get_env_name().find(itr) == 0 &&
|
||||
_rhs->get_env_name().find(itr) != 0)
|
||||
@@ -423,8 +423,9 @@ generate_config(std::string _config_file, const std::set<std::string>& _config_f
|
||||
true, _output_dir);
|
||||
std::ofstream ofs{};
|
||||
_open(ofs, _fname, "text")
|
||||
<< "# auto-generated by omnitrace-avail (version " << OMNITRACE_VERSION_STRING
|
||||
<< ") on " << tim::get_local_datetime("%F @ %H:%M", &_time) << "\n\n"
|
||||
<< "# auto-generated by rocprof-sys-avail (version "
|
||||
<< ROCPROFSYS_VERSION_STRING << ") on "
|
||||
<< tim::get_local_datetime("%F @ %H:%M", &_time) << "\n\n"
|
||||
<< _ss.str();
|
||||
}
|
||||
|
||||
@@ -440,7 +441,7 @@ update_choices(const std::shared_ptr<settings>& _settings)
|
||||
std::vector<info_type> _info = get_component_info<TIMEMORY_NATIVE_COMPONENTS_END>();
|
||||
|
||||
if(_settings->get_verbose() >= 2 || _settings->get_debug())
|
||||
printf("[omnitrace-avail] # of component found: %zu\n", _info.size());
|
||||
printf("[rocprof-sys-avail] # of component found: %zu\n", _info.size());
|
||||
|
||||
_info.erase(std::remove_if(_info.begin(), _info.end(),
|
||||
[](const auto& itr) {
|
||||
@@ -463,8 +464,8 @@ update_choices(const std::shared_ptr<settings>& _settings)
|
||||
for(const auto& itr : _info)
|
||||
_component_choices.emplace_back(itr.id_type());
|
||||
if(_settings->get_verbose() >= 2 || _settings->get_debug())
|
||||
printf("[omnitrace-avail] # of component choices: %zu\n",
|
||||
printf("[rocprof-sys-avail] # of component choices: %zu\n",
|
||||
_component_choices.size());
|
||||
_settings->find("OMNITRACE_TIMEMORY_COMPONENTS")
|
||||
_settings->find("ROCPROFSYS_TIMEMORY_COMPONENTS")
|
||||
->second->set_choices(_component_choices);
|
||||
}
|
||||
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
@@ -0,0 +1,31 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocprofiler-systems-causal target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(
|
||||
rocprofiler-systems-causal
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-causal PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-causal
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-causal
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-causal)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-causal
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+82
-80
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-causal.hpp"
|
||||
#include "rocprof-sys-causal.hpp"
|
||||
|
||||
#include "common/defines.h"
|
||||
#include "common/delimit.hpp"
|
||||
@@ -61,7 +61,7 @@ namespace filepath = ::tim::filepath;
|
||||
namespace console = ::tim::utility::console;
|
||||
namespace argparse = ::tim::argparse;
|
||||
using namespace ::timemory::join;
|
||||
using ::omnitrace::utility::parse_numeric_range;
|
||||
using ::rocprofsys::utility::parse_numeric_range;
|
||||
using ::tim::get_env;
|
||||
using ::tim::log::monochrome;
|
||||
using ::tim::log::stream;
|
||||
@@ -121,10 +121,10 @@ forward_signal(int sig)
|
||||
int
|
||||
get_verbose()
|
||||
{
|
||||
verbose = get_env("OMNITRACE_CAUSAL_VERBOSE",
|
||||
get_env<int>("OMNITRACE_VERBOSE", verbose, false));
|
||||
auto _debug =
|
||||
get_env("OMNITRACE_CAUSAL_DEBUG", get_env<bool>("OMNITRACE_DEBUG", false, false));
|
||||
verbose = get_env("ROCPROFSYS_CAUSAL_VERBOSE",
|
||||
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
|
||||
auto _debug = get_env("ROCPROFSYS_CAUSAL_DEBUG",
|
||||
get_env<bool>("ROCPROFSYS_DEBUG", false, false));
|
||||
if(_debug) verbose += 8;
|
||||
return verbose;
|
||||
}
|
||||
@@ -151,13 +151,13 @@ remove_child_pid(pid_t _v)
|
||||
int
|
||||
wait_pid(pid_t _pid, int _opts)
|
||||
{
|
||||
return ::omnitrace::mproc::wait_pid(_pid, _opts);
|
||||
return ::rocprofsys::mproc::wait_pid(_pid, _opts);
|
||||
}
|
||||
|
||||
int
|
||||
diagnose_status(pid_t _pid, int _status)
|
||||
{
|
||||
return ::omnitrace::mproc::diagnose_status(_pid, _status, get_verbose());
|
||||
return ::rocprofsys::mproc::diagnose_status(_pid, _status, get_verbose());
|
||||
}
|
||||
|
||||
std::string
|
||||
@@ -194,15 +194,15 @@ get_initial_environment()
|
||||
}
|
||||
}
|
||||
|
||||
update_env(_env, "OMNITRACE_MODE", "causal");
|
||||
update_env(_env, "OMNITRACE_USE_CAUSAL", true);
|
||||
update_env(_env, "OMNITRACE_USE_SAMPLING", false);
|
||||
update_env(_env, "OMNITRACE_TRACE", false);
|
||||
update_env(_env, "OMNITRACE_PROFILE", false);
|
||||
update_env(_env, "OMNITRACE_USE_PROCESS_SAMPLING", false);
|
||||
update_env(_env, "OMNITRACE_THREAD_POOL_SIZE",
|
||||
get_env<int>("OMNITRACE_THREAD_POOL_SIZE", 0));
|
||||
update_env(_env, "OMNITRACE_LAUNCHER", "omnitrace-causal");
|
||||
update_env(_env, "ROCPROFSYS_MODE", "causal");
|
||||
update_env(_env, "ROCPROFSYS_USE_CAUSAL", true);
|
||||
update_env(_env, "ROCPROFSYS_USE_SAMPLING", false);
|
||||
update_env(_env, "ROCPROFSYS_TRACE", false);
|
||||
update_env(_env, "ROCPROFSYS_PROFILE", false);
|
||||
update_env(_env, "ROCPROFSYS_USE_PROCESS_SAMPLING", false);
|
||||
update_env(_env, "ROCPROFSYS_THREAD_POOL_SIZE",
|
||||
get_env<int>("ROCPROFSYS_THREAD_POOL_SIZE", 0));
|
||||
update_env(_env, "ROCPROFSYS_LAUNCHER", "rocprof-sys-causal");
|
||||
|
||||
return _env;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ prepare_command_for_run(char* _exe, std::vector<char*>& _argv)
|
||||
if(!_injected)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
join("", "omnitrace-causal was unable to match \"", launcher,
|
||||
join("", "rocprof-sys-causal was unable to match \"", launcher,
|
||||
"\" to any arguments on the command line: \"",
|
||||
join(array_config{ " ", "", "" }, _argv), "\""));
|
||||
}
|
||||
@@ -244,7 +244,7 @@ prepare_environment_for_run(std::vector<char*>& _env)
|
||||
{
|
||||
update_env(_env, "LD_PRELOAD",
|
||||
join(":", LIBPTHREAD_SO,
|
||||
get_realpath(get_internal_libpath("libomnitrace-dl.so"))),
|
||||
get_realpath(get_internal_libpath("librocprof-sys-dl.so"))),
|
||||
true);
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ get_internal_libpath(const std::string& _lib)
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = std::string{ "./" };
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return omnitrace::common::join("/", _dir, "..", "lib", _lib);
|
||||
return rocprofsys::common::join("/", _dir, "..", "lib", _lib);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -277,7 +277,7 @@ print_updated_environment(std::vector<char*> _env, std::string_view _prefix)
|
||||
{
|
||||
if(itr == nullptr) continue;
|
||||
|
||||
auto _is_omni = (std::string_view{ itr }.find("OMNITRACE") == 0);
|
||||
auto _is_omni = (std::string_view{ itr }.find("ROCPROFSYS") == 0);
|
||||
auto _updated = false;
|
||||
for(const auto& vitr : updated_envs)
|
||||
{
|
||||
@@ -343,13 +343,13 @@ update_env(std::vector<char*>& _environ, std::string_view _env_var, Tp&& _env_va
|
||||
else
|
||||
{
|
||||
free(itr);
|
||||
itr = strdup(omnitrace::common::join('=', _env_var, _env_val).c_str());
|
||||
itr = strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
_environ.emplace_back(
|
||||
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
||||
strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str()));
|
||||
}
|
||||
|
||||
template <typename Tp>
|
||||
@@ -365,7 +365,7 @@ add_default_env(std::vector<char*>& _environ, std::string_view _env_var, Tp&& _e
|
||||
|
||||
updated_envs.emplace(_env_var);
|
||||
_environ.emplace_back(
|
||||
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
||||
strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -419,24 +419,24 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
This executable is designed to streamline that process.
|
||||
For example (assume all commands end with '-- <exe> <args>'):
|
||||
|
||||
omnitrace-causal -n 5 -- <exe> # runs <exe> 5x with causal profiling enabled
|
||||
rocprof-sys-causal -n 5 -- <exe> # runs <exe> 5x with causal profiling enabled
|
||||
|
||||
omnitrace-causal -s 0 5,10,15,20 # runs <exe> 2x with virtual speedups:
|
||||
rocprof-sys-causal -s 0 5,10,15,20 # runs <exe> 2x with virtual speedups:
|
||||
# - 0
|
||||
# - randomly selected from 5, 10, 15, and 20
|
||||
|
||||
omnitrace-causal -F func_A func_B func_(A|B) # runs <exe> 3x with the function scope limited to:
|
||||
rocprof-sys-causal -F func_A func_B func_(A|B) # runs <exe> 3x with the function scope limited to:
|
||||
# 1. func_A
|
||||
# 2. func_B
|
||||
# 3. func_A or func_B
|
||||
General tips:
|
||||
- Insert progress points at hotspots in your code or use omnitrace's runtime instrumentation
|
||||
- Insert progress points at hotspots in your code or use rocprof-sys's runtime instrumentation
|
||||
- Note: binary rewrite will produce a incompatible new binary
|
||||
- Collect a flat profile via sampling
|
||||
- E.g., omnitrace-sample -F -- <exe> <args>
|
||||
- E.g., rocprof-sys-sample -F -- <exe> <args>
|
||||
- Inspect sampling_wall_clock.txt and sampling_cpu_clock.txt for functions to target
|
||||
- Run omnitrace-causal in "function" mode first (does not require debug info)
|
||||
- Run omnitrace-causal in "line" mode when you are targeting one function (requires debug info)
|
||||
- Run rocprof-sys-causal in "function" mode first (does not require debug info)
|
||||
- Run rocprof-sys-causal in "line" mode when you are targeting one function (requires debug info)
|
||||
- Preferably, use predictions from the "function" mode to determine which function to target
|
||||
- Limit the virtual speedups to a smaller pool, e.g., 0,5,10,25,50, to get reliable predictions quicker
|
||||
- Make use of the binary, source, and function scope to limit the functions/lines selected for experiments
|
||||
@@ -451,7 +451,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
});
|
||||
|
||||
parser.enable_help();
|
||||
parser.enable_version("omnitrace-causal", OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
parser.enable_version("rocprof-sys-causal", ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
|
||||
auto _cols = std::get<0>(console::get_columns());
|
||||
if(_cols > parser.get_help_width() + 8)
|
||||
@@ -466,24 +466,24 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
auto _monochrome = p.get<bool>("monochrome");
|
||||
monochrome() = _monochrome;
|
||||
p.set_use_color(!_monochrome);
|
||||
update_env(_env, "OMNITRACE_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_env, "ROCPROFSYS_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_env, "MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
});
|
||||
parser.add_argument({ "--debug" }, "Debug output")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_DEBUG", p.get<bool>("debug"));
|
||||
update_env(_env, "ROCPROFSYS_DEBUG", p.get<bool>("debug"));
|
||||
});
|
||||
parser.add_argument({ "-v", "--verbose" }, "Verbose output")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<int>("verbose");
|
||||
verbose = _v;
|
||||
update_env(_env, "OMNITRACE_VERBOSE", _v);
|
||||
update_env(_env, "ROCPROFSYS_VERBOSE", _v);
|
||||
});
|
||||
|
||||
std::string _config_file = {};
|
||||
std::string _config_folder = "omnitrace-causal-config";
|
||||
std::string _config_folder = "rocprof-sys-causal-config";
|
||||
bool _generate_configs = false;
|
||||
bool _add_defaults = true;
|
||||
|
||||
@@ -498,11 +498,13 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
parser
|
||||
.add_argument(
|
||||
{ "-l", "--launcher" },
|
||||
"When running MPI jobs, omnitrace-causal needs to be *before* the executable "
|
||||
"When running MPI jobs, rocprof-sys-causal needs to be *before* the "
|
||||
"executable "
|
||||
"which launches the MPI processes (i.e. before `mpirun`, `srun`, etc.). Pass "
|
||||
"the name of the target executable (or a regex for matching to the name of "
|
||||
"the target) for causal profiling, e.g., `omnitrace-causal -l foo -- mpirun "
|
||||
"-n 4 foo`. This ensures that the omnitrace library is LD_PRELOADed on the "
|
||||
"the target) for causal profiling, e.g., `rocprof-sys-causal -l foo -- "
|
||||
"mpirun "
|
||||
"-n 4 foo`. This ensures that the rocprof-sys library is LD_PRELOADed on the "
|
||||
"proper target")
|
||||
.count(1)
|
||||
.dtype("executable")
|
||||
@@ -511,7 +513,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.add_argument({ "-g", "--generate-configs" },
|
||||
"Generate config files instead of passing environment variables "
|
||||
"directly. If no arguments are provided, the config files will be "
|
||||
"placed in ${PWD}/omnitrace-causal-config folder")
|
||||
"placed in ${PWD}/rocprof-sys-causal-config folder")
|
||||
.min_count(0)
|
||||
.max_count(1)
|
||||
.dtype("folder")
|
||||
@@ -526,7 +528,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
"Do not activate default features which are recommended for causal "
|
||||
"profiling. For example: PID-tagging of output files and "
|
||||
"timestamped subdirectories are disabled by default. Kokkos tools "
|
||||
"support is added by default (OMNITRACE_USE_KOKKOSP=ON) because, "
|
||||
"support is added by default (ROCPROFSYS_USE_KOKKOSP=ON) because, "
|
||||
"for Kokkos applications, the Kokkos-Tools callbacks are used for "
|
||||
"progress points. Activation of OpenMP tools support is similar")
|
||||
.min_count(0)
|
||||
@@ -547,7 +549,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.choices({ "function", "line" })
|
||||
.choice_alias("function", { "func" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_MODE", p.get<std::string>("mode"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_MODE", p.get<std::string>("mode"));
|
||||
});
|
||||
|
||||
parser.add_argument({ "-b", "--backend" }, "Causal profiling sampling backend.")
|
||||
@@ -555,7 +557,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.dtype("string")
|
||||
.choices({ "auto", "perf", "timer" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_BACKEND", p.get<std::string>("backend"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_BACKEND", p.get<std::string>("backend"));
|
||||
});
|
||||
|
||||
parser
|
||||
@@ -564,7 +566,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.min_count(1)
|
||||
.dtype("filename")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_FILE", p.get<std::string>("output-name"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_FILE", p.get<std::string>("output-name"));
|
||||
});
|
||||
|
||||
bool _reset = false;
|
||||
@@ -582,7 +584,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.max_count(1)
|
||||
.dtype("bool")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_END_TO_END", p.get<bool>("end-to-end"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_END_TO_END", p.get<bool>("end-to-end"));
|
||||
});
|
||||
|
||||
parser
|
||||
@@ -592,7 +594,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_DELAY", p.get<double>("wait"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_DELAY", p.get<double>("wait"));
|
||||
});
|
||||
|
||||
parser
|
||||
@@ -605,7 +607,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_CAUSAL_DURATION", p.get<double>("duration"));
|
||||
update_env(_env, "ROCPROFSYS_CAUSAL_DURATION", p.get<double>("duration"));
|
||||
});
|
||||
|
||||
int64_t _niterations = 1;
|
||||
@@ -750,7 +752,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
|
||||
parser.end_group();
|
||||
|
||||
#if OMNITRACE_HIP_VERSION > 0 && OMNITRACE_HIP_VERSION < 50300
|
||||
#if ROCPROFSYS_HIP_VERSION > 0 && ROCPROFSYS_HIP_VERSION < 50300
|
||||
update_env(_env, "HSA_ENABLE_INTERRUPT", 0);
|
||||
#endif
|
||||
|
||||
@@ -809,38 +811,38 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
|
||||
if(_add_defaults)
|
||||
{
|
||||
add_default_env(_env, "OMNITRACE_TIME_OUTPUT", false);
|
||||
add_default_env(_env, "OMNITRACE_USE_PID", false);
|
||||
add_default_env(_env, "OMNITRACE_USE_KOKKOSP", true);
|
||||
add_default_env(_env, "ROCPROFSYS_TIME_OUTPUT", false);
|
||||
add_default_env(_env, "ROCPROFSYS_USE_PID", false);
|
||||
add_default_env(_env, "ROCPROFSYS_USE_KOKKOSP", true);
|
||||
|
||||
#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0
|
||||
add_default_env(_env, "OMNITRACE_USE_OMPT", true);
|
||||
#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0
|
||||
add_default_env(_env, "ROCPROFSYS_USE_OMPT", true);
|
||||
#endif
|
||||
|
||||
#if(defined(OMNITRACE_USE_MPI) && OMNITRACE_USE_MPI > 0) || \
|
||||
(defined(OMNITRACE_USE_MPI_HEADERS) && OMNITRACE_USE_MPI_HEADERS > 0)
|
||||
add_default_env(_env, "OMNITRACE_USE_MPIP", true);
|
||||
#if(defined(ROCPROFSYS_USE_MPI) && ROCPROFSYS_USE_MPI > 0) || \
|
||||
(defined(ROCPROFSYS_USE_MPI_HEADERS) && ROCPROFSYS_USE_MPI_HEADERS > 0)
|
||||
add_default_env(_env, "ROCPROFSYS_USE_MPIP", true);
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
|
||||
add_default_env(_env, "OMNITRACE_ROCTRACER_HIP_API", true);
|
||||
add_default_env(_env, "OMNITRACE_ROCTRACER_HSA_API", true);
|
||||
#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(OMNITRACE_USE_RCCL) && OMNITRACE_USE_RCCL > 0
|
||||
add_default_env(_env, "OMNITRACE_USE_RCCLP", true);
|
||||
#if defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL > 0
|
||||
add_default_env(_env, "ROCPROFSYS_USE_RCCLP", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
_fill("OMNITRACE_CAUSAL_BINARY_EXCLUDE", _binary_excludes, _generate_configs);
|
||||
_fill("OMNITRACE_CAUSAL_SOURCE_EXCLUDE", _source_excludes, _generate_configs);
|
||||
_fill("OMNITRACE_CAUSAL_FUNCTION_EXCLUDE", _function_excludes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_BINARY_EXCLUDE", _binary_excludes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_SOURCE_EXCLUDE", _source_excludes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_FUNCTION_EXCLUDE", _function_excludes, _generate_configs);
|
||||
|
||||
_fill("OMNITRACE_CAUSAL_BINARY_SCOPE", _binary_scopes, _generate_configs);
|
||||
_fill("OMNITRACE_CAUSAL_SOURCE_SCOPE", _source_scopes, _generate_configs);
|
||||
_fill("OMNITRACE_CAUSAL_FUNCTION_SCOPE", _function_scopes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_BINARY_SCOPE", _binary_scopes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_SOURCE_SCOPE", _source_scopes, _generate_configs);
|
||||
_fill("ROCPROFSYS_CAUSAL_FUNCTION_SCOPE", _function_scopes, _generate_configs);
|
||||
|
||||
_fill("OMNITRACE_CAUSAL_FIXED_SPEEDUP", _virtual_speedups, false);
|
||||
_fill("ROCPROFSYS_CAUSAL_FIXED_SPEEDUP", _virtual_speedups, false);
|
||||
|
||||
// make sure at least one env exists
|
||||
if(_causal_envs_tmp.empty()) _causal_envs_tmp.emplace_back();
|
||||
@@ -857,10 +859,10 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
if(_generate_configs)
|
||||
{
|
||||
auto _is_omni_cfg = [](std::string_view itr) {
|
||||
return (itr.find("OMNITRACE") == 0 && itr.find("OMNITRACE_MODE") != 0 &&
|
||||
itr.find("OMNITRACE_DEBUG_") != 0 && itr.find('=') < itr.length());
|
||||
// omnitrace has miscellaneous env options starting with OMNITRACE_DEBUG_ that
|
||||
// are not official options
|
||||
return (itr.find("ROCPROFSYS") == 0 && itr.find("ROCPROFSYS_MODE") != 0 &&
|
||||
itr.find("ROCPROFSYS_DEBUG_") != 0 && itr.find('=') < itr.length());
|
||||
// rocprof-sys has miscellaneous env options starting with ROCPROFSYS_DEBUG_
|
||||
// that are not official options
|
||||
};
|
||||
|
||||
auto _omni_env_m = std::map<std::string, std::string>{};
|
||||
@@ -879,9 +881,9 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
_env.erase(std::remove_if(_env.begin(), _env.end(), _is_omni_cfg), _env.end());
|
||||
|
||||
auto _omni_env = std::vector<std::pair<std::string, std::string>>{};
|
||||
// make sure that OMNITRACE_CONFIG_FILE is the first entry
|
||||
// make sure that ROCPROFSYS_CONFIG_FILE is the first entry
|
||||
{
|
||||
auto citr = _omni_env_m.find("OMNITRACE_CONFIG_FILE");
|
||||
auto citr = _omni_env_m.find("ROCPROFSYS_CONFIG_FILE");
|
||||
if(citr != _omni_env_m.end())
|
||||
{
|
||||
_omni_env.emplace_back(citr->first, citr->second);
|
||||
@@ -903,12 +905,12 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
for(const auto& itr : _data)
|
||||
_width = std::max(_width, itr.first.length());
|
||||
|
||||
_os << "# omnitrace common settings\n";
|
||||
_os << "# rocprofsys common settings\n";
|
||||
for(const auto& itr : _omni_env)
|
||||
_os << std::setw(_width + 1) << std::left << itr.first << " = "
|
||||
<< itr.second << "\n";
|
||||
|
||||
_os << "\n# omnitrace causal settings\n";
|
||||
_os << "\n# rocprofsys causal settings\n";
|
||||
for(const auto& itr : _data)
|
||||
_os << std::setw(_width + 1) << std::left << itr.first << " = "
|
||||
<< itr.second << "\n";
|
||||
@@ -926,20 +928,20 @@ parse_args(int argc, char** argv, std::vector<char*>& _env,
|
||||
? fname.str()
|
||||
: join(array_config{ ":" }, _config_file, fname.str());
|
||||
auto _cfg =
|
||||
std::map<std::string_view, std::string>{ { "OMNITRACE_CONFIG_FILE",
|
||||
std::map<std::string_view, std::string>{ { "ROCPROFSYS_CONFIG_FILE",
|
||||
_cfg_name } };
|
||||
_causal_envs.emplace_back(_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if(_reset)
|
||||
_causal_envs.front().emplace(std::string_view{ "OMNITRACE_CAUSAL_FILE_RESET" },
|
||||
_causal_envs.front().emplace(std::string_view{ "ROCPROFSYS_CAUSAL_FILE_RESET" },
|
||||
std::string{ "true" });
|
||||
|
||||
return _outv;
|
||||
}
|
||||
|
||||
// explicit instantiation for usage in omnitrace-causal.cpp
|
||||
// explicit instantiation for usage in rocprof-sys-causal.cpp
|
||||
template void
|
||||
update_env(std::vector<char*>&, std::string_view, const std::string& _env_val,
|
||||
bool _append, std::string_view);
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-causal.hpp"
|
||||
#include "rocprof-sys-causal.hpp"
|
||||
|
||||
#include <timemory/log/macros.hpp>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TIMEMORY_PROJECT_NAME "omnitrace-causal"
|
||||
#define TIMEMORY_PROJECT_NAME "rocprof-sys-causal"
|
||||
|
||||
#include <csignal>
|
||||
#include <map>
|
||||
@@ -0,0 +1,25 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# TODO: [DFG] Remove this file after 'rocprofsys' rebranding is complete
|
||||
# rocprofiler-systems-exe target (deprecated 'omnitrace' executable, now 'rocprofiler-systems-instrument')
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(rocprofiler-systems-exe ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys.cpp)
|
||||
|
||||
target_link_libraries(rocprofiler-systems-exe
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-exe
|
||||
PROPERTIES OUTPUT_NAME rocprof-sys
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-exe)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-exe
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+12
-11
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -66,17 +66,17 @@ main(int argc, char** argv)
|
||||
gggggg
|
||||
|
||||
|
||||
OmniTrace has renamed the "omnitrace" executable to "omnitrace-instrument" to reduce confusion.
|
||||
ROCm Systems Profiler has renamed the "rocprof-sys" executable to "rocprof-sys-instrument".
|
||||
|
||||
This executable only exists to provide this deprecation warning and maintain backwards compatibility for a few releases.
|
||||
This executable will soon invoke "omnitrace-instrument" with the arguments you just provided after we've given you
|
||||
This executable will soon invoke "rocprof-sys-instrument" with the arguments you just provided after we've given you
|
||||
a chance to read this message.
|
||||
|
||||
If you are running this job interactively, please acknowledge that you've read this message and whether you want to continue.
|
||||
If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or OMNITRACE_CI is defined
|
||||
If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or ROCPROFSYS_CI is defined
|
||||
in the environment, in which case, we will throw an error.
|
||||
|
||||
Thanks for using OmniTrace and happy optimizing!
|
||||
Thanks for using ROCm Systems Profiler and happy optimizing!
|
||||
)warning";
|
||||
|
||||
auto _completed = std::promise<void>{};
|
||||
@@ -94,11 +94,12 @@ main(int argc, char** argv)
|
||||
auto _env_failure = [_emit_warning, argv](std::string_view _env_var) {
|
||||
// emit warning
|
||||
_emit_warning();
|
||||
std::cerr << "[" << argv[0] << "] Detected " << _env_var
|
||||
<< " environment variable. Exiting to prevent consuming CI resources. "
|
||||
"Use \"omnitrace-instrument\" executable instead of \"omnitrace\" "
|
||||
"to prevent this error."
|
||||
<< std::endl;
|
||||
std::cerr
|
||||
<< "[" << argv[0] << "] Detected " << _env_var
|
||||
<< " environment variable. Exiting to prevent consuming CI resources. "
|
||||
"Use \"rocprof-sys-instrument\" executable instead of \"rocprof-sys\" "
|
||||
"to prevent this error."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
};
|
||||
auto _wait_for_input = [&_completed, &_acknowledged, _emit_warning]() {
|
||||
@@ -116,7 +117,7 @@ main(int argc, char** argv)
|
||||
_completed.set_value();
|
||||
};
|
||||
|
||||
for(const auto* itr : { "CI", "OMNITRACE_CI" })
|
||||
for(const auto* itr : { "CI", "ROCPROFSYS_CI" })
|
||||
{
|
||||
if(_get_env(itr)) _env_failure(itr);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocprofiler-systems-instrument target (formerly rocprofiler-systems-exe target prior to 1.8.1)
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
|
||||
add_executable(rocprofiler-systems-instrument)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-instrument
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/info.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/log.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp)
|
||||
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-instrument
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-dyninst
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer
|
||||
timemory::timemory-headers
|
||||
timemory::timemory-extensions
|
||||
timemory::timemory-core)
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-instrument
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument)
|
||||
|
||||
if(ROCPROFSYS_BUILD_DYNINST)
|
||||
target_compile_definitions(rocprofiler-systems-instrument
|
||||
PRIVATE ROCPROFSYS_BUILD_DYNINST=1)
|
||||
endif()
|
||||
|
||||
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-instrument)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(DEBUG|Debug)")
|
||||
string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
target_compile_options(rocprofiler-systems-instrument PRIVATE ${_FLAGS})
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-instrument
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+18
-18
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "function_signature.hpp"
|
||||
#include "fwd.hpp"
|
||||
#include "log.hpp"
|
||||
#include "omnitrace-instrument.hpp"
|
||||
#include "rocprof-sys-instrument.hpp"
|
||||
|
||||
#include <timemory/components/rusage/components.hpp>
|
||||
#include <timemory/components/timing/wall_clock.hpp>
|
||||
@@ -216,7 +216,7 @@ get_func_file_line_info(module_t* module, procedure_t* func)
|
||||
{
|
||||
using address_t = Dyninst::Address;
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Getting function line info for", get_name(func));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Getting function line info for", get_name(func));
|
||||
|
||||
auto _file_name = get_name(module);
|
||||
auto _func_name = get_name(func);
|
||||
@@ -249,7 +249,7 @@ function_signature
|
||||
get_loop_file_line_info(module_t* module, procedure_t* func, flow_graph_t*,
|
||||
basic_loop_t* loopToInstrument)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Getting loop line info for", get_name(func));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Getting loop line info for", get_name(func));
|
||||
|
||||
auto basic_blocks = std::vector<BPatch_basicBlock*>{};
|
||||
loopToInstrument->getLoopBasicBlocksExclusive(basic_blocks);
|
||||
@@ -343,7 +343,7 @@ get_basic_block_file_line_info(module_t* module, procedure_t* func)
|
||||
std::map<basic_block_t*, basic_block_signature> _data{};
|
||||
if(!func) return _data;
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Getting basic block line info for", get_name(func));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Getting basic block line info for", get_name(func));
|
||||
|
||||
auto* _cfg = func->getCFG();
|
||||
auto _basic_blocks = std::set<BPatch_basicBlock*>{};
|
||||
@@ -421,7 +421,7 @@ get_basic_block_file_line_info(module_t* module, procedure_t* func)
|
||||
std::vector<statement_t>
|
||||
get_source_code(module_t* module, procedure_t* func)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Getting source code for", get_name(func));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Getting source code for", get_name(func));
|
||||
|
||||
std::vector<statement_t> _lines{};
|
||||
if(!module || !func) return _lines;
|
||||
@@ -523,15 +523,15 @@ is_text_file(const std::string& filename)
|
||||
// Get the realpath to this exe
|
||||
//
|
||||
std::string&
|
||||
omnitrace_get_exe_realpath()
|
||||
rocprofsys_get_exe_realpath()
|
||||
{
|
||||
static std::string _v = []() {
|
||||
auto _cmd_line = tim::read_command_line(tim::process::get_id());
|
||||
if(!_cmd_line.empty())
|
||||
{
|
||||
using array_config_t = timemory::join::array_config;
|
||||
OMNITRACE_ADD_DETAILED_LOG_ENTRY(array_config_t{ " ", "[ ", " ]" },
|
||||
"cmdline:: ", _cmd_line);
|
||||
ROCPROFSYS_ADD_DETAILED_LOG_ENTRY(array_config_t{ " ", "[ ", " ]" },
|
||||
"cmdline:: ", _cmd_line);
|
||||
return _cmd_line.front();
|
||||
// return tim::filepath::realpath(_cmd_line.front(), nullptr, false);
|
||||
}
|
||||
@@ -545,8 +545,8 @@ omnitrace_get_exe_realpath()
|
||||
// Error callback routine.
|
||||
//
|
||||
std::vector<std::string>
|
||||
omnitrace_get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
const std::string& _exclude_re, std::vector<int>&& _open_modes)
|
||||
rocprofsys_get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
const std::string& _exclude_re, std::vector<int>&& _open_modes)
|
||||
{
|
||||
if(_open_modes.empty()) _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) };
|
||||
|
||||
@@ -573,7 +573,7 @@ omnitrace_get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
{
|
||||
// only insert exe name if dlopened the exe and
|
||||
// empty name is first entry
|
||||
_chain.emplace_back(omnitrace_get_exe_realpath());
|
||||
_chain.emplace_back(rocprofsys_get_exe_realpath());
|
||||
}
|
||||
else if(!std::string_view{ _next->l_name }.empty())
|
||||
{
|
||||
@@ -615,7 +615,7 @@ omnitrace_get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
// Get the path of a loaded dynamic binary
|
||||
//
|
||||
std::optional<std::string>
|
||||
omnitrace_get_loaded_path(const char* _name, std::vector<int>&& _open_modes)
|
||||
rocprofsys_get_loaded_path(const char* _name, std::vector<int>&& _open_modes)
|
||||
{
|
||||
if(_open_modes.empty()) _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) };
|
||||
|
||||
@@ -647,7 +647,7 @@ omnitrace_get_loaded_path(const char* _name, std::vector<int>&& _open_modes)
|
||||
// Get the path of a loaded dynamic binary
|
||||
//
|
||||
std::optional<std::string>
|
||||
omnitrace_get_origin(const char* _name, std::vector<int>&& _open_modes)
|
||||
rocprofsys_get_origin(const char* _name, std::vector<int>&& _open_modes)
|
||||
{
|
||||
if(_open_modes.empty()) _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) };
|
||||
|
||||
@@ -695,8 +695,8 @@ error_func_real(error_level_t level, int num, const char* const* params)
|
||||
const char* msg = bpatch->getEnglishErrorString(num);
|
||||
bpatch->formatErrorString(line, sizeof(line), msg, params);
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Dyninst error function called with level", level,
|
||||
":: ID# =", num, "::", line)
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Dyninst error function called with level", level,
|
||||
":: ID# =", num, "::", line)
|
||||
.force(level < BPatchInfo);
|
||||
|
||||
if(num == 0)
|
||||
@@ -742,8 +742,8 @@ error_func_fake(error_level_t level, int num, const char* const* params)
|
||||
bpatch->formatErrorString(line, sizeof(line), msg, params);
|
||||
|
||||
// just log it
|
||||
OMNITRACE_ADD_LOG_ENTRY("Dyninst error function called with level", level,
|
||||
":: ID# =", num, "::", line)
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Dyninst error function called with level", level,
|
||||
":: ID# =", num, "::", line)
|
||||
.force(level < BPatchInfo);
|
||||
}
|
||||
|
||||
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
+9
-9
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -162,7 +162,7 @@ constexpr auto SV_END_V =
|
||||
std::max({ SV_UNKNOWN, SV_DEFAULT, SV_INTERNAL, SV_HIDDEN, SV_PROTECTED }) + 1;
|
||||
|
||||
void
|
||||
omnitrace_prefork_callback(thread_t* parent, thread_t* child);
|
||||
rocprofsys_prefork_callback(thread_t* parent, thread_t* child);
|
||||
|
||||
enum CodeCoverageMode
|
||||
{
|
||||
@@ -268,19 +268,19 @@ extern std::unique_ptr<std::ofstream> log_ofs;
|
||||
{ \
|
||||
char _logmsgbuff[FUNCNAMELEN]; \
|
||||
snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \
|
||||
OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
if(werror || LEVEL < 0) \
|
||||
{ \
|
||||
if(debug_print || verbose_level >= LEVEL) \
|
||||
fprintf(stderr, "[omnitrace][exe] Error! " __VA_ARGS__); \
|
||||
fprintf(stderr, "[rocprof-sys][exe] Error! " __VA_ARGS__); \
|
||||
char _buff[FUNCNAMELEN]; \
|
||||
sprintf(_buff, "[omnitrace][exe] Error! " __VA_ARGS__); \
|
||||
sprintf(_buff, "[rocprof-sys][exe] Error! " __VA_ARGS__); \
|
||||
throw std::runtime_error(std::string{ _buff }); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if(debug_print || verbose_level >= LEVEL) \
|
||||
fprintf(stderr, "[omnitrace][exe] Warning! " __VA_ARGS__); \
|
||||
fprintf(stderr, "[rocprof-sys][exe] Warning! " __VA_ARGS__); \
|
||||
} \
|
||||
fflush(stderr); \
|
||||
}
|
||||
@@ -290,9 +290,9 @@ extern std::unique_ptr<std::ofstream> log_ofs;
|
||||
{ \
|
||||
char _logmsgbuff[FUNCNAMELEN]; \
|
||||
snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \
|
||||
OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
if(debug_print || verbose_level >= LEVEL) \
|
||||
fprintf(stdout, "[omnitrace][exe] " __VA_ARGS__); \
|
||||
fprintf(stdout, "[rocprof-sys][exe] " __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ extern std::unique_ptr<std::ofstream> log_ofs;
|
||||
{ \
|
||||
char _logmsgbuff[FUNCNAMELEN]; \
|
||||
snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \
|
||||
OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \
|
||||
if(debug_print || verbose_level >= LEVEL) fprintf(stdout, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -70,7 +70,7 @@ dump_info(const string_t& _label, string_t _oname, const string_t& _ext,
|
||||
_msg << "[dump_info] Error opening '" << _oname << " for output";
|
||||
verbprintf(_level, "%s\n", _msg.str().c_str());
|
||||
if(_fail)
|
||||
throw std::runtime_error(std::string{ "[omnitrace][exe]" } + _msg.str());
|
||||
throw std::runtime_error(std::string{ "[rocprof-sys][exe]" } + _msg.str());
|
||||
};
|
||||
|
||||
if(!debug_print && verbose_level < _level) return;
|
||||
@@ -97,7 +97,7 @@ dump_info(const string_t& _label, string_t _oname, const string_t& _ext,
|
||||
output_policy::indent() = true;
|
||||
auto ar = output_policy::get(oss);
|
||||
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName(_label.c_str());
|
||||
ar->startNode();
|
||||
@@ -125,7 +125,7 @@ dump_info(const string_t& _label, string_t _oname, const string_t& _ext,
|
||||
using output_policy = policy::output_archive<cereal::PrettyJSONOutputArchive>;
|
||||
auto ar = output_policy::get(oss);
|
||||
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName(_label.c_str());
|
||||
ar->startNode();
|
||||
@@ -149,7 +149,7 @@ dump_info(const string_t& _label, string_t _oname, const string_t& _ext,
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(TIMEMORY_JOIN(
|
||||
"", "[omnitrace][exe] Error in ", __FUNCTION__, " :: filename '", _oname,
|
||||
"", "[rocprof-sys][exe] Error in ", __FUNCTION__, " :: filename '", _oname,
|
||||
"' does not have one of recognized file extensions: txt, json, xml"));
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ load_info(const string_t& _label, const string_t& _iname, fmodset_t& _data, int
|
||||
std::stringstream _msg{};
|
||||
_msg << "[load_info] Error opening '" << _iname << " for input";
|
||||
verbprintf(_level, "%s\n", _msg.str().c_str());
|
||||
throw std::runtime_error(std::string{ "[omnitrace][exe]" } + _msg.str());
|
||||
throw std::runtime_error(std::string{ "[rocprof-sys][exe]" } + _msg.str());
|
||||
};
|
||||
|
||||
if(_ext == "xml")
|
||||
@@ -190,7 +190,7 @@ load_info(const string_t& _label, const string_t& _iname, fmodset_t& _data, int
|
||||
using input_policy = policy::input_archive<cereal::XMLInputArchive>;
|
||||
auto ar = input_policy::get(ifs);
|
||||
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName(_label.c_str());
|
||||
ar->startNode();
|
||||
@@ -212,7 +212,7 @@ load_info(const string_t& _label, const string_t& _iname, fmodset_t& _data, int
|
||||
using input_policy = policy::input_archive<cereal::JSONInputArchive>;
|
||||
auto ar = input_policy::get(ifs);
|
||||
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName(_label.c_str());
|
||||
ar->startNode();
|
||||
@@ -226,7 +226,7 @@ load_info(const string_t& _label, const string_t& _iname, fmodset_t& _data, int
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(TIMEMORY_JOIN(
|
||||
"", "[omnitrace][exe] Error in ", __FUNCTION__, " :: filename '", _iname,
|
||||
"", "[rocprof-sys][exe] Error in ", __FUNCTION__, " :: filename '", _iname,
|
||||
"' does not have one of recognized extentions: txt, json, xml :: ", _ext));
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ load_info(const string_t& _inp, std::map<std::string, fmodset_t*>& _data, int _l
|
||||
std::stringstream _msg{};
|
||||
for(auto& itr : _exceptions)
|
||||
{
|
||||
_msg << "[omnitrace][exe] " << itr << "\n";
|
||||
_msg << "[rocprof-sys][exe] " << itr << "\n";
|
||||
}
|
||||
throw std::runtime_error(_msg.str());
|
||||
}
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -199,9 +199,9 @@ get_library_search_paths_impl()
|
||||
for(const auto& itr : delimit(get_env("LD_LIBRARY_PATH", std::string{}, false), ":"))
|
||||
_emplace_if_exists(itr);
|
||||
|
||||
for(const auto& itr : { get_env<std::string>("OMNITRACE_ROCM_PATH", ""),
|
||||
for(const auto& itr : { get_env<std::string>("ROCPROFSYS_ROCM_PATH", ""),
|
||||
get_env<std::string>("ROCM_PATH", ""),
|
||||
std::string{ OMNITRACE_DEFAULT_ROCM_PATH } })
|
||||
std::string{ ROCPROFSYS_DEFAULT_ROCM_PATH } })
|
||||
{
|
||||
if(!itr.empty())
|
||||
{
|
||||
@@ -311,7 +311,7 @@ get_internal_basic_libs_impl()
|
||||
"libbz2.so",
|
||||
"liblzma.so" };
|
||||
|
||||
// shared libraries used by omnitrace
|
||||
// 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",
|
||||
@@ -411,16 +411,16 @@ get_internal_libs_data_impl()
|
||||
auto _libs = std::vector<std::string>{};
|
||||
_libs.assign(_libs_v.begin(), _libs_v.end());
|
||||
|
||||
auto _omnitrace_base_path = filepath::dirname(
|
||||
auto _rocprofsys_base_path = filepath::dirname(
|
||||
filepath::dirname(filepath::realpath("/proc/self/exe", nullptr, false)));
|
||||
auto _omnitrace_lib_path = std::string{};
|
||||
auto _rocprofsys_lib_path = std::string{};
|
||||
|
||||
for(const auto* itr : { "lib", "lib64" })
|
||||
{
|
||||
for(const auto* litr :
|
||||
{ "libomnitrace-dl.so", "libomnitrace-user.so", "libomnitrace-rt.so" })
|
||||
{ "librocprof-sys-dl.so", "librocprof-sys-user.so", "librocprof-sys-rt.so" })
|
||||
{
|
||||
auto _libpath = join('/', _omnitrace_base_path, itr, litr);
|
||||
auto _libpath = join('/', _rocprofsys_base_path, itr, litr);
|
||||
if(filepath::exists(_libpath))
|
||||
{
|
||||
_libs.emplace_back(filepath::realpath(_libpath, nullptr, false));
|
||||
@@ -428,7 +428,7 @@ get_internal_libs_data_impl()
|
||||
}
|
||||
}
|
||||
|
||||
omnitrace::utility::filter_sort_unique(
|
||||
rocprofsys::utility::filter_sort_unique(
|
||||
_libs, [](const auto& itr) { return itr.empty() || !filepath::exists(itr); });
|
||||
|
||||
auto _data = library_module_map_t{};
|
||||
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
+3
-3
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -81,12 +81,12 @@ private:
|
||||
bool);
|
||||
};
|
||||
|
||||
#define OMNITRACE_ADD_LOG_ENTRY(...) \
|
||||
#define ROCPROFSYS_ADD_LOG_ENTRY(...) \
|
||||
log_entry::add_log_entry( \
|
||||
{ log_entry::source_location{ __FUNCTION__, __FILE__, __LINE__ }, \
|
||||
timemory::join::join(' ', __VA_ARGS__) })
|
||||
|
||||
#define OMNITRACE_ADD_DETAILED_LOG_ENTRY(DELIM, ...) \
|
||||
#define ROCPROFSYS_ADD_DETAILED_LOG_ENTRY(DELIM, ...) \
|
||||
log_entry::add_log_entry( \
|
||||
{ log_entry::source_location{ __FUNCTION__, __FILE__, __LINE__ }, \
|
||||
timemory::join::join(DELIM, __VA_ARGS__) })
|
||||
+34
-28
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "fwd.hpp"
|
||||
#include "internal_libs.hpp"
|
||||
#include "log.hpp"
|
||||
#include "omnitrace-instrument.hpp"
|
||||
#include "rocprof-sys-instrument.hpp"
|
||||
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
@@ -64,7 +64,8 @@ module_function::module_function(module_t* mod, procedure_t* proc)
|
||||
, module_name{ get_name(module) }
|
||||
, function_name{ get_name(function) }
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Adding function", function_name, "from module", module_name);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Adding function", function_name, "from module",
|
||||
module_name);
|
||||
|
||||
if(!function->isInstrumentable())
|
||||
{
|
||||
@@ -444,16 +445,19 @@ module_function::is_internal_constrained() const
|
||||
auto _module_base = _basename(module_name);
|
||||
auto _module_real = _realpath(module_name);
|
||||
|
||||
if(std::regex_search(module_name, std::regex{ "lib(omnitrace|timemory|perfetto)" }))
|
||||
return _report("Excluding", "module", "omnitrace", 3);
|
||||
if(std::regex_search(module_name,
|
||||
std::regex{ "lib(rocprof-sys|rocprofsys|timemory|perfetto)" }))
|
||||
return _report("Excluding", "module", "rocprofsys", 3);
|
||||
else if(std::regex_match(module_name,
|
||||
std::regex{ ".*/source/lib/"
|
||||
"(core|common|binary|omnitrace|omnitrace-dl|"
|
||||
"omnitrace-user)/.*/.*\\.(h|c|cpp|hpp)$" }))
|
||||
return _report("Excluding", "module", "omnitrace", 3);
|
||||
"(core|common|binary|"
|
||||
"rocprofsys|rocprofsys-dl|"
|
||||
"rocprofsys-user)/.*/.*\\.(h|c|cpp|hpp)$" }))
|
||||
return _report("Excluding", "module", "rocprofsys", 3);
|
||||
|
||||
if(std::regex_search(function_name, std::regex{ "9omnitrace|omnitrace(::|_)" }))
|
||||
return _report("Excluding", "function", "omnitrace", 3);
|
||||
if(std::regex_search(function_name,
|
||||
std::regex{ "10rocprofsys|rocprofsys|rocprofsys(::|_)" }))
|
||||
return _report("Excluding", "function", "rocprofsys", 3);
|
||||
else if(std::regex_search(function_name, std::regex{ "3tim|tim::|timemory(::|_)" }))
|
||||
return _report("Excluding", "function", "timemory", 3);
|
||||
else if(std::regex_search(function_name, std::regex{ "9perfetto|perfetto(::|_)" }))
|
||||
@@ -507,7 +511,8 @@ module_function::is_module_constrained() const
|
||||
static std::regex sys_build_regex{ "^(\\.\\./sysdeps/|/build/)", regex_opts };
|
||||
static std::regex dyninst_regex{ "(dyninst|DYNINST|(^|/)RT[[:graph:]]+\\.c$)",
|
||||
regex_opts };
|
||||
static std::regex dependlib_regex{ "^(lib|)(omnitrace|pthread|caliper|gotcha|papi|"
|
||||
static std::regex dependlib_regex{ "^(lib|)(rocprof-sys|rocprofsys|"
|
||||
"pthread|caliper|gotcha|papi|"
|
||||
"cupti|TAU|likwid|pfm|nvperf|unwind)",
|
||||
regex_opts };
|
||||
static std::regex core_cmod_regex{
|
||||
@@ -529,12 +534,12 @@ module_function::is_module_constrained() const
|
||||
if(std::regex_search(module_name, dyninst_regex))
|
||||
return _report("Excluding", "dyninst module", 3);
|
||||
|
||||
// modules used by omnitrace and dependent libraries
|
||||
// modules used by rocprof-sys and dependent libraries
|
||||
if(std::regex_search(module_name, core_lib_regex) ||
|
||||
std::regex_search(module_name, core_cmod_regex))
|
||||
return _report("Excluding", "core module", 3);
|
||||
|
||||
// modules used by omnitrace and dependent libraries
|
||||
// modules used by rocprof-sys and dependent libraries
|
||||
if(std::regex_search(module_name, dependlib_regex))
|
||||
return _report("Excluding", "dependency module", 3);
|
||||
|
||||
@@ -556,9 +561,9 @@ module_function::is_routine_constrained() const
|
||||
};
|
||||
|
||||
auto npos = std::string::npos;
|
||||
if(function_name.find("omnitrace") != npos)
|
||||
if(function_name.find("rocprofsys") != npos)
|
||||
{
|
||||
return _report("Skipping", "omnitrace-function", 1);
|
||||
return _report("Skipping", "rocprofsys-function", 1);
|
||||
}
|
||||
|
||||
if(function_name.find("FunctionInfo") != npos ||
|
||||
@@ -567,8 +572,9 @@ module_function::is_routine_constrained() const
|
||||
return _report("Skipping", "function-constraint", 2);
|
||||
}
|
||||
|
||||
static std::regex exclude(
|
||||
"(omnitrace|tim::|MPI_Init|MPI_Finalize|dyninst|DYNINST|tm_clones)", regex_opts);
|
||||
static std::regex exclude("(rocprofsys|rocprof-sys|tim::|MPI_Init|MPI_"
|
||||
"Finalize|dyninst|DYNINST|tm_clones)",
|
||||
regex_opts);
|
||||
// static std::regex exclude_printf("(|v|f)printf$", regex_opts);
|
||||
static std::regex exclude_cxx(
|
||||
"(std::_Sp_counted_base|std::(use|has)_facet|std::locale|::sentry|^std::_|::_(M|"
|
||||
@@ -866,8 +872,8 @@ module_function::operator()(address_space_t* _addr_space, procedure_t* _entr_tra
|
||||
if(!function || !module) return _count;
|
||||
|
||||
auto _name = signature.get();
|
||||
auto _trace_entr = omnitrace_call_expr(_name.c_str());
|
||||
auto _trace_exit = omnitrace_call_expr(_name.c_str());
|
||||
auto _trace_entr = rocprofsys_call_expr(_name.c_str());
|
||||
auto _trace_exit = rocprofsys_call_expr(_name.c_str());
|
||||
auto _entr = _trace_entr.get(_entr_trace);
|
||||
auto _exit = _trace_exit.get(_exit_trace);
|
||||
|
||||
@@ -917,8 +923,8 @@ module_function::operator()(address_space_t* _addr_space, procedure_t* _entr_tra
|
||||
"loop-exit-point-trap-instrumentation", _lname))
|
||||
continue;
|
||||
|
||||
auto _ltrace_entr = omnitrace_call_expr(_lname.c_str());
|
||||
auto _ltrace_exit = omnitrace_call_expr(_lname.c_str());
|
||||
auto _ltrace_entr = rocprofsys_call_expr(_lname.c_str());
|
||||
auto _ltrace_exit = rocprofsys_call_expr(_lname.c_str());
|
||||
auto _lentr = _ltrace_entr.get(_entr_trace);
|
||||
auto _lexit = _ltrace_exit.get(_exit_trace);
|
||||
|
||||
@@ -946,8 +952,8 @@ module_function::register_source(address_space_t* _addr_space, procedure_t* _ent
|
||||
{
|
||||
auto _name = signature.get_coverage(false);
|
||||
auto _trace_entr =
|
||||
omnitrace_call_expr(signature.m_file, signature.m_name,
|
||||
signature.m_row.first, start_address, _name);
|
||||
rocprofsys_call_expr(signature.m_file, signature.m_name,
|
||||
signature.m_row.first, start_address, _name);
|
||||
auto _entr = _trace_entr.get(_entr_trace);
|
||||
|
||||
if(insert_instr(_addr_space, _entr_points, _entr, BPatch_entry))
|
||||
@@ -965,8 +971,8 @@ module_function::register_source(address_space_t* _addr_space, procedure_t* _ent
|
||||
auto& _signature = itr.second.signature;
|
||||
auto _name = _signature.get_coverage(true);
|
||||
auto _trace_entr =
|
||||
omnitrace_call_expr(_signature.m_file, _signature.m_name,
|
||||
_signature.m_row.first, _start_addr, _name);
|
||||
rocprofsys_call_expr(_signature.m_file, _signature.m_name,
|
||||
_signature.m_row.first, _start_addr, _name);
|
||||
auto _entr = _trace_entr.get(_entr_trace);
|
||||
|
||||
if(insert_instr(_addr_space, _entr_points, _entr, BPatch_entry))
|
||||
@@ -991,7 +997,7 @@ module_function::register_coverage(address_space_t* _addr_space,
|
||||
case CODECOV_FUNCTION:
|
||||
{
|
||||
auto _trace_entr =
|
||||
omnitrace_call_expr(signature.m_file, signature.m_name, start_address);
|
||||
rocprofsys_call_expr(signature.m_file, signature.m_name, start_address);
|
||||
auto _entr = _trace_entr.get(_entr_trace);
|
||||
|
||||
if(insert_instr(_addr_space, function, _entr, BPatch_entry))
|
||||
@@ -1008,8 +1014,8 @@ module_function::register_coverage(address_space_t* _addr_space,
|
||||
{
|
||||
auto _start_addr = itr.second.start_address;
|
||||
auto& _signature = itr.second.signature;
|
||||
auto _trace_entr = omnitrace_call_expr(_signature.m_file,
|
||||
_signature.m_name, _start_addr);
|
||||
auto _trace_entr = rocprofsys_call_expr(_signature.m_file,
|
||||
_signature.m_name, _start_addr);
|
||||
auto _entr = _trace_entr.get(_entr_trace);
|
||||
|
||||
if(insert_instr(_addr_space, _entr, BPatch_entry, itr.first))
|
||||
Ficheiro renomeado sem modificações.
+154
-141
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-instrument.hpp"
|
||||
#include "rocprof-sys-instrument.hpp"
|
||||
#include "common/defines.h"
|
||||
#include "common/join.hpp"
|
||||
#include "dl/dl.hpp"
|
||||
@@ -65,12 +65,12 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if !defined(OMNITRACE_USE_MPI)
|
||||
# define OMNITRACE_USE_MPI 0
|
||||
#if !defined(ROCPROFSYS_USE_MPI)
|
||||
# define ROCPROFSYS_USE_MPI 0
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_MPI_HEADERS)
|
||||
# define OMNITRACE_USE_MPI_HEADERS 0
|
||||
#if !defined(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
# define ROCPROFSYS_USE_MPI_HEADERS 0
|
||||
#endif
|
||||
|
||||
namespace
|
||||
@@ -79,7 +79,7 @@ auto
|
||||
get_default_min_instructions()
|
||||
{
|
||||
// default to 1024
|
||||
return tim::get_env<size_t>("OMNITRACE_DEFAULT_MIN_INSTRUCTIONS", (1 << 10), false);
|
||||
return tim::get_env<size_t>("ROCPROFSYS_DEFAULT_MIN_INSTRUCTIONS", (1 << 10), false);
|
||||
}
|
||||
auto
|
||||
get_default_min_address_range()
|
||||
@@ -89,7 +89,7 @@ get_default_min_address_range()
|
||||
}
|
||||
} // namespace
|
||||
|
||||
using InstrumentMode = ::omnitrace::dl::InstrumentMode;
|
||||
using InstrumentMode = ::rocprofsys::dl::InstrumentMode;
|
||||
|
||||
bool use_return_info = false;
|
||||
bool use_args_info = false;
|
||||
@@ -111,9 +111,9 @@ bool instr_print = false;
|
||||
bool simulate = false;
|
||||
bool include_uninstr = false;
|
||||
bool include_internal_linked_libs = false;
|
||||
int verbose_level = tim::get_env<int>("OMNITRACE_VERBOSE_INSTRUMENT", 0);
|
||||
int verbose_level = tim::get_env<int>("ROCPROFSYS_VERBOSE_INSTRUMENT", 0);
|
||||
int num_log_entries = tim::get_env<int>(
|
||||
"OMNITRACE_LOG_COUNT", tim::get_env<bool>("OMNITRACE_CI", false) ? 20 : 50);
|
||||
"ROCPROFSYS_LOG_COUNT", tim::get_env<bool>("ROCPROFSYS_CI", false) ? 20 : 50);
|
||||
string_t main_fname = "main";
|
||||
string_t argv0 = {};
|
||||
string_t cmdv0 = {};
|
||||
@@ -195,7 +195,7 @@ get_internal_libpath()
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = std::string{ "./" };
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return omnitrace::common::join("/", _dir, "..", "lib");
|
||||
return rocprofsys::common::join("/", _dir, "..", "lib");
|
||||
}
|
||||
|
||||
strvec_t lib_search_paths = tim::delimit(
|
||||
@@ -206,7 +206,7 @@ strvec_t lib_search_paths = tim::delimit(
|
||||
strvec_t bin_search_paths = tim::delimit(tim::get_env<std::string>("PATH"), ":");
|
||||
|
||||
auto _dyn_api_rt_paths = tim::delimit(
|
||||
JOIN(":", get_internal_libpath(), JOIN("/", get_internal_libpath(), "omnitrace")),
|
||||
JOIN(":", get_internal_libpath(), JOIN("/", get_internal_libpath(), "rocprofsys")),
|
||||
":");
|
||||
|
||||
std::string
|
||||
@@ -250,7 +250,7 @@ activate_signal_handlers(const std::vector<sys_signal>& _signals)
|
||||
if(_protect) return;
|
||||
_protect = true;
|
||||
TIMEMORY_PRINTF_FATAL(
|
||||
stderr, "omnitrace exited with signal %i :: %s\n", nsig,
|
||||
stderr, "rocprof-sys exited with signal %i :: %s\n", nsig,
|
||||
signal_settings::str(static_cast<sys_signal>(nsig)).c_str());
|
||||
|
||||
// print any forced entries
|
||||
@@ -258,7 +258,7 @@ activate_signal_handlers(const std::vector<sys_signal>& _signals)
|
||||
std::cerr, -1, [](const auto& _v) { return _v.forced(); },
|
||||
[]() {
|
||||
tim::log::stream(std::cerr, tim::log::color::info())
|
||||
<< "\n[omnitrace][exe] Potentially important log entries:\n\n";
|
||||
<< "\n[rocprof-sys][exe] Potentially important log entries:\n\n";
|
||||
});
|
||||
|
||||
// print the last log entries
|
||||
@@ -267,8 +267,8 @@ activate_signal_handlers(const std::vector<sys_signal>& _signals)
|
||||
TIMEMORY_PRINTF_FATAL(stderr, "\n");
|
||||
TIMEMORY_PRINTF_FATAL(
|
||||
stderr,
|
||||
"These were the last %i log entries from omnitrace. You can control the "
|
||||
"number of log entries via the '--log <N>' option or OMNITRACE_LOG_COUNT "
|
||||
"These were the last %i log entries from rocprof-sys. You can control the "
|
||||
"number of log entries via the '--log <N>' option or ROCPROFSYS_LOG_COUNT "
|
||||
"env variable.\n",
|
||||
num_log_entries);
|
||||
|
||||
@@ -311,40 +311,51 @@ main(int argc, char** argv)
|
||||
argv0 = argv[0];
|
||||
|
||||
auto _omni_root = tim::get_env<std::string>(
|
||||
"omnitrace_ROOT", tim::get_env<std::string>("OMNITRACE_ROOT", ""));
|
||||
"rocprofiler_systems_ROOT", tim::get_env<std::string>("ROCPROFSYS_ROOT", ""));
|
||||
if(!_omni_root.empty() && exists(_omni_root))
|
||||
{
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_root, "bin"));
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace"));
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "bin"));
|
||||
bin_search_paths.emplace_back(
|
||||
JOIN('/', _omni_root, "lib", "rocprofiler-systems"));
|
||||
bin_search_paths.emplace_back(
|
||||
JOIN('/', _omni_root, "lib", "rocprofiler-systems", "bin"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "lib"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "lib64"));
|
||||
OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace root path: ", _omni_root);
|
||||
lib_search_paths.emplace_back(
|
||||
JOIN('/', _omni_root, "lib", "rocprofiler-systems"));
|
||||
lib_search_paths.emplace_back(
|
||||
JOIN('/', _omni_root, "lib", "rocprofiler-systems", "lib"));
|
||||
lib_search_paths.emplace_back(
|
||||
JOIN('/', _omni_root, "lib", "rocprofiler-systems", "lib64"));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(argv[0],
|
||||
"::", "rocprofiler-systems root path: ", _omni_root);
|
||||
}
|
||||
|
||||
auto _omni_exe_path = get_realpath(get_absolute_exe_filepath(argv[0]));
|
||||
if(!exists(_omni_exe_path))
|
||||
_omni_exe_path =
|
||||
get_realpath(get_absolute_exe_filepath(omnitrace_get_exe_realpath()));
|
||||
get_realpath(get_absolute_exe_filepath(rocprofsys_get_exe_realpath()));
|
||||
bin_search_paths.emplace_back(filepath::dirname(_omni_exe_path));
|
||||
|
||||
auto _omni_lib_path =
|
||||
JOIN('/', filepath::dirname(filepath::dirname(_omni_exe_path)), "lib");
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace"));
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "bin"));
|
||||
bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofiler-systems"));
|
||||
bin_search_paths.emplace_back(
|
||||
JOIN('/', _omni_lib_path, "rocprofiler-systems", "bin"));
|
||||
lib_search_paths.emplace_back(_omni_lib_path);
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "lib"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "lib64"));
|
||||
lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofiler-systems"));
|
||||
lib_search_paths.emplace_back(
|
||||
JOIN('/', _omni_lib_path, "rocprofiler-systems", "lib"));
|
||||
lib_search_paths.emplace_back(
|
||||
JOIN('/', _omni_lib_path, "rocprofiler-systems", "lib64"));
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace bin path: ", _omni_exe_path);
|
||||
OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace lib path: ", _omni_lib_path);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys bin path: ", _omni_exe_path);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys lib path: ", _omni_lib_path);
|
||||
|
||||
for(const auto& itr : omnitrace_get_link_map(nullptr))
|
||||
for(const auto& itr : rocprofsys_get_link_map(nullptr))
|
||||
{
|
||||
if(itr.find("omnitrace") != std::string::npos ||
|
||||
if(itr.find("rocprofsys") != std::string::npos ||
|
||||
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|"
|
||||
@@ -364,19 +375,19 @@ main(int argc, char** argv)
|
||||
|
||||
for(const auto& itr : bin_search_paths)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("bin search path:", itr);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("bin search path:", itr);
|
||||
}
|
||||
|
||||
for(const auto& itr : lib_search_paths)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("lib search path:", itr);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("lib search path:", itr);
|
||||
}
|
||||
|
||||
address_space_t* addr_space = nullptr;
|
||||
string_t mutname = {};
|
||||
string_t outfile = {};
|
||||
string_t logfile = {};
|
||||
std::vector<string_t> inputlib = { "libomnitrace-dl" };
|
||||
std::vector<string_t> inputlib = { "librocprof-sys-dl" };
|
||||
std::vector<string_t> libname = {};
|
||||
std::vector<string_t> sharedlibname = {};
|
||||
std::vector<string_t> staticlibname = {};
|
||||
@@ -452,9 +463,9 @@ main(int argc, char** argv)
|
||||
|
||||
if(verbose_level > 1)
|
||||
{
|
||||
std::cout << "[omnitrace][exe][original]: " << cmd_string(argc, argv)
|
||||
std::cout << "[rocprof-sys][exe][original]: " << cmd_string(argc, argv)
|
||||
<< std::endl;
|
||||
std::cout << "[omnitrace][exe][cfg-args]: " << cmd_string(_argc, _argv)
|
||||
std::cout << "[rocprof-sys][exe][cfg-args]: " << cmd_string(_argc, _argv)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@@ -465,11 +476,11 @@ main(int argc, char** argv)
|
||||
// it is unrecognized, then set the errflag to report an error. When we come to a
|
||||
// non '-' charcter, then we must be at the application name.
|
||||
using parser_t = tim::argparse::argument_parser;
|
||||
parser_t parser("omnitrace-instrument");
|
||||
parser_t parser("rocprof-sys-instrument");
|
||||
string_t extra_help = "-- <CMD> <ARGS>";
|
||||
|
||||
parser.enable_help();
|
||||
parser.enable_version("omnitrace-instrument", OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
parser.enable_version("rocprof-sys-instrument", ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
|
||||
parser.add_argument({ "" }, "");
|
||||
parser.add_argument({ "[DEBUG OPTIONS]" }, "");
|
||||
@@ -597,9 +608,9 @@ main(int argc, char** argv)
|
||||
parser
|
||||
.add_argument({ "-o", "--output" },
|
||||
"Enable generation of a new executable (binary-rewrite). If a "
|
||||
"filename is not provided, omnitrace will use the basename and "
|
||||
"filename is not provided, rocprof-sys will use the basename and "
|
||||
"output to the cwd, unless the target binary is in the cwd. In the "
|
||||
"latter case, omnitrace will either use ${PWD}/<basename>.inst "
|
||||
"latter case, rocprof-sys will either use ${PWD}/<basename>.inst "
|
||||
"(non-libraries) or ${PWD}/instrumented/<basename> (libraries)")
|
||||
.min_count(0)
|
||||
.max_count(1)
|
||||
@@ -755,11 +766,11 @@ main(int argc, char** argv)
|
||||
"that match the provided regular-expressions");
|
||||
parser.add_argument({ "--internal-function-include" },
|
||||
"Regex(es) for including functions which are (likely) utilized "
|
||||
"by omnitrace itself. Use this option with care.");
|
||||
"by rocprof-sys itself. Use this option with care.");
|
||||
parser.add_argument(
|
||||
{ "--internal-module-include" },
|
||||
"Regex(es) for including modules/libraries which are (likely) utilized "
|
||||
"by omnitrace itself. Use this option with care.");
|
||||
"by rocprof-sys itself. Use this option with care.");
|
||||
parser.add_argument(
|
||||
{ "--instruction-exclude" },
|
||||
"Regex(es) for excluding functions containing certain instructions");
|
||||
@@ -782,8 +793,8 @@ main(int argc, char** argv)
|
||||
|
||||
parser
|
||||
.add_argument({ "--internal-library-append" },
|
||||
"Append to the list of libraries which omnitrace treats as being "
|
||||
"used internally, e.g. OmniTrace will find all the symbols in "
|
||||
"Append to the list of libraries which rocprof-sys treats as being "
|
||||
"used internally, e.g. rocprof-sys will find all the symbols in "
|
||||
"this library and prevent them from being instrumented.")
|
||||
.action([](parser_t& p) {
|
||||
for(const auto& itr : p.get<strvec_t>("internal-library-append"))
|
||||
@@ -793,7 +804,7 @@ main(int argc, char** argv)
|
||||
parser
|
||||
.add_argument({ "--internal-library-remove" },
|
||||
"Remove the specified libraries from being treated as being "
|
||||
"used internally, e.g. OmniTrace will permit all the symbols in "
|
||||
"used internally, e.g. rocprof-sys will permit all the symbols in "
|
||||
"these libraries to be eligible for instrumentation.")
|
||||
.choices(_internal_libs)
|
||||
.action([](parser_t& p) {
|
||||
@@ -885,19 +896,19 @@ main(int argc, char** argv)
|
||||
"defaults in the executable");
|
||||
parser.add_argument({ "--env" },
|
||||
"Environment variables to add to the runtime in form "
|
||||
"VARIABLE=VALUE. E.g. use '--env OMNITRACE_PROFILE=ON' to "
|
||||
"VARIABLE=VALUE. E.g. use '--env ROCPROFSYS_PROFILE=ON' to "
|
||||
"default to using timemory instead of perfetto");
|
||||
parser
|
||||
.add_argument({ "--mpi" },
|
||||
"Enable MPI support (requires omnitrace built w/ full or partial "
|
||||
"Enable MPI support (requires rocprof-sys built w/ full or partial "
|
||||
"MPI support). NOTE: this will automatically be activated if "
|
||||
"MPI_Init, MPI_Init_thread, MPI_Finalize, MPI_Comm_rank, or "
|
||||
"MPI_Comm_size are found in the symbol table of target")
|
||||
.max_count(1)
|
||||
.action([](parser_t& p) {
|
||||
use_mpi = p.get<bool>("mpi");
|
||||
#if OMNITRACE_USE_MPI == 0 && OMNITRACE_USE_MPI_HEADERS == 0
|
||||
errprintf(0, "omnitrace was not built with full or partial MPI support\n");
|
||||
#if ROCPROFSYS_USE_MPI == 0 && ROCPROFSYS_USE_MPI_HEADERS == 0
|
||||
errprintf(0, "rocprof-sys was not built with full or partial MPI support\n");
|
||||
use_mpi = false;
|
||||
#endif
|
||||
});
|
||||
@@ -1004,8 +1015,10 @@ main(int argc, char** argv)
|
||||
parser
|
||||
.add_argument(
|
||||
{ "--parse-all-modules" },
|
||||
"By default, omnitrace simply requests Dyninst to provide all the procedures "
|
||||
"in the application image. If this option is enabled, omnitrace will iterate "
|
||||
"By default, rocprof-sys simply requests Dyninst to provide all the "
|
||||
"procedures "
|
||||
"in the application image. If this option is enabled, rocprof-sys will "
|
||||
"iterate "
|
||||
"over all the modules and extract the functions. Theoretically, it should be "
|
||||
"the same but the data is slightly different, possibly due to weak binding "
|
||||
"scopes. In general, enabling option will probably have no visible effect")
|
||||
@@ -1064,12 +1077,12 @@ main(int argc, char** argv)
|
||||
|
||||
if(parser.exists("config"))
|
||||
{
|
||||
struct omnitrace_env_config_s
|
||||
struct rocprofsys_env_config_s
|
||||
{};
|
||||
auto _configs = parser.get<strvec_t>("config");
|
||||
for(auto&& itr : _configs)
|
||||
{
|
||||
auto _settings = tim::settings::push<omnitrace_env_config_s>();
|
||||
auto _settings = tim::settings::push<rocprofsys_env_config_s>();
|
||||
for(auto&& iitr : *_settings)
|
||||
{
|
||||
if(iitr.second->get_updated()) iitr.second->set_user_updated();
|
||||
@@ -1092,7 +1105,7 @@ main(int argc, char** argv)
|
||||
verbprintf(1, "Exporting unknown config value :: %s\n",
|
||||
env_config_variables.back().c_str());
|
||||
}
|
||||
tim::settings::pop<omnitrace_env_config_s>();
|
||||
tim::settings::pop<rocprofsys_env_config_s>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,12 +1159,12 @@ main(int argc, char** argv)
|
||||
!parser.exists("min-instructions") &&
|
||||
!parser.exists("min-address-range-loop"));
|
||||
|
||||
auto _omnitrace_exe_path = tim::dirname(::get_realpath("/proc/self/exe"));
|
||||
verbprintf(4, "omnitrace exe path: %s\n", _omnitrace_exe_path.c_str());
|
||||
auto _rocprofsys_exe_path = tim::dirname(::get_realpath("/proc/self/exe"));
|
||||
verbprintf(4, "rocprof-sys exe path: %s\n", _rocprofsys_exe_path.c_str());
|
||||
|
||||
if(_cmdv && _cmdv[0] && strlen(_cmdv[0]) > 0)
|
||||
{
|
||||
auto _is_executable = omnitrace_get_is_executable(_cmdv[0], binary_rewrite);
|
||||
auto _is_executable = rocprofsys_get_is_executable(_cmdv[0], binary_rewrite);
|
||||
std::string _cmdv_base = ::basename(_cmdv[0]);
|
||||
auto _has_lib_suffix = _cmdv_base.length() > 3 &&
|
||||
(_cmdv_base.find(".so.") != std::string::npos ||
|
||||
@@ -1163,10 +1176,10 @@ main(int argc, char** argv)
|
||||
{
|
||||
fflush(stdout);
|
||||
std::stringstream _separator{};
|
||||
// 18 is approximate length of '[omnitrace][exe] '
|
||||
// 20 is approximate length of '[rocprof-sys][exe] '
|
||||
// 32 is approximate length of 'Warning! "" is not executable!'
|
||||
size_t _width =
|
||||
std::min<size_t>(std::get<0>(tim::utility::console::get_columns()) - 18,
|
||||
std::min<size_t>(std::get<0>(tim::utility::console::get_columns()) - 20,
|
||||
strlen(_cmdv[0]) + 32);
|
||||
_separator.fill('=');
|
||||
_separator << "#" << std::setw(_width - 2) << ""
|
||||
@@ -1225,12 +1238,12 @@ main(int argc, char** argv)
|
||||
{
|
||||
auto* _save = _cmdv[0];
|
||||
_cmdv[0] = const_cast<char*>(outfile.c_str());
|
||||
tim::timemory_init(_cmdc, _cmdv, "omnitrace-");
|
||||
tim::timemory_init(_cmdc, _cmdv, "rocprofsys-");
|
||||
_cmdv[0] = _save;
|
||||
}
|
||||
else
|
||||
{
|
||||
tim::timemory_init(_cmdc, _cmdv, "omnitrace-");
|
||||
tim::timemory_init(_cmdc, _cmdv, "rocprofsys-");
|
||||
}
|
||||
|
||||
if(!logfile.empty())
|
||||
@@ -1253,32 +1266,32 @@ main(int argc, char** argv)
|
||||
{
|
||||
// Helper function for adding regex expressions
|
||||
auto add_regex = [](auto& regex_array, const string_t& regex_expr) {
|
||||
OMNITRACE_ADD_DETAILED_LOG_ENTRY("", "Adding regular expression \"",
|
||||
regex_expr, "\" to regex_array@",
|
||||
®ex_array);
|
||||
ROCPROFSYS_ADD_DETAILED_LOG_ENTRY("", "Adding regular expression \"",
|
||||
regex_expr, "\" to regex_array@",
|
||||
®ex_array);
|
||||
if(!regex_expr.empty())
|
||||
regex_array.emplace_back(std::regex(regex_expr, regex_opts));
|
||||
};
|
||||
|
||||
add_regex(func_include, tim::get_env<string_t>("OMNITRACE_REGEX_INCLUDE", ""));
|
||||
add_regex(func_exclude, tim::get_env<string_t>("OMNITRACE_REGEX_EXCLUDE", ""));
|
||||
add_regex(func_restrict, tim::get_env<string_t>("OMNITRACE_REGEX_RESTRICT", ""));
|
||||
add_regex(func_include, tim::get_env<string_t>("ROCPROFSYS_REGEX_INCLUDE", ""));
|
||||
add_regex(func_exclude, tim::get_env<string_t>("ROCPROFSYS_REGEX_EXCLUDE", ""));
|
||||
add_regex(func_restrict, tim::get_env<string_t>("ROCPROFSYS_REGEX_RESTRICT", ""));
|
||||
add_regex(caller_include,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_CALLER_INCLUDE"));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_CALLER_INCLUDE"));
|
||||
add_regex(func_internal_include,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_INTERNAL_INCLUDE", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_INTERNAL_INCLUDE", ""));
|
||||
|
||||
add_regex(file_include,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_MODULE_INCLUDE", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_MODULE_INCLUDE", ""));
|
||||
add_regex(file_exclude,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_MODULE_EXCLUDE", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_MODULE_EXCLUDE", ""));
|
||||
add_regex(file_restrict,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_MODULE_RESTRICT", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_MODULE_RESTRICT", ""));
|
||||
add_regex(file_internal_include,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_MODULE_INTERNAL_INCLUDE", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_MODULE_INTERNAL_INCLUDE", ""));
|
||||
|
||||
add_regex(instruction_exclude,
|
||||
tim::get_env<string_t>("OMNITRACE_REGEX_INSTRUCTION_EXCLUDE", ""));
|
||||
tim::get_env<string_t>("ROCPROFSYS_REGEX_INSTRUCTION_EXCLUDE", ""));
|
||||
|
||||
// Helper function for parsing the regex options
|
||||
auto _parse_regex_option = [&parser, &add_regex](const string_t& _option,
|
||||
@@ -1362,8 +1375,8 @@ main(int argc, char** argv)
|
||||
{
|
||||
parser.print_help(extra_help);
|
||||
fprintf(stderr, "\nError! No command for dynamic instrumentation. Use "
|
||||
"\n\tomnitrace <OPTIONS> -- <COMMAND> <ARGS>\nE.g. "
|
||||
"\n\tomnitrace -o foo.inst -- ./foo\nwill output an "
|
||||
"\n\trocprof-sys-instrument <OPTIONS> -- <COMMAND> <ARGS>\nE.g. "
|
||||
"\n\trocprof-sys-instrument -o foo.inst -- ./foo\nwill output an "
|
||||
"instrumented version of 'foo' executable to 'foo.inst'\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -1403,16 +1416,16 @@ main(int argc, char** argv)
|
||||
env_vars.reserve(env_vars.size() + env_config_variables.size());
|
||||
for(auto&& itr : env_config_variables)
|
||||
env_vars.emplace_back(itr);
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_MODE", instr_mode));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_MODE", instr_mode));
|
||||
env_vars.emplace_back(
|
||||
TIMEMORY_JOIN('=', "OMNITRACE_INSTRUMENT_MODE", instr_mode_v_int));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_MPI_INIT", "OFF"));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_MPI_FINALIZE", "OFF"));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_USE_CODE_COVERAGE",
|
||||
TIMEMORY_JOIN('=', "ROCPROFSYS_INSTRUMENT_MODE", instr_mode_v_int));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_MPI_INIT", "OFF"));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_MPI_FINALIZE", "OFF"));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_USE_CODE_COVERAGE",
|
||||
(coverage_mode != CODECOV_NONE) ? "ON" : "OFF"));
|
||||
|
||||
addr_space = omnitrace_get_address_space(bpatch, _cmdc, _cmdv, env_vars,
|
||||
binary_rewrite, _pid, mutname);
|
||||
addr_space = rocprofsys_get_address_space(bpatch, _cmdc, _cmdv, env_vars,
|
||||
binary_rewrite, _pid, mutname);
|
||||
|
||||
// addr_space->allowTraps(instr_traps);
|
||||
|
||||
@@ -1462,14 +1475,14 @@ main(int argc, char** argv)
|
||||
};
|
||||
|
||||
auto _add_overlapping = [](module_t* mitr, procedure_t* pitr) {
|
||||
OMNITRACE_ADD_LOG_ENTRY("Checking if procedure", get_name(pitr), "in module",
|
||||
get_name(mitr), "is overlapping");
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Checking if procedure", get_name(pitr), "in module",
|
||||
get_name(mitr), "is overlapping");
|
||||
if(!pitr->isInstrumentable()) return;
|
||||
std::vector<procedure_t*> _overlapping{};
|
||||
if(pitr->findOverlapping(_overlapping))
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Adding overlapping procedure", get_name(pitr),
|
||||
"and module", get_name(mitr));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Adding overlapping procedure", get_name(pitr),
|
||||
"and module", get_name(mitr));
|
||||
_insert_module_function(overlapping_module_functions,
|
||||
module_function{ mitr, pitr });
|
||||
for(auto* oitr : _overlapping)
|
||||
@@ -1589,8 +1602,8 @@ main(int argc, char** argv)
|
||||
|
||||
is_static_exe = addr_space->isStaticExecutable();
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("address space is", (is_static_exe) ? "" : "not",
|
||||
"a static executable");
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("address space is", (is_static_exe) ? "" : "not",
|
||||
"a static executable");
|
||||
if(binary_rewrite)
|
||||
app_binary = static_cast<BPatch_binaryEdit*>(addr_space);
|
||||
else
|
||||
@@ -1598,7 +1611,7 @@ main(int argc, char** argv)
|
||||
|
||||
is_attached = (_pid >= 0 && app_thread != nullptr);
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("address space is attached:", is_attached);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("address space is attached:", is_attached);
|
||||
|
||||
if(!app_binary && !app_thread)
|
||||
{
|
||||
@@ -1618,7 +1631,7 @@ main(int argc, char** argv)
|
||||
string_t _tried_libs;
|
||||
for(auto _libname : _libnames)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Getting the absolute lib filepath to", _libname);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Getting the absolute lib filepath to", _libname);
|
||||
_libname = get_realpath(get_absolute_lib_filepath(_libname));
|
||||
_tried_libs += string_t("|") + _libname;
|
||||
verbprintf(1, "loading library: '%s'...\n", _libname.c_str());
|
||||
@@ -1627,7 +1640,7 @@ main(int argc, char** argv)
|
||||
(result) ? "success" : "failure");
|
||||
if(result)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Using library:", _libname);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Using library:", _libname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1656,7 +1669,7 @@ main(int argc, char** argv)
|
||||
};
|
||||
for(auto& lname : lnames)
|
||||
lname = _get_library_ext(lname);
|
||||
OMNITRACE_ADD_LOG_ENTRY("Using library:", lnames);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Using library:", lnames);
|
||||
return lnames;
|
||||
};
|
||||
|
||||
@@ -1668,11 +1681,11 @@ main(int argc, char** argv)
|
||||
//----------------------------------------------------------------------------------//
|
||||
|
||||
auto* main_func = find_function(app_image, main_fname.c_str());
|
||||
auto* user_start_func = find_function(app_image, "omnitrace_user_start_trace",
|
||||
{ "omnitrace_user_start_thread_trace" });
|
||||
auto* user_stop_func = find_function(app_image, "omnitrace_user_stop_trace",
|
||||
{ "omnitrace_user_stop_thread_trace" });
|
||||
#if OMNITRACE_USE_MPI > 0 || OMNITRACE_USE_MPI_HEADERS > 0
|
||||
auto* user_start_func = find_function(app_image, "rocprofsys_user_start_trace",
|
||||
{ "rocprofsys_user_start_thread_trace" });
|
||||
auto* user_stop_func = find_function(app_image, "rocprofsys_user_stop_trace",
|
||||
{ "rocprofsys_user_stop_thread_trace" });
|
||||
#if ROCPROFSYS_USE_MPI > 0 || ROCPROFSYS_USE_MPI_HEADERS > 0
|
||||
// if any of the below MPI functions are found, enable MPI support
|
||||
for(const auto* itr : { "MPI_Init", "MPI_Init_thread", "MPI_Finalize",
|
||||
"MPI_Comm_rank", "MPI_Comm_size" })
|
||||
@@ -1705,15 +1718,15 @@ main(int argc, char** argv)
|
||||
|
||||
verbprintf(0, "Finding instrumentation functions...\n");
|
||||
|
||||
auto* init_func = find_function(app_image, "omnitrace_init");
|
||||
auto* fini_func = find_function(app_image, "omnitrace_finalize");
|
||||
auto* env_func = find_function(app_image, "omnitrace_set_env");
|
||||
auto* mpi_func = find_function(app_image, "omnitrace_set_mpi");
|
||||
auto* entr_trace = find_function(app_image, "omnitrace_push_trace");
|
||||
auto* exit_trace = find_function(app_image, "omnitrace_pop_trace");
|
||||
auto* reg_src_func = find_function(app_image, "omnitrace_register_source");
|
||||
auto* reg_cov_func = find_function(app_image, "omnitrace_register_coverage");
|
||||
auto* set_instr_func = find_function(app_image, "omnitrace_set_instrumented");
|
||||
auto* init_func = find_function(app_image, "rocprofsys_init");
|
||||
auto* fini_func = find_function(app_image, "rocprofsys_finalize");
|
||||
auto* env_func = find_function(app_image, "rocprofsys_set_env");
|
||||
auto* mpi_func = find_function(app_image, "rocprofsys_set_mpi");
|
||||
auto* entr_trace = find_function(app_image, "rocprofsys_push_trace");
|
||||
auto* exit_trace = find_function(app_image, "rocprofsys_pop_trace");
|
||||
auto* reg_src_func = find_function(app_image, "rocprofsys_register_source");
|
||||
auto* reg_cov_func = find_function(app_image, "rocprofsys_register_coverage");
|
||||
auto* set_instr_func = find_function(app_image, "rocprofsys_set_instrumented");
|
||||
|
||||
if(!main_func && main_fname == "main") main_func = find_function(app_image, "_main");
|
||||
|
||||
@@ -1757,9 +1770,9 @@ main(int argc, char** argv)
|
||||
if(_pos != npos_v) _name = _name.substr(_pos + 1);
|
||||
_pos = _name.find('.');
|
||||
if(_pos != npos_v) _name = _name.substr(0, _pos);
|
||||
_pos = _name.find("libomnitrace-");
|
||||
_pos = _name.find("librocprof-sys-");
|
||||
if(_pos != npos_v)
|
||||
_name = _name.erase(_pos, std::string("libomnitrace-").length());
|
||||
_name = _name.erase(_pos, std::string("librocprof-sys-").length());
|
||||
_pos = _name.find("lib");
|
||||
if(_pos == 0) _name = _name.substr(_pos + std::string("lib").length());
|
||||
while((_pos = _name.find('-')) != npos_v)
|
||||
@@ -1768,7 +1781,7 @@ main(int argc, char** argv)
|
||||
verbprintf(2,
|
||||
"Supplemental instrumentation library '%s' is named '%s' after "
|
||||
"removing everything before last '/', everything after first '.', and "
|
||||
"'libomnitrace-'...\n",
|
||||
"'librocprof-sys-'...\n",
|
||||
itr.c_str(), _name.c_str());
|
||||
|
||||
use_stubs[_name] = false;
|
||||
@@ -1814,8 +1827,8 @@ main(int argc, char** argv)
|
||||
}
|
||||
|
||||
// check standard function signature if no user-specified matches
|
||||
if(add_instr_library(_name, TIMEMORY_JOIN("", "omnitrace_register_" + _name),
|
||||
TIMEMORY_JOIN("", "omnitrace_deregister_" + _name)))
|
||||
if(add_instr_library(_name, TIMEMORY_JOIN("", "rocprofsys_register_" + _name),
|
||||
TIMEMORY_JOIN("", "rocprofsys_deregister_" + _name)))
|
||||
continue;
|
||||
|
||||
found_instr_functions:
|
||||
@@ -1830,14 +1843,14 @@ main(int argc, char** argv)
|
||||
|
||||
using pair_t = std::pair<procedure_t*, string_t>;
|
||||
|
||||
for(const auto& itr : { pair_t{ entr_trace, "omnitrace_push_trace" },
|
||||
pair_t{ exit_trace, "omnitrace_pop_trace" },
|
||||
pair_t{ init_func, "omnitrace_init" },
|
||||
pair_t{ fini_func, "omnitrace_finalize" },
|
||||
pair_t{ env_func, "omnitrace_set_env" },
|
||||
pair_t{ set_instr_func, "omnitrace_set_instrumented" },
|
||||
pair_t{ reg_src_func, "omnitrace_register_source" },
|
||||
pair_t{ reg_cov_func, "omnitrace_register_coverage" } })
|
||||
for(const auto& itr : { pair_t{ entr_trace, "rocprofsys_push_trace" },
|
||||
pair_t{ exit_trace, "rocprofsys_pop_trace" },
|
||||
pair_t{ init_func, "rocprofsys_init" },
|
||||
pair_t{ fini_func, "rocprofsys_finalize" },
|
||||
pair_t{ env_func, "rocprofsys_set_env" },
|
||||
pair_t{ set_instr_func, "rocprofsys_set_instrumented" },
|
||||
pair_t{ reg_src_func, "rocprofsys_register_source" },
|
||||
pair_t{ reg_cov_func, "rocprofsys_register_coverage" } })
|
||||
{
|
||||
if(!itr.first)
|
||||
{
|
||||
@@ -1891,12 +1904,12 @@ main(int argc, char** argv)
|
||||
auto _init_arg0 = main_fname;
|
||||
if(main_func) main_sign.get();
|
||||
|
||||
auto main_call_args = omnitrace_call_expr(main_sign.get());
|
||||
auto init_call_args = omnitrace_call_expr(instr_mode, binary_rewrite, "");
|
||||
auto fini_call_args = omnitrace_call_expr();
|
||||
auto umpi_call_args = omnitrace_call_expr(use_mpi, is_attached);
|
||||
auto none_call_args = omnitrace_call_expr();
|
||||
auto set_instr_args = omnitrace_call_expr(instr_mode_v_int);
|
||||
auto main_call_args = rocprofsys_call_expr(main_sign.get());
|
||||
auto init_call_args = rocprofsys_call_expr(instr_mode, binary_rewrite, "");
|
||||
auto fini_call_args = rocprofsys_call_expr();
|
||||
auto umpi_call_args = rocprofsys_call_expr(use_mpi, is_attached);
|
||||
auto none_call_args = rocprofsys_call_expr();
|
||||
auto set_instr_args = rocprofsys_call_expr(instr_mode_v_int);
|
||||
|
||||
verbprintf(2, "Done\n");
|
||||
verbprintf(2, "Getting call snippets... ");
|
||||
@@ -1927,16 +1940,16 @@ main(int argc, char** argv)
|
||||
{
|
||||
if(_libname.empty()) _libname = get_absolute_lib_filepath(itr);
|
||||
}
|
||||
if(_libname.empty()) _libname = "libomnitrace-dl.so";
|
||||
if(_libname.empty()) _libname = "librocprof-sys-dl.so";
|
||||
|
||||
if(!binary_rewrite && !is_attached) env_vars.clear();
|
||||
|
||||
env_vars.emplace_back(
|
||||
TIMEMORY_JOIN('=', "OMNITRACE_INIT_ENABLED",
|
||||
TIMEMORY_JOIN('=', "ROCPROFSYS_INIT_ENABLED",
|
||||
(user_start_func && user_stop_func) ? "OFF" : "ON"));
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_USE_MPIP",
|
||||
env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_USE_MPIP",
|
||||
(binary_rewrite && use_mpi) ? "ON" : "OFF"));
|
||||
if(use_mpi) env_vars.emplace_back(TIMEMORY_JOIN('=', "OMNITRACE_USE_PID", "ON"));
|
||||
if(use_mpi) env_vars.emplace_back(TIMEMORY_JOIN('=', "ROCPROFSYS_USE_PID", "ON"));
|
||||
|
||||
for(auto& itr : env_vars)
|
||||
{
|
||||
@@ -1949,7 +1962,7 @@ main(int argc, char** argv)
|
||||
auto _var = itr.substr(0, _pos);
|
||||
auto _val = itr.substr(_pos + 1);
|
||||
tim::set_env(_var, _val);
|
||||
auto _expr = omnitrace_call_expr(_var, _val);
|
||||
auto _expr = rocprofsys_call_expr(_var, _val);
|
||||
env_variables.emplace_back(_expr.get(env_func));
|
||||
}
|
||||
|
||||
@@ -1959,7 +1972,7 @@ main(int argc, char** argv)
|
||||
//
|
||||
//----------------------------------------------------------------------------------//
|
||||
|
||||
// call into omnitrace-dl to notify that instrumentation is occurring
|
||||
// call into rocprof-sys-dl to notify that instrumentation is occurring
|
||||
if(binary_rewrite)
|
||||
{
|
||||
init_names.emplace(init_names.begin(), set_instr_call.get());
|
||||
@@ -2076,7 +2089,7 @@ main(int argc, char** argv)
|
||||
size_t _ninits = 0;
|
||||
for(auto* itr : _objs)
|
||||
{
|
||||
if(itr->name().find("libomnitrace") != std::string::npos) continue;
|
||||
if(itr->name().find("librocprof-sys") != std::string::npos) continue;
|
||||
try
|
||||
{
|
||||
verbprintf(2, "Adding main init callbacks (via %s)...\n",
|
||||
@@ -2424,7 +2437,7 @@ main(int argc, char** argv)
|
||||
for(auto& itr : cmdv_envp)
|
||||
::free(itr);
|
||||
|
||||
if(perr != 0) perror("Error in omnitrace_fork");
|
||||
if(perr != 0) perror("Error in rocprofsys_fork");
|
||||
|
||||
for(const auto& itr : linked_libs)
|
||||
verbprintf(0, "\t%s\n", itr.c_str());
|
||||
@@ -2450,7 +2463,7 @@ main(int argc, char** argv)
|
||||
auto _compute_exit_code = [app_thread, &code]() {
|
||||
if(app_thread->terminationStatus() == ExitedNormally)
|
||||
{
|
||||
if(app_thread->isTerminated()) verbprintf(0, "End of omnitrace\n");
|
||||
if(app_thread->isTerminated()) verbprintf(0, "End of rocprof-sys\n");
|
||||
}
|
||||
else if(app_thread->terminationStatus() == ExitedViaSignal)
|
||||
{
|
||||
@@ -2523,7 +2536,7 @@ main(int argc, char** argv)
|
||||
free(_cmdv[i]);
|
||||
delete[] _cmdv;
|
||||
|
||||
verbprintf(0, "End of omnitrace\n");
|
||||
verbprintf(0, "End of rocprof-sys\n");
|
||||
verbprintf((code != 0) ? 0 : 1, "Exit code: %i\n", code);
|
||||
|
||||
if(log_ofs)
|
||||
@@ -2684,7 +2697,7 @@ get_absolute_filepath(std::string _name, const strvec_t& _search_paths)
|
||||
if(!is_directory(itr) || is_file(itr)) itr = filepath::dirname(itr);
|
||||
|
||||
auto _exists = false;
|
||||
OMNITRACE_ADD_LOG_ENTRY("searching", itr, "for", _name);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("searching", itr, "for", _name);
|
||||
for(const auto& pitr :
|
||||
{ absolute(JOIN('/', itr, _name)),
|
||||
absolute(JOIN('/', itr, filepath::basename(_name))) })
|
||||
@@ -2813,9 +2826,9 @@ using tim::dirname;
|
||||
void
|
||||
find_dyn_api_rt()
|
||||
{
|
||||
#if defined(OMNITRACE_BUILD_DYNINST)
|
||||
#if defined(ROCPROFSYS_BUILD_DYNINST)
|
||||
std::string _dyn_api_rt_base =
|
||||
(binary_rewrite) ? "libomnitrace-rt" : "libdyninstAPI_RT";
|
||||
(binary_rewrite) ? "librocprof-sys-rt" : "libdyninstAPI_RT";
|
||||
#else
|
||||
std::string _dyn_api_rt_base = "libdyninstAPI_RT";
|
||||
#endif
|
||||
+51
-51
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -83,12 +83,12 @@ get_snippets(Args&&... args)
|
||||
//
|
||||
//======================================================================================//
|
||||
//
|
||||
struct omnitrace_call_expr
|
||||
struct rocprofsys_call_expr
|
||||
{
|
||||
using snippet_pointer_t = std::shared_ptr<snippet_t>;
|
||||
|
||||
template <typename... Args>
|
||||
omnitrace_call_expr(Args&&... args)
|
||||
rocprofsys_call_expr(Args&&... args)
|
||||
: m_params(get_snippets(std::forward<Args>(args)...))
|
||||
{}
|
||||
|
||||
@@ -112,15 +112,15 @@ private:
|
||||
//
|
||||
//======================================================================================//
|
||||
//
|
||||
struct omnitrace_snippet_vec
|
||||
struct rocprofsys_snippet_vec
|
||||
{
|
||||
using entry_type = std::vector<omnitrace_call_expr>;
|
||||
using entry_type = std::vector<rocprofsys_call_expr>;
|
||||
using value_type = std::vector<call_expr_pointer_t>;
|
||||
|
||||
template <typename... Args>
|
||||
void generate(procedure_t* func, Args&&... args)
|
||||
{
|
||||
auto _expr = omnitrace_call_expr(std::forward<Args>(args)...);
|
||||
auto _expr = rocprofsys_call_expr(std::forward<Args>(args)...);
|
||||
auto _call = _expr.get(func);
|
||||
if(_call)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
//======================================================================================//
|
||||
//
|
||||
static inline bool
|
||||
omnitrace_get_is_executable(std::string_view _cmd, bool _default_v)
|
||||
rocprofsys_get_is_executable(std::string_view _cmd, bool _default_v)
|
||||
{
|
||||
bool _is_executable = _default_v;
|
||||
|
||||
@@ -172,9 +172,9 @@ omnitrace_get_is_executable(std::string_view _cmd, bool _default_v)
|
||||
//======================================================================================//
|
||||
//
|
||||
static inline address_space_t*
|
||||
omnitrace_get_address_space(patch_pointer_t& _bpatch, int _cmdc, char** _cmdv,
|
||||
const std::vector<std::string>& _cmdenv, bool _rewrite,
|
||||
int _pid = -1, const std::string& _name = {})
|
||||
rocprofsys_get_address_space(patch_pointer_t& _bpatch, int _cmdc, char** _cmdv,
|
||||
const std::vector<std::string>& _cmdenv, bool _rewrite,
|
||||
int _pid = -1, const std::string& _name = {})
|
||||
{
|
||||
address_space_t* mutatee = nullptr;
|
||||
|
||||
@@ -182,10 +182,10 @@ omnitrace_get_address_space(patch_pointer_t& _bpatch, int _cmdc, char** _cmdv,
|
||||
{
|
||||
if(is_text_file(_name))
|
||||
{
|
||||
errprintf(
|
||||
-127,
|
||||
"'%s' is a text file. OmniTrace only supports instrumenting binary files",
|
||||
_name.c_str());
|
||||
errprintf(-127,
|
||||
"'%s' is a text file. rocprof-sys only supports instrumenting "
|
||||
"binary files",
|
||||
_name.c_str());
|
||||
}
|
||||
|
||||
verbprintf(1, "Opening '%s' for binary rewrite... ", _name.c_str());
|
||||
@@ -251,7 +251,7 @@ omnitrace_get_address_space(patch_pointer_t& _bpatch, int _cmdc, char** _cmdv,
|
||||
if(is_text_file(_cmdv[0]))
|
||||
{
|
||||
errprintf(-1,
|
||||
"'%s' is a text file. OmniTrace only supports instrumenting "
|
||||
"'%s' is a text file. rocprof-sys only supports instrumenting "
|
||||
"binary files",
|
||||
_cmdv[0]);
|
||||
}
|
||||
@@ -283,17 +283,17 @@ omnitrace_get_address_space(patch_pointer_t& _bpatch, int _cmdc, char** _cmdv,
|
||||
//======================================================================================//
|
||||
//
|
||||
TIMEMORY_NOINLINE inline void
|
||||
omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type)
|
||||
rocprofsys_thread_exit(thread_t* thread, BPatch_exitType exit_type)
|
||||
{
|
||||
if(!thread) return;
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Executing the thread callback");
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Executing the thread callback");
|
||||
|
||||
BPatch_process* app = thread->getProcess();
|
||||
|
||||
if(!terminate_expr)
|
||||
{
|
||||
fprintf(stderr, "[omnitrace][exe] continuing execution\n");
|
||||
fprintf(stderr, "[rocprof-sys][exe] continuing execution\n");
|
||||
app->continueExecution();
|
||||
return;
|
||||
}
|
||||
@@ -302,18 +302,18 @@ omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type)
|
||||
{
|
||||
case ExitedNormally:
|
||||
{
|
||||
fprintf(stderr, "[omnitrace][exe] Thread exited normally\n");
|
||||
fprintf(stderr, "[rocprof-sys][exe] Thread exited normally\n");
|
||||
break;
|
||||
}
|
||||
case ExitedViaSignal:
|
||||
{
|
||||
fprintf(stderr, "[omnitrace][exe] Thread terminated unexpectedly\n");
|
||||
fprintf(stderr, "[rocprof-sys][exe] Thread terminated unexpectedly\n");
|
||||
break;
|
||||
}
|
||||
case NoExit:
|
||||
default:
|
||||
{
|
||||
fprintf(stderr, "[omnitrace][exe] %s invoked with NoExit\n", __FUNCTION__);
|
||||
fprintf(stderr, "[rocprof-sys][exe] %s invoked with NoExit\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -321,16 +321,16 @@ omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type)
|
||||
// terminate_expr = nullptr;
|
||||
thread->oneTimeCode(*terminate_expr);
|
||||
|
||||
fprintf(stderr, "[omnitrace][exe] continuing execution\n");
|
||||
fprintf(stderr, "[rocprof-sys][exe] continuing execution\n");
|
||||
app->continueExecution();
|
||||
}
|
||||
//
|
||||
//======================================================================================//
|
||||
//
|
||||
TIMEMORY_NOINLINE inline void
|
||||
omnitrace_fork_callback(thread_t* parent, thread_t* child)
|
||||
rocprofsys_fork_callback(thread_t* parent, thread_t* child)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Executing the fork callback");
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Executing the fork callback");
|
||||
|
||||
if(child)
|
||||
{
|
||||
@@ -360,16 +360,16 @@ omnitrace_fork_callback(thread_t* parent, thread_t* child)
|
||||
// path resolution helpers
|
||||
//
|
||||
std::string&
|
||||
omnitrace_get_exe_realpath();
|
||||
rocprofsys_get_exe_realpath();
|
||||
//
|
||||
std::optional<std::string>
|
||||
omnitrace_get_origin(const char* _name,
|
||||
std::vector<int>&& _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) });
|
||||
rocprofsys_get_origin(const char* _name,
|
||||
std::vector<int>&& _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) });
|
||||
//
|
||||
std::vector<std::string>
|
||||
omnitrace_get_link_map(const char* _lib, const std::string& _exclude_linked_by = {},
|
||||
const std::string& _exclude_re = {},
|
||||
std::vector<int>&& _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) });
|
||||
rocprofsys_get_link_map(const char* _lib, const std::string& _exclude_linked_by = {},
|
||||
const std::string& _exclude_re = {},
|
||||
std::vector<int>&& _open_modes = { (RTLD_LAZY | RTLD_NOLOAD) });
|
||||
//
|
||||
//======================================================================================//
|
||||
// insert_instr -- insert instrumentation into a function
|
||||
@@ -388,8 +388,8 @@ insert_instr(address_space_t* mutatee, const std::vector<point_t*>& _points, Tp
|
||||
return _v;
|
||||
}();
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Inserting", _points.size(),
|
||||
"instrumentation points into function(s)", _names);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Inserting", _points.size(),
|
||||
"instrumentation points into function(s)", _names);
|
||||
|
||||
auto _trace = traceFunc.get();
|
||||
auto _traps = std::set<point_t*>{};
|
||||
@@ -401,8 +401,8 @@ insert_instr(address_space_t* mutatee, const std::vector<point_t*>& _points, Tp
|
||||
}
|
||||
}
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Found", _traps.size(),
|
||||
"instrumentation points using traps in function(s)", _names);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Found", _traps.size(),
|
||||
"instrumentation points using traps in function(s)", _names);
|
||||
|
||||
size_t _n = 0;
|
||||
for(const auto& itr : _points)
|
||||
@@ -412,8 +412,8 @@ insert_instr(address_space_t* mutatee, const std::vector<point_t*>& _points, Tp
|
||||
++_n;
|
||||
}
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Inserted", _n, "instrumentation points in function(s)",
|
||||
_names);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Inserted", _n, "instrumentation points in function(s)",
|
||||
_names);
|
||||
|
||||
return (_n > 0);
|
||||
}
|
||||
@@ -434,8 +434,8 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc,
|
||||
std::vector<point_t*>* _points = nullptr;
|
||||
auto _trace = traceFunc.get();
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Searching for loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Searching for loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
|
||||
if(!cfGraph) funcToInstr->getCFG();
|
||||
if(cfGraph && loopToInstrument)
|
||||
@@ -453,9 +453,9 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc,
|
||||
if(_points == nullptr) return false;
|
||||
if(_points->empty()) return false;
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Inserting max of", _points->size(),
|
||||
"loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Inserting max of", _points->size(),
|
||||
"loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
|
||||
std::set<point_t*> _traps{};
|
||||
if(!allow_traps)
|
||||
@@ -466,9 +466,9 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc,
|
||||
}
|
||||
}
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Found", _traps.size(),
|
||||
"loop instrumentation points using traps in function",
|
||||
get_name(funcToInstr));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Found", _traps.size(),
|
||||
"loop instrumentation points using traps in function",
|
||||
get_name(funcToInstr));
|
||||
|
||||
size_t _n = 0;
|
||||
for(auto& itr : *_points)
|
||||
@@ -478,8 +478,8 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc,
|
||||
++_n;
|
||||
}
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY("Inserted", _n, "loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Inserted", _n, "loop instrumentation points in function",
|
||||
get_name(funcToInstr));
|
||||
|
||||
return (_n > 0);
|
||||
}
|
||||
@@ -497,7 +497,7 @@ insert_instr(address_space_t* mutatee, Tp traceFunc, procedure_loc_t traceLoc,
|
||||
point_t* _point = nullptr;
|
||||
auto _trace = traceFunc.get();
|
||||
|
||||
OMNITRACE_ADD_LOG_ENTRY(
|
||||
ROCPROFSYS_ADD_LOG_ENTRY(
|
||||
"Searching for basic-block entry and exit instrumentation points ::",
|
||||
*basicBlock);
|
||||
|
||||
@@ -514,15 +514,15 @@ insert_instr(address_space_t* mutatee, Tp traceFunc, procedure_loc_t traceLoc,
|
||||
|
||||
if(_point == nullptr)
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("No instrumentation points were found in basic-block ",
|
||||
*basicBlock);
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("No instrumentation points were found in basic-block ",
|
||||
*basicBlock);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!allow_traps && _point->usesTrap_NP())
|
||||
{
|
||||
OMNITRACE_ADD_LOG_ENTRY("Basic-block", *basicBlock,
|
||||
"uses traps and traps are disallowed");
|
||||
ROCPROFSYS_ADD_LOG_ENTRY("Basic-block", *basicBlock,
|
||||
"uses traps and traps are disallowed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocprofiler-systems-run target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(
|
||||
rocprofiler-systems-run
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-run PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-run PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-run
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library
|
||||
rocprofiler-systems::rocprofiler-systems-core
|
||||
rocprofiler-systems::rocprofiler-systems-sanitizer)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-run
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-run)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-run)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-run
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+19
-19
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-run.hpp"
|
||||
#include "rocprof-sys-run.hpp"
|
||||
|
||||
#include "common/defines.h"
|
||||
#include "common/delimit.hpp"
|
||||
@@ -66,7 +66,7 @@ namespace filepath = ::tim::filepath; // NOLINT
|
||||
namespace console = ::tim::utility::console;
|
||||
namespace argparse = ::tim::argparse;
|
||||
namespace signals = ::tim::signals;
|
||||
using settings = ::omnitrace::settings;
|
||||
using settings = ::rocprofsys::settings;
|
||||
using namespace ::timemory::join;
|
||||
using ::tim::get_env;
|
||||
using ::tim::log::stream;
|
||||
@@ -89,7 +89,7 @@ get_internal_libpath(const std::string& _lib)
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = std::string{ "./" };
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return omnitrace::common::join("/", _dir, "..", "lib", _lib);
|
||||
return rocprofsys::common::join("/", _dir, "..", "lib", _lib);
|
||||
}
|
||||
|
||||
parser_data_t&
|
||||
@@ -113,10 +113,10 @@ int
|
||||
get_verbose(parser_data_t& _data)
|
||||
{
|
||||
auto& verbose = _data.verbose;
|
||||
verbose = get_env("OMNITRACE_CAUSAL_VERBOSE",
|
||||
get_env<int>("OMNITRACE_VERBOSE", verbose, false));
|
||||
auto _debug =
|
||||
get_env("OMNITRACE_CAUSAL_DEBUG", get_env<bool>("OMNITRACE_DEBUG", false, false));
|
||||
verbose = get_env("ROCPROFSYS_CAUSAL_VERBOSE",
|
||||
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
|
||||
auto _debug = get_env("ROCPROFSYS_CAUSAL_DEBUG",
|
||||
get_env<bool>("ROCPROFSYS_DEBUG", false, false));
|
||||
if(_debug) verbose += 8;
|
||||
return verbose;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ prepare_command_for_run(char* _exe, parser_data_t& _data)
|
||||
if(!_injected)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
join("", "omnitrace-run was unable to match \"", _data.launcher,
|
||||
join("", "rocprof-sys-run was unable to match \"", _data.launcher,
|
||||
"\" to any arguments on the command line: \"",
|
||||
join(array_config{ " ", "", "" }, _data.command), "\""));
|
||||
}
|
||||
@@ -190,8 +190,8 @@ prepare_environment_for_run(parser_data_t& _data)
|
||||
{
|
||||
if(_data.launcher.empty())
|
||||
{
|
||||
omnitrace::argparse::add_ld_preload(_data);
|
||||
omnitrace::argparse::add_ld_library_path(_data);
|
||||
rocprofsys::argparse::add_ld_preload(_data);
|
||||
rocprofsys::argparse::add_ld_library_path(_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ print_updated_environment(parser_data_t& _data, std::string_view _prefix)
|
||||
{
|
||||
if(itr == nullptr) continue;
|
||||
|
||||
auto _is_omni = (std::string_view{ itr }.find("OMNITRACE") == 0);
|
||||
auto _is_omni = (std::string_view{ itr }.find("ROCPROFSYS") == 0);
|
||||
auto _updated = false;
|
||||
for(const auto& vitr : _updated_envs)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec)
|
||||
using parser_err_t = typename parser_t::result_type;
|
||||
|
||||
toggle_suppression(initial_suppression);
|
||||
omnitrace::argparse::init_parser(_parser_data);
|
||||
rocprofsys::argparse::init_parser(_parser_data);
|
||||
|
||||
// no need for backtraces
|
||||
signals::disable_signal_detection(signals::signal_settings::get_enabled());
|
||||
@@ -282,7 +282,7 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec)
|
||||
};
|
||||
|
||||
const auto* _desc = R"desc(
|
||||
Command line interface to omnitrace configuration.
|
||||
Command line interface to rocprof-sys configuration.
|
||||
)desc";
|
||||
|
||||
auto parser = parser_t{ basename(argv[0]), _desc };
|
||||
@@ -292,8 +292,8 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec)
|
||||
exit(EXIT_FAILURE);
|
||||
});
|
||||
|
||||
parser.enable_help("", "Usage: omnitrace-run <OPTIONS> -- <COMMAND> <ARGS>");
|
||||
parser.enable_version("omnitrace-run", OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
parser.enable_help("", "Usage: rocprof-sys-run <OPTIONS> -- <COMMAND> <ARGS>");
|
||||
parser.enable_version("rocprof-sys-run", ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
|
||||
auto _cols = std::get<0>(console::get_columns());
|
||||
if(_cols > parser.get_help_width() + 8)
|
||||
@@ -303,8 +303,8 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec)
|
||||
// disable options related to causal profiling
|
||||
_parser_data.processed_groups.emplace("causal");
|
||||
|
||||
omnitrace::argparse::add_core_arguments(parser, _parser_data);
|
||||
omnitrace::argparse::add_extended_arguments(parser, _parser_data);
|
||||
rocprofsys::argparse::add_core_arguments(parser, _parser_data);
|
||||
rocprofsys::argparse::add_extended_arguments(parser, _parser_data);
|
||||
|
||||
parser.start_group("EXECUTION OPTIONS", "");
|
||||
parser.add_argument({ "--fork" }, "Execute via fork + execvpe instead of execvpe")
|
||||
@@ -352,7 +352,7 @@ parser_data_t&
|
||||
parse_command(int argc, char** argv, parser_data_t& _parser_data)
|
||||
{
|
||||
toggle_suppression(initial_suppression);
|
||||
omnitrace::argparse::init_parser(_parser_data);
|
||||
rocprofsys::argparse::init_parser(_parser_data);
|
||||
|
||||
// no need for backtraces
|
||||
signals::disable_signal_detection(signals::signal_settings::get_enabled());
|
||||
+9
-8
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-run.hpp"
|
||||
#include "rocprof-sys-run.hpp"
|
||||
#include "core/mproc.hpp"
|
||||
|
||||
#include <timemory/log/color.hpp>
|
||||
@@ -71,8 +71,8 @@ main(int argc, char** argv)
|
||||
auto& _envp = _parse_data.current;
|
||||
if(!_argv.empty())
|
||||
{
|
||||
print_updated_environment(_parse_data, "OMNITRACE: ");
|
||||
print_command(_parse_data, "OMNITRACE: ");
|
||||
print_updated_environment(_parse_data, "ROCPROFSYS: ");
|
||||
print_command(_parse_data, "ROCPROFSYS: ");
|
||||
_argv.emplace_back(nullptr);
|
||||
_envp.emplace_back(nullptr);
|
||||
|
||||
@@ -87,8 +87,8 @@ main(int argc, char** argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto _status = omnitrace::mproc::wait_pid(_pid);
|
||||
auto _ec = omnitrace::mproc::diagnose_status(_pid, _status);
|
||||
auto _status = rocprofsys::mproc::wait_pid(_pid);
|
||||
auto _ec = rocprofsys::mproc::diagnose_status(_pid, _status);
|
||||
if(_ec != 0 && _parse_data.verbose >= 0)
|
||||
{
|
||||
TIMEMORY_PRINTF_FATAL(
|
||||
@@ -98,8 +98,9 @@ main(int argc, char** argv)
|
||||
else if(_parse_data.verbose >= 2)
|
||||
{
|
||||
TIMEMORY_PRINTF_FATAL(
|
||||
stderr, "omnitrace run in process %i completed. exit code: %i\n",
|
||||
_pid, _ec);
|
||||
stderr,
|
||||
"rocprof-sys run in process %i completed. exit code: %i\n", _pid,
|
||||
_ec);
|
||||
}
|
||||
return _ec;
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
using parser_data_t = omnitrace::argparse::parser_data;
|
||||
using parser_data_t = rocprofsys::argparse::parser_data;
|
||||
|
||||
void
|
||||
print_command(const parser_data_t&, std::string_view);
|
||||
@@ -0,0 +1,28 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocprofiler-systems-sample target
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_executable(rocprofiler-systems-sample ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
|
||||
|
||||
target_compile_definitions(rocprofiler-systems-sample PRIVATE TIMEMORY_CMAKE=1)
|
||||
target_include_directories(rocprofiler-systems-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-sample
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-common-library)
|
||||
set_target_properties(
|
||||
rocprofiler-systems-sample
|
||||
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
|
||||
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
|
||||
OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample)
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-sample)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-systems-sample
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL)
|
||||
+119
-117
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-sample.hpp"
|
||||
#include "rocprof-sys-sample.hpp"
|
||||
|
||||
#include "common/delimit.hpp"
|
||||
#include "common/environment.hpp"
|
||||
@@ -44,12 +44,12 @@
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
# define OMNITRACE_USE_ROCTRACER 0
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
# define ROCPROFSYS_USE_ROCTRACER 0
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
# define OMNITRACE_USE_ROCPROFILER 0
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
# define ROCPROFSYS_USE_ROCPROFILER 0
|
||||
#endif
|
||||
|
||||
namespace color = tim::log::color;
|
||||
@@ -74,25 +74,25 @@ auto clock_id_choices = []() {
|
||||
return _v;
|
||||
};
|
||||
|
||||
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
||||
#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \
|
||||
std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL })
|
||||
|
||||
auto _choices = std::vector<std::string>{};
|
||||
auto _aliases = std::map<std::string, std::vector<std::string>>{};
|
||||
for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
for(auto itr : { ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
{
|
||||
auto _choice = std::to_string(std::get<1>(itr));
|
||||
_choices.emplace_back(_choice);
|
||||
_aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } };
|
||||
}
|
||||
|
||||
#undef OMNITRACE_CLOCK_IDENTIFIER
|
||||
#undef ROCPROFSYS_CLOCK_IDENTIFIER
|
||||
|
||||
return std::make_pair(_choices, _aliases);
|
||||
}();
|
||||
@@ -130,28 +130,28 @@ get_initial_environment()
|
||||
}
|
||||
}
|
||||
|
||||
auto _dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so"));
|
||||
auto _omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so"));
|
||||
auto _dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so"));
|
||||
auto _omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so"));
|
||||
|
||||
update_env(_env, "LD_PRELOAD", _dl_libpath, UPD_APPEND);
|
||||
update_env(_env, "LD_LIBRARY_PATH", tim::filepath::dirname(_dl_libpath), UPD_APPEND);
|
||||
|
||||
auto _mode = get_env<std::string>("OMNITRACE_MODE", "sampling", false);
|
||||
auto _mode = get_env<std::string>("ROCPROFSYS_MODE", "sampling", false);
|
||||
|
||||
update_env(_env, "OMNITRACE_USE_SAMPLING", (_mode != "causal"));
|
||||
update_env(_env, "ROCPROFSYS_USE_SAMPLING", (_mode != "causal"));
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#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(OMNITRACE_USE_ROCPROFILER)
|
||||
#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(OMNITRACE_USE_OMPT)
|
||||
#if defined(ROCPROFSYS_USE_OMPT)
|
||||
if(!getenv("OMP_TOOL_LIBRARIES"))
|
||||
update_env(_env, "OMP_TOOL_LIBRARIES", _dl_libpath, UPD_APPEND);
|
||||
#endif
|
||||
@@ -166,13 +166,13 @@ get_internal_libpath(const std::string& _lib)
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = std::string{ "./" };
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return omnitrace::common::join("/", _dir, "..", "lib", _lib);
|
||||
return rocprofsys::common::join("/", _dir, "..", "lib", _lib);
|
||||
}
|
||||
|
||||
void
|
||||
print_updated_environment(std::vector<char*> _env)
|
||||
{
|
||||
if(get_env<int>("OMNITRACE_VERBOSE", 0) < 0) return;
|
||||
if(get_env<int>("ROCPROFSYS_VERBOSE", 0) < 0) return;
|
||||
|
||||
std::sort(_env.begin(), _env.end(), [](auto* _lhs, auto* _rhs) {
|
||||
if(!_lhs) return false;
|
||||
@@ -187,7 +187,7 @@ print_updated_environment(std::vector<char*> _env)
|
||||
{
|
||||
if(itr == nullptr) continue;
|
||||
|
||||
auto _is_omni = (std::string_view{ itr }.find("OMNITRACE") == 0);
|
||||
auto _is_omni = (std::string_view{ itr }.find("ROCPROFSYS") == 0);
|
||||
auto _updated = false;
|
||||
for(const auto& vitr : updated_envs)
|
||||
{
|
||||
@@ -260,13 +260,13 @@ update_env(std::vector<char*>& _environ, std::string_view _env_var, Tp&& _env_va
|
||||
else
|
||||
{
|
||||
free(itr);
|
||||
itr = strdup(omnitrace::common::join('=', _env_var, _env_val).c_str());
|
||||
itr = strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
_environ.emplace_back(
|
||||
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
||||
strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -315,9 +315,9 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
};
|
||||
|
||||
auto* _dl_libpath =
|
||||
realpath(get_internal_libpath("libomnitrace-dl.so").c_str(), nullptr);
|
||||
realpath(get_internal_libpath("librocprof-sys-dl.so").c_str(), nullptr);
|
||||
auto* _omni_libpath =
|
||||
realpath(get_internal_libpath("libomnitrace.so").c_str(), nullptr);
|
||||
realpath(get_internal_libpath("librocprof-sys.so").c_str(), nullptr);
|
||||
|
||||
auto parser = parser_t(argv[0]);
|
||||
|
||||
@@ -361,7 +361,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
? std::vector<std::string>{ "hsa-interrupt" }
|
||||
: std::vector<std::string>{};
|
||||
|
||||
#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0
|
||||
#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0
|
||||
_realtime_reqs.clear();
|
||||
#endif
|
||||
|
||||
@@ -372,7 +372,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
|
||||
parser.set_use_color(true);
|
||||
parser.enable_help();
|
||||
parser.enable_version("omnitrace-sample", OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
parser.enable_version("rocprof-sys-sample", ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
|
||||
auto _cols = std::get<0>(tim::utility::console::get_columns());
|
||||
if(_cols > parser.get_help_width() + 8)
|
||||
@@ -387,20 +387,20 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
auto _monochrome = p.get<bool>("monochrome");
|
||||
monochrome() = _monochrome;
|
||||
p.set_use_color(!_monochrome);
|
||||
update_env(_env, "OMNITRACE_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_env, "ROCPROFSYS_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_env, "MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
});
|
||||
parser.add_argument({ "--debug" }, "Debug output")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_DEBUG", p.get<bool>("debug"));
|
||||
update_env(_env, "ROCPROFSYS_DEBUG", p.get<bool>("debug"));
|
||||
});
|
||||
parser.add_argument({ "-v", "--verbose" }, "Verbose output")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<int>("verbose");
|
||||
verbose = _v;
|
||||
update_env(_env, "OMNITRACE_VERBOSE", _v);
|
||||
update_env(_env, "ROCPROFSYS_VERBOSE", _v);
|
||||
});
|
||||
|
||||
parser.start_group("GENERAL OPTIONS",
|
||||
@@ -410,7 +410,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_env, "OMNITRACE_CONFIG_FILE",
|
||||
_env, "ROCPROFSYS_CONFIG_FILE",
|
||||
join(array_config{ ":" }, p.get<std::vector<std::string>>("config")));
|
||||
});
|
||||
parser
|
||||
@@ -421,14 +421,14 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.max_count(2)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::vector<std::string>>("output");
|
||||
update_env(_env, "OMNITRACE_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_env, "OMNITRACE_OUTPUT_PREFIX", _v.at(1));
|
||||
update_env(_env, "ROCPROFSYS_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_env, "ROCPROFSYS_OUTPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
parser
|
||||
.add_argument({ "-T", "--trace" }, "Generate a detailed trace (perfetto output)")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE", p.get<bool>("trace"));
|
||||
update_env(_env, "ROCPROFSYS_TRACE", p.get<bool>("trace"));
|
||||
});
|
||||
parser
|
||||
.add_argument(
|
||||
@@ -437,7 +437,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.max_count(1)
|
||||
.conflicts({ "flat-profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PROFILE", p.get<bool>("profile"));
|
||||
update_env(_env, "ROCPROFSYS_PROFILE", p.get<bool>("profile"));
|
||||
});
|
||||
parser
|
||||
.add_argument({ "-F", "--flat-profile" },
|
||||
@@ -445,8 +445,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.max_count(1)
|
||||
.conflicts({ "profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_env, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_env, "ROCPROFSYS_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_env, "ROCPROFSYS_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
});
|
||||
parser
|
||||
.add_argument({ "-H", "--host" },
|
||||
@@ -456,8 +456,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_env, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_env, "OMNITRACE_CPU_FREQ_ENABLED", _h);
|
||||
update_env(_env, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_env, "ROCPROFSYS_CPU_FREQ_ENABLED", _h);
|
||||
});
|
||||
parser
|
||||
.add_argument({ "-D", "--device" },
|
||||
@@ -467,8 +467,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_env, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_env, "OMNITRACE_USE_ROCM_SMI", _d);
|
||||
update_env(_env, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_env, "ROCPROFSYS_USE_ROCM_SMI", _d);
|
||||
});
|
||||
parser
|
||||
.add_argument({ "-w", "--wait" },
|
||||
@@ -476,8 +476,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"'--sampling-wait'. See the descriptions for those two options.")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_DELAY", p.get<double>("wait"));
|
||||
update_env(_env, "OMNITRACE_SAMPLING_DELAY", p.get<double>("wait"));
|
||||
update_env(_env, "ROCPROFSYS_TRACE_DELAY", p.get<double>("wait"));
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_DELAY", p.get<double>("wait"));
|
||||
});
|
||||
parser
|
||||
.add_argument(
|
||||
@@ -486,8 +486,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"'--sampling-duration'. See the descriptions for those two options.")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_DURATION", p.get<double>("duration"));
|
||||
update_env(_env, "OMNITRACE_SAMPLING_DURATION", p.get<double>("duration"));
|
||||
update_env(_env, "ROCPROFSYS_TRACE_DURATION", p.get<double>("duration"));
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_DURATION", p.get<double>("duration"));
|
||||
});
|
||||
|
||||
parser.start_group("TRACING OPTIONS", "Specific options controlling tracing (i.e. "
|
||||
@@ -499,7 +499,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.count(1)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PERFETTO_FILE", p.get<std::string>("trace-file"));
|
||||
update_env(_env, "ROCPROFSYS_PERFETTO_FILE",
|
||||
p.get<std::string>("trace-file"));
|
||||
});
|
||||
parser
|
||||
.add_argument({ "--trace-buffer-size" },
|
||||
@@ -507,14 +508,14 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.count(1)
|
||||
.dtype("KB")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PERFETTO_BUFFER_SIZE_KB",
|
||||
update_env(_env, "ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB",
|
||||
p.get<int64_t>("trace-buffer-size"));
|
||||
});
|
||||
parser.add_argument({ "--trace-fill-policy" }, _trace_policy_desc)
|
||||
.count(1)
|
||||
.choices({ "discard", "ring_buffer" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PERFETTO_FILL_POLICY",
|
||||
update_env(_env, "ROCPROFSYS_PERFETTO_FILL_POLICY",
|
||||
p.get<std::string>("trace-fill-policy"));
|
||||
});
|
||||
parser
|
||||
@@ -525,7 +526,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"but that can changed via --trace-clock-id.")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
update_env(_env, "ROCPROFSYS_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
});
|
||||
parser
|
||||
.add_argument({ "--trace-duration" },
|
||||
@@ -534,7 +535,8 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"that can changed via --trace-clock-id.")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_DURATION", p.get<double>("trace-duration"));
|
||||
update_env(_env, "ROCPROFSYS_TRACE_DURATION",
|
||||
p.get<double>("trace-duration"));
|
||||
});
|
||||
parser
|
||||
.add_argument(
|
||||
@@ -544,7 +546,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"and/or <DELAY>:<DURATION>:<REPEAT>:<CLOCK_ID>.")
|
||||
.min_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_PERIODS",
|
||||
update_env(_env, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config{ ",", "", "" },
|
||||
p.get<std::vector<std::string>>("trace-periods")));
|
||||
});
|
||||
@@ -556,10 +558,10 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"threads, i.e. 4 seconds of CPU-time for an application with 4 fully active "
|
||||
"threads would equate to ~1 second of realtime. If this proves to be "
|
||||
"difficult to handle in practice, please file a feature request for "
|
||||
"omnitrace to auto-scale based on the number of threads.")
|
||||
"rocprof-sys to auto-scale based on the number of threads.")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_TRACE_PERIOD_CLOCK_ID",
|
||||
update_env(_env, "ROCPROFSYS_TRACE_PERIOD_CLOCK_ID",
|
||||
p.get<double>("trace-clock-id"));
|
||||
})
|
||||
.choices(clock_id_choices.first)
|
||||
@@ -575,12 +577,12 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.choices({ "text", "json", "console" })
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::set<std::string>>("profile");
|
||||
update_env(_env, "OMNITRACE_PROFILE", true);
|
||||
update_env(_env, "ROCPROFSYS_PROFILE", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_env, "OMNITRACE_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_env, "OMNITRACE_COUT_OUTPUT", _v.count("console") != 0);
|
||||
update_env(_env, "ROCPROFSYS_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_env, "ROCPROFSYS_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_env, "ROCPROFSYS_COUT_OUTPUT", _v.count("console") != 0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -593,9 +595,9 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.max_count(2)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::vector<std::string>>("profile-diff");
|
||||
update_env(_env, "OMNITRACE_DIFF_OUTPUT", true);
|
||||
update_env(_env, "OMNITRACE_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_env, "OMNITRACE_INPUT_PREFIX", _v.at(1));
|
||||
update_env(_env, "ROCPROFSYS_DIFF_OUTPUT", true);
|
||||
update_env(_env, "ROCPROFSYS_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_env, "ROCPROFSYS_INPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
|
||||
parser.start_group(
|
||||
@@ -608,7 +610,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"(number of interrupts per second)")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PROCESS_SAMPLING_FREQ",
|
||||
update_env(_env, "ROCPROFSYS_PROCESS_SAMPLING_FREQ",
|
||||
p.get<double>("process-freq"));
|
||||
});
|
||||
parser
|
||||
@@ -617,7 +619,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"(in seconds of realtime)")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_PROCESS_SAMPLING_DELAY",
|
||||
update_env(_env, "ROCPROFSYS_PROCESS_SAMPLING_DELAY",
|
||||
p.get<double>("process-wait"));
|
||||
});
|
||||
parser
|
||||
@@ -626,7 +628,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"Set the duration of the host/device sampling (in seconds of realtime)")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_PROCESS_DURATION",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_PROCESS_DURATION",
|
||||
p.get<double>("process-duration"));
|
||||
});
|
||||
parser
|
||||
@@ -636,7 +638,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.required({ "host" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_env, "OMNITRACE_SAMPLING_CPUS",
|
||||
_env, "ROCPROFSYS_SAMPLING_CPUS",
|
||||
join(array_config{ "," }, p.get<std::vector<std::string>>("cpus")));
|
||||
});
|
||||
parser
|
||||
@@ -646,7 +648,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.required({ "device" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_env, "OMNITRACE_SAMPLING_GPUS",
|
||||
_env, "ROCPROFSYS_SAMPLING_GPUS",
|
||||
join(array_config{ "," }, p.get<std::vector<std::string>>("gpus")));
|
||||
});
|
||||
|
||||
@@ -657,7 +659,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"(number of interrupts per second)")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_FREQ", p.get<double>("freq"));
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_FREQ", p.get<double>("freq"));
|
||||
});
|
||||
parser
|
||||
.add_argument(
|
||||
@@ -667,7 +669,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"delay of 1 second for CPU-clock sampler may not equal 1 second of realtime")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_DELAY", p.get<double>("sampling-wait"));
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_DELAY", p.get<double>("sampling-wait"));
|
||||
});
|
||||
parser
|
||||
.add_argument(
|
||||
@@ -677,7 +679,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"real-time duration... resulting in zero samples being taken")
|
||||
.count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_DURATION",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_DURATION",
|
||||
p.get<double>("sampling-duration"));
|
||||
});
|
||||
parser
|
||||
@@ -687,7 +689,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"is assigned an atomically incrementing value.")
|
||||
.min_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_TIDS",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_TIDS",
|
||||
join(array_config{ ", " }, p.get<std::vector<int64_t>>("tids")));
|
||||
});
|
||||
|
||||
@@ -698,20 +700,20 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.min_count(0)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("cputime");
|
||||
update_env(_env, "OMNITRACE_SAMPLING_CPUTIME", true);
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_CPUTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_CPUTIME_TIDS",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_CPUTIME_TIDS",
|
||||
join(array_config{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -721,20 +723,20 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
.required(std::move(_realtime_reqs))
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("realtime");
|
||||
update_env(_env, "OMNITRACE_SAMPLING_REALTIME", true);
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_REALTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_env, "OMNITRACE_SAMPLING_REALTIME_TIDS",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_REALTIME_TIDS",
|
||||
join(array_config{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -744,28 +746,28 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"roctracer", "rocprofiler", "roctx",
|
||||
"mutex-locks", "spin-locks", "rw-locks" };
|
||||
|
||||
#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS)
|
||||
#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
_backend_choices.erase("mpip");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_OMPT)
|
||||
#if !defined(ROCPROFSYS_USE_OMPT)
|
||||
_backend_choices.erase("ompt");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL)
|
||||
_backend_choices.erase("rcclp");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
#if !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
_backend_choices.erase("rocm-smi");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
_backend_choices.erase("rocprofiler");
|
||||
#endif
|
||||
|
||||
@@ -779,17 +781,17 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_env, _opt, true);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_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_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("ompt") > 0)
|
||||
update_env(_env, "OMP_TOOL_LIBRARIES", _dl_libpath, UPD_APPEND);
|
||||
@@ -805,17 +807,17 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_env, _opt, false);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_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_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))
|
||||
@@ -837,26 +839,26 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
remove_env(_env, "KOKKOS_PROFILE_LIBRARY");
|
||||
});
|
||||
|
||||
parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H");
|
||||
parser.start_group("HARDWARE COUNTER OPTIONS", "See also: rocprof-sys-avail -H");
|
||||
parser
|
||||
.add_argument({ "-C", "--cpu-events" },
|
||||
"Set the CPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c CPU`)")
|
||||
"`rocprof-sys-avail -H -c CPU`)")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events =
|
||||
join(array_config{ "," }, p.get<std::vector<std::string>>("cpu-events"));
|
||||
update_env(_env, "OMNITRACE_PAPI_EVENTS", _events);
|
||||
update_env(_env, "ROCPROFSYS_PAPI_EVENTS", _events);
|
||||
});
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
parser
|
||||
.add_argument({ "-G", "--gpu-events" },
|
||||
"Set the GPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c GPU`)")
|
||||
"`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, "OMNITRACE_ROCM_EVENTS", _events);
|
||||
update_env(_env, "ROCPROFSYS_ROCM_EVENTS", _events);
|
||||
});
|
||||
#endif
|
||||
|
||||
@@ -866,7 +868,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
"Include inline info in output when available")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_env, "OMNITRACE_SAMPLING_INCLUDE_INLINES",
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_INCLUDE_INLINES",
|
||||
p.get<bool>("inlines"));
|
||||
});
|
||||
|
||||
@@ -906,7 +908,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
|
||||
throw std::runtime_error(_cerr.what());
|
||||
|
||||
if(parser.exists("realtime") && !parser.exists("cputime"))
|
||||
update_env(_env, "OMNITRACE_SAMPLING_CPUTIME", false);
|
||||
update_env(_env, "ROCPROFSYS_SAMPLING_CPUTIME", false);
|
||||
if(parser.exists("profile") && parser.exists("flat-profile"))
|
||||
throw std::runtime_error(
|
||||
"Error! '--profile' argument conflicts with '--flat-profile' argument");
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "omnitrace-sample.hpp"
|
||||
#include "rocprof-sys-sample.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
Ficheiro renomeado sem modificações.
@@ -1,10 +1,10 @@
|
||||
set(OMNITRACE_ABORT_FAIL_REGEX
|
||||
set(ROCPROFSYS_ABORT_FAIL_REGEX
|
||||
"### ERROR ###|unknown-hash=|address of faulting memory reference|exiting with non-zero exit code|terminate called after throwing an instance|calling abort.. in |Exit code: [1-9]"
|
||||
CACHE INTERNAL "Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set"
|
||||
FORCE)
|
||||
|
||||
# adds a ctest for executable
|
||||
function(OMNITRACE_ADD_BIN_TEST)
|
||||
function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
|
||||
cmake_parse_arguments(
|
||||
TEST
|
||||
"" # options
|
||||
@@ -19,10 +19,10 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
|
||||
if(NOT TEST_ENVIRONMENT)
|
||||
set(TEST_ENVIRONMENT
|
||||
"OMNITRACE_TRACE=ON"
|
||||
"OMNITRACE_PROFILE=ON"
|
||||
"OMNITRACE_USE_SAMPLING=ON"
|
||||
"OMNITRACE_TIME_OUTPUT=OFF"
|
||||
"ROCPROFSYS_TRACE=ON"
|
||||
"ROCPROFSYS_PROFILE=ON"
|
||||
"ROCPROFSYS_USE_SAMPLING=ON"
|
||||
"ROCPROFSYS_TIME_OUTPUT=OFF"
|
||||
"LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}"
|
||||
)
|
||||
endif()
|
||||
@@ -31,31 +31,31 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
list(
|
||||
APPEND
|
||||
TEST_ENVIRONMENT
|
||||
"OMNITRACE_CI=ON"
|
||||
"OMNITRACE_CI_TIMEOUT=${TEST_TIMEOUT}"
|
||||
"OMNITRACE_CONFIG_FILE="
|
||||
"OMNITRACE_OUTPUT_PATH=${PROJECT_BINARY_DIR}/omnitrace-tests-output"
|
||||
"ROCPROFSYS_CI=ON"
|
||||
"ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}"
|
||||
"ROCPROFSYS_CONFIG_FILE="
|
||||
"ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output"
|
||||
"TWD=${TEST_WORKING_DIRECTORY}")
|
||||
# copy for inverse
|
||||
set(TEST_ENVIRONMENT_INV "${TEST_ENVIRONMENT}")
|
||||
|
||||
# different for regular test and inverse test
|
||||
list(APPEND TEST_ENVIRONMENT "OMNITRACE_OUTPUT_PREFIX=${TEST_NAME}/")
|
||||
list(APPEND TEST_ENVIRONMENT_INV "OMNITRACE_OUTPUT_PREFIX=${TEST_NAME}-inverse/")
|
||||
list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}/")
|
||||
list(APPEND TEST_ENVIRONMENT_INV "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}-inverse/")
|
||||
|
||||
if(NOT "${TEST_PASS_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" STREQUAL ""
|
||||
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
omnitrace_message(
|
||||
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
rocprofiler_systems_message(
|
||||
FATAL_ERROR
|
||||
"${TEST_NAME} has set pass and fail regexes but fail regex does not include '|OMNITRACE_ABORT_FAIL_REGEX'"
|
||||
"${TEST_NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'"
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${TEST_FAIL_REGEX}" STREQUAL "")
|
||||
set(TEST_FAIL_REGEX "(${OMNITRACE_ABORT_FAIL_REGEX})")
|
||||
set(TEST_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})")
|
||||
else()
|
||||
string(REPLACE "|OMNITRACE_ABORT_FAIL_REGEX" "|${OMNITRACE_ABORT_FAIL_REGEX}"
|
||||
string(REPLACE "|ROCPROFSYS_ABORT_FAIL_REGEX" "|${ROCPROFSYS_ABORT_FAIL_REGEX}"
|
||||
TEST_FAIL_REGEX "${TEST_FAIL_REGEX}")
|
||||
endif()
|
||||
|
||||
@@ -74,7 +74,7 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
DEPENDS
|
||||
"${TEST_DEPENDS}"
|
||||
LABELS
|
||||
"omnitrace-bin;${TEST_LABELS}"
|
||||
"rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION
|
||||
"${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
@@ -97,7 +97,7 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
DEPENDS
|
||||
"${TEST_DEPENDS}"
|
||||
LABELS
|
||||
"omnitrace-bin;${TEST_LABELS}"
|
||||
"rocprofiler-systems-bin;${TEST_LABELS}"
|
||||
PASS_REGULAR_EXPRESSION
|
||||
"${TEST_PASS_REGEX}"
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
@@ -105,19 +105,19 @@ function(OMNITRACE_ADD_BIN_TEST)
|
||||
SKIP_REGULAR_EXPRESSION
|
||||
"${TEST_SKIP_REGEX}"
|
||||
${TEST_PROPERTIES})
|
||||
elseif(OMNITRACE_BUILD_TESTING)
|
||||
elseif(ROCPROFSYS_BUILD_TESTING)
|
||||
message(FATAL_ERROR "Error! ${TEST_TARGET} does not exist")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-help
|
||||
TARGET omnitrace-instrument
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-help
|
||||
TARGET rocprofiler-systems-instrument
|
||||
ARGS --help
|
||||
LABELS omnitrace-instrument
|
||||
LABELS rocprofiler-systems-instrument
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
".*\\\[omnitrace-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
|
||||
".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
|
||||
)
|
||||
|
||||
# on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls`
|
||||
@@ -129,9 +129,9 @@ else()
|
||||
set(LS_ARGS)
|
||||
endif()
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-simulate-ls
|
||||
TARGET omnitrace-instrument
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-ls
|
||||
TARGET rocprofiler-systems-instrument
|
||||
ARGS --simulate
|
||||
--print-format
|
||||
json
|
||||
@@ -146,45 +146,48 @@ omnitrace_add_bin_test(
|
||||
LABELS "simulate"
|
||||
TIMEOUT 240)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-simulate-ls-check
|
||||
DEPENDS omnitrace-instrument-simulate-ls
|
||||
COMMAND ls omnitrace-tests-output/omnitrace-instrument-simulate-ls/instrumentation
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-ls-check
|
||||
DEPENDS rocprofiler-systems-instrument-simulate-ls
|
||||
COMMAND
|
||||
ls
|
||||
rocprof-sys-tests-output/rocprofiler-systems-instrument-simulate-ls/instrumentation
|
||||
TIMEOUT 60
|
||||
PASS_REGEX
|
||||
".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*"
|
||||
FAIL_REGEX "No such file or directory|not found|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-simulate-lib
|
||||
TARGET omnitrace-instrument
|
||||
ARGS --print-available functions -v 2 -- $<TARGET_FILE:omnitrace-user-library>
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-lib
|
||||
TARGET rocprofiler-systems-instrument
|
||||
ARGS --print-available functions -v 2 --
|
||||
$<TARGET_FILE:rocprofiler-systems-user-library>
|
||||
LABELS "simulate"
|
||||
TIMEOUT 120
|
||||
PASS_REGEX
|
||||
"\\\[omnitrace\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[omnitrace\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'"
|
||||
"\\\[rocprof-sys\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[rocprof-sys\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'"
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp)
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-simulate-lib-basename
|
||||
TARGET omnitrace-instrument
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-simulate-lib-basename
|
||||
TARGET rocprofiler-systems-instrument
|
||||
ARGS --print-available
|
||||
functions
|
||||
-v
|
||||
2
|
||||
-o
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:omnitrace-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
--
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:omnitrace-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
LABELS "simulate"
|
||||
TIMEOUT 120
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp)
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-write-log
|
||||
TARGET omnitrace-instrument
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-write-log
|
||||
TARGET rocprofiler-systems-instrument
|
||||
ARGS --print-instrumented
|
||||
functions
|
||||
-v
|
||||
@@ -198,98 +201,99 @@ omnitrace_add_bin_test(
|
||||
TIMEOUT 120
|
||||
PASS_REGEX "Opening .*/instrumentation/user.log")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-instrument-write-log-check
|
||||
DEPENDS omnitrace-instrument-write-log
|
||||
COMMAND ls
|
||||
omnitrace-tests-output/omnitrace-instrument-write-log/instrumentation/user.log
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-instrument-write-log-check
|
||||
DEPENDS rocprofiler-systems-instrument-write-log
|
||||
COMMAND
|
||||
ls
|
||||
rocprof-sys-tests-output/rocprofiler-systems-instrument-write-log/instrumentation/user.log
|
||||
LABELS "log"
|
||||
TIMEOUT 60
|
||||
PASS_REGEX "user.log"
|
||||
FAIL_REGEX "No such file or directory|not found|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-help
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-help
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --help
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
".*\\\[omnitrace-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
|
||||
".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-all
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --all
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-all-expand-keys
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-expand-keys
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --all --expand-keys
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
FAIL_REGEX "%[a-zA-Z_]%|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-all-only-available-alphabetical
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-only-available-alphabetical
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --all --available --alphabetical --debug --output
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omnitrace-avail-all-only-available-alphabetical.log
|
||||
LABELS "omnitrace-avail"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PROPERTIES
|
||||
ATTACHED_FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/omnitrace-avail-all-only-available-alphabetical.log)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-all-csv
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-all-csv
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --all --csv --csv-separator "#"
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-filter-wall-clock-available
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-filter-wall-clock-available
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS -r wall_clock -C --available
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-category-filter-omnitrace
|
||||
TARGET omnitrace-avail
|
||||
ARGS --categories settings::omnitrace --brief
|
||||
LABELS "omnitrace-avail"
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-category-filter-rocprofiler-systems
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --categories settings::rocprofsys --brief
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
|
||||
PASS_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
|
||||
FAIL_REGEX
|
||||
"OMNITRACE_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|OMNITRACE_ABORT_FAIL_REGEX"
|
||||
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-category-filter-timemory
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-category-filter-timemory
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --categories settings::timemory --brief --advanced
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"OMNITRACE_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
|
||||
FAIL_REGEX "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE)|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
|
||||
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-regex-negation
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-regex-negation
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS -R
|
||||
omnitrace
|
||||
rocprofsys
|
||||
~timemory
|
||||
-r
|
||||
_P
|
||||
@@ -299,20 +303,22 @@ omnitrace_add_bin_test(
|
||||
--csv
|
||||
--brief
|
||||
--advanced
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
TIMEOUT 45
|
||||
PASS_REGEX
|
||||
"ENVIRONMENT VARIABLE,[ \n]+OMNITRACE_THREAD_POOL_SIZE,[ \n]+OMNITRACE_USE_PID,[ \n]+"
|
||||
FAIL_REGEX "OMNITRACE_TRACE|OMNITRACE_ABORT_FAIL_REGEX")
|
||||
"ENVIRONMENT VARIABLE,[ \n]+ROCPROFSYS_THREAD_POOL_SIZE,[ \n]+ROCPROFSYS_USE_PID,[ \n]+"
|
||||
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX")
|
||||
|
||||
string(REPLACE "+" "\\\+" _AVAIL_CFG_PATH
|
||||
"${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-avail/omnitrace-")
|
||||
string(
|
||||
REPLACE
|
||||
"+" "\\\+" _AVAIL_CFG_PATH
|
||||
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-")
|
||||
# use of TWD == Test Working Directory (added by function)
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-write-config
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-write-config
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS -G
|
||||
%env{TWD}%/omnitrace-tests-output/omnitrace-avail/omnitrace-test.cfg
|
||||
%env{TWD}%/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-test.cfg
|
||||
-F
|
||||
txt
|
||||
json
|
||||
@@ -320,69 +326,69 @@ omnitrace_add_bin_test(
|
||||
--force
|
||||
--all
|
||||
-c
|
||||
omnitrace
|
||||
rocprofsys
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX
|
||||
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-write-config-tweak
|
||||
TARGET omnitrace-avail
|
||||
ARGS -G %env{TWD}%/omnitrace-tests-output/omnitrace-avail/omnitrace-tweak.cfg -F txt
|
||||
json xml --force
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-write-config-tweak
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS -G %env{TWD}%/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-tweak.cfg -F
|
||||
txt json xml --force
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail"
|
||||
ENVIRONMENT "OMNITRACE_TRACE=OFF;OMNITRACE_PROFILE=ON"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
ENVIRONMENT "ROCPROFSYS_TRACE=OFF;ROCPROFSYS_PROFILE=ON"
|
||||
PASS_REGEX
|
||||
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-list-keys
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-keys
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --list-keys --expand-keys
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-list-keys-markdown
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-keys-markdown
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --list-keys --expand-keys --markdown
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail;markdown"
|
||||
LABELS "rocprofiler-systems-avail;markdown"
|
||||
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-list-categories
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-list-categories
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS --list-categories
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX " component::(.*) hw_counters::(.*) settings::")
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-avail-core-categories
|
||||
TARGET omnitrace-avail
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-avail-core-categories
|
||||
TARGET rocprofiler-systems-avail
|
||||
ARGS -c core
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-avail"
|
||||
LABELS "rocprofiler-systems-avail"
|
||||
PASS_REGEX
|
||||
"OMNITRACE_CONFIG_FILE(.*)OMNITRACE_ENABLED(.*)OMNITRACE_SUPPRESS_CONFIG(.*)OMNITRACE_SUPPRESS_PARSING(.*)OMNITRACE_VERBOSE"
|
||||
"ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE"
|
||||
)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-run-help
|
||||
TARGET omnitrace-run
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-run-help
|
||||
TARGET rocprofiler-systems-run
|
||||
ARGS --help
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-run")
|
||||
LABELS "rocprofiler-systems-run")
|
||||
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/omnitrace-tests-config")
|
||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config")
|
||||
file(
|
||||
WRITE "${PROJECT_BINARY_DIR}/omnitrace-tests-config/empty.cfg"
|
||||
WRITE "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
|
||||
"
|
||||
#
|
||||
# empty config file
|
||||
@@ -394,18 +400,18 @@ set_target_properties(
|
||||
sleeper PROPERTIES BUILD_TYPE RelWithDebInfo RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin/testing)
|
||||
|
||||
omnitrace_add_bin_test(
|
||||
NAME omnitrace-run-args
|
||||
TARGET omnitrace-run
|
||||
rocprofiler_systems_add_bin_test(
|
||||
NAME rocprofiler-systems-run-args
|
||||
TARGET rocprofiler-systems-run
|
||||
ARGS --monochrome
|
||||
--debug=false
|
||||
-v
|
||||
1
|
||||
-c
|
||||
%env{TWD}%/omnitrace-tests-config/empty.cfg
|
||||
%env{TWD}%/rocprof-sys-tests-config/empty.cfg
|
||||
-o
|
||||
omnitrace-tests-output
|
||||
omnitrace-run-args-output/
|
||||
rocprof-sys-tests-output
|
||||
rocprofiler-systems-run-args-output/
|
||||
-TPHD
|
||||
-S
|
||||
cputime
|
||||
@@ -469,7 +475,7 @@ omnitrace_add_bin_test(
|
||||
--kokkosp-name-length-max=1024
|
||||
--kokkosp-prefix="[kokkos]"
|
||||
--tmpdir
|
||||
${CMAKE_BINARY_DIR}/omnitrace-tests-config/tmpdir
|
||||
${CMAKE_BINARY_DIR}/rocprof-sys-tests-config/tmpdir
|
||||
--perfetto-backend
|
||||
inprocess
|
||||
--use-pid
|
||||
@@ -488,4 +494,4 @@ omnitrace_add_bin_test(
|
||||
$<TARGET_FILE:sleeper>
|
||||
5
|
||||
TIMEOUT 45
|
||||
LABELS "omnitrace-run")
|
||||
LABELS "rocprofiler-systems-run")
|
||||
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
Ficheiro renomeado sem modificações.
@@ -1,10 +1,10 @@
|
||||
# ----------------------------------------------------------------------------- #
|
||||
#
|
||||
# omnitrace: contains all instrumentation functionality
|
||||
# rocprofiler-systems: contains all instrumentation functionality
|
||||
#
|
||||
# omnitrace-dl: contains minimal symbols and dlopen's omnitrace
|
||||
# rocprofiler-systems-dl: contains minimal symbols and dlopen's rocprofiler-systems
|
||||
#
|
||||
# omnitrace-user: contains symbols for user API
|
||||
# rocprofiler-systems-user: contains symbols for user API
|
||||
#
|
||||
# ----------------------------------------------------------------------------- #
|
||||
|
||||
@@ -12,56 +12,58 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
|
||||
cmake_policy(SET CMP0115 NEW)
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_USE_ROCPROFILER
|
||||
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(OMNITRACE_LIB_INSTALL_RPATH
|
||||
"\$ORIGIN:\$ORIGIN/omnitrace:${rocprofiler_LIBRARY_DIR}")
|
||||
set(ROCPROFSYS_LIB_INSTALL_RPATH
|
||||
"\$ORIGIN:\$ORIGIN/${PROJECT_NAME}:${rocprofiler_LIBRARY_DIR}")
|
||||
else()
|
||||
set(OMNITRACE_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
|
||||
set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace interface library
|
||||
# rocprofiler-systems interface library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-interface-library INTERFACE)
|
||||
add_library(omnitrace::omnitrace-interface-library ALIAS omnitrace-interface-library)
|
||||
add_library(rocprofiler-systems-interface-library INTERFACE)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-interface-library ALIAS
|
||||
rocprofiler-systems-interface-library)
|
||||
|
||||
target_include_directories(
|
||||
omnitrace-interface-library INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace)
|
||||
rocprofiler-systems-interface-library
|
||||
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-interface-library
|
||||
rocprofiler-systems-interface-library
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-headers>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-threading>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-common-library>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-options>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-perfetto>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-timemory>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-elfutils>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-bfd>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-mpi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-ptl>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-hip>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-roctracer>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocprofiler>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocm-smi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rccl>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${OMNITRACE_BUILD_LTO}>,omnitrace::omnitrace-lto,>>)
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-headers>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-options>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-perfetto>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-timemory>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-elfutils>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-bfd>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-ptl>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-hip>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-roctracer>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocprofiler>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm-smi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rccl>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace internal libraries
|
||||
# rocprofiler-systems internal libraries
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
@@ -71,11 +73,11 @@ add_subdirectory(binary)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace exported libraries
|
||||
# rocprofiler-systems exported libraries
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_subdirectory(omnitrace)
|
||||
add_subdirectory(omnitrace-dl)
|
||||
add_subdirectory(omnitrace-rt)
|
||||
add_subdirectory(omnitrace-user)
|
||||
add_subdirectory(rocprof-sys)
|
||||
add_subdirectory(rocprof-sys-dl)
|
||||
add_subdirectory(rocprof-sys-rt)
|
||||
add_subdirectory(rocprof-sys-user)
|
||||
@@ -16,13 +16,17 @@ set(binary_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp)
|
||||
|
||||
add_library(omnitrace-binary-library STATIC)
|
||||
add_library(omnitrace::omnitrace-binary ALIAS omnitrace-binary-library)
|
||||
add_library(rocprofiler-systems-binary-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-binary ALIAS
|
||||
rocprofiler-systems-binary-library)
|
||||
|
||||
target_sources(omnitrace-binary-library PRIVATE ${binary_sources} ${binary_headers})
|
||||
target_sources(rocprofiler-systems-binary-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-binary-library PRIVATE omnitrace::omnitrace-interface-library
|
||||
omnitrace::omnitrace-core)
|
||||
rocprofiler-systems-binary-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core)
|
||||
|
||||
set_target_properties(omnitrace-binary-library PROPERTIES OUTPUT_NAME omnitrace-binary)
|
||||
set_target_properties(rocprofiler-systems-binary-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary)
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -72,4 +72,4 @@ address_multirange::operator+=(address_range _v)
|
||||
return *this;
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -39,7 +39,7 @@ struct address_multirange
|
||||
struct coarse
|
||||
{};
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(address_multirange)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(address_multirange)
|
||||
|
||||
address_multirange& operator+=(std::pair<coarse, uintptr_t>&&);
|
||||
address_multirange& operator+=(std::pair<coarse, address_range>&& _v);
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename Tp>
|
||||
OMNITRACE_INLINE bool
|
||||
ROCPROFSYS_INLINE bool
|
||||
address_multirange::contains(Tp&& _v) const
|
||||
{
|
||||
using type = concepts::unqualified_type_t<Tp>;
|
||||
@@ -74,4 +74,4 @@ address_multirange::contains(Tp&& _v) const
|
||||
[_v](auto&& itr) { return itr.contains(_v); });
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
# error "BFD support not enabled"
|
||||
#endif
|
||||
|
||||
#define PACKAGE "omnitrace"
|
||||
#define PACKAGE "rocprofiler-systems"
|
||||
|
||||
#include <bfd.h>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -75,7 +75,8 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd
|
||||
auto& _bfd = _info.bfd;
|
||||
_bfd = std::make_shared<bfd_file>(_name);
|
||||
|
||||
OMNITRACE_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n", _name.c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n",
|
||||
_name.c_str());
|
||||
|
||||
if(_bfd && _bfd->is_good())
|
||||
{
|
||||
@@ -124,8 +125,8 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd
|
||||
_info.sort();
|
||||
}
|
||||
|
||||
OMNITRACE_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n",
|
||||
_bfd->name.c_str(), _info.symbols.size());
|
||||
ROCPROFSYS_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n",
|
||||
_bfd->name.c_str(), _info.symbols.size());
|
||||
|
||||
return _info;
|
||||
}
|
||||
@@ -151,7 +152,7 @@ get_binary_info(const std::vector<std::string>& _files,
|
||||
};
|
||||
|
||||
// filter function used by procfs::get_contiguous_maps
|
||||
// ensures that we do not process omnitrace/gotcha/libunwind libraries
|
||||
// ensures that we do not process rocprof-sys/gotcha/libunwind libraries
|
||||
// and do not process the libraries outside of the binary scope
|
||||
auto _filter = [&_satisfies_binary_filter](const procfs::maps& _v) {
|
||||
if(_v.pathname.empty()) return false;
|
||||
@@ -237,10 +238,10 @@ lookup_ipaddr_entry(uintptr_t _addr, unw_context_t* _context_p,
|
||||
}
|
||||
};
|
||||
|
||||
for(const auto& itr : binary::get_link_map("libomnitrace.so", "", ""))
|
||||
for(const auto& itr : binary::get_link_map("librocprof-sys.so", "", ""))
|
||||
_insert_exclude_range(itr.real());
|
||||
|
||||
for(const auto& itr : binary::get_link_map("libomnitrace-dl.so", "", ""))
|
||||
for(const auto& itr : binary::get_link_map("librocprof-sys-dl.so", "", ""))
|
||||
_insert_exclude_range(itr.real());
|
||||
|
||||
return _exclude_range_v;
|
||||
@@ -305,4 +306,4 @@ lookup_ipaddr_entry<true>(uintptr_t, unw_context_t*, tim::unwind::cache*);
|
||||
template std::optional<tim::unwind::processed_entry>
|
||||
lookup_ipaddr_entry<false>(uintptr_t, unw_context_t*, tim::unwind::cache*);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -62,4 +62,4 @@ template <bool ExcludeInternal>
|
||||
std::optional<tim::unwind::processed_entry>
|
||||
lookup_ipaddr_entry(uintptr_t, unw_context_t* = nullptr, tim::unwind::cache* = nullptr);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -84,4 +84,4 @@ binary_info::filename() const
|
||||
return (bfd) ? std::string{ bfd->name } : std::string{};
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <dwarf.h>
|
||||
#include <elfutils/libdw.h>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -206,20 +206,20 @@ template <typename ArchiveT>
|
||||
void
|
||||
dwarf_entry::serialize(ArchiveT& ar, const unsigned int)
|
||||
{
|
||||
#define OMNITRACE_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER));
|
||||
#define ROCPROFSYS_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER));
|
||||
|
||||
OMNITRACE_SERIALIZE_MEMBER(file)
|
||||
OMNITRACE_SERIALIZE_MEMBER(line)
|
||||
OMNITRACE_SERIALIZE_MEMBER(col)
|
||||
OMNITRACE_SERIALIZE_MEMBER(address)
|
||||
OMNITRACE_SERIALIZE_MEMBER(discriminator)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(begin_statement)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(end_sequence)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(line_block)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(prologue_end)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(epilogue_begin)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(vliw_op_index)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(isa)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(file)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(line)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(col)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(address)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(discriminator)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(begin_statement)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(end_sequence)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(line_block)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(prologue_end)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(epilogue_begin)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(vliw_op_index)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(isa)
|
||||
}
|
||||
|
||||
template void
|
||||
@@ -234,4 +234,4 @@ template void
|
||||
dwarf_entry::serialize<cereal::PrettyJSONOutputArchive>(cereal::PrettyJSONOutputArchive&,
|
||||
const unsigned int);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "core/binary/address_range.hpp"
|
||||
#include "core/binary/fwd.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -35,7 +35,7 @@ struct dwarf_entry
|
||||
using dwarf_tuple_t = std::tuple<std::deque<dwarf_entry>, std::vector<address_range>,
|
||||
std::vector<uintptr_t>>;
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(dwarf_entry)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(dwarf_entry)
|
||||
|
||||
bool begin_statement = false;
|
||||
bool end_sequence = false;
|
||||
@@ -63,4 +63,4 @@ struct dwarf_entry
|
||||
void serialize(ArchiveT&, const unsigned int);
|
||||
};
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -138,14 +138,14 @@ get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
auto _name = (!_lib) ? config::get_exe_realpath() : std::string{ _lib };
|
||||
for(const auto& itr : _fini_chain)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name),
|
||||
itr.real().c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name),
|
||||
itr.real().c_str());
|
||||
}
|
||||
|
||||
for(const auto& itr : _excl_chain)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(),
|
||||
link_file{ itr }.real().c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(),
|
||||
link_file{ itr }.real().c_str());
|
||||
}
|
||||
|
||||
return _fini_chain;
|
||||
@@ -178,4 +178,4 @@ link_file::real() const
|
||||
return filepath::realpath(name, nullptr, false);
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -54,11 +54,11 @@ std::optional<std::string>
|
||||
get_linked_path(const char*, open_modes_vec_t&& = {});
|
||||
|
||||
// default parameters: get the linked binaries for the exe but exclude the linked binaries
|
||||
// from libomnitrace
|
||||
// from librocprof-sys
|
||||
std::set<link_file>
|
||||
get_link_map(const char* _lib = nullptr,
|
||||
const std::string& _exclude_linked_by = "libomnitrace.so",
|
||||
const std::string& _exclude_re = "libomnitrace-([a-zA-Z]+)\\.so",
|
||||
const std::string& _exclude_linked_by = "librocprof-sys.so",
|
||||
const std::string& _exclude_re = "librocprof-sys-([a-zA-Z]+)\\.so",
|
||||
open_modes_vec_t&& _open_modes = {});
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <regex>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -43,4 +43,4 @@ scope_filter::operator()(std::string_view _value) const
|
||||
throw exception<std::runtime_error>{ "invalid scope filter mode" };
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -55,7 +55,7 @@ struct scope_filter
|
||||
|
||||
template <typename ContainerT>
|
||||
static bool satisfies_filter(const ContainerT&, filter_scope,
|
||||
std::string_view) OMNITRACE_PURE;
|
||||
std::string_view) ROCPROFSYS_PURE;
|
||||
};
|
||||
|
||||
template <typename ContainerT>
|
||||
@@ -72,4 +72,4 @@ scope_filter::satisfies_filter(const ContainerT& _filters, filter_scope _scope,
|
||||
return true;
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
# error "BFD support not enabled"
|
||||
#endif
|
||||
|
||||
#define PACKAGE "omnitrace"
|
||||
#define PACKAGE "rocprofiler-systems"
|
||||
#define L_LNNO_SIZE 4
|
||||
|
||||
#include <bfd.h>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#include <timemory/mpl/concepts.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -404,4 +404,4 @@ template std::vector<dwarf_entry>
|
||||
symbol::get_debug_line_info<std::vector<dwarf_entry>>(
|
||||
const std::vector<scope_filter>& _filters) const;
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -95,4 +95,4 @@ struct symbol : private tim::unwind::bfd_file::symbol
|
||||
std::vector<dwarf_entry> dwarf_info = {};
|
||||
};
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,18 +1,19 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace common headers
|
||||
# rocprofiler-systems common headers
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-common-library INTERFACE)
|
||||
add_library(omnitrace::common-library ALIAS omnitrace-common-library)
|
||||
add_library(omnitrace::omnitrace-common-library ALIAS omnitrace-common-library)
|
||||
add_library(rocprofiler-systems-common-library INTERFACE)
|
||||
add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS
|
||||
rocprofiler-systems-common-library)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY)
|
||||
|
||||
target_sources(
|
||||
omnitrace-common-library
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
|
||||
@@ -24,11 +25,11 @@ get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" D
|
||||
get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY)
|
||||
|
||||
target_include_directories(
|
||||
omnitrace-common-library
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>)
|
||||
|
||||
target_compile_definitions(omnitrace-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:OMNITRACE_INTERNAL_BUILD=1>)
|
||||
target_compile_definitions(rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>)
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,117 +23,118 @@
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define OMNITRACE_VERSION_STRING "@FULL_VERSION_STRING@"
|
||||
#define OMNITRACE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define OMNITRACE_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define OMNITRACE_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define OMNITRACE_GIT_DESCRIBE "@OMNITRACE_GIT_DESCRIBE@"
|
||||
#define OMNITRACE_GIT_REVISION "@OMNITRACE_GIT_REVISION@"
|
||||
#define ROCPROFSYS_VERSION_STRING "@FULL_VERSION_STRING@"
|
||||
#define ROCPROFSYS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCPROFSYS_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define ROCPROFSYS_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define ROCPROFSYS_GIT_DESCRIBE "@ROCPROFSYS_GIT_DESCRIBE@"
|
||||
#define ROCPROFSYS_GIT_REVISION "@ROCPROFSYS_GIT_REVISION@"
|
||||
|
||||
// system info during compilation
|
||||
#define OMNITRACE_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#define OMNITRACE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define OMNITRACE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#define OMNITRACE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
|
||||
#define ROCPROFSYS_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#define ROCPROFSYS_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define ROCPROFSYS_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#define ROCPROFSYS_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
|
||||
|
||||
// compiler information
|
||||
#define OMNITRACE_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
|
||||
#define OMNITRACE_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
#define OMNITRACE_COMPILER_STRING OMNITRACE_COMPILER_ID " v" OMNITRACE_COMPILER_VERSION
|
||||
#define ROCPROFSYS_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
|
||||
#define ROCPROFSYS_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
#define ROCPROFSYS_COMPILER_STRING ROCPROFSYS_COMPILER_ID " v" ROCPROFSYS_COMPILER_VERSION
|
||||
|
||||
#define OMNITRACE_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
|
||||
#define OMNITRACE_HIP_VERSION_STRING "@OMNITRACE_HIP_VERSION@"
|
||||
#define OMNITRACE_HIP_VERSION_MAJOR @OMNITRACE_HIP_VERSION_MAJOR@
|
||||
#define OMNITRACE_HIP_VERSION_MINOR @OMNITRACE_HIP_VERSION_MINOR@
|
||||
#define OMNITRACE_HIP_VERSION_PATCH @OMNITRACE_HIP_VERSION_PATCH@
|
||||
#define ROCPROFSYS_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
|
||||
#define ROCPROFSYS_HIP_VERSION_STRING "@ROCPROFSYS_HIP_VERSION@"
|
||||
#define ROCPROFSYS_HIP_VERSION_MAJOR @ROCPROFSYS_HIP_VERSION_MAJOR@
|
||||
#define ROCPROFSYS_HIP_VERSION_MINOR @ROCPROFSYS_HIP_VERSION_MINOR@
|
||||
#define ROCPROFSYS_HIP_VERSION_PATCH @ROCPROFSYS_HIP_VERSION_PATCH@
|
||||
|
||||
// these can be set via defining the variable in CMake, e.g.:
|
||||
// cmake -D OMNITRACE_CACHELINE_SIZE=N /path/to/source
|
||||
// cmake -D ROCPROFSYS_CACHELINE_SIZE=N /path/to/source
|
||||
// if not defined when configuring cmake, these values fall back to
|
||||
// default values set in core/containers/aligned_static_vector.hpp.
|
||||
// the OMNITRACE_CACHELINE_SIZE_MIN is used to ensure portability
|
||||
#cmakedefine OMNITRACE_CACHELINE_SIZE @OMNITRACE_CACHELINE_SIZE@
|
||||
#cmakedefine OMNITRACE_CACHELINE_SIZE_MIN @OMNITRACE_CACHELINE_SIZE_MIN@
|
||||
// the ROCPROFSYS_CACHELINE_SIZE_MIN is used to ensure portability
|
||||
#cmakedefine ROCPROFSYS_CACHELINE_SIZE @ROCPROFSYS_CACHELINE_SIZE@
|
||||
#cmakedefine ROCPROFSYS_CACHELINE_SIZE_MIN @ROCPROFSYS_CACHELINE_SIZE_MIN@
|
||||
|
||||
// misc definitions which can be configured by cmake to override the defaults
|
||||
#cmakedefine OMNITRACE_ROCM_MAX_COUNTERS @OMNITRACE_ROCM_MAX_COUNTERS@
|
||||
#cmakedefine ROCPROFSYS_ROCM_MAX_COUNTERS @ROCPROFSYS_ROCM_MAX_COUNTERS@
|
||||
// clang-format on
|
||||
|
||||
#define OMNITRACE_VERSION \
|
||||
((10000 * OMNITRACE_VERSION_MAJOR) + (100 * OMNITRACE_VERSION_MINOR) + \
|
||||
OMNITRACE_VERSION_PATCH)
|
||||
#define ROCPROFSYS_VERSION \
|
||||
((10000 * ROCPROFSYS_VERSION_MAJOR) + (100 * ROCPROFSYS_VERSION_MINOR) + \
|
||||
ROCPROFSYS_VERSION_PATCH)
|
||||
|
||||
#define OMNITRACE_HIP_VERSION \
|
||||
((10000 * OMNITRACE_HIP_VERSION_MAJOR) + (100 * OMNITRACE_HIP_VERSION_MINOR) + \
|
||||
OMNITRACE_HIP_VERSION_PATCH)
|
||||
#define ROCPROFSYS_HIP_VERSION \
|
||||
((10000 * ROCPROFSYS_HIP_VERSION_MAJOR) + (100 * ROCPROFSYS_HIP_VERSION_MINOR) + \
|
||||
ROCPROFSYS_HIP_VERSION_PATCH)
|
||||
|
||||
#if OMNITRACE_HIP_VERSION_MAJOR > 0
|
||||
# define OMNITRACE_HIP_VERSION_COMPAT_STRING \
|
||||
"v@OMNITRACE_HIP_VERSION_MAJOR@.@OMNITRACE_HIP_VERSION_MINOR@.x"
|
||||
#if ROCPROFSYS_HIP_VERSION_MAJOR > 0
|
||||
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
|
||||
"v@ROCPROFSYS_HIP_VERSION_MAJOR@.@ROCPROFSYS_HIP_VERSION_MINOR@.x"
|
||||
#else
|
||||
# define OMNITRACE_HIP_VERSION_COMPAT_STRING ""
|
||||
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING ""
|
||||
#endif
|
||||
|
||||
// this should be passed to argparse::argument_parser::enable_version
|
||||
// Example:
|
||||
// parser.enable_version(<name>, OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
#if !defined(OMNITRACE_ARGPARSE_VERSION_INFO)
|
||||
# define OMNITRACE_ARGPARSE_VERSION_INFO \
|
||||
"v" OMNITRACE_VERSION_STRING, OMNITRACE_GIT_DESCRIBE, OMNITRACE_GIT_REVISION, \
|
||||
// parser.enable_version(<name>, ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
#if !defined(ROCPROFSYS_ARGPARSE_VERSION_INFO)
|
||||
# define ROCPROFSYS_ARGPARSE_VERSION_INFO \
|
||||
"v" ROCPROFSYS_VERSION_STRING, ROCPROFSYS_GIT_DESCRIBE, ROCPROFSYS_GIT_REVISION, \
|
||||
{ \
|
||||
{ "", OMNITRACE_LIBRARY_ARCH }, { "compiler", OMNITRACE_COMPILER_STRING }, \
|
||||
{ "", ROCPROFSYS_LIBRARY_ARCH }, { "compiler", ROCPROFSYS_COMPILER_STRING }, \
|
||||
{ \
|
||||
"rocm", OMNITRACE_HIP_VERSION_COMPAT_STRING \
|
||||
"rocm", ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
#if !defined(OMNITRACE_MAX_THREADS)
|
||||
# define OMNITRACE_MAX_THREADS @OMNITRACE_MAX_THREADS@
|
||||
#if !defined(ROCPROFSYS_MAX_THREADS)
|
||||
# define ROCPROFSYS_MAX_THREADS @ROCPROFSYS_MAX_THREADS@
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_MAX_UNWIND_DEPTH)
|
||||
# define OMNITRACE_MAX_UNWIND_DEPTH @OMNITRACE_MAX_UNWIND_DEPTH@
|
||||
#if !defined(ROCPROFSYS_MAX_UNWIND_DEPTH)
|
||||
# define ROCPROFSYS_MAX_UNWIND_DEPTH @ROCPROFSYS_MAX_UNWIND_DEPTH@
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// in general, we want to make sure the cache line size is not less than
|
||||
// 64 bytes (most common cacheline size for x86-64 CPUs) so unless
|
||||
// OMNITRACE_CACHELINE_SIZE was explicitly set, we set the min to 64
|
||||
// and use the max value of OMNITRACE_CACHELINE_SIZE and
|
||||
// OMNITRACE_CACHELINE_SIZE_MIN to assure that false-sharing is well
|
||||
// ROCPROFSYS_CACHELINE_SIZE was explicitly set, we set the min to 64
|
||||
// and use the max value of ROCPROFSYS_CACHELINE_SIZE and
|
||||
// ROCPROFSYS_CACHELINE_SIZE_MIN to assure that false-sharing is well
|
||||
// guarded against
|
||||
#if !defined(OMNITRACE_CACHELINE_SIZE_MIN)
|
||||
# if defined(OMNITRACE_CACHELINE_SIZE)
|
||||
# define OMNITRACE_CACHELINE_SIZE_MIN OMNITRACE_CACHELINE_SIZE
|
||||
#if !defined(ROCPROFSYS_CACHELINE_SIZE_MIN)
|
||||
# if defined(ROCPROFSYS_CACHELINE_SIZE)
|
||||
# define ROCPROFSYS_CACHELINE_SIZE_MIN ROCPROFSYS_CACHELINE_SIZE
|
||||
# else
|
||||
# define OMNITRACE_CACHELINE_SIZE_MIN 64
|
||||
# define ROCPROFSYS_CACHELINE_SIZE_MIN 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ROCM_MAX_COUNTERS)
|
||||
# define OMNITRACE_ROCM_MAX_COUNTERS 25
|
||||
#if !defined(ROCPROFSYS_ROCM_MAX_COUNTERS)
|
||||
# define ROCPROFSYS_ROCM_MAX_COUNTERS 25
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
|
||||
#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE))
|
||||
#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default")
|
||||
#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden")
|
||||
#define OMNITRACE_INTERNAL_API OMNITRACE_VISIBILITY("internal")
|
||||
#define OMNITRACE_INLINE OMNITRACE_ATTRIBUTE(always_inline) inline
|
||||
#define OMNITRACE_NOINLINE OMNITRACE_ATTRIBUTE(noinline)
|
||||
#define OMNITRACE_HOT OMNITRACE_ATTRIBUTE(hot)
|
||||
#define OMNITRACE_COLD OMNITRACE_ATTRIBUTE(cold)
|
||||
#define OMNITRACE_CONST OMNITRACE_ATTRIBUTE(const)
|
||||
#define OMNITRACE_PURE OMNITRACE_ATTRIBUTE(pure)
|
||||
#define OMNITRACE_WEAK OMNITRACE_ATTRIBUTE(weak)
|
||||
#define OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__packed__)
|
||||
#define OMNITRACE_PACKED_ALIGN(VAL) OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__aligned__(VAL))
|
||||
#define OMNITRACE_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
|
||||
#define OMNITRACE_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
|
||||
#define ROCPROFSYS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
|
||||
#define ROCPROFSYS_VISIBILITY(MODE) ROCPROFSYS_ATTRIBUTE(visibility(MODE))
|
||||
#define ROCPROFSYS_PUBLIC_API ROCPROFSYS_VISIBILITY("default")
|
||||
#define ROCPROFSYS_HIDDEN_API ROCPROFSYS_VISIBILITY("hidden")
|
||||
#define ROCPROFSYS_INTERNAL_API ROCPROFSYS_VISIBILITY("internal")
|
||||
#define ROCPROFSYS_INLINE ROCPROFSYS_ATTRIBUTE(always_inline) inline
|
||||
#define ROCPROFSYS_NOINLINE ROCPROFSYS_ATTRIBUTE(noinline)
|
||||
#define ROCPROFSYS_HOT ROCPROFSYS_ATTRIBUTE(hot)
|
||||
#define ROCPROFSYS_COLD ROCPROFSYS_ATTRIBUTE(cold)
|
||||
#define ROCPROFSYS_CONST ROCPROFSYS_ATTRIBUTE(const)
|
||||
#define ROCPROFSYS_PURE ROCPROFSYS_ATTRIBUTE(pure)
|
||||
#define ROCPROFSYS_WEAK ROCPROFSYS_ATTRIBUTE(weak)
|
||||
#define ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__packed__)
|
||||
#define ROCPROFSYS_PACKED_ALIGN(VAL) \
|
||||
ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__aligned__(VAL))
|
||||
#define ROCPROFSYS_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
|
||||
#define ROCPROFSYS_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
|
||||
|
||||
#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0
|
||||
#if defined(ROCPROFSYS_CI) && ROCPROFSYS_CI > 0
|
||||
# if defined(NDEBUG)
|
||||
# undef NDEBUG
|
||||
# endif
|
||||
@@ -147,15 +148,15 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_STRINGIZE(X) OMNITRACE_STRINGIZE2(X)
|
||||
#define OMNITRACE_STRINGIZE2(X) #X
|
||||
#define OMNITRACE_VAR_NAME_COMBINE(X, Y) X##Y
|
||||
#define OMNITRACE_VARIABLE(X, Y) OMNITRACE_VAR_NAME_COMBINE(X, Y)
|
||||
#define OMNITRACE_LINESTR OMNITRACE_STRINGIZE(__LINE__)
|
||||
#define OMNITRACE_ESC(...) __VA_ARGS__
|
||||
#define ROCPROFSYS_STRINGIZE(X) ROCPROFSYS_STRINGIZE2(X)
|
||||
#define ROCPROFSYS_STRINGIZE2(X) #X
|
||||
#define ROCPROFSYS_VAR_NAME_COMBINE(X, Y) X##Y
|
||||
#define ROCPROFSYS_VARIABLE(X, Y) ROCPROFSYS_VAR_NAME_COMBINE(X, Y)
|
||||
#define ROCPROFSYS_LINESTR ROCPROFSYS_STRINGIZE(__LINE__)
|
||||
#define ROCPROFSYS_ESC(...) __VA_ARGS__
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# if !defined(OMNITRACE_FOLD_EXPRESSION)
|
||||
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
# if !defined(ROCPROFSYS_FOLD_EXPRESSION)
|
||||
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
# endif
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -120,4 +120,4 @@ delimit(const std::string& line, const char* delimiters)
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -34,47 +34,48 @@
|
||||
#include <type_traits>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_ENVIRON_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_NAME
|
||||
# define ROCPROFSYS_ENVIRON_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_ENVIRON_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_ENVIRON_LOG_START \
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_START
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_ENVIRON_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_ENVIRON_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END \
|
||||
fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_END
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_ENVIRON_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_ENVIRON_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_ENVIRON_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_ENVIRON_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_ENVIRON_LOG_END \
|
||||
ROCPROFSYS_ENVIRON_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -108,7 +109,7 @@ get_env_impl(std::string_view env_id, int _default)
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"[omnitrace][get_env] Exception thrown converting getenv(\"%s\") = "
|
||||
"[rocprof-sys][get_env] Exception thrown converting getenv(\"%s\") = "
|
||||
"%s to integer :: %s. Using default value of %i\n",
|
||||
env_id.data(), env_var, _e.what(), _default);
|
||||
}
|
||||
@@ -162,7 +163,7 @@ get_env(std::string_view env_id, Tp&& _default)
|
||||
}
|
||||
}
|
||||
|
||||
struct OMNITRACE_INTERNAL_API env_config
|
||||
struct ROCPROFSYS_INTERNAL_API env_config
|
||||
{
|
||||
std::string env_name = {};
|
||||
std::string env_value = {};
|
||||
@@ -171,10 +172,10 @@ struct OMNITRACE_INTERNAL_API env_config
|
||||
auto operator()(bool _verbose = false) const
|
||||
{
|
||||
if(env_name.empty()) return -1;
|
||||
OMNITRACE_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
|
||||
env_value.c_str(), override);
|
||||
ROCPROFSYS_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
|
||||
env_value.c_str(), override);
|
||||
return setenv(env_name.c_str(), env_value.c_str(), override);
|
||||
}
|
||||
};
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,20 +31,20 @@
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_COMMON_LIBRARY_NAME "common"
|
||||
# error OMNITRACE_COMMON_LIBRARY_NAME must be defined
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_NAME "common"
|
||||
# error ROCPROFSYS_COMMON_LIBRARY_NAME must be defined
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
#endif
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace
|
||||
{
|
||||
template <typename FuncT, typename... Args>
|
||||
inline auto
|
||||
invoke(const char* _name, FuncT&& _func, Args... _args) OMNITRACE_HIDDEN_API;
|
||||
invoke(const char* _name, FuncT&& _func, Args... _args) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
inline int32_t&
|
||||
get_guard()
|
||||
@@ -77,7 +77,7 @@ ignore(const char* _name, int _verbose, int _value, const char* _reason, Args...
|
||||
{
|
||||
fflush(stderr);
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) was ignored :: %s\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str(), _reason);
|
||||
@@ -107,13 +107,13 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
if(_verbose >= 3)
|
||||
{
|
||||
fflush(stderr);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li][%i] %s(%s)\n",
|
||||
getpid(), get_thread_index(), _lk, _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str());
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
fflush(stderr);
|
||||
}
|
||||
return std::invoke(std::forward<FuncT>(_func), _args...);
|
||||
@@ -121,25 +121,25 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
else if(_verbose >= 2)
|
||||
{
|
||||
fflush(stderr);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) was guarded :: value = %i\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str(), _lk);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
else if(_verbose >= 0)
|
||||
{
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) ignored :: null function pointer\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str());
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
}
|
||||
|
||||
using return_type = decltype(std::invoke(std::forward<FuncT>(_func), _args...));
|
||||
@@ -147,4 +147,4 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,11 +31,11 @@
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(OMNITRACE_FOLD_EXPRESSION)
|
||||
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
#if !defined(ROCPROFSYS_FOLD_EXPRESSION)
|
||||
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
#endif
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -99,13 +99,13 @@ join(DelimT&& _delim, Args&&... _args)
|
||||
if constexpr(std::is_same<delim_type, char>::value)
|
||||
{
|
||||
const char _delim_c[2] = { _delim, '\0' };
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << _args);
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << _args);
|
||||
auto _ret = _ss.str();
|
||||
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
|
||||
}
|
||||
else
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << _args);
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << _args);
|
||||
auto _ret = _ss.str();
|
||||
auto&& _len = std::string{ _delim }.length();
|
||||
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
|
||||
@@ -127,13 +127,13 @@ join(QuoteStrings&&, DelimT&& _delim, Args&&... _args)
|
||||
if constexpr(std::is_same<delim_type, char>::value)
|
||||
{
|
||||
const char _delim_c[2] = { _delim, '\0' };
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
|
||||
auto _ret = _ss.str();
|
||||
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
|
||||
}
|
||||
else
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
|
||||
auto _ret = _ss.str();
|
||||
auto&& _len = std::string{ _delim }.length();
|
||||
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
|
||||
@@ -177,4 +177,4 @@ join(QuoteStrings&&, std::tuple<DelimB, DelimT, DelimE>&& _delim, Args&&... _arg
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -38,46 +38,47 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_PATH_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_PATH_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_NAME
|
||||
# define ROCPROFSYS_PATH_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_PATH_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_PATH_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_PATH_LOG_START fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# define ROCPROFSYS_PATH_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_START
|
||||
# define ROCPROFSYS_PATH_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_PATH_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_PATH_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_END
|
||||
# define ROCPROFSYS_PATH_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_PATH_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_PATH_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_PATH_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_PATH_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_PATH_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_PATH_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_PATH_LOG_END \
|
||||
ROCPROFSYS_PATH_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -85,45 +86,45 @@ namespace path
|
||||
{
|
||||
inline std::vector<std::string>
|
||||
get_link_map(const char*, std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) },
|
||||
bool _include_self = false) OMNITRACE_INTERNAL_API;
|
||||
bool _include_self = false) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline auto
|
||||
get_link_map(const char* _name, bool&& _include_self,
|
||||
std::vector<int>&& _open_modes = {
|
||||
(RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
|
||||
(RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
get_origin(const std::string&,
|
||||
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
|
||||
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
exists(const std::string& _fname) OMNITRACE_INTERNAL_API;
|
||||
exists(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
template <typename RetT = std::string>
|
||||
inline RetT
|
||||
get_default_lib_search_paths() OMNITRACE_INTERNAL_API;
|
||||
get_default_lib_search_paths() ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
find_path(const std::string& _path, int _verbose,
|
||||
const std::string& _search_paths = {}) OMNITRACE_INTERNAL_API;
|
||||
const std::string& _search_paths = {}) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
dirname(const std::string& _fname) OMNITRACE_INTERNAL_API;
|
||||
dirname(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
realpath(const std::string& _relpath,
|
||||
std::string* _resolved = nullptr) OMNITRACE_INTERNAL_API;
|
||||
std::string* _resolved = nullptr) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
is_text_file(const std::string& filename) OMNITRACE_INTERNAL_API;
|
||||
is_text_file(const std::string& filename) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
is_link(const std::string& _path) OMNITRACE_INTERNAL_API;
|
||||
is_link(const std::string& _path) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
readlink(const std::string& _path) OMNITRACE_INTERNAL_API;
|
||||
readlink(const std::string& _path) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
struct OMNITRACE_INTERNAL_API path_type
|
||||
struct ROCPROFSYS_INTERNAL_API path_type
|
||||
{
|
||||
enum path_type_e
|
||||
{
|
||||
@@ -181,8 +182,9 @@ template <typename RetT>
|
||||
RetT
|
||||
get_default_lib_search_paths()
|
||||
{
|
||||
auto _paths = join(":", get_env("OMNITRACE_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
|
||||
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
|
||||
auto _paths =
|
||||
join(":", get_env("ROCPROFSYS_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
|
||||
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
|
||||
if constexpr(std::is_same<RetT, std::string>::value)
|
||||
return _paths;
|
||||
else
|
||||
@@ -204,13 +206,13 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
|
||||
for(const auto& itr : _paths)
|
||||
{
|
||||
auto _f = join('/', itr, _path);
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
if(exists(_f))
|
||||
{
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
|
||||
_path.c_str(), itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
|
||||
_path.c_str(), itr.c_str());
|
||||
return _f;
|
||||
}
|
||||
}
|
||||
@@ -224,14 +226,14 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
|
||||
for(const auto* sitr : { "lib", "lib64", "../lib", "../lib64" })
|
||||
{
|
||||
auto _f = join('/', dirname(itr), sitr, _path);
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
common::join('/', itr, sitr).c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
common::join('/', itr, sitr).c_str());
|
||||
if(exists(_f))
|
||||
{
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl,
|
||||
"found '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl,
|
||||
"found '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
return _f;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +319,7 @@ is_text_file(const std::string& filename)
|
||||
std::ifstream _file{ filename, std::ios::in | std::ios::binary };
|
||||
if(!_file.is_open())
|
||||
{
|
||||
OMNITRACE_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
|
||||
ROCPROFSYS_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -411,4 +413,4 @@ get_origin(const std::string& _filename, std::vector<int>&& _open_modes)
|
||||
}
|
||||
} // namespace path
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -41,54 +41,54 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_SETUP_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_SETUP_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_NAME
|
||||
# define ROCPROFSYS_SETUP_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_SETUP_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_SETUP_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_SETUP_LOG_START \
|
||||
# define ROCPROFSYS_SETUP_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_START
|
||||
# define ROCPROFSYS_SETUP_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_SETUP_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_SETUP_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_END
|
||||
# define ROCPROFSYS_SETUP_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_SETUP_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_SETUP_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_SETUP_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_SETUP_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_SETUP_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_SETUP_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_SETUP_LOG_END \
|
||||
ROCPROFSYS_SETUP_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
inline std::vector<env_config>
|
||||
get_environ(int _verbose, std::string _search_paths = {},
|
||||
std::string _omnilib = "libomnitrace.so",
|
||||
std::string _omnilib_dl = "libomnitrace-dl.so")
|
||||
std::string _omnilib = "librocprof-sys.so",
|
||||
std::string _omnilib_dl = "librocprof-sys-dl.so")
|
||||
{
|
||||
auto _data = std::vector<env_config>{};
|
||||
auto _omnilib_path = path::get_origin(_omnilib);
|
||||
@@ -109,17 +109,17 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
_omnilib = common::path::find_path(_omnilib, _verbose, _search_paths);
|
||||
_omnilib_dl = common::path::find_path(_omnilib_dl, _verbose, _search_paths);
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0
|
||||
_data.emplace_back(env_config{ "HSA_TOOLS_LIB", _omnilib.c_str(), 0 });
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0
|
||||
# if OMNITRACE_HIP_VERSION >= 50200
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0
|
||||
# if ROCPROFSYS_HIP_VERSION >= 50200
|
||||
# define ROCPROFILER_METRICS_DIR "lib/rocprofiler"
|
||||
# else
|
||||
# define ROCPROFILER_METRICS_DIR "rocprofiler/lib"
|
||||
# endif
|
||||
# if OMNITRACE_HIP_VERSION <= 50500
|
||||
# if ROCPROFSYS_HIP_VERSION <= 50500
|
||||
# define ROCPROFILER_LIBNAME "librocprofiler64.so"
|
||||
# else
|
||||
# define ROCPROFILER_LIBNAME "librocprofiler64.so.1"
|
||||
@@ -133,7 +133,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
auto _possible_rocp_metrics = std::vector<std::string>{};
|
||||
auto _possible_rocprof_libs = std::vector<std::string>{};
|
||||
for(const auto* itr : { "OMNITRACE_ROCM_PATH", "ROCM_PATH" })
|
||||
for(const auto* itr : { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" })
|
||||
{
|
||||
if(getenv(itr))
|
||||
{
|
||||
@@ -150,9 +150,9 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
// default path
|
||||
_possible_rocp_metrics.emplace_back(
|
||||
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
|
||||
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
|
||||
_possible_rocp_metrics.emplace_back(
|
||||
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
|
||||
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
|
||||
|
||||
auto _realpath_and_unique = [](const auto& _inp_v) {
|
||||
auto _out_v = decltype(_inp_v){};
|
||||
@@ -172,7 +172,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
if(path::exists(itr))
|
||||
{
|
||||
_data.emplace_back(
|
||||
env_config{ "OMNITRACE_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
|
||||
env_config{ "ROCPROFSYS_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
|
||||
_possible_rocp_metrics.emplace(
|
||||
_possible_rocp_metrics.begin(),
|
||||
common::join('/', path::dirname(itr), "../../lib/rocprofiler"));
|
||||
@@ -195,7 +195,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
}
|
||||
|
||||
auto _found_rocp_metrics = (!_env_rocp_metrics.empty())
|
||||
? get_env("OMNITRACE_ROCP_METRICS_FORCE_VALID", false)
|
||||
? get_env("ROCPROFSYS_ROCP_METRICS_FORCE_VALID", false)
|
||||
: false;
|
||||
|
||||
if(!_found_rocp_metrics)
|
||||
@@ -232,26 +232,27 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
<< path::exists(_rocp_metrics_xml) << ") and/or gfx_metrics.xml (found: "
|
||||
<< path::exists(_rocp_gfx_metrics_xml)
|
||||
<< "). To ignore this error, set "
|
||||
"OMNITRACE_ROCP_METRICS_FORCE_VALID=true in the environment";
|
||||
"ROCPROFSYS_ROCP_METRICS_FORCE_VALID=true in the environment";
|
||||
}
|
||||
else
|
||||
{
|
||||
_msg << "Error! ROCP_METRICS not set in environment and OmniTrace could not "
|
||||
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
|
||||
"in the environment. This file is typically located in the same "
|
||||
"folder as the librocprofiler64.so library.\nAdditional note: "
|
||||
"metrics.xml typically contains:\n\t#include "
|
||||
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
|
||||
"file.\nExample:\n\texport ROCP_METRICS="
|
||||
<< OMNITRACE_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
|
||||
<< "/metrics.xml\n";
|
||||
_msg
|
||||
<< "Error! ROCP_METRICS not set in environment and rocprof-sys could not "
|
||||
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
|
||||
"in the environment. This file is typically located in the same "
|
||||
"folder as the librocprofiler64.so library.\nAdditional note: "
|
||||
"metrics.xml typically contains:\n\t#include "
|
||||
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
|
||||
"file.\nExample:\n\texport ROCP_METRICS="
|
||||
<< ROCPROFSYS_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
|
||||
<< "/metrics.xml\n";
|
||||
}
|
||||
throw std::runtime_error(_msg.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0
|
||||
if(get_env("OMNITRACE_USE_OMPT", true))
|
||||
#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0
|
||||
if(get_env("ROCPROFSYS_USE_OMPT", true))
|
||||
{
|
||||
std::string _omni_omp_libs = _omnilib_dl;
|
||||
const char* _omp_libs = getenv("OMP_TOOL_LIBRARIES");
|
||||
@@ -262,8 +263,8 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
_override = 1;
|
||||
_omni_omp_libs = common::join(':', _omp_libs, _omnilib_dl);
|
||||
}
|
||||
OMNITRACE_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
|
||||
_omni_omp_libs.c_str());
|
||||
ROCPROFSYS_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
|
||||
_omni_omp_libs.c_str());
|
||||
_data.emplace_back(
|
||||
env_config{ "OMP_TOOL_LIBRARIES", _omni_omp_libs.c_str(), _override });
|
||||
}
|
||||
@@ -274,8 +275,8 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
inline void
|
||||
setup_environ(int _verbose, const std::string& _search_paths = {},
|
||||
std::string _omnilib = "libomnitrace.so",
|
||||
std::string _omnilib_dl = "libomnitrace-dl.so")
|
||||
std::string _omnilib = "librocprof-sys.so",
|
||||
std::string _omnilib_dl = "librocprof-sys-dl.so")
|
||||
{
|
||||
auto _data =
|
||||
get_environ(_verbose, _search_paths, std::move(_omnilib), std::move(_omnilib_dl));
|
||||
@@ -283,4 +284,4 @@ setup_environ(int _verbose, const std::string& _search_paths = {},
|
||||
itr(_verbose >= 3);
|
||||
}
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -40,36 +40,40 @@ set(core_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/timemory.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.hpp)
|
||||
|
||||
add_library(omnitrace-core-library STATIC)
|
||||
add_library(omnitrace::omnitrace-core ALIAS omnitrace-core-library)
|
||||
add_library(rocprofiler-systems-core-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-core ALIAS
|
||||
rocprofiler-systems-core-library)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${core_sources} ${core_headers}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library PRIVATE ${core_sources} ${core_headers}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
add_subdirectory(binary)
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(containers)
|
||||
|
||||
target_include_directories(omnitrace-core-library BEFORE
|
||||
target_include_directories(rocprofiler-systems-core-library BEFORE
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
target_link_libraries(omnitrace-core-library
|
||||
PRIVATE omnitrace::omnitrace-interface-library)
|
||||
target_link_libraries(rocprofiler-systems-core-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
|
||||
target_link_libraries(
|
||||
omnitrace-core-library
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-headers>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-threading>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-common-library>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-options>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-perfetto>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-timemory>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-mpi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-hip>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocm-smi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${OMNITRACE_BUILD_LTO}>,omnitrace::omnitrace-lto,>>)
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-headers>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-options>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-perfetto>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-timemory>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-hip>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm-smi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
|
||||
set_target_properties(omnitrace-core-library PROPERTIES OUTPUT_NAME omnitrace-core)
|
||||
set_target_properties(rocprofiler-systems-core-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core)
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <timemory/utility/filepath.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace argparse
|
||||
{
|
||||
@@ -56,25 +56,25 @@ get_clock_id_choices()
|
||||
return _v;
|
||||
};
|
||||
|
||||
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
||||
#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \
|
||||
std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL })
|
||||
|
||||
auto _choices = strvec_t{};
|
||||
auto _aliases = std::map<std::string, strvec_t>{};
|
||||
for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
for(auto itr : { ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
{
|
||||
auto _choice = std::to_string(std::get<1>(itr));
|
||||
_choices.emplace_back(_choice);
|
||||
_aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } };
|
||||
}
|
||||
|
||||
#undef OMNITRACE_CLOCK_IDENTIFIER
|
||||
#undef ROCPROFSYS_CLOCK_IDENTIFIER
|
||||
|
||||
return std::make_pair(_choices, _aliases);
|
||||
}
|
||||
@@ -137,13 +137,13 @@ update_env(parser_data& _data, std::string_view _env_var, Tp&& _env_val,
|
||||
else
|
||||
{
|
||||
free(itr);
|
||||
itr = strdup(omnitrace::common::join('=', _env_var, _env_val).c_str());
|
||||
itr = strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
_data.current.emplace_back(
|
||||
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
||||
strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -171,7 +171,7 @@ get_internal_libpath(const std::string& _lib)
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = filepath::get_cwd();
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return filepath::realpath(omnitrace::common::join("/", _dir, "..", "lib", _lib),
|
||||
return filepath::realpath(rocprofsys::common::join("/", _dir, "..", "lib", _lib),
|
||||
nullptr, false);
|
||||
}
|
||||
} // namespace
|
||||
@@ -219,21 +219,21 @@ init_parser(parser_data& _data)
|
||||
}
|
||||
}
|
||||
|
||||
_data.dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so").c_str());
|
||||
_data.omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so").c_str());
|
||||
_data.dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so").c_str());
|
||||
_data.omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so").c_str());
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) || defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "HSA_TOOLS_LIB", _data.dl_libpath);
|
||||
if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE"))
|
||||
update_env(_data, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "ROCP_TOOL_LIB", _data.omni_libpath);
|
||||
if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_data, "ROCP_HSA_INTERCEPT", "1");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_OMPT)
|
||||
#if defined(ROCPROFSYS_USE_OMPT)
|
||||
if(!getenv("OMP_TOOL_LIBRARIES"))
|
||||
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath, UPD_PREPEND);
|
||||
#endif
|
||||
@@ -305,7 +305,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
? strvec_t{ "hsa-interrupt" }
|
||||
: strvec_t{};
|
||||
|
||||
#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0
|
||||
#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0
|
||||
_realtime_reqs.clear();
|
||||
#endif
|
||||
|
||||
@@ -325,7 +325,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _monochrome = p.get<bool>("monochrome");
|
||||
_data.monochrome = _monochrome;
|
||||
p.set_use_color(!_monochrome);
|
||||
update_env(_data, "OMNITRACE_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_data, "ROCPROFSYS_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_data, "MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
});
|
||||
|
||||
@@ -337,7 +337,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
_parser.add_argument({ "--debug" }, "Debug output")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_DEBUG", p.get<bool>("debug"));
|
||||
update_env(_data, "ROCPROFSYS_DEBUG", p.get<bool>("debug"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("debug");
|
||||
@@ -351,7 +351,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<int>("verbose");
|
||||
_data.verbose = _v;
|
||||
update_env(_data, "OMNITRACE_VERBOSE", _v);
|
||||
update_env(_data, "ROCPROFSYS_VERBOSE", _v);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("verbose");
|
||||
@@ -369,7 +369,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_CONFIG_FILE",
|
||||
update_env(_data, "ROCPROFSYS_CONFIG_FILE",
|
||||
join(array_config_t{ ":" }, p.get<strvec_t>("config")));
|
||||
});
|
||||
|
||||
@@ -389,8 +389,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("path [prefix]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strvec_t>("output");
|
||||
update_env(_data, "OMNITRACE_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "OMNITRACE_OUTPUT_PREFIX", _v.at(1));
|
||||
update_env(_data, "ROCPROFSYS_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "ROCPROFSYS_OUTPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("output");
|
||||
@@ -405,7 +405,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"Generate a detailed trace (perfetto output)")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE", p.get<bool>("trace"));
|
||||
update_env(_data, "ROCPROFSYS_TRACE", p.get<bool>("trace"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("trace");
|
||||
@@ -420,7 +420,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.max_count(1)
|
||||
.conflicts({ "flat-profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("profile"));
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", p.get<bool>("profile"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("profile");
|
||||
@@ -434,8 +434,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.max_count(1)
|
||||
.conflicts({ "profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "ROCPROFSYS_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("flat_profile");
|
||||
@@ -451,13 +451,13 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("timer-type")
|
||||
.choices({ "cputime", "realtime" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_USE_SAMPLING", true);
|
||||
update_env(_data, "ROCPROFSYS_USE_SAMPLING", true);
|
||||
auto _modes = p.get<strset_t>("sample");
|
||||
if(!_modes.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME",
|
||||
_modes.count("cputime") > 0, UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME",
|
||||
_modes.count("realtime") > 0, UPD_WEAK);
|
||||
}
|
||||
});
|
||||
@@ -475,8 +475,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "OMNITRACE_CPU_FREQ_ENABLED", _h);
|
||||
update_env(_data, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "ROCPROFSYS_CPU_FREQ_ENABLED", _h);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("host");
|
||||
@@ -494,8 +494,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "OMNITRACE_USE_ROCM_SMI", _d);
|
||||
update_env(_data, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCM_SMI", _d);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("device");
|
||||
@@ -512,11 +512,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_CAUSAL_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_CAUSAL_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
});
|
||||
|
||||
@@ -533,11 +533,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DURATION", p.get<double>("duration"),
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DURATION", p.get<double>("duration"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DURATION",
|
||||
p.get<double>("duration"), UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_CAUSAL_DURATION", p.get<double>("duration"),
|
||||
update_env(_data, "ROCPROFSYS_CAUSAL_DURATION", p.get<double>("duration"),
|
||||
UPD_WEAK);
|
||||
});
|
||||
|
||||
@@ -555,7 +555,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "OMNITRACE_TRACE_PERIODS",
|
||||
_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ " ", "", "" }, p.get<strvec_t>("periods")),
|
||||
UPD_WEAK);
|
||||
});
|
||||
@@ -567,28 +567,28 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"rcclp", "rocm-smi", "roctracer", "rocprofiler",
|
||||
"roctx", "mutex-locks", "spin-locks", "rw-locks" };
|
||||
|
||||
#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS)
|
||||
#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
_backend_choices.erase("mpip");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_OMPT)
|
||||
#if !defined(ROCPROFSYS_USE_OMPT)
|
||||
_backend_choices.erase("ompt");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL)
|
||||
_backend_choices.erase("rcclp");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
#if !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
_backend_choices.erase("rocm-smi");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
_backend_choices.erase("rocprofiler");
|
||||
#endif
|
||||
|
||||
@@ -599,25 +599,25 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("rocprofiler");
|
||||
|
||||
#if defined(OMNITRACE_USE_RCCL)
|
||||
update_env(_data, "OMNITRACE_USE_RCCLP", false);
|
||||
#if defined(ROCPROFSYS_USE_RCCL)
|
||||
update_env(_data, "ROCPROFSYS_USE_RCCLP", false);
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCM_SMI)
|
||||
update_env(_data, "OMNITRACE_USE_ROCM_SMI", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCM_SMI", false);
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER)
|
||||
update_env(_data, "OMNITRACE_USE_ROCTRACER", false);
|
||||
update_env(_data, "OMNITRACE_USE_ROCTX", false);
|
||||
update_env(_data, "OMNITRACE_ROCTRACER_HSA_ACTIVITY", false);
|
||||
update_env(_data, "OMNITRACE_ROCTRACER_HIP_ACTIVITY", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCTRACER", false);
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCTX", false);
|
||||
update_env(_data, "ROCPROFSYS_ROCTRACER_HSA_ACTIVITY", false);
|
||||
update_env(_data, "ROCPROFSYS_ROCTRACER_HIP_ACTIVITY", false);
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
update_env(_data, "OMNITRACE_USE_ROCPROFILER", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCPROFILER", false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -637,17 +637,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_data, _opt, true);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_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_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("ompt") > 0)
|
||||
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath,
|
||||
@@ -673,17 +673,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_data, _opt, false);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_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_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))
|
||||
@@ -746,7 +746,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_FILE",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_FILE",
|
||||
p.get<std::string>("trace-file"));
|
||||
});
|
||||
|
||||
@@ -762,7 +762,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("KB")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_BUFFER_SIZE_KB",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB",
|
||||
p.get<int64_t>("trace-buffer-size"));
|
||||
});
|
||||
|
||||
@@ -777,7 +777,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("policy")
|
||||
.choices({ "discard", "ring_buffer" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_FILL_POLICY",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_FILL_POLICY",
|
||||
p.get<std::string>("trace-fill-policy"));
|
||||
});
|
||||
|
||||
@@ -797,7 +797,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("trace_delay");
|
||||
@@ -814,7 +814,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DURATION",
|
||||
p.get<double>("trace-duration"));
|
||||
});
|
||||
|
||||
@@ -833,7 +833,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_PERIODS",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ ",", "", "" },
|
||||
p.get<strvec_t>("trace-periods")));
|
||||
});
|
||||
@@ -855,11 +855,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"active "
|
||||
"threads would equate to ~1 second of realtime. If this proves to be "
|
||||
"difficult to handle in practice, please file a feature request for "
|
||||
"omnitrace to auto-scale based on the number of threads.")
|
||||
"rocprof-sys to auto-scale based on the number of threads.")
|
||||
.count(1)
|
||||
.dtype("clock-id")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_PERIOD_CLOCK_ID",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIOD_CLOCK_ID",
|
||||
p.get<double>("trace-clock-id"));
|
||||
})
|
||||
.choices(_clock_id_choices.first)
|
||||
@@ -883,12 +883,12 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.choices({ "text", "json", "console" })
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strset_t>("profile-format");
|
||||
update_env(_data, "OMNITRACE_PROFILE", true);
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_data, "OMNITRACE_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_data, "OMNITRACE_COUT_OUTPUT", _v.count("console") != 0);
|
||||
update_env(_data, "ROCPROFSYS_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_data, "ROCPROFSYS_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_data, "ROCPROFSYS_COUT_OUTPUT", _v.count("console") != 0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -911,9 +911,9 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("path [prefix]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strvec_t>("profile-diff");
|
||||
update_env(_data, "OMNITRACE_DIFF_OUTPUT", true);
|
||||
update_env(_data, "OMNITRACE_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "OMNITRACE_INPUT_PREFIX", _v.at(1));
|
||||
update_env(_data, "ROCPROFSYS_DIFF_OUTPUT", true);
|
||||
update_env(_data, "ROCPROFSYS_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "ROCPROFSYS_INPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("profile_diff");
|
||||
@@ -936,7 +936,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("floating-point")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_FREQ",
|
||||
update_env(_data, "ROCPROFSYS_PROCESS_SAMPLING_FREQ",
|
||||
p.get<double>("process-freq"));
|
||||
});
|
||||
|
||||
@@ -953,7 +953,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_DELAY",
|
||||
update_env(_data, "ROCPROFSYS_PROCESS_SAMPLING_DELAY",
|
||||
p.get<double>("process-wait"));
|
||||
});
|
||||
|
||||
@@ -970,7 +970,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_PROCESS_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_PROCESS_DURATION",
|
||||
p.get<double>("process-duration"));
|
||||
});
|
||||
|
||||
@@ -987,7 +987,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.required({ "host" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("cpus")));
|
||||
});
|
||||
|
||||
@@ -1003,7 +1003,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.required({ "device" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_GPUS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_GPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("gpus")));
|
||||
});
|
||||
|
||||
@@ -1023,7 +1023,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("floating-point")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_FREQ",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_FREQ",
|
||||
p.get<double>("sampling-freq"));
|
||||
});
|
||||
|
||||
@@ -1042,7 +1042,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "OMNITRACE_SAMPLING_TIDS",
|
||||
_data, "ROCPROFSYS_SAMPLING_TIDS",
|
||||
join(array_config_t{ ", " }, p.get<std::vector<int64_t>>("tids")));
|
||||
});
|
||||
|
||||
@@ -1063,7 +1063,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DELAY",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DELAY",
|
||||
p.get<double>("sampling-wait"));
|
||||
});
|
||||
|
||||
@@ -1082,7 +1082,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DURATION",
|
||||
p.get<double>("sampling-duration"));
|
||||
});
|
||||
|
||||
@@ -1100,20 +1100,20 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("[freq] [delay] [tids...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-cputime");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1129,20 +1129,20 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.required(std::move(_realtime_reqs))
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-realtime");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1157,7 +1157,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("[event] [freq] [tids...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-overflow");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW", true);
|
||||
|
||||
if(!_v.empty())
|
||||
{
|
||||
@@ -1167,17 +1167,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"", "'--sample-overflow ", _v.front(),
|
||||
" ...' conflicts with '--sampling-overflow-event ",
|
||||
p.get<std::string>("sampling-overflow-event"), "' option"));
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_EVENT", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1191,37 +1191,37 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
|
||||
add_group_arguments(_parser, "sampling", _data);
|
||||
|
||||
_parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H");
|
||||
_parser.start_group("HARDWARE COUNTER OPTIONS", "See also: rocprof-sys-avail -H");
|
||||
|
||||
if(_data.environ_filter("cpu_events", _data))
|
||||
{
|
||||
_parser
|
||||
.add_argument({ "-C", "--cpu-events" },
|
||||
"Set the CPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c CPU`)")
|
||||
"`rocprof-sys-avail -H -c CPU`)")
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("cpu-events"));
|
||||
update_env(_data, "OMNITRACE_PAPI_EVENTS", _events);
|
||||
update_env(_data, "ROCPROFSYS_PAPI_EVENTS", _events);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("cpu_events");
|
||||
_data.processed_environs.emplace("papi_events");
|
||||
}
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
if(_data.environ_filter("gpu_events", _data))
|
||||
{
|
||||
_parser
|
||||
.add_argument({ "-G", "--gpu-events" },
|
||||
"Set the GPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c GPU`)")
|
||||
"`rocprof-sys-avail -H -c GPU`)")
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("gpu-events"));
|
||||
update_env(_data, "OMNITRACE_ROCM_EVENTS", _events);
|
||||
update_env(_data, "ROCPROFSYS_ROCM_EVENTS", _events);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("gpu_events");
|
||||
@@ -1244,7 +1244,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"Include inline info in output when available")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_INCLUDE_INLINES",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_INCLUDE_INLINES",
|
||||
p.get<bool>("inlines"));
|
||||
});
|
||||
|
||||
@@ -1328,9 +1328,9 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
};
|
||||
|
||||
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
||||
for(auto& itr : *omnitrace::settings::instance())
|
||||
for(auto& itr : *rocprofsys::settings::instance())
|
||||
{
|
||||
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
||||
if(itr.second->get_categories().count("rocprofsys") == 0) continue;
|
||||
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
||||
if(itr.second->get_hidden()) continue;
|
||||
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
||||
@@ -1353,7 +1353,7 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
}),
|
||||
_choices.end());
|
||||
_choices.emplace_back(
|
||||
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
||||
"... run `rocprof-sys-avail -H -c CPU` for full list ...");
|
||||
itr.second->set_choices(_choices);
|
||||
}
|
||||
}
|
||||
@@ -1390,9 +1390,9 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
{
|
||||
auto _category_count_map = std::unordered_map<std::string, uint32_t>{};
|
||||
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
||||
for(auto& itr : *omnitrace::settings::instance())
|
||||
for(auto& itr : *rocprofsys::settings::instance())
|
||||
{
|
||||
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
||||
if(itr.second->get_categories().count("rocprofsys") == 0) continue;
|
||||
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
||||
if(itr.second->get_hidden()) continue;
|
||||
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
||||
@@ -1414,15 +1414,14 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
}),
|
||||
_choices.end());
|
||||
_choices.emplace_back(
|
||||
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
||||
"... run `rocprof-sys-avail -H -c CPU` for full list ...");
|
||||
itr.second->set_choices(_choices);
|
||||
}
|
||||
|
||||
for(const auto& citr : itr.second->get_categories())
|
||||
{
|
||||
if(std::regex_search(
|
||||
citr, std::regex{
|
||||
"omnitrace|timemory|^(native|custom|advanced|analysis)$" }))
|
||||
if(std::regex_search(citr, std::regex{ "rocprofsys|timemory|^("
|
||||
"native|custom|advanced|analysis)$" }))
|
||||
continue;
|
||||
_category_count_map[citr] += 1;
|
||||
}
|
||||
@@ -1467,4 +1466,4 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
return _data;
|
||||
}
|
||||
} // namespace argparse
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace argparse
|
||||
{
|
||||
@@ -93,4 +93,4 @@ add_group_arguments(parser_t&, const std::string&, parser_data&, bool _add_group
|
||||
parser_data&
|
||||
add_extended_arguments(parser_t&, parser_data&);
|
||||
} // namespace argparse
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -4,4 +4,5 @@ set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp)
|
||||
set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${binary_sources} ${binary_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "binary/address_range.hpp"
|
||||
#include "debug.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -187,4 +187,4 @@ address_range::hash() const
|
||||
: hash_value_t{ low };
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -43,7 +43,7 @@ struct address_range
|
||||
uintptr_t low = std::numeric_limits<uintptr_t>::max();
|
||||
uintptr_t high = std::numeric_limits<uintptr_t>::min();
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(address_range)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(address_range)
|
||||
|
||||
explicit address_range(uintptr_t _v);
|
||||
address_range(uintptr_t _low, uintptr_t _high);
|
||||
@@ -89,14 +89,14 @@ operator+(uintptr_t _v, binary::address_range _lhs)
|
||||
{
|
||||
return (_lhs += _v);
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::omnitrace::binary::address_range>
|
||||
struct hash<::rocprofsys::binary::address_range>
|
||||
{
|
||||
using address_range_t = ::omnitrace::binary::address_range;
|
||||
using address_range_t = ::rocprofsys::binary::address_range;
|
||||
|
||||
auto operator()(const address_range_t& _v) const { return _v.hash(); }
|
||||
auto operator()(address_range_t&& _v) const { return _v.hash(); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -59,4 +59,4 @@ struct symbol;
|
||||
struct dwarf_entry;
|
||||
struct binary_info;
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace categories
|
||||
{
|
||||
@@ -44,8 +44,8 @@ configure_categories(bool _enable, const std::set<std::string>& _categories)
|
||||
auto _name = trait::name<Tp>::value;
|
||||
if(_categories.count(_name) > 0)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling",
|
||||
_name);
|
||||
ROCPROFSYS_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling",
|
||||
_name);
|
||||
trait::runtime_enabled<Tp>::set(_enable);
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,11 @@ configure_categories(bool _enable, const std::set<std::string>& _categories,
|
||||
void
|
||||
configure_categories(bool _enable, const std::set<std::string>& _categories)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling");
|
||||
ROCPROFSYS_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling");
|
||||
|
||||
configure_categories(
|
||||
_enable, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -74,7 +74,7 @@ enable_categories(const std::set<std::string>& _categories)
|
||||
{
|
||||
configure_categories(
|
||||
true, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -82,7 +82,7 @@ disable_categories(const std::set<std::string>& _categories)
|
||||
{
|
||||
configure_categories(
|
||||
false, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -138,4 +138,4 @@ shutdown()
|
||||
disable_categories(config::get_enabled_categories());
|
||||
}
|
||||
} // namespace categories
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "common/join.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "omnitrace/categories.h" // in omnitrace-user
|
||||
#include "rocprofiler-systems/categories.h" // in rocprof-sys-user
|
||||
|
||||
#if defined(TIMEMORY_PERFETTO_CATEGORIES)
|
||||
# error "TIMEMORY_PERFETTO_CATEGORIES is already defined. Please include \"" __FILE__ "\" before including any timemory files"
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <timemory/mpl/macros.hpp>
|
||||
#include <timemory/mpl/types.hpp>
|
||||
|
||||
#define OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, ...) \
|
||||
#define ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, ...) \
|
||||
namespace tim \
|
||||
{ \
|
||||
namespace trait \
|
||||
@@ -49,7 +49,7 @@
|
||||
} \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
template <size_t>
|
||||
struct category_type_id;
|
||||
@@ -59,10 +59,10 @@ struct category_enum_id;
|
||||
|
||||
template <size_t Idx>
|
||||
using category_type_id_t = typename category_type_id<Idx>::type;
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#define OMNITRACE_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
template <> \
|
||||
struct category_type_id<ENUM> \
|
||||
@@ -76,61 +76,61 @@ using category_type_id_t = typename category_type_id<Idx>::type;
|
||||
}; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
#define ROCPROFSYS_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
TIMEMORY_DECLARE_NS_API(NS, VALUE) \
|
||||
OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
#define OMNITRACE_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
#define ROCPROFSYS_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
TIMEMORY_DEFINE_NS_API(NS, VALUE) \
|
||||
OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
|
||||
// clang-format off
|
||||
// these are defined by omnitrace
|
||||
OMNITRACE_DEFINE_CATEGORY(project, omnitrace, OMNITRACE_CATEGORY_NONE, "omnitrace", "Omnitrace project")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, host, OMNITRACE_CATEGORY_HOST, "host", "Host-side function tracing")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, user, OMNITRACE_CATEGORY_USER, "user", "User-defined regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, python, OMNITRACE_CATEGORY_PYTHON, "python", "Python regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, device_hip, OMNITRACE_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, device_hsa, OMNITRACE_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_hip, OMNITRACE_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_hsa, OMNITRACE_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_roctx, OMNITRACE_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi, OMNITRACE_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_busy, OMNITRACE_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_temp, OMNITRACE_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_power, OMNITRACE_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_memory_usage, OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_rccl, OMNITRACE_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, roctracer, OMNITRACE_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocprofiler, OMNITRACE_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, pthread, OMNITRACE_CATEGORY_PTHREAD, "pthread", "POSIX threading functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, kokkos, OMNITRACE_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, mpi, OMNITRACE_CATEGORY_MPI, "mpi", "MPI regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, ompt, OMNITRACE_CATEGORY_OMPT, "ompt", "OpenMP tools regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_sampling, OMNITRACE_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, comm_data, OMNITRACE_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, causal, OMNITRACE_CATEGORY_CAUSAL, "causal", "Causal profiling data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, cpu_freq, OMNITRACE_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_page, OMNITRACE_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_virt, OMNITRACE_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_peak, OMNITRACE_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_context_switch, OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_page_fault, OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_user_mode_time, OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_kernel_mode_time, OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_wall_time, OMNITRACE_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_cpu_time, OMNITRACE_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_page_fault, OMNITRACE_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_peak_memory, OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_context_switch, OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_hardware_counter, OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, kernel_hardware_counter, OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, numa, OMNITRACE_CATEGORY_NUMA, "numa", "Non-unified memory architecture")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, timer_sampling, OMNITRACE_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, overflow_sampling, OMNITRACE_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow")
|
||||
// these are defined by rocprofsys
|
||||
ROCPROFSYS_DEFINE_CATEGORY(project, rocprofsys, ROCPROFSYS_CATEGORY_NONE, "rocprofsys", "ROCm Systems Profiler project")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, host, ROCPROFSYS_CATEGORY_HOST, "host", "Host-side function tracing")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, user, ROCPROFSYS_CATEGORY_USER, "user", "User-defined regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, python, ROCPROFSYS_CATEGORY_PYTHON, "python", "Python regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, device_hip, ROCPROFSYS_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, device_hsa, ROCPROFSYS_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hip, ROCPROFSYS_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hsa, ROCPROFSYS_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_roctx, ROCPROFSYS_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi, ROCPROFSYS_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_busy, ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_temp, ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_power, ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_memory_usage, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rccl, ROCPROFSYS_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, roctracer, ROCPROFSYS_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocprofiler, ROCPROFSYS_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, pthread, ROCPROFSYS_CATEGORY_PTHREAD, "pthread", "POSIX threading functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, kokkos, ROCPROFSYS_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, mpi, ROCPROFSYS_CATEGORY_MPI, "mpi", "MPI regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, ompt, ROCPROFSYS_CATEGORY_OMPT, "ompt", "OpenMP tools regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_sampling, ROCPROFSYS_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, comm_data, ROCPROFSYS_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, causal, ROCPROFSYS_CATEGORY_CAUSAL, "causal", "Causal profiling data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, cpu_freq, ROCPROFSYS_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_page, ROCPROFSYS_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_virt, ROCPROFSYS_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_peak, ROCPROFSYS_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_context_switch, ROCPROFSYS_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_page_fault, ROCPROFSYS_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_user_mode_time, ROCPROFSYS_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_kernel_mode_time, ROCPROFSYS_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_wall_time, ROCPROFSYS_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_cpu_time, ROCPROFSYS_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_page_fault, ROCPROFSYS_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_peak_memory, ROCPROFSYS_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_context_switch, ROCPROFSYS_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_hardware_counter, ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, kernel_hardware_counter, ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, numa, ROCPROFSYS_CATEGORY_NUMA, "numa", "Non-unified memory architecture")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, timer_sampling, ROCPROFSYS_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, overflow_sampling, ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow")
|
||||
|
||||
OMNITRACE_DECLARE_CATEGORY(category, sampling, OMNITRACE_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling")
|
||||
ROCPROFSYS_DECLARE_CATEGORY(category, sampling, ROCPROFSYS_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling")
|
||||
// clang-format on
|
||||
|
||||
namespace tim
|
||||
@@ -142,64 +142,64 @@ using name = perfetto_category<Tp...>;
|
||||
}
|
||||
} // namespace tim
|
||||
|
||||
#define OMNITRACE_PERFETTO_CATEGORY(TYPE) \
|
||||
#define ROCPROFSYS_PERFETTO_CATEGORY(TYPE) \
|
||||
::perfetto::Category(::tim::trait::perfetto_category<::tim::TYPE>::value) \
|
||||
.SetDescription(::tim::trait::perfetto_category<::tim::TYPE>::description)
|
||||
|
||||
#define OMNITRACE_PERFETTO_CATEGORIES \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::host), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::user), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::python), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::device_hip), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::device_hsa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_hip), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_hsa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_roctx), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_busy), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_temp), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_power), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_rccl), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::roctracer), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocprofiler), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::pthread), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::kokkos), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::mpi), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::ompt), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::comm_data), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::causal), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::cpu_freq), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_page), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_virt), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_peak), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_context_switch), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_page_fault), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_user_mode_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_kernel_mode_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_wall_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_cpu_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_page_fault), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_peak_memory), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_context_switch), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_hardware_counter), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::kernel_hardware_counter), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::numa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::timer_sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::overflow_sampling), \
|
||||
#define ROCPROFSYS_PERFETTO_CATEGORIES \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::host), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::user), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::python), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::device_hip), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::device_hsa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hip), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hsa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_roctx), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_busy), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_temp), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_power), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rccl), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::roctracer), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocprofiler), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::pthread), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::kokkos), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::mpi), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::ompt), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::comm_data), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::causal), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::cpu_freq), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_page), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_virt), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_peak), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_context_switch), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_page_fault), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_user_mode_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_kernel_mode_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_wall_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_cpu_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_page_fault), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_peak_memory), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_context_switch), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_hardware_counter), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::kernel_hardware_counter), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::numa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::timer_sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::overflow_sampling), \
|
||||
::perfetto::Category("timemory").SetDescription("Events from the timemory API")
|
||||
|
||||
#if defined(TIMEMORY_USE_PERFETTO)
|
||||
# define TIMEMORY_PERFETTO_CATEGORIES OMNITRACE_PERFETTO_CATEGORIES
|
||||
# define TIMEMORY_PERFETTO_CATEGORIES ROCPROFSYS_PERFETTO_CATEGORIES
|
||||
#endif
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace config
|
||||
{
|
||||
@@ -224,4 +224,4 @@ setup();
|
||||
void
|
||||
shutdown();
|
||||
} // namespace categories
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -50,8 +50,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define OMNITRACE_DECLARE_COMPONENT(NAME) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_DECLARE_COMPONENT(NAME) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
@@ -63,7 +63,7 @@
|
||||
namespace trait \
|
||||
{ \
|
||||
template <> \
|
||||
struct is_component<omnitrace::component::NAME> : true_type \
|
||||
struct is_component<rocprofsys::component::NAME> : true_type \
|
||||
{}; \
|
||||
} \
|
||||
} \
|
||||
@@ -71,12 +71,12 @@
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
using ::omnitrace::component::NAME; \
|
||||
using ::rocprofsys::component::NAME; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMNITRACE_COMPONENT_ALIAS(NAME, ...) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_COMPONENT_ALIAS(NAME, ...) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
@@ -87,22 +87,22 @@
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
using ::omnitrace::component::NAME; \
|
||||
using ::rocprofsys::component::NAME; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMNITRACE_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \
|
||||
#define ROCPROFSYS_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \
|
||||
namespace tim \
|
||||
{ \
|
||||
namespace trait \
|
||||
{ \
|
||||
template <> \
|
||||
struct TRAIT<::omnitrace::TYPE> : VALUE \
|
||||
struct TRAIT<::rocprofsys::TYPE> : VALUE \
|
||||
{}; \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace api = ::tim::api; // NOLINT
|
||||
namespace category = ::tim::category; // NOLINT
|
||||
@@ -126,9 +126,9 @@ struct construct_on_thread
|
||||
{
|
||||
int64_t index = threading::get_id();
|
||||
};
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
// same sort of functionality as python's " ".join([...])
|
||||
#if !defined(JOIN)
|
||||
# define JOIN(...) ::omnitrace::common::join(__VA_ARGS__)
|
||||
# define JOIN(...) ::rocprofsys::common::join(__VA_ARGS__)
|
||||
#endif
|
||||
@@ -3,4 +3,5 @@ set(component_sources)
|
||||
|
||||
set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${component_sources} ${component_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${component_sources}
|
||||
${component_headers})
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,15 +39,15 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
OMNITRACE_DECLARE_COMPONENT(roctracer)
|
||||
OMNITRACE_DECLARE_COMPONENT(rocprofiler)
|
||||
OMNITRACE_DECLARE_COMPONENT(rcclp_handle)
|
||||
OMNITRACE_DECLARE_COMPONENT(comm_data)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(roctracer)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(rocprofiler)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(rcclp_handle)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(comm_data)
|
||||
|
||||
OMNITRACE_COMPONENT_ALIAS(comm_data_tracker_t,
|
||||
::tim::component::data_tracker<float, project::omnitrace>)
|
||||
ROCPROFSYS_COMPONENT_ALIAS(comm_data_tracker_t,
|
||||
::tim::component::data_tracker<float, project::rocprofsys>)
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace policy = ::tim::policy; // NOLINT
|
||||
namespace comp = ::tim::component; // NOLINT
|
||||
@@ -94,161 +94,162 @@ template <typename ApiT, typename StartFuncT = default_functor_t,
|
||||
typename StopFuncT = default_functor_t>
|
||||
struct functors;
|
||||
} // namespace component
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL) && !defined(OMNITRACE_USE_MPI)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL) && !defined(ROCPROFSYS_USE_MPI)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type)
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type)
|
||||
#endif
|
||||
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::roctracer, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::roctracer, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::external)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::rocprofiler, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::rocprofiler, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::external, category::hardware_counter)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_wall_clock, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_wall_clock,
|
||||
project::rocprofsys, category::timing, os::supports_unix,
|
||||
category::sampling, category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_cpu_clock, project::rocprofsys,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_cpu_clock, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_percent, project::rocprofsys,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_percent, project::omnitrace,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_busy, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_busy, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_memory, project::omnitrace,
|
||||
tpls::rocm, device::gpu, os::supports_linux, category::memory,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_power, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_memory,
|
||||
project::rocprofsys, tpls::rocm, device::gpu,
|
||||
os::supports_linux, category::memory, category::sampling,
|
||||
category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_power, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux, category::power,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_temp, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_temp, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::temperature, category::sampling,
|
||||
category::process_sampling)
|
||||
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::roctracer, "roctracer",
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::roctracer, "roctracer",
|
||||
"High-precision ROCm API and kernel tracing", "")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::rocprofiler, "rocprofiler",
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::rocprofiler, "rocprofiler",
|
||||
"ROCm kernel hardware counters", "")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_wall_clock,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_wall_clock,
|
||||
"sampling_wall_clock", "Wall-clock timing",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_cpu_clock,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_cpu_clock,
|
||||
"sampling_cpu_clock", "CPU-clock timing",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_percent,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_percent,
|
||||
"sampling_percent",
|
||||
"Fraction of wall-clock time spent in functions",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_busy,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_busy,
|
||||
"sampling_gpu_busy",
|
||||
"GPU Utilization (% busy) via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_memory,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_memory,
|
||||
"sampling_gpu_memory_usage",
|
||||
"GPU Memory Usage via ROCm-SMI", "Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_power,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_power,
|
||||
"sampling_gpu_power", "GPU Power Usage via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_temp,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_temp,
|
||||
"sampling_gpu_temp", "GPU Temperature via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
|
||||
// statistics type
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_wall_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_cpu_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_busy, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_temp, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_power, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_memory, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::comm_data_tracker_t, float)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_wall_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_cpu_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_busy, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_temp, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_power, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_memory, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::comm_data_tracker_t, float)
|
||||
|
||||
// enable timing units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
|
||||
// enable percent units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent,
|
||||
true_type)
|
||||
|
||||
// enable memory units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
|
||||
// reporting categories (sum)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type)
|
||||
|
||||
// reporting categories (mean)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type)
|
||||
|
||||
// reporting categories (stats)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent,
|
||||
false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent,
|
||||
false_type)
|
||||
|
||||
// reporting categories (self)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type)
|
||||
|
||||
#define OMNITRACE_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
#define ROCPROFSYS_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
TIMEMORY_DECLARE_EXTERN_TEMPLATE( \
|
||||
struct tim::component::base<TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
struct tim::component::base<TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
__VA_ARGS__>) \
|
||||
TIMEMORY_DECLARE_EXTERN_OPERATIONS(TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
TIMEMORY_DECLARE_EXTERN_OPERATIONS(TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
HAS_DATA) \
|
||||
TIMEMORY_DECLARE_EXTERN_STORAGE(TIMEMORY_ESC(omnitrace::component::NAME))
|
||||
TIMEMORY_DECLARE_EXTERN_STORAGE(TIMEMORY_ESC(rocprofsys::component::NAME))
|
||||
|
||||
#define OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
#define ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_TEMPLATE( \
|
||||
struct tim::component::base<TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
struct tim::component::base<TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
__VA_ARGS__>) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_OPERATIONS(TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_OPERATIONS(TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
HAS_DATA) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_STORAGE(TIMEMORY_ESC(omnitrace::component::NAME))
|
||||
TIMEMORY_INSTANTIATE_EXTERN_STORAGE(TIMEMORY_ESC(rocprofsys::component::NAME))
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,16 +31,16 @@
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace concepts = ::tim::concepts; // NOLINT
|
||||
|
||||
static constexpr size_t max_supported_threads = OMNITRACE_MAX_THREADS;
|
||||
static constexpr size_t max_supported_threads = ROCPROFSYS_MAX_THREADS;
|
||||
|
||||
template <typename Tp>
|
||||
struct thread_deleter;
|
||||
|
||||
// unique ptr type for omnitrace
|
||||
// unique ptr type for rocprof-sys
|
||||
template <typename Tp>
|
||||
using unique_ptr_t = std::unique_ptr<Tp, thread_deleter<Tp>>;
|
||||
|
||||
@@ -59,7 +59,7 @@ make_unique(Args&&... args)
|
||||
{
|
||||
return unique_ptr_t<Tp>{ new Tp{ std::forward<Args>(args)... } };
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
namespace tim
|
||||
{
|
||||
@@ -70,7 +70,7 @@ struct is_unique_pointer : std::false_type
|
||||
{};
|
||||
|
||||
template <typename Tp>
|
||||
struct is_unique_pointer<::omnitrace::unique_ptr_t<Tp>> : std::true_type
|
||||
struct is_unique_pointer<::rocprofsys::unique_ptr_t<Tp>> : std::true_type
|
||||
{};
|
||||
|
||||
template <typename Tp>
|
||||
|
||||
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande.
Carregar diff
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
//
|
||||
// Initialization routines
|
||||
@@ -49,7 +49,7 @@ using signal_handler_t = void (*)(void);
|
||||
signal_handler_t set_signal_handler(signal_handler_t);
|
||||
|
||||
bool
|
||||
settings_are_configured() OMNITRACE_HOT;
|
||||
settings_are_configured() ROCPROFSYS_HOT;
|
||||
|
||||
void
|
||||
configure_settings(bool _init = true);
|
||||
@@ -156,10 +156,10 @@ bool&
|
||||
is_binary_rewrite();
|
||||
|
||||
bool
|
||||
get_is_continuous_integration() OMNITRACE_HOT;
|
||||
get_is_continuous_integration() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_env() OMNITRACE_HOT;
|
||||
get_debug_env() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_init();
|
||||
@@ -168,49 +168,49 @@ bool
|
||||
get_debug_finalize();
|
||||
|
||||
bool
|
||||
get_debug() OMNITRACE_HOT;
|
||||
get_debug() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_sampling() OMNITRACE_HOT;
|
||||
get_debug_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_tid() OMNITRACE_HOT;
|
||||
get_debug_tid() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_pid() OMNITRACE_HOT;
|
||||
get_debug_pid() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose_env() OMNITRACE_HOT;
|
||||
get_verbose_env() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose() OMNITRACE_HOT;
|
||||
get_verbose() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_perfetto() OMNITRACE_HOT;
|
||||
get_use_perfetto() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_timemory() OMNITRACE_HOT;
|
||||
get_use_timemory() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_causal() OMNITRACE_HOT;
|
||||
get_use_causal() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_roctracer() OMNITRACE_HOT;
|
||||
get_use_roctracer() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_rocprofiler() OMNITRACE_HOT;
|
||||
get_use_rocprofiler() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_rocm_smi() OMNITRACE_HOT;
|
||||
get_use_rocm_smi() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_roctx();
|
||||
|
||||
bool&
|
||||
get_use_sampling() OMNITRACE_HOT;
|
||||
get_use_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_process_sampling() OMNITRACE_HOT;
|
||||
get_use_process_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_pid();
|
||||
@@ -267,7 +267,7 @@ std::set<std::string>
|
||||
get_disabled_categories();
|
||||
|
||||
bool
|
||||
get_perfetto_annotations() OMNITRACE_HOT;
|
||||
get_perfetto_annotations() ROCPROFSYS_HOT;
|
||||
|
||||
uint64_t
|
||||
get_thread_pool_size();
|
||||
@@ -278,12 +278,12 @@ get_trace_hsa_api_types();
|
||||
std::string&
|
||||
get_perfetto_backend();
|
||||
|
||||
// make this visible so omnitrace-avail can call it
|
||||
// make this visible so rocprof-sys-avail can call it
|
||||
std::string
|
||||
get_perfetto_output_filename();
|
||||
|
||||
bool
|
||||
get_perfetto_roctracer_per_stream() OMNITRACE_HOT;
|
||||
get_perfetto_roctracer_per_stream() ROCPROFSYS_HOT;
|
||||
|
||||
double
|
||||
get_trace_delay();
|
||||
@@ -424,4 +424,4 @@ get_causal_source_exclude();
|
||||
std::vector<std::string>
|
||||
get_causal_function_exclude();
|
||||
} // namespace config
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace constraint
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace units = ::tim::units;
|
||||
using clock_type = std::chrono::high_resolution_clock;
|
||||
using duration_type = std::chrono::duration<double, std::nano>;
|
||||
|
||||
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
||||
#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \
|
||||
clock_identifier { #VAL, VAL }
|
||||
|
||||
auto
|
||||
@@ -63,13 +63,13 @@ clock_name(std::string _v)
|
||||
}
|
||||
|
||||
auto accepted_clock_ids =
|
||||
std::set<clock_identifier>{ OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) };
|
||||
std::set<clock_identifier>{ ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) };
|
||||
|
||||
template <typename Tp>
|
||||
clock_identifier
|
||||
@@ -101,9 +101,9 @@ find_clock_identifier(const Tp& _v)
|
||||
}
|
||||
}
|
||||
|
||||
OMNITRACE_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript,
|
||||
timemory::join::join("", _v).c_str(),
|
||||
timemory::join::join("", accepted_clock_ids).c_str());
|
||||
ROCPROFSYS_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript,
|
||||
timemory::join::join("", _v).c_str(),
|
||||
timemory::join::join("", accepted_clock_ids).c_str());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -232,10 +232,10 @@ spec::spec(const std::string& _clock_id, double _delay, double _dur, uint64_t _n
|
||||
{}
|
||||
|
||||
spec::spec(const std::string& _line)
|
||||
: spec{ config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIOD_CLOCK_ID")
|
||||
: spec{ config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIOD_CLOCK_ID")
|
||||
.value_or("CLOCK_REALTIME"),
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DELAY").value_or(0.0),
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DURATION").value_or(0.0) }
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DELAY").value_or(0.0),
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DURATION").value_or(0.0) }
|
||||
{
|
||||
auto _delim = tim::delimit(_line, ":");
|
||||
if(!_delim.empty()) delay = utility::convert<double>(_delim.at(0));
|
||||
@@ -266,11 +266,11 @@ spec::operator()(const stages& _stages) const
|
||||
return _ret;
|
||||
};
|
||||
|
||||
OMNITRACE_VERBOSE(2,
|
||||
"Executing constraint spec %lu of %lu :: delay: %6.3f, "
|
||||
"duration: %6.3f, clock: %s\n",
|
||||
i, _spec.repeat, _spec.delay, _spec.duration,
|
||||
_spec.clock_id.as_string().c_str());
|
||||
ROCPROFSYS_VERBOSE(2,
|
||||
"Executing constraint spec %lu of %lu :: delay: %6.3f, "
|
||||
"duration: %6.3f, clock: %s\n",
|
||||
i, _spec.repeat, _spec.delay, _spec.duration,
|
||||
_spec.clock_id.as_string().c_str());
|
||||
|
||||
if(_stages.init(_spec) && _wait(_stages.wait, _spec.delay) &&
|
||||
_stages.start(_spec) && _wait(_stages.collect, _spec.duration) &&
|
||||
@@ -302,11 +302,11 @@ get_trace_specs()
|
||||
|
||||
{
|
||||
auto _delay_v =
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DELAY").value_or(0.0);
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DELAY").value_or(0.0);
|
||||
auto _duration_v =
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DURATION").value_or(0.0);
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DURATION").value_or(0.0);
|
||||
auto _clock_v = find_clock_identifier(
|
||||
config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIOD_CLOCK_ID")
|
||||
config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIOD_CLOCK_ID")
|
||||
.value_or("CLOCK_REALTIME"));
|
||||
|
||||
if(_delay_v > 0.0 || _duration_v > 0.0)
|
||||
@@ -317,7 +317,7 @@ get_trace_specs()
|
||||
|
||||
{
|
||||
auto _periods_v =
|
||||
config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIODS")
|
||||
config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIODS")
|
||||
.value_or("");
|
||||
if(!_periods_v.empty())
|
||||
{
|
||||
@@ -349,4 +349,4 @@ get_trace_stages()
|
||||
return _v;
|
||||
}
|
||||
} // namespace constraint
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace constraint
|
||||
{
|
||||
@@ -51,7 +51,7 @@ struct stages
|
||||
|
||||
stages();
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(stages)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(stages)
|
||||
|
||||
functor_t init = [](const spec&) { return true; };
|
||||
functor_t wait = [](const spec&) { return true; };
|
||||
@@ -69,7 +69,7 @@ struct clock_identifier
|
||||
clock_identifier();
|
||||
clock_identifier(std::string_view, int);
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(clock_identifier)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(clock_identifier)
|
||||
|
||||
std::string as_string() const;
|
||||
|
||||
@@ -91,7 +91,7 @@ struct spec
|
||||
spec(const std::string&, double, double, uint64_t = 0, uint64_t = 1);
|
||||
spec(const std::string&);
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(spec)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(spec)
|
||||
|
||||
void operator()(const stages&) const;
|
||||
|
||||
@@ -111,4 +111,4 @@ get_trace_specs();
|
||||
stages
|
||||
get_trace_stages();
|
||||
} // namespace constraint
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -8,4 +8,5 @@ set(containers_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${containers_sources} ${containers_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${containers_sources}
|
||||
${containers_headers})
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,21 +32,21 @@
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
#if !defined(OMNITRACE_CACHELINE_SIZE)
|
||||
#if !defined(ROCPROFSYS_CACHELINE_SIZE)
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# define OMNITRACE_CACHELINE_SIZE std::hardware_destructive_interference_size
|
||||
# define ROCPROFSYS_CACHELINE_SIZE std::hardware_destructive_interference_size
|
||||
# else
|
||||
// 64 bytes on x86-64 │ L1_CACHE_BYTES │ L1_CACHE_SHIFT │ __cacheline_aligned │ ...
|
||||
# define OMNITRACE_CACHELINE_SIZE 64
|
||||
# define ROCPROFSYS_CACHELINE_SIZE 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
constexpr std::size_t cacheline_align_v =
|
||||
std::max<size_t>(OMNITRACE_CACHELINE_SIZE, OMNITRACE_CACHELINE_SIZE_MIN);
|
||||
std::max<size_t>(ROCPROFSYS_CACHELINE_SIZE, ROCPROFSYS_CACHELINE_SIZE_MIN);
|
||||
|
||||
template <typename Tp, size_t N, size_t AlignN = cacheline_align_v,
|
||||
bool AtomicSizeV = false>
|
||||
@@ -228,7 +228,7 @@ aligned_static_vector<Tp, N, AlignN, AtomicSizeV>&
|
||||
aligned_static_vector<Tp, N, AlignN, AtomicSizeV>::operator=(
|
||||
std::initializer_list<Tp>&& _v)
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(_v.size() > N))
|
||||
if(ROCPROFSYS_UNLIKELY(_v.size() > N))
|
||||
{
|
||||
throw exception<std::out_of_range>(
|
||||
std::string{ "aligned_static_vector::operator=(initializer_list) size > " } +
|
||||
@@ -323,4 +323,4 @@ aligned_static_vector<Tp, N, AlignN, AtomicSizeV>::emplace_back(Args&&... _v)
|
||||
}
|
||||
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
@@ -62,7 +62,7 @@ struct c_array
|
||||
Tp& at(size_t i)
|
||||
{
|
||||
if(i < m_size) return m_base[i];
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
std::string{ typeid(*this).name() } + std::to_string(i) + " exceeds size " +
|
||||
std::to_string(m_size));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ struct c_array
|
||||
const Tp& at(size_t i) const
|
||||
{
|
||||
if(i < m_size) return m_base[i];
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
std::string{ typeid(*this).name() } + std::to_string(i) + " exceeds size " +
|
||||
std::to_string(m_size));
|
||||
}
|
||||
@@ -137,4 +137,4 @@ wrap_c_array(Tp* base, size_t size)
|
||||
return c_array<Tp>(base, size);
|
||||
}
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,30 +27,30 @@
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
#define OMNITRACE_IMPORT_TEMPLATE2(template_name)
|
||||
#define OMNITRACE_IMPORT_TEMPLATE1(template_name)
|
||||
#define ROCPROFSYS_IMPORT_TEMPLATE2(template_name)
|
||||
#define ROCPROFSYS_IMPORT_TEMPLATE1(template_name)
|
||||
|
||||
// Import a 2-type-argument operator template into boost (if necessary) and
|
||||
// provide a specialization of 'is_chained_base<>' for it.
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE2(template_name2) \
|
||||
OMNITRACE_IMPORT_TEMPLATE2(template_name2) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE2(template_name2) \
|
||||
ROCPROFSYS_IMPORT_TEMPLATE2(template_name2) \
|
||||
template <typename T, typename U, typename B> \
|
||||
struct is_chained_base<::omnitrace::container::template_name2<T, U, B>> \
|
||||
struct is_chained_base<::rocprofsys::container::template_name2<T, U, B>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
};
|
||||
|
||||
// Import a 1-type-argument operator template into boost (if necessary) and
|
||||
// provide a specialization of 'is_chained_base<>' for it.
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE1(template_name1) \
|
||||
OMNITRACE_IMPORT_TEMPLATE1(template_name1) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE1(template_name1) \
|
||||
ROCPROFSYS_IMPORT_TEMPLATE1(template_name1) \
|
||||
template <typename T, typename B> \
|
||||
struct is_chained_base<::omnitrace::container::template_name1<T, B>> \
|
||||
struct is_chained_base<::rocprofsys::container::template_name1<T, B>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
};
|
||||
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE(template_name) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE(template_name) \
|
||||
template <typename T, typename U = T, typename B = empty_base<T>, \
|
||||
typename O = typename is_chained_base<U>::value> \
|
||||
struct template_name; \
|
||||
@@ -74,13 +74,13 @@
|
||||
template <typename T, typename U, typename B, typename O> \
|
||||
struct is_chained_base<template_name<T, U, B, O>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
}; \
|
||||
\
|
||||
OMNITRACE_OPERATOR_TEMPLATE2(template_name##2) \
|
||||
OMNITRACE_OPERATOR_TEMPLATE1(template_name##1)
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE2(template_name##2) \
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE1(template_name##1)
|
||||
|
||||
#define OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \
|
||||
#define ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \
|
||||
template <typename T, typename U, typename B = empty_base<T>> \
|
||||
struct NAME##2 \
|
||||
: B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \
|
||||
@@ -96,7 +96,7 @@
|
||||
} \
|
||||
;
|
||||
|
||||
#define OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \
|
||||
#define ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \
|
||||
template <typename T, typename U, typename B = empty_base<T>> \
|
||||
struct NAME##2 \
|
||||
: B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \
|
||||
@@ -104,7 +104,7 @@
|
||||
} \
|
||||
;
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
@@ -124,10 +124,10 @@ struct is_chained_base
|
||||
using value = true_t;
|
||||
};
|
||||
|
||||
OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(addable, +)
|
||||
OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -)
|
||||
ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(addable, +)
|
||||
ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -)
|
||||
|
||||
OMNITRACE_OPERATOR_TEMPLATE(addable)
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE(addable)
|
||||
|
||||
template <typename T, typename B = empty_base<T>>
|
||||
struct incrementable : B
|
||||
@@ -237,4 +237,4 @@ struct random_access_iterator_helper
|
||||
friend D requires_difference_operator(const T& x, const T& y) { return x - y; }
|
||||
}; // random_access_iterator_helper
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -34,11 +34,11 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
template <typename Tp, size_t ChunkSizeV = OMNITRACE_MAX_THREADS,
|
||||
template <typename Tp, size_t ChunkSizeV = ROCPROFSYS_MAX_THREADS,
|
||||
size_t AlignN = alignof(Tp)>
|
||||
class stable_vector
|
||||
{
|
||||
@@ -299,7 +299,7 @@ template <typename Tp, size_t ChunkSizeV, size_t AlignN>
|
||||
typename stable_vector<Tp, ChunkSizeV, AlignN>::chunk_type&
|
||||
stable_vector<Tp, ChunkSizeV, AlignN>::last_chunk()
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV))
|
||||
if(ROCPROFSYS_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV))
|
||||
{
|
||||
add_chunk();
|
||||
}
|
||||
@@ -358,9 +358,9 @@ template <typename Tp, size_t ChunkSizeV, size_t AlignN>
|
||||
typename stable_vector<Tp, ChunkSizeV, AlignN>::reference
|
||||
stable_vector<Tp, ChunkSizeV, AlignN>::at(size_type i)
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(i >= size()))
|
||||
if(ROCPROFSYS_UNLIKELY(i >= size()))
|
||||
{
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
"stable_vector::at(" + std::to_string(i) + "). size is " +
|
||||
std::to_string(size()));
|
||||
}
|
||||
@@ -387,4 +387,4 @@ resize(stable_vector<Tp, ChunkSizeV, AlignN>& _v, size_t _n, Args&&... args)
|
||||
return _v.size();
|
||||
}
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
Foram carregados 100 ficheiros de um total de 420. Não foram mostrados mais ficheiros porque foram modificados demasiados, neste diff.
Mostrar mais
Criar uma nova questão referindo esta
Bloquear um utilizador