39#include <unordered_map>
42#if !defined(TIMEMORY_KOKKOSP_PREFIX)
43# if defined(TIMEMORY_LIBRARY_SOURCE)
44# define TIMEMORY_KOKKOSP_PREFIX TIMEMORY_WEAK_PREFIX
46# define TIMEMORY_KOKKOSP_PREFIX
50#if !defined(TIMEMORY_KOKKOSP_POSTFIX)
51# if defined(TIMEMORY_LIBRARY_SOURCE)
52# define TIMEMORY_KOKKOSP_POSTFIX \
53 TIMEMORY_WEAK_POSTFIX TIMEMORY_VISIBILITY("default")
55# define TIMEMORY_KOKKOSP_POSTFIX TIMEMORY_VISIBILITY("default")
64struct KokkosPDeviceInfo
95 switch(handle.name[0])
123 static thread_local uint64_t _instance = 0;
132 static std::mutex _instance;
141 static std::vector<std::function<void()>> _instance{};
147template <
typename Tp>
152 static thread_local Tp _instance{};
154 static thread_local bool _init = [&]() {
156 get_cleanup().push_back([&]() { _instance.clear(); });
167template <
typename Tp>
172 static Tp _instance{};
174 static bool _init = [&]() {
176 get_cleanup().push_back([&]() { _instance.clear(); });
202 template <
typename... Args>
209 auto_lock_t _lk{ type_mutex<decltype(std::cerr)>() };
224 static int64_t _value = 0;
233 std::stringstream ss;
234 ss << std::right << std::setw(_depth * 2) <<
"";
246template <
typename... Tail>
250template <
typename... Tail>
253template <
typename... Tail>
257template <
typename... Tail>
260template <
typename... Tail>
265template <
typename... Tail>
268template <
typename... Tail>
273template <
typename... Tail>
282template <
typename... Tail>
291template <
typename... Tail>
300template <
typename... Tail>
309template <
typename... Tail>
318template <
typename... Tail>
327template <
typename... Tail>
331 if(get_profiler_index_map<Tail...>().find(kernid) !=
332 get_profiler_index_map<Tail...>().
end())
338template <
typename... Tail>
342 if(get_profiler_index_map<Tail...>().find(kernid) !=
343 get_profiler_index_map<Tail...>().
end())
349template <
typename... Tail>
353 if(get_profiler_index_map<Tail...>().find(kernid) !=
354 get_profiler_index_map<Tail...>().
end())
382 const int loadSeq,
const uint64_t interfaceVer,
const uint32_t devInfoCount,
429 const SpaceHandle space,
const char* label,
const void*
const ptr,
433 const SpaceHandle space,
const char* label,
const void*
const ptr,
437 SpaceHandle dst_handle,
const char* dst_name,
const void* dst_ptr,
438 SpaceHandle src_handle,
const char* src_name,
const void* src_ptr,
This is a variadic component wrapper where all components are allocated on the stack and cannot be di...
Implementation of the data_tracker component(s)
Forward declaration of user_bundle components. User-bundles are similar to the classical profiling in...
void kokkosp_end_deep_copy()
void kokkosp_end_fence(uint64_t kernid)
void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, const uint32_t devInfoCount, void *deviceInfo)
#define TIMEMORY_KOKKOSP_POSTFIX
void kokkosp_push_profile_region(const char *name)
void kokkosp_start_profile_section(uint32_t secid)
TIMEMORY_DEFINE_CONCRETE_TRAIT(uses_memory_units, kokkosp::memory_tracker, std::true_type) TIMEMORY_DEFINE_CONCRETE_TRAIT(is_memory_category
void kokkosp_end_parallel_scan(uint64_t kernid)
std::true_type void kokkosp_print_help(char *argv0)
void kokkosp_parse_args(int argc, char **argv)
void kokkosp_begin_parallel_reduce(const char *name, uint32_t devid, uint64_t *kernid)
void kokkosp_end_parallel_reduce(uint64_t kernid)
void kokkosp_begin_parallel_scan(const char *name, uint32_t devid, uint64_t *kernid)
void kokkosp_stop_profile_section(uint32_t secid)
void kokkosp_begin_deep_copy(SpaceHandle dst_handle, const char *dst_name, const void *dst_ptr, SpaceHandle src_handle, const char *src_name, const void *src_ptr, uint64_t size)
void kokkosp_profile_event(const char *name)
void kokkosp_pop_profile_region()
void kokkosp_finalize_library()
void kokkosp_begin_fence(const char *name, uint32_t devid, uint64_t *kernid)
void kokkosp_begin_parallel_for(const char *name, uint32_t devid, uint64_t *kernid)
void kokkosp_declare_metadata(const char *key, const char *value)
void kokkosp_create_profile_section(const char *name, uint32_t *secid)
void kokkosp_deallocate_data(const SpaceHandle space, const char *label, const void *const ptr, const uint64_t size)
void kokkosp_allocate_data(const SpaceHandle space, const char *label, const void *const ptr, const uint64_t size)
void kokkosp_destroy_profile_section(uint32_t secid)
#define TIMEMORY_KOKKOSP_PREFIX
void kokkosp_end_parallel_for(uint64_t kernid)
_reported insert(_hash_id)
std::mutex & get_cleanup_mutex()
tim::component::data_tracker< int64_t, tim::project::kokkosp > memory_tracker
tim::component::user_kokkosp_bundle kokkos_bundle
profiler_index_map_t< Tail... > & get_profiler_index_map()
profiler_stack_t< Tail... > & get_profiler_stack()
Space get_space(const SpaceHandle &handle)
void create_profiler(const std::string &pname, uint64_t kernid)
void stop_profiler(uint64_t kernid)
std::unordered_map< uint64_t, profiler_t< Tail... > > profiler_index_map_t
std::unordered_map< string_view_t, std::unordered_map< string_view_t, profiler_t< Tail... > > > profiler_memory_map_t
tim::component_bundle_t< project::kokkosp, kokkosp::kernel_logger * > logger_t
const char * get_space_name(int space)
profiler_section_map_t< Tail... > & get_profiler_section_map()
tim::component_bundle_t< project::kokkosp, kokkosp::memory_tracker, Tail... > profiler_t
std::vector< profiler_t< Tail... > > profiler_stack_t
profiler_memory_map_t< Tail... > & get_profiler_memory_map()
void destroy_profiler(uint64_t kernid)
std::tuple< std::string, profiler_t< Tail... > > profiler_section_t
void start_profiler(uint64_t kernid)
std::unordered_map< uint64_t, profiler_section_t< Tail... > > profiler_section_map_t
std::array< char *, 4 > _args
std::string string_view_t
std::unique_lock< mutex_t > auto_lock_t
Unique lock type around mutex_t.
convert_t< mpl::available_t< type_list< T... > >, component_bundle< Tag > > component_bundle_t
const std::string & string_view_cref_t
tim::mpl::apply< std::string > string
void consume_parameters(ArgsT &&...)
This component is provided to facilitate data tracking. The first template parameter is the type of d...
static std::string get_indent()
void mark(int64_t _inc_depth, Args &&... _args)
static int64_t & get_depth()
static std::string get_message(string_view_cref_t _msg)
#define TIMEMORY_JOIN(delim,...)