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]
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c444ba6131
Коммит
489eda995d
@@ -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)
|
||||
{
|
||||
+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); \
|
||||
+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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+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{};
|
||||
+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))
|
||||
+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>
|
||||
@@ -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")
|
||||
|
||||
Ссылка в новой задаче
Block a user