13#ifndef OMPT_SPECIFIC_H
14#define OMPT_SPECIFIC_H
31 ompt_data_t *ompt_pid,
void *codeptr);
34 int on_heap,
bool always =
false);
47 ompt_data_t **parallel_data,
51 ompt_data_t **task_data,
52 ompt_frame_t **task_frame,
53 ompt_data_t **parallel_data,
int *thread_num);
68#define OMPT_CUR_TASK_INFO(thr) (&((thr)->th.th_current_task->ompt_task_info))
69#define OMPT_CUR_TASK_DATA(thr) \
70 (&((thr)->th.th_current_task->ompt_task_info.task_data))
71#define OMPT_CUR_TEAM_INFO(thr) (&((thr)->th.th_team->t.ompt_team_info))
72#define OMPT_CUR_TEAM_DATA(thr) \
73 (&((thr)->th.th_team->t.ompt_team_info.parallel_data))
75#define OMPT_HAVE_WEAK_ATTRIBUTE KMP_HAVE_WEAK_ATTRIBUTE
76#define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI
77#define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle)
79inline void *__ompt_load_return_address(
int gtid) {
81 void *return_address = thr->th.ompt_thread_info.return_address;
82 thr->th.ompt_thread_info.return_address = NULL;
83 return return_address;
91#define OMPT_STORE_RETURN_ADDRESS(gtid) \
92 OmptReturnAddressGuard ReturnAddressGuard{gtid, __builtin_return_address(0)};
93#define OMPT_LOAD_RETURN_ADDRESS(gtid) __ompt_load_return_address(gtid)
94#define OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid) \
95 ((ompt_enabled.enabled && gtid >= 0 && __kmp_threads[gtid] && \
96 __kmp_threads[gtid]->th.ompt_thread_info.return_address) \
97 ? __ompt_load_return_address(gtid) \
98 : __builtin_return_address(0))
100#define OMPT_GET_DISPATCH_CHUNK(chunk, lb, ub, incr) \
103 chunk.start = static_cast<uint64_t>(lb); \
104 chunk.iterations = static_cast<uint64_t>(((ub) - (lb)) / (incr) + 1); \
106 chunk.start = static_cast<uint64_t>(ub); \
107 chunk.iterations = static_cast<uint64_t>(((lb) - (ub)) / -(incr) + 1); \
115inline kmp_info_t *ompt_get_thread_gtid(
int gtid) {
121 return ompt_get_thread_gtid(gtid);
124inline void ompt_set_thread_state(
kmp_info_t *thread, ompt_state_t state) {
126 thread->th.ompt_thread_info.state = state;
129inline const char *ompt_get_runtime_version() {
133inline ompt_work_t ompt_get_work_schedule(
enum sched_type schedule) {
138 return ompt_work_loop_static;
141 return ompt_work_loop_dynamic;
146 return ompt_work_loop_guided;
148 return ompt_work_loop_other;
152class OmptReturnAddressGuard {
154 bool SetAddress{
false};
158 OmptReturnAddressGuard(
int Gtid,
void *ReturnAddress) : Gtid(Gtid) {
162 __kmp_threads[Gtid]->th.ompt_thread_info.return_address = ReturnAddress;
165 ~OmptReturnAddressGuard() {
167 __kmp_threads[Gtid]->th.ompt_thread_info.return_address = NULL;
174#if OMPT_SUPPORT && OMPT_OPTIONAL
175#define OMPT_REDUCTION_DECL(this_thr, gtid) \
176 ompt_data_t *my_task_data = OMPT_CUR_TASK_DATA(this_thr); \
177 ompt_data_t *my_parallel_data = OMPT_CUR_TEAM_DATA(this_thr); \
178 void *return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
179#define OMPT_REDUCTION_BEGIN \
180 if (ompt_enabled.enabled && ompt_enabled.ompt_callback_reduction) { \
181 ompt_callbacks.ompt_callback(ompt_callback_reduction)( \
182 ompt_sync_region_reduction, ompt_scope_begin, my_parallel_data, \
183 my_task_data, return_address); \
185#define OMPT_REDUCTION_END \
186 if (ompt_enabled.enabled && ompt_enabled.ompt_callback_reduction) { \
187 ompt_callbacks.ompt_callback(ompt_callback_reduction)( \
188 ompt_sync_region_reduction, ompt_scope_end, my_parallel_data, \
189 my_task_data, return_address); \
192#define OMPT_REDUCTION_DECL(this_thr, gtid)
193#define OMPT_REDUCTION_BEGIN
194#define OMPT_REDUCTION_END
sched_type
Describes the loop schedule to be used for a parallel for loop.
@ kmp_sch_guided_simd
guided with chunk adjustment
@ kmp_sch_guided_chunked
guided unspecialized
@ kmp_sch_dynamic_chunked
@ kmp_sch_guided_analytical_chunked
@ kmp_sch_static_balanced
@ kmp_sch_guided_iterative_chunked
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
kmp_info_t ** __kmp_threads
#define SCHEDULE_WITHOUT_MODIFIERS(s)
static kmp_info_t * __kmp_thread_from_gtid(int gtid)
union KMP_ALIGN_CACHE kmp_info kmp_info_t
char const __kmp_version_lib_ver[]
#define KMP_VERSION_MAGIC_LEN
ompt_callbacks_active_t ompt_enabled
void __ompt_thread_assign_wait_id(void *variable)
ompt_team_info_t * __ompt_get_teaminfo(int depth, int *size)
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid, ompt_data_t *ompt_pid, void *codeptr)
ompt_data_t * __ompt_get_target_task_data()
int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame, ompt_data_t **parallel_data, int *thread_num)
ompt_data_t * __ompt_get_task_data()
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int on_heap, bool always)
ompt_task_info_t * __ompt_get_task_info_object(int depth)
void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid)
void __ompt_force_initialization()
void __ompt_lw_taskteam_unlink(kmp_info_t *thr)
ompt_sync_region_t __ompt_get_barrier_kind(enum barrier_type bt, kmp_info_t *thr)
ompt_data_t * __ompt_get_thread_data_internal()
int __ompt_get_parallel_info_internal(int ancestor_level, ompt_data_t **parallel_data, int *team_size)