Rename hosttrace to omnitrace (#18)
[ROCm/rocprofiler-systems commit: 39cf760a4e]
This commit is contained in:
committed by
GitHub
parent
efb6d766af
commit
9d5ebf9c3b
@@ -33,12 +33,12 @@
|
||||
// forward decl of the API
|
||||
extern "C"
|
||||
{
|
||||
void hosttrace_push_trace(const char* name) TIMEMORY_VISIBILITY("default");
|
||||
void hosttrace_pop_trace(const char* name) TIMEMORY_VISIBILITY("default");
|
||||
void hosttrace_trace_init(const char*, bool, const char*)
|
||||
void omnitrace_push_trace(const char* name) TIMEMORY_VISIBILITY("default");
|
||||
void omnitrace_pop_trace(const char* name) TIMEMORY_VISIBILITY("default");
|
||||
void omnitrace_trace_init(const char*, bool, const char*)
|
||||
TIMEMORY_VISIBILITY("default");
|
||||
void hosttrace_trace_finalize(void) TIMEMORY_VISIBILITY("default");
|
||||
void hosttrace_trace_set_env(const char* env_name, const char* env_val)
|
||||
void omnitrace_trace_finalize(void) TIMEMORY_VISIBILITY("default");
|
||||
void omnitrace_trace_set_env(const char* env_name, const char* env_val)
|
||||
TIMEMORY_VISIBILITY("default");
|
||||
void hosttrace_trace_set_mpi(bool use, bool attached) TIMEMORY_VISIBILITY("default");
|
||||
void omnitrace_trace_set_mpi(bool use, bool attached) TIMEMORY_VISIBILITY("default");
|
||||
}
|
||||
|
||||
@@ -46,5 +46,5 @@
|
||||
#include <vector>
|
||||
|
||||
// timemory api struct
|
||||
struct hosttrace : tim::concepts::api
|
||||
struct omnitrace : tim::concepts::api
|
||||
{};
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
// bundle of components around hosttrace_init and hosttrace_finalize
|
||||
// bundle of components around omnitrace_init and omnitrace_finalize
|
||||
using main_bundle_t =
|
||||
tim::lightweight_tuple<comp::wall_clock, comp::peak_rss, comp::cpu_clock,
|
||||
comp::cpu_util, comp::roctracer, papi_tot_ins,
|
||||
@@ -48,13 +48,13 @@ using main_bundle_t =
|
||||
|
||||
// bundle of components used in instrumentation
|
||||
using instrumentation_bundle_t =
|
||||
tim::component_bundle<hosttrace, comp::wall_clock*, comp::user_global_bundle*>;
|
||||
tim::component_bundle<omnitrace, comp::wall_clock*, comp::user_global_bundle*>;
|
||||
|
||||
// allocator for instrumentation_bundle_t
|
||||
using bundle_allocator_t = tim::data::ring_buffer_allocator<instrumentation_bundle_t>;
|
||||
|
||||
// bundle of components around each thread
|
||||
using hosttrace_thread_bundle_t =
|
||||
using omnitrace_thread_bundle_t =
|
||||
tim::lightweight_tuple<comp::wall_clock, comp::thread_cpu_clock,
|
||||
comp::thread_cpu_util,
|
||||
#if defined(TIMEMORY_RUSAGE_THREAD) && TIMEMORY_RUSAGE_THREAD > 0
|
||||
|
||||
@@ -41,40 +41,40 @@ bool
|
||||
get_critical_trace_debug();
|
||||
|
||||
#if defined(TIMEMORY_USE_MPI)
|
||||
# define HOSTTRACE_CONDITIONAL_PRINT(COND, ...) \
|
||||
# define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \
|
||||
if(COND) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
tim::auto_lock_t _lk{ tim::type_mutex<decltype(std::cerr)>() }; \
|
||||
fprintf(stderr, "[hosttrace][%i][%li] ", static_cast<int>(tim::dmp::rank()), \
|
||||
fprintf(stderr, "[omnitrace][%i][%li] ", static_cast<int>(tim::dmp::rank()), \
|
||||
tim::threading::get_id()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fflush(stderr); \
|
||||
}
|
||||
#else
|
||||
# define HOSTTRACE_CONDITIONAL_PRINT(COND, ...) \
|
||||
# define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \
|
||||
if(COND) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
tim::auto_lock_t _lk{ tim::type_mutex<decltype(std::cerr)>() }; \
|
||||
fprintf(stderr, "[hosttrace][%i][%li] ", \
|
||||
fprintf(stderr, "[omnitrace][%i][%li] ", \
|
||||
static_cast<int>(tim::process::get_id()), tim::threading::get_id()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fflush(stderr); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define HOSTTRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \
|
||||
if(COND) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
tim::auto_lock_t _lk{ tim::type_mutex<decltype(std::cerr)>() }; \
|
||||
fprintf(stderr, "[hosttrace] "); \
|
||||
fprintf(stderr, "[omnitrace] "); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
#define HOSTTRACE_DEBUG(...) HOSTTRACE_CONDITIONAL_PRINT(get_debug(), __VA_ARGS__)
|
||||
#define HOSTTRACE_PRINT(...) HOSTTRACE_CONDITIONAL_PRINT(true, __VA_ARGS__)
|
||||
#define HOSTTRACE_CT_DEBUG(...) \
|
||||
HOSTTRACE_CONDITIONAL_PRINT(get_critical_trace_debug(), __VA_ARGS__)
|
||||
#define OMNITRACE_DEBUG(...) OMNITRACE_CONDITIONAL_PRINT(get_debug(), __VA_ARGS__)
|
||||
#define OMNITRACE_PRINT(...) OMNITRACE_CONDITIONAL_PRINT(true, __VA_ARGS__)
|
||||
#define OMNITRACE_CT_DEBUG(...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT(get_critical_trace_debug(), __VA_ARGS__)
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define HOSTTRACE_HIP_VERSION_STRING "@HIP_VERSION@"
|
||||
#define HOSTTRACE_HIP_VERSION_MAJOR @HIP_VERSION_MAJOR@
|
||||
#define HOSTTRACE_HIP_VERSION_MINOR @HIP_VERSION_MINOR@
|
||||
#define HOSTTRACE_HIP_VERSION_PATCH @HIP_VERSION_PATCH@
|
||||
#define OMNITRACE_HIP_VERSION_STRING "@HIP_VERSION@"
|
||||
#define OMNITRACE_HIP_VERSION_MAJOR @HIP_VERSION_MAJOR@
|
||||
#define OMNITRACE_HIP_VERSION_MINOR @HIP_VERSION_MINOR@
|
||||
#define OMNITRACE_HIP_VERSION_PATCH @HIP_VERSION_PATCH@
|
||||
// clang-format on
|
||||
|
||||
#if defined(HOSTTRACE_USE_ROCTRACER)
|
||||
# define HOSTTRACE_ROCTRACER_LIBKFDWRAPPER "@roctracer_kfdwrapper_LIBRARY@"
|
||||
#if defined(OMNITRACE_USE_ROCTRACER)
|
||||
# define OMNITRACE_ROCTRACER_LIBKFDWRAPPER "@roctracer_kfdwrapper_LIBRARY@"
|
||||
#else
|
||||
# define HOSTTRACE_ROCTRACER_LIBKFDWRAPPER "/opt/rocm/roctracer/lib/libkfdwrapper64.so"
|
||||
# define OMNITRACE_ROCTRACER_LIBKFDWRAPPER "/opt/rocm/roctracer/lib/libkfdwrapper64.so"
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ struct dynamic_library
|
||||
handle = dlopen(filename.c_str(), flags);
|
||||
if(!handle)
|
||||
{
|
||||
HOSTTRACE_DEBUG("%s\n", dlerror());
|
||||
OMNITRACE_DEBUG("%s\n", dlerror());
|
||||
}
|
||||
dlerror(); // Clear any existing error
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@ struct fork_gotcha : comp::base<fork_gotcha, void>
|
||||
void audit(const gotcha_data_t& _data, audit::outgoing, pid_t _pid);
|
||||
};
|
||||
|
||||
using fork_gotcha_t = comp::gotcha<4, tim::component_tuple<fork_gotcha>, hosttrace>;
|
||||
using fork_gotcha_t = comp::gotcha<4, tim::component_tuple<fork_gotcha>, omnitrace>;
|
||||
|
||||
@@ -34,21 +34,31 @@
|
||||
// this is used to wrap MPI_Init and MPI_Init_thread
|
||||
struct mpi_gotcha : comp::base<mpi_gotcha, void>
|
||||
{
|
||||
using comm_t = tim::mpi::comm_t;
|
||||
using gotcha_data_t = comp::gotcha_data;
|
||||
|
||||
TIMEMORY_DEFAULT_OBJECT(mpi_gotcha)
|
||||
|
||||
// this will get called right before MPI_Init with that functions arguments
|
||||
void audit(const gotcha_data_t& _data, audit::incoming, int*, char***);
|
||||
// called right before MPI_Init with that functions arguments
|
||||
static void audit(const gotcha_data_t& _data, audit::incoming, int*, char***);
|
||||
|
||||
// this will get called right before MPI_Init_thread with that functions arguments
|
||||
void audit(const gotcha_data_t& _data, audit::incoming, int*, char***, int, int*);
|
||||
// called right before MPI_Init_thread with that functions arguments
|
||||
static void audit(const gotcha_data_t& _data, audit::incoming, int*, char***, int,
|
||||
int*);
|
||||
|
||||
// this will get called right after MPI_Init and MPI_Init_thread with the return value
|
||||
// called right before MPI_Finalize
|
||||
static void audit(const gotcha_data_t& _data, audit::incoming);
|
||||
|
||||
// called right before MPI_Comm_{rank,size} with that functions arguments
|
||||
void audit(const gotcha_data_t& _data, audit::incoming, comm_t, int*);
|
||||
|
||||
// called right after MPI_{Init,Init_thread,Comm_rank,Comm_size} with the return value
|
||||
void audit(const gotcha_data_t& _data, audit::outgoing, int _retval);
|
||||
|
||||
// this will get called right before MPI_Finalize
|
||||
void audit(const gotcha_data_t& _data, audit::incoming);
|
||||
private:
|
||||
comm_t m_comm = tim::mpi::comm_world_v;
|
||||
int* m_rank = nullptr;
|
||||
int* m_size = nullptr;
|
||||
};
|
||||
|
||||
using mpi_gotcha_t = comp::gotcha<4, tim::component_tuple<mpi_gotcha>, hosttrace>;
|
||||
using mpi_gotcha_t = comp::gotcha<5, tim::component_tuple<mpi_gotcha>, omnitrace>;
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
|
||||
#include "library/timemory.hpp"
|
||||
|
||||
// timemory component which calls hosttrace functions
|
||||
// timemory component which calls omnitrace functions
|
||||
// (used in gotcha wrappers)
|
||||
struct hosttrace_component : comp::base<hosttrace_component, void>
|
||||
struct omnitrace_component : comp::base<omnitrace_component, void>
|
||||
{
|
||||
void start();
|
||||
void stop();
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
TIMEMORY_DECLARE_COMPONENT(roctracer)
|
||||
|
||||
#if !defined(HOSTTRACE_USE_ROCTRACER)
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
|
||||
using hsa_timer_t = hsa_rt_utils::Timer;
|
||||
using timestamp_t = hsa_timer_t::timestamp_t;
|
||||
using roctracer_bundle_t = tim::component_bundle<hosttrace, comp::roctracer_data,
|
||||
using roctracer_bundle_t = tim::component_bundle<omnitrace, comp::roctracer_data,
|
||||
comp::wall_clock, quirk::explicit_pop>;
|
||||
using roctracer_hsa_bundle_t = tim::component_bundle<hosttrace, comp::roctracer_data>;
|
||||
using roctracer_hsa_bundle_t = tim::component_bundle<omnitrace, comp::roctracer_data>;
|
||||
using roctracer_functions_t = std::vector<std::pair<std::string, std::function<void()>>>;
|
||||
|
||||
std::unique_ptr<hsa_timer_t>&
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// used for specifying the state of hosttrace
|
||||
// used for specifying the state of omnitrace
|
||||
enum class State : unsigned short
|
||||
{
|
||||
DelayedInit = 0,
|
||||
|
||||
@@ -36,14 +36,14 @@
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(HOSTTRACE_MAX_THREADS)
|
||||
# define HOSTTRACE_MAX_THREADS 1024
|
||||
#if !defined(OMNITRACE_MAX_THREADS)
|
||||
# define OMNITRACE_MAX_THREADS 1024
|
||||
#endif
|
||||
|
||||
static constexpr size_t max_supported_threads = HOSTTRACE_MAX_THREADS;
|
||||
static constexpr size_t max_supported_threads = OMNITRACE_MAX_THREADS;
|
||||
|
||||
template <typename Tp, typename Tag = void, size_t MaxThreads = max_supported_threads>
|
||||
struct hosttrace_thread_data
|
||||
struct omnitrace_thread_data
|
||||
{
|
||||
using instance_array_t = std::array<std::unique_ptr<Tp>, MaxThreads>;
|
||||
using construct_on_init = std::true_type;
|
||||
@@ -61,7 +61,7 @@ struct hosttrace_thread_data
|
||||
template <typename Tp, typename Tag, size_t MaxThreads>
|
||||
template <typename... Args>
|
||||
void
|
||||
hosttrace_thread_data<Tp, Tag, MaxThreads>::construct(Args&&... _args)
|
||||
omnitrace_thread_data<Tp, Tag, MaxThreads>::construct(Args&&... _args)
|
||||
{
|
||||
static thread_local bool _v = [&_args...]() {
|
||||
instances().at(threading::get_id()) =
|
||||
@@ -73,14 +73,14 @@ hosttrace_thread_data<Tp, Tag, MaxThreads>::construct(Args&&... _args)
|
||||
|
||||
template <typename Tp, typename Tag, size_t MaxThreads>
|
||||
std::unique_ptr<Tp>&
|
||||
hosttrace_thread_data<Tp, Tag, MaxThreads>::instance()
|
||||
omnitrace_thread_data<Tp, Tag, MaxThreads>::instance()
|
||||
{
|
||||
return instances().at(threading::get_id());
|
||||
}
|
||||
|
||||
template <typename Tp, typename Tag, size_t MaxThreads>
|
||||
typename hosttrace_thread_data<Tp, Tag, MaxThreads>::instance_array_t&
|
||||
hosttrace_thread_data<Tp, Tag, MaxThreads>::instances()
|
||||
typename omnitrace_thread_data<Tp, Tag, MaxThreads>::instance_array_t&
|
||||
omnitrace_thread_data<Tp, Tag, MaxThreads>::instances()
|
||||
{
|
||||
static auto _v = instance_array_t{};
|
||||
return _v;
|
||||
@@ -89,7 +89,7 @@ hosttrace_thread_data<Tp, Tag, MaxThreads>::instances()
|
||||
template <typename Tp, typename Tag, size_t MaxThreads>
|
||||
template <typename... Args>
|
||||
std::unique_ptr<Tp>&
|
||||
hosttrace_thread_data<Tp, Tag, MaxThreads>::instance(construct_on_init, Args&&... _args)
|
||||
omnitrace_thread_data<Tp, Tag, MaxThreads>::instance(construct_on_init, Args&&... _args)
|
||||
{
|
||||
construct(std::forward<Args>(_args)...);
|
||||
return instances().at(threading::get_id());
|
||||
@@ -97,8 +97,8 @@ hosttrace_thread_data<Tp, Tag, MaxThreads>::instance(construct_on_init, Args&&..
|
||||
|
||||
template <typename Tp, typename Tag, size_t MaxThreads>
|
||||
template <typename... Args>
|
||||
typename hosttrace_thread_data<Tp, Tag, MaxThreads>::instance_array_t&
|
||||
hosttrace_thread_data<Tp, Tag, MaxThreads>::instances(construct_on_init, Args&&... _args)
|
||||
typename omnitrace_thread_data<Tp, Tag, MaxThreads>::instance_array_t&
|
||||
omnitrace_thread_data<Tp, Tag, MaxThreads>::instances(construct_on_init, Args&&... _args)
|
||||
{
|
||||
static auto _v = [&]() {
|
||||
auto _internal = instance_array_t{};
|
||||
|
||||
Reference in New Issue
Block a user