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>
This commit is contained in:
David Galiffi
2024-10-15 11:20:40 -04:00
committed by GitHub
parent dc63370a1f
commit d07bf508a9
420 changed files with 10418 additions and 9914 deletions
+9 -8
View File
@@ -1,18 +1,19 @@
# ------------------------------------------------------------------------------#
#
# omnitrace common headers
# rocprofiler-systems common headers
#
# ------------------------------------------------------------------------------#
add_library(omnitrace-common-library INTERFACE)
add_library(omnitrace::common-library ALIAS omnitrace-common-library)
add_library(omnitrace::omnitrace-common-library ALIAS omnitrace-common-library)
add_library(rocprofiler-systems-common-library INTERFACE)
add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library)
add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS
rocprofiler-systems-common-library)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY)
target_sources(
omnitrace-common-library
rocprofiler-systems-common-library
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
@@ -24,11 +25,11 @@ get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" D
get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY)
target_include_directories(
omnitrace-common-library
rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>)
target_compile_definitions(omnitrace-common-library
INTERFACE $<BUILD_INTERFACE:OMNITRACE_INTERNAL_BUILD=1>)
target_compile_definitions(rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>)
+79 -78
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -23,117 +23,118 @@
#pragma once
// clang-format off
#define OMNITRACE_VERSION_STRING "@FULL_VERSION_STRING@"
#define OMNITRACE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define OMNITRACE_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define OMNITRACE_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define OMNITRACE_GIT_DESCRIBE "@OMNITRACE_GIT_DESCRIBE@"
#define OMNITRACE_GIT_REVISION "@OMNITRACE_GIT_REVISION@"
#define ROCPROFSYS_VERSION_STRING "@FULL_VERSION_STRING@"
#define ROCPROFSYS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define ROCPROFSYS_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define ROCPROFSYS_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define ROCPROFSYS_GIT_DESCRIBE "@ROCPROFSYS_GIT_DESCRIBE@"
#define ROCPROFSYS_GIT_REVISION "@ROCPROFSYS_GIT_REVISION@"
// system info during compilation
#define OMNITRACE_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
#define OMNITRACE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
#define OMNITRACE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
#define OMNITRACE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
#define ROCPROFSYS_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
#define ROCPROFSYS_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
#define ROCPROFSYS_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
#define ROCPROFSYS_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
// compiler information
#define OMNITRACE_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
#define OMNITRACE_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
#define OMNITRACE_COMPILER_STRING OMNITRACE_COMPILER_ID " v" OMNITRACE_COMPILER_VERSION
#define ROCPROFSYS_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
#define ROCPROFSYS_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
#define ROCPROFSYS_COMPILER_STRING ROCPROFSYS_COMPILER_ID " v" ROCPROFSYS_COMPILER_VERSION
#define OMNITRACE_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
#define OMNITRACE_HIP_VERSION_STRING "@OMNITRACE_HIP_VERSION@"
#define OMNITRACE_HIP_VERSION_MAJOR @OMNITRACE_HIP_VERSION_MAJOR@
#define OMNITRACE_HIP_VERSION_MINOR @OMNITRACE_HIP_VERSION_MINOR@
#define OMNITRACE_HIP_VERSION_PATCH @OMNITRACE_HIP_VERSION_PATCH@
#define ROCPROFSYS_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
#define ROCPROFSYS_HIP_VERSION_STRING "@ROCPROFSYS_HIP_VERSION@"
#define ROCPROFSYS_HIP_VERSION_MAJOR @ROCPROFSYS_HIP_VERSION_MAJOR@
#define ROCPROFSYS_HIP_VERSION_MINOR @ROCPROFSYS_HIP_VERSION_MINOR@
#define ROCPROFSYS_HIP_VERSION_PATCH @ROCPROFSYS_HIP_VERSION_PATCH@
// these can be set via defining the variable in CMake, e.g.:
// cmake -D OMNITRACE_CACHELINE_SIZE=N /path/to/source
// cmake -D ROCPROFSYS_CACHELINE_SIZE=N /path/to/source
// if not defined when configuring cmake, these values fall back to
// default values set in core/containers/aligned_static_vector.hpp.
// the OMNITRACE_CACHELINE_SIZE_MIN is used to ensure portability
#cmakedefine OMNITRACE_CACHELINE_SIZE @OMNITRACE_CACHELINE_SIZE@
#cmakedefine OMNITRACE_CACHELINE_SIZE_MIN @OMNITRACE_CACHELINE_SIZE_MIN@
// the ROCPROFSYS_CACHELINE_SIZE_MIN is used to ensure portability
#cmakedefine ROCPROFSYS_CACHELINE_SIZE @ROCPROFSYS_CACHELINE_SIZE@
#cmakedefine ROCPROFSYS_CACHELINE_SIZE_MIN @ROCPROFSYS_CACHELINE_SIZE_MIN@
// misc definitions which can be configured by cmake to override the defaults
#cmakedefine OMNITRACE_ROCM_MAX_COUNTERS @OMNITRACE_ROCM_MAX_COUNTERS@
#cmakedefine ROCPROFSYS_ROCM_MAX_COUNTERS @ROCPROFSYS_ROCM_MAX_COUNTERS@
// clang-format on
#define OMNITRACE_VERSION \
((10000 * OMNITRACE_VERSION_MAJOR) + (100 * OMNITRACE_VERSION_MINOR) + \
OMNITRACE_VERSION_PATCH)
#define ROCPROFSYS_VERSION \
((10000 * ROCPROFSYS_VERSION_MAJOR) + (100 * ROCPROFSYS_VERSION_MINOR) + \
ROCPROFSYS_VERSION_PATCH)
#define OMNITRACE_HIP_VERSION \
((10000 * OMNITRACE_HIP_VERSION_MAJOR) + (100 * OMNITRACE_HIP_VERSION_MINOR) + \
OMNITRACE_HIP_VERSION_PATCH)
#define ROCPROFSYS_HIP_VERSION \
((10000 * ROCPROFSYS_HIP_VERSION_MAJOR) + (100 * ROCPROFSYS_HIP_VERSION_MINOR) + \
ROCPROFSYS_HIP_VERSION_PATCH)
#if OMNITRACE_HIP_VERSION_MAJOR > 0
# define OMNITRACE_HIP_VERSION_COMPAT_STRING \
"v@OMNITRACE_HIP_VERSION_MAJOR@.@OMNITRACE_HIP_VERSION_MINOR@.x"
#if ROCPROFSYS_HIP_VERSION_MAJOR > 0
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
"v@ROCPROFSYS_HIP_VERSION_MAJOR@.@ROCPROFSYS_HIP_VERSION_MINOR@.x"
#else
# define OMNITRACE_HIP_VERSION_COMPAT_STRING ""
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING ""
#endif
// this should be passed to argparse::argument_parser::enable_version
// Example:
// parser.enable_version(<name>, OMNITRACE_ARGPARSE_VERSION_INFO);
#if !defined(OMNITRACE_ARGPARSE_VERSION_INFO)
# define OMNITRACE_ARGPARSE_VERSION_INFO \
"v" OMNITRACE_VERSION_STRING, OMNITRACE_GIT_DESCRIBE, OMNITRACE_GIT_REVISION, \
// parser.enable_version(<name>, ROCPROFSYS_ARGPARSE_VERSION_INFO);
#if !defined(ROCPROFSYS_ARGPARSE_VERSION_INFO)
# define ROCPROFSYS_ARGPARSE_VERSION_INFO \
"v" ROCPROFSYS_VERSION_STRING, ROCPROFSYS_GIT_DESCRIBE, ROCPROFSYS_GIT_REVISION, \
{ \
{ "", OMNITRACE_LIBRARY_ARCH }, { "compiler", OMNITRACE_COMPILER_STRING }, \
{ "", ROCPROFSYS_LIBRARY_ARCH }, { "compiler", ROCPROFSYS_COMPILER_STRING }, \
{ \
"rocm", OMNITRACE_HIP_VERSION_COMPAT_STRING \
"rocm", ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
} \
}
#endif
// clang-format off
#if !defined(OMNITRACE_MAX_THREADS)
# define OMNITRACE_MAX_THREADS @OMNITRACE_MAX_THREADS@
#if !defined(ROCPROFSYS_MAX_THREADS)
# define ROCPROFSYS_MAX_THREADS @ROCPROFSYS_MAX_THREADS@
#endif
#if !defined(OMNITRACE_MAX_UNWIND_DEPTH)
# define OMNITRACE_MAX_UNWIND_DEPTH @OMNITRACE_MAX_UNWIND_DEPTH@
#if !defined(ROCPROFSYS_MAX_UNWIND_DEPTH)
# define ROCPROFSYS_MAX_UNWIND_DEPTH @ROCPROFSYS_MAX_UNWIND_DEPTH@
#endif
// clang-format on
// in general, we want to make sure the cache line size is not less than
// 64 bytes (most common cacheline size for x86-64 CPUs) so unless
// OMNITRACE_CACHELINE_SIZE was explicitly set, we set the min to 64
// and use the max value of OMNITRACE_CACHELINE_SIZE and
// OMNITRACE_CACHELINE_SIZE_MIN to assure that false-sharing is well
// ROCPROFSYS_CACHELINE_SIZE was explicitly set, we set the min to 64
// and use the max value of ROCPROFSYS_CACHELINE_SIZE and
// ROCPROFSYS_CACHELINE_SIZE_MIN to assure that false-sharing is well
// guarded against
#if !defined(OMNITRACE_CACHELINE_SIZE_MIN)
# if defined(OMNITRACE_CACHELINE_SIZE)
# define OMNITRACE_CACHELINE_SIZE_MIN OMNITRACE_CACHELINE_SIZE
#if !defined(ROCPROFSYS_CACHELINE_SIZE_MIN)
# if defined(ROCPROFSYS_CACHELINE_SIZE)
# define ROCPROFSYS_CACHELINE_SIZE_MIN ROCPROFSYS_CACHELINE_SIZE
# else
# define OMNITRACE_CACHELINE_SIZE_MIN 64
# define ROCPROFSYS_CACHELINE_SIZE_MIN 64
# endif
#endif
#if !defined(OMNITRACE_ROCM_MAX_COUNTERS)
# define OMNITRACE_ROCM_MAX_COUNTERS 25
#if !defined(ROCPROFSYS_ROCM_MAX_COUNTERS)
# define ROCPROFSYS_ROCM_MAX_COUNTERS 25
#endif
#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE))
#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default")
#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden")
#define OMNITRACE_INTERNAL_API OMNITRACE_VISIBILITY("internal")
#define OMNITRACE_INLINE OMNITRACE_ATTRIBUTE(always_inline) inline
#define OMNITRACE_NOINLINE OMNITRACE_ATTRIBUTE(noinline)
#define OMNITRACE_HOT OMNITRACE_ATTRIBUTE(hot)
#define OMNITRACE_COLD OMNITRACE_ATTRIBUTE(cold)
#define OMNITRACE_CONST OMNITRACE_ATTRIBUTE(const)
#define OMNITRACE_PURE OMNITRACE_ATTRIBUTE(pure)
#define OMNITRACE_WEAK OMNITRACE_ATTRIBUTE(weak)
#define OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__packed__)
#define OMNITRACE_PACKED_ALIGN(VAL) OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__aligned__(VAL))
#define OMNITRACE_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
#define OMNITRACE_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
#define ROCPROFSYS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
#define ROCPROFSYS_VISIBILITY(MODE) ROCPROFSYS_ATTRIBUTE(visibility(MODE))
#define ROCPROFSYS_PUBLIC_API ROCPROFSYS_VISIBILITY("default")
#define ROCPROFSYS_HIDDEN_API ROCPROFSYS_VISIBILITY("hidden")
#define ROCPROFSYS_INTERNAL_API ROCPROFSYS_VISIBILITY("internal")
#define ROCPROFSYS_INLINE ROCPROFSYS_ATTRIBUTE(always_inline) inline
#define ROCPROFSYS_NOINLINE ROCPROFSYS_ATTRIBUTE(noinline)
#define ROCPROFSYS_HOT ROCPROFSYS_ATTRIBUTE(hot)
#define ROCPROFSYS_COLD ROCPROFSYS_ATTRIBUTE(cold)
#define ROCPROFSYS_CONST ROCPROFSYS_ATTRIBUTE(const)
#define ROCPROFSYS_PURE ROCPROFSYS_ATTRIBUTE(pure)
#define ROCPROFSYS_WEAK ROCPROFSYS_ATTRIBUTE(weak)
#define ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__packed__)
#define ROCPROFSYS_PACKED_ALIGN(VAL) \
ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__aligned__(VAL))
#define ROCPROFSYS_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
#define ROCPROFSYS_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0
#if defined(ROCPROFSYS_CI) && ROCPROFSYS_CI > 0
# if defined(NDEBUG)
# undef NDEBUG
# endif
@@ -147,15 +148,15 @@
# endif
#endif
#define OMNITRACE_STRINGIZE(X) OMNITRACE_STRINGIZE2(X)
#define OMNITRACE_STRINGIZE2(X) #X
#define OMNITRACE_VAR_NAME_COMBINE(X, Y) X##Y
#define OMNITRACE_VARIABLE(X, Y) OMNITRACE_VAR_NAME_COMBINE(X, Y)
#define OMNITRACE_LINESTR OMNITRACE_STRINGIZE(__LINE__)
#define OMNITRACE_ESC(...) __VA_ARGS__
#define ROCPROFSYS_STRINGIZE(X) ROCPROFSYS_STRINGIZE2(X)
#define ROCPROFSYS_STRINGIZE2(X) #X
#define ROCPROFSYS_VAR_NAME_COMBINE(X, Y) X##Y
#define ROCPROFSYS_VARIABLE(X, Y) ROCPROFSYS_VAR_NAME_COMBINE(X, Y)
#define ROCPROFSYS_LINESTR ROCPROFSYS_STRINGIZE(__LINE__)
#define ROCPROFSYS_ESC(...) __VA_ARGS__
#if defined(__cplusplus)
# if !defined(OMNITRACE_FOLD_EXPRESSION)
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
# if !defined(ROCPROFSYS_FOLD_EXPRESSION)
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
# endif
#endif
+3 -3
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@
#include <string>
#include <vector>
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
@@ -120,4 +120,4 @@ delimit(const std::string& line, const char* delimiters)
}
} // namespace
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys
+26 -25
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -34,47 +34,48 @@
#include <type_traits>
#include <unistd.h>
#if !defined(OMNITRACE_ENVIRON_LOG_NAME)
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
# define OMNITRACE_ENVIRON_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
#if !defined(ROCPROFSYS_ENVIRON_LOG_NAME)
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
# define ROCPROFSYS_ENVIRON_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
# else
# define OMNITRACE_ENVIRON_LOG_NAME
# define ROCPROFSYS_ENVIRON_LOG_NAME
# endif
#endif
#if !defined(OMNITRACE_ENVIRON_LOG_START)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
# define OMNITRACE_ENVIRON_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
#if !defined(ROCPROFSYS_ENVIRON_LOG_START)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
# define ROCPROFSYS_ENVIRON_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_ENVIRON_LOG_START \
# define ROCPROFSYS_ENVIRON_LOG_START \
fprintf(stderr, "%s", ::tim::log::color::info());
# else
# define OMNITRACE_ENVIRON_LOG_START
# define ROCPROFSYS_ENVIRON_LOG_START
# endif
#endif
#if !defined(OMNITRACE_ENVIRON_LOG_END)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
# define OMNITRACE_ENVIRON_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
#if !defined(ROCPROFSYS_ENVIRON_LOG_END)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
# define ROCPROFSYS_ENVIRON_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_ENVIRON_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
# define ROCPROFSYS_ENVIRON_LOG_END \
fprintf(stderr, "%s", ::tim::log::color::end());
# else
# define OMNITRACE_ENVIRON_LOG_END
# define ROCPROFSYS_ENVIRON_LOG_END
# endif
#endif
#define OMNITRACE_ENVIRON_LOG(CONDITION, ...) \
#define ROCPROFSYS_ENVIRON_LOG(CONDITION, ...) \
if(CONDITION) \
{ \
fflush(stderr); \
OMNITRACE_ENVIRON_LOG_START \
fprintf(stderr, "[omnitrace]" OMNITRACE_ENVIRON_LOG_NAME "[%i] ", getpid()); \
ROCPROFSYS_ENVIRON_LOG_START \
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_ENVIRON_LOG_NAME "[%i] ", getpid()); \
fprintf(stderr, __VA_ARGS__); \
OMNITRACE_ENVIRON_LOG_END \
ROCPROFSYS_ENVIRON_LOG_END \
fflush(stderr); \
}
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
@@ -108,7 +109,7 @@ get_env_impl(std::string_view env_id, int _default)
} catch(std::exception& _e)
{
fprintf(stderr,
"[omnitrace][get_env] Exception thrown converting getenv(\"%s\") = "
"[rocprof-sys][get_env] Exception thrown converting getenv(\"%s\") = "
"%s to integer :: %s. Using default value of %i\n",
env_id.data(), env_var, _e.what(), _default);
}
@@ -162,7 +163,7 @@ get_env(std::string_view env_id, Tp&& _default)
}
}
struct OMNITRACE_INTERNAL_API env_config
struct ROCPROFSYS_INTERNAL_API env_config
{
std::string env_name = {};
std::string env_value = {};
@@ -171,10 +172,10 @@ struct OMNITRACE_INTERNAL_API env_config
auto operator()(bool _verbose = false) const
{
if(env_name.empty()) return -1;
OMNITRACE_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
env_value.c_str(), override);
ROCPROFSYS_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
env_value.c_str(), override);
return setenv(env_name.c_str(), env_value.c_str(), override);
}
};
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys
+21 -21
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -31,20 +31,20 @@
#include <string>
#include <unistd.h>
#if !defined(OMNITRACE_COMMON_LIBRARY_NAME)
# define OMNITRACE_COMMON_LIBRARY_NAME "common"
# error OMNITRACE_COMMON_LIBRARY_NAME must be defined
#if !defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
# define ROCPROFSYS_COMMON_LIBRARY_NAME "common"
# error ROCPROFSYS_COMMON_LIBRARY_NAME must be defined
#endif
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
# define OMNITRACE_COMMON_LIBRARY_LOG_START
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
# define ROCPROFSYS_COMMON_LIBRARY_LOG_START
#endif
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
# define OMNITRACE_COMMON_LIBRARY_LOG_END
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
# define ROCPROFSYS_COMMON_LIBRARY_LOG_END
#endif
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
@@ -52,7 +52,7 @@ namespace
{
template <typename FuncT, typename... Args>
inline auto
invoke(const char* _name, FuncT&& _func, Args... _args) OMNITRACE_HIDDEN_API;
invoke(const char* _name, FuncT&& _func, Args... _args) ROCPROFSYS_HIDDEN_API;
inline int32_t&
get_guard()
@@ -77,7 +77,7 @@ ignore(const char* _name, int _verbose, int _value, const char* _reason, Args...
{
fflush(stderr);
fprintf(stderr,
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
"][%i][%li] %s(%s) was ignored :: %s\n",
getpid(), get_thread_index(), _name,
join(QuoteStrings{}, ", ", _args...).c_str(), _reason);
@@ -107,13 +107,13 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
if(_verbose >= 3)
{
fflush(stderr);
OMNITRACE_COMMON_LIBRARY_LOG_START
ROCPROFSYS_COMMON_LIBRARY_LOG_START
fprintf(stderr,
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
"][%i][%li][%i] %s(%s)\n",
getpid(), get_thread_index(), _lk, _name,
join(QuoteStrings{}, ", ", _args...).c_str());
OMNITRACE_COMMON_LIBRARY_LOG_END
ROCPROFSYS_COMMON_LIBRARY_LOG_END
fflush(stderr);
}
return std::invoke(std::forward<FuncT>(_func), _args...);
@@ -121,25 +121,25 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
else if(_verbose >= 2)
{
fflush(stderr);
OMNITRACE_COMMON_LIBRARY_LOG_START
ROCPROFSYS_COMMON_LIBRARY_LOG_START
fprintf(stderr,
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
"][%i][%li] %s(%s) was guarded :: value = %i\n",
getpid(), get_thread_index(), _name,
join(QuoteStrings{}, ", ", _args...).c_str(), _lk);
OMNITRACE_COMMON_LIBRARY_LOG_END
ROCPROFSYS_COMMON_LIBRARY_LOG_END
fflush(stderr);
}
}
else if(_verbose >= 0)
{
OMNITRACE_COMMON_LIBRARY_LOG_START
ROCPROFSYS_COMMON_LIBRARY_LOG_START
fprintf(stderr,
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
"][%i][%li] %s(%s) ignored :: null function pointer\n",
getpid(), get_thread_index(), _name,
join(QuoteStrings{}, ", ", _args...).c_str());
OMNITRACE_COMMON_LIBRARY_LOG_END
ROCPROFSYS_COMMON_LIBRARY_LOG_END
}
using return_type = decltype(std::invoke(std::forward<FuncT>(_func), _args...));
@@ -147,4 +147,4 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
}
} // namespace
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys
+9 -9
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -31,11 +31,11 @@
#include <tuple>
#include <type_traits>
#if !defined(OMNITRACE_FOLD_EXPRESSION)
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
#if !defined(ROCPROFSYS_FOLD_EXPRESSION)
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
#endif
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
@@ -99,13 +99,13 @@ join(DelimT&& _delim, Args&&... _args)
if constexpr(std::is_same<delim_type, char>::value)
{
const char _delim_c[2] = { _delim, '\0' };
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << _args);
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << _args);
auto _ret = _ss.str();
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
}
else
{
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << _args);
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << _args);
auto _ret = _ss.str();
auto&& _len = std::string{ _delim }.length();
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
@@ -127,13 +127,13 @@ join(QuoteStrings&&, DelimT&& _delim, Args&&... _args)
if constexpr(std::is_same<delim_type, char>::value)
{
const char _delim_c[2] = { _delim, '\0' };
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
auto _ret = _ss.str();
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
}
else
{
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
auto _ret = _ss.str();
auto&& _len = std::string{ _delim }.length();
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
@@ -177,4 +177,4 @@ join(QuoteStrings&&, std::tuple<DelimB, DelimT, DelimE>&& _delim, Args&&... _arg
}
} // namespace
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys
+49 -47
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -38,46 +38,47 @@
#include <sys/stat.h>
#include <unistd.h>
#if !defined(OMNITRACE_PATH_LOG_NAME)
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
# define OMNITRACE_PATH_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
#if !defined(ROCPROFSYS_PATH_LOG_NAME)
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
# define ROCPROFSYS_PATH_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
# else
# define OMNITRACE_PATH_LOG_NAME
# define ROCPROFSYS_PATH_LOG_NAME
# endif
#endif
#if !defined(OMNITRACE_PATH_LOG_START)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
# define OMNITRACE_PATH_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
#if !defined(ROCPROFSYS_PATH_LOG_START)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
# define ROCPROFSYS_PATH_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_PATH_LOG_START fprintf(stderr, "%s", ::tim::log::color::info());
# define ROCPROFSYS_PATH_LOG_START \
fprintf(stderr, "%s", ::tim::log::color::info());
# else
# define OMNITRACE_PATH_LOG_START
# define ROCPROFSYS_PATH_LOG_START
# endif
#endif
#if !defined(OMNITRACE_PATH_LOG_END)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
# define OMNITRACE_PATH_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
#if !defined(ROCPROFSYS_PATH_LOG_END)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
# define ROCPROFSYS_PATH_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
# define ROCPROFSYS_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
# else
# define OMNITRACE_PATH_LOG_END
# define ROCPROFSYS_PATH_LOG_END
# endif
#endif
#define OMNITRACE_PATH_LOG(CONDITION, ...) \
#define ROCPROFSYS_PATH_LOG(CONDITION, ...) \
if(CONDITION) \
{ \
fflush(stderr); \
OMNITRACE_PATH_LOG_START \
fprintf(stderr, "[omnitrace]" OMNITRACE_PATH_LOG_NAME "[%i] ", getpid()); \
ROCPROFSYS_PATH_LOG_START \
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_PATH_LOG_NAME "[%i] ", getpid()); \
fprintf(stderr, __VA_ARGS__); \
OMNITRACE_PATH_LOG_END \
ROCPROFSYS_PATH_LOG_END \
fflush(stderr); \
}
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
@@ -85,45 +86,45 @@ namespace path
{
inline std::vector<std::string>
get_link_map(const char*, std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) },
bool _include_self = false) OMNITRACE_INTERNAL_API;
bool _include_self = false) ROCPROFSYS_INTERNAL_API;
inline auto
get_link_map(const char* _name, bool&& _include_self,
std::vector<int>&& _open_modes = {
(RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
(RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
inline std::string
get_origin(const std::string&,
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
inline bool
exists(const std::string& _fname) OMNITRACE_INTERNAL_API;
exists(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
template <typename RetT = std::string>
inline RetT
get_default_lib_search_paths() OMNITRACE_INTERNAL_API;
get_default_lib_search_paths() ROCPROFSYS_INTERNAL_API;
inline std::string
find_path(const std::string& _path, int _verbose,
const std::string& _search_paths = {}) OMNITRACE_INTERNAL_API;
const std::string& _search_paths = {}) ROCPROFSYS_INTERNAL_API;
inline std::string
dirname(const std::string& _fname) OMNITRACE_INTERNAL_API;
dirname(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
inline std::string
realpath(const std::string& _relpath,
std::string* _resolved = nullptr) OMNITRACE_INTERNAL_API;
std::string* _resolved = nullptr) ROCPROFSYS_INTERNAL_API;
inline bool
is_text_file(const std::string& filename) OMNITRACE_INTERNAL_API;
is_text_file(const std::string& filename) ROCPROFSYS_INTERNAL_API;
inline bool
is_link(const std::string& _path) OMNITRACE_INTERNAL_API;
is_link(const std::string& _path) ROCPROFSYS_INTERNAL_API;
inline std::string
readlink(const std::string& _path) OMNITRACE_INTERNAL_API;
readlink(const std::string& _path) ROCPROFSYS_INTERNAL_API;
struct OMNITRACE_INTERNAL_API path_type
struct ROCPROFSYS_INTERNAL_API path_type
{
enum path_type_e
{
@@ -181,8 +182,9 @@ template <typename RetT>
RetT
get_default_lib_search_paths()
{
auto _paths = join(":", get_env("OMNITRACE_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
auto _paths =
join(":", get_env("ROCPROFSYS_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
if constexpr(std::is_same<RetT, std::string>::value)
return _paths;
else
@@ -204,13 +206,13 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
for(const auto& itr : _paths)
{
auto _f = join('/', itr, _path);
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
"searching for '%s' in '%s' ...\n", _path.c_str(),
itr.c_str());
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
"searching for '%s' in '%s' ...\n", _path.c_str(),
itr.c_str());
if(exists(_f))
{
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
_path.c_str(), itr.c_str());
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
_path.c_str(), itr.c_str());
return _f;
}
}
@@ -224,14 +226,14 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
for(const auto* sitr : { "lib", "lib64", "../lib", "../lib64" })
{
auto _f = join('/', dirname(itr), sitr, _path);
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
"searching for '%s' in '%s' ...\n", _path.c_str(),
common::join('/', itr, sitr).c_str());
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
"searching for '%s' in '%s' ...\n", _path.c_str(),
common::join('/', itr, sitr).c_str());
if(exists(_f))
{
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl,
"found '%s' in '%s' ...\n", _path.c_str(),
itr.c_str());
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl,
"found '%s' in '%s' ...\n", _path.c_str(),
itr.c_str());
return _f;
}
}
@@ -317,7 +319,7 @@ is_text_file(const std::string& filename)
std::ifstream _file{ filename, std::ios::in | std::ios::binary };
if(!_file.is_open())
{
OMNITRACE_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
ROCPROFSYS_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
return false;
}
@@ -411,4 +413,4 @@ get_origin(const std::string& _filename, std::vector<int>&& _open_modes)
}
} // namespace path
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys
+49 -48
View File
@@ -1,6 +1,6 @@
// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -41,54 +41,54 @@
#include <sys/stat.h>
#include <unistd.h>
#if !defined(OMNITRACE_SETUP_LOG_NAME)
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
# define OMNITRACE_SETUP_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
#if !defined(ROCPROFSYS_SETUP_LOG_NAME)
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
# define ROCPROFSYS_SETUP_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
# else
# define OMNITRACE_SETUP_LOG_NAME
# define ROCPROFSYS_SETUP_LOG_NAME
# endif
#endif
#if !defined(OMNITRACE_SETUP_LOG_START)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
# define OMNITRACE_SETUP_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
#if !defined(ROCPROFSYS_SETUP_LOG_START)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
# define ROCPROFSYS_SETUP_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_SETUP_LOG_START \
# define ROCPROFSYS_SETUP_LOG_START \
fprintf(stderr, "%s", ::tim::log::color::info());
# else
# define OMNITRACE_SETUP_LOG_START
# define ROCPROFSYS_SETUP_LOG_START
# endif
#endif
#if !defined(OMNITRACE_SETUP_LOG_END)
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
# define OMNITRACE_SETUP_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
#if !defined(ROCPROFSYS_SETUP_LOG_END)
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
# define ROCPROFSYS_SETUP_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
# define OMNITRACE_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
# define ROCPROFSYS_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
# else
# define OMNITRACE_SETUP_LOG_END
# define ROCPROFSYS_SETUP_LOG_END
# endif
#endif
#define OMNITRACE_SETUP_LOG(CONDITION, ...) \
#define ROCPROFSYS_SETUP_LOG(CONDITION, ...) \
if(CONDITION) \
{ \
fflush(stderr); \
OMNITRACE_SETUP_LOG_START \
fprintf(stderr, "[omnitrace]" OMNITRACE_SETUP_LOG_NAME "[%i] ", getpid()); \
ROCPROFSYS_SETUP_LOG_START \
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_SETUP_LOG_NAME "[%i] ", getpid()); \
fprintf(stderr, __VA_ARGS__); \
OMNITRACE_SETUP_LOG_END \
ROCPROFSYS_SETUP_LOG_END \
fflush(stderr); \
}
namespace omnitrace
namespace rocprofsys
{
inline namespace common
{
inline std::vector<env_config>
get_environ(int _verbose, std::string _search_paths = {},
std::string _omnilib = "libomnitrace.so",
std::string _omnilib_dl = "libomnitrace-dl.so")
std::string _omnilib = "librocprof-sys.so",
std::string _omnilib_dl = "librocprof-sys-dl.so")
{
auto _data = std::vector<env_config>{};
auto _omnilib_path = path::get_origin(_omnilib);
@@ -109,17 +109,17 @@ get_environ(int _verbose, std::string _search_paths = {},
_omnilib = common::path::find_path(_omnilib, _verbose, _search_paths);
_omnilib_dl = common::path::find_path(_omnilib_dl, _verbose, _search_paths);
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0
_data.emplace_back(env_config{ "HSA_TOOLS_LIB", _omnilib.c_str(), 0 });
#endif
#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0
# if OMNITRACE_HIP_VERSION >= 50200
#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0
# if ROCPROFSYS_HIP_VERSION >= 50200
# define ROCPROFILER_METRICS_DIR "lib/rocprofiler"
# else
# define ROCPROFILER_METRICS_DIR "rocprofiler/lib"
# endif
# if OMNITRACE_HIP_VERSION <= 50500
# if ROCPROFSYS_HIP_VERSION <= 50500
# define ROCPROFILER_LIBNAME "librocprofiler64.so"
# else
# define ROCPROFILER_LIBNAME "librocprofiler64.so.1"
@@ -133,7 +133,7 @@ get_environ(int _verbose, std::string _search_paths = {},
auto _possible_rocp_metrics = std::vector<std::string>{};
auto _possible_rocprof_libs = std::vector<std::string>{};
for(const auto* itr : { "OMNITRACE_ROCM_PATH", "ROCM_PATH" })
for(const auto* itr : { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" })
{
if(getenv(itr))
{
@@ -150,9 +150,9 @@ get_environ(int _verbose, std::string _search_paths = {},
// default path
_possible_rocp_metrics.emplace_back(
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
_possible_rocp_metrics.emplace_back(
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
auto _realpath_and_unique = [](const auto& _inp_v) {
auto _out_v = decltype(_inp_v){};
@@ -172,7 +172,7 @@ get_environ(int _verbose, std::string _search_paths = {},
if(path::exists(itr))
{
_data.emplace_back(
env_config{ "OMNITRACE_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
env_config{ "ROCPROFSYS_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
_possible_rocp_metrics.emplace(
_possible_rocp_metrics.begin(),
common::join('/', path::dirname(itr), "../../lib/rocprofiler"));
@@ -195,7 +195,7 @@ get_environ(int _verbose, std::string _search_paths = {},
}
auto _found_rocp_metrics = (!_env_rocp_metrics.empty())
? get_env("OMNITRACE_ROCP_METRICS_FORCE_VALID", false)
? get_env("ROCPROFSYS_ROCP_METRICS_FORCE_VALID", false)
: false;
if(!_found_rocp_metrics)
@@ -232,26 +232,27 @@ get_environ(int _verbose, std::string _search_paths = {},
<< path::exists(_rocp_metrics_xml) << ") and/or gfx_metrics.xml (found: "
<< path::exists(_rocp_gfx_metrics_xml)
<< "). To ignore this error, set "
"OMNITRACE_ROCP_METRICS_FORCE_VALID=true in the environment";
"ROCPROFSYS_ROCP_METRICS_FORCE_VALID=true in the environment";
}
else
{
_msg << "Error! ROCP_METRICS not set in environment and OmniTrace could not "
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
"in the environment. This file is typically located in the same "
"folder as the librocprofiler64.so library.\nAdditional note: "
"metrics.xml typically contains:\n\t#include "
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
"file.\nExample:\n\texport ROCP_METRICS="
<< OMNITRACE_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
<< "/metrics.xml\n";
_msg
<< "Error! ROCP_METRICS not set in environment and rocprof-sys could not "
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
"in the environment. This file is typically located in the same "
"folder as the librocprofiler64.so library.\nAdditional note: "
"metrics.xml typically contains:\n\t#include "
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
"file.\nExample:\n\texport ROCP_METRICS="
<< ROCPROFSYS_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
<< "/metrics.xml\n";
}
throw std::runtime_error(_msg.str());
}
#endif
#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0
if(get_env("OMNITRACE_USE_OMPT", true))
#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0
if(get_env("ROCPROFSYS_USE_OMPT", true))
{
std::string _omni_omp_libs = _omnilib_dl;
const char* _omp_libs = getenv("OMP_TOOL_LIBRARIES");
@@ -262,8 +263,8 @@ get_environ(int _verbose, std::string _search_paths = {},
_override = 1;
_omni_omp_libs = common::join(':', _omp_libs, _omnilib_dl);
}
OMNITRACE_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
_omni_omp_libs.c_str());
ROCPROFSYS_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
_omni_omp_libs.c_str());
_data.emplace_back(
env_config{ "OMP_TOOL_LIBRARIES", _omni_omp_libs.c_str(), _override });
}
@@ -274,8 +275,8 @@ get_environ(int _verbose, std::string _search_paths = {},
inline void
setup_environ(int _verbose, const std::string& _search_paths = {},
std::string _omnilib = "libomnitrace.so",
std::string _omnilib_dl = "libomnitrace-dl.so")
std::string _omnilib = "librocprof-sys.so",
std::string _omnilib_dl = "librocprof-sys-dl.so")
{
auto _data =
get_environ(_verbose, _search_paths, std::move(_omnilib), std::move(_omnilib_dl));
@@ -283,4 +284,4 @@ setup_environ(int _verbose, const std::string& _search_paths = {},
itr(_verbose >= 3);
}
} // namespace common
} // namespace omnitrace
} // namespace rocprofsys