LLVM OpenMP* Runtime Library
ompt-internal.h
1 #ifndef __OMPT_INTERNAL_H__
2 #define __OMPT_INTERNAL_H__
3 
4 #include "ompt-event-specific.h"
5 #include "ompt.h"
6 
7 #define OMPT_VERSION 1
8 
9 #define _OMP_EXTERN extern "C"
10 
11 #define OMPT_INVOKER(x) \
12  ((x == fork_context_gnu) ? ompt_invoker_program : ompt_invoker_runtime)
13 
14 #define ompt_callback(e) e##_callback
15 
16 typedef struct ompt_callbacks_s {
17 #define ompt_event_macro(event, callback, eventid) \
18  callback ompt_callback(event);
19 
20  FOREACH_OMPT_EVENT(ompt_event_macro)
21 
22 #undef ompt_event_macro
23 } ompt_callbacks_t;
24 
25 typedef struct {
26  ompt_frame_t frame;
27  void *function;
28  ompt_task_id_t task_id;
29 #if OMP_40_ENABLED
30  int ndeps;
31  ompt_task_dependence_t *deps;
32 #endif /* OMP_40_ENABLED */
33 } ompt_task_info_t;
34 
35 typedef struct {
36  ompt_parallel_id_t parallel_id;
37  void *microtask;
38 } ompt_team_info_t;
39 
40 typedef struct ompt_lw_taskteam_s {
41  ompt_team_info_t ompt_team_info;
42  ompt_task_info_t ompt_task_info;
43  struct ompt_lw_taskteam_s *parent;
44 } ompt_lw_taskteam_t;
45 
46 typedef struct ompt_parallel_info_s {
47  ompt_task_id_t parent_task_id; /* id of parent task */
48  ompt_parallel_id_t parallel_id; /* id of parallel region */
49  ompt_frame_t *parent_task_frame; /* frame data of parent task */
50  void *parallel_function; /* pointer to outlined function */
51 } ompt_parallel_info_t;
52 
53 typedef struct {
54  ompt_state_t state;
55  ompt_wait_id_t wait_id;
56  void *idle_frame;
57 } ompt_thread_info_t;
58 
59 extern ompt_callbacks_t ompt_callbacks;
60 
61 #if OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE
62 #if USE_FAST_MEMORY
63 #define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
64 #define KMP_OMPT_DEPS_FREE __kmp_fast_free
65 #else
66 #define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
67 #define KMP_OMPT_DEPS_FREE __kmp_thread_free
68 #endif
69 #endif /* OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE */
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
75 void ompt_pre_init(void);
76 void ompt_post_init(void);
77 void ompt_fini(void);
78 
79 extern int ompt_enabled;
80 
81 #ifdef __cplusplus
82 };
83 #endif
84 
85 #endif