LLVM OpenMP* Runtime Library
ompt-specific.h
1 #ifndef OMPT_SPECIFIC_H
2 #define OMPT_SPECIFIC_H
3 
4 #include "kmp.h"
5 
6 /*****************************************************************************
7  * types
8  ****************************************************************************/
9 
10 typedef kmp_info_t ompt_thread_t;
11 
12 
13 
14 /*****************************************************************************
15  * forward declarations
16  ****************************************************************************/
17 
18 void __ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid);
19 void __ompt_thread_assign_wait_id(void *variable);
20 
21 void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr,
22  int gtid, void *microtask,
23  ompt_parallel_id_t ompt_pid);
24 
25 void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr);
26 
27 ompt_lw_taskteam_t * __ompt_lw_taskteam_unlink(ompt_thread_t *thr);
28 
29 ompt_parallel_id_t __ompt_parallel_id_new(int gtid);
30 ompt_task_id_t __ompt_task_id_new(int gtid);
31 
32 ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size);
33 
34 ompt_task_info_t *__ompt_get_taskinfo(int depth);
35 
36 void __ompt_thread_begin(ompt_thread_type_t thread_type, int gtid);
37 
38 void __ompt_thread_end(ompt_thread_type_t thread_type, int gtid);
39 
40 int __ompt_get_parallel_team_size_internal(int ancestor_level);
41 
42 ompt_task_id_t __ompt_get_task_id_internal(int depth);
43 
44 ompt_frame_t *__ompt_get_task_frame_internal(int depth);
45 
46 
47 
48 /*****************************************************************************
49  * macros
50  ****************************************************************************/
51 
52 #define OMPT_HAVE_WEAK_ATTRIBUTE KMP_HAVE_WEAK_ATTRIBUTE
53 #define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI
54 #define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle)
55 
56 
57 
58 //******************************************************************************
59 // inline functions
60 //******************************************************************************
61 
62 inline ompt_thread_t *
63 ompt_get_thread_gtid(int gtid)
64 {
65  return (gtid >= 0) ? __kmp_thread_from_gtid(gtid) : NULL;
66 }
67 
68 
69 inline ompt_thread_t *
70 ompt_get_thread()
71 {
72  int gtid = __kmp_gtid_get_specific();
73  return ompt_get_thread_gtid(gtid);
74 }
75 
76 
77 inline void
78 ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state)
79 {
80  thread->th.ompt_thread_info.state = state;
81 }
82 
83 
84 inline const char *
85 ompt_get_runtime_version()
86 {
87  return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
88 }
89 
90 #endif