Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 1 | #ifndef OMPT_SPECIFIC_H |
| 2 | #define OMPT_SPECIFIC_H |
| 3 | |
| 4 | #include "kmp.h" |
| 5 | |
Jonathan Peyton | 95246e7 | 2015-11-05 16:54:55 +0000 | [diff] [blame] | 6 | /***************************************************************************** |
| 7 | * types |
| 8 | ****************************************************************************/ |
| 9 | |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 10 | typedef kmp_info_t ompt_thread_t; |
| 11 | |
Jonathan Peyton | 95246e7 | 2015-11-05 16:54:55 +0000 | [diff] [blame] | 12 | /***************************************************************************** |
| 13 | * forward declarations |
| 14 | ****************************************************************************/ |
| 15 | |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 16 | void __ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid); |
| 17 | void __ompt_thread_assign_wait_id(void *variable); |
| 18 | |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 19 | void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr, |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 20 | int gtid, void *microtask, |
| 21 | ompt_parallel_id_t ompt_pid); |
| 22 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 23 | void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr); |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 24 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 25 | ompt_lw_taskteam_t *__ompt_lw_taskteam_unlink(ompt_thread_t *thr); |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 26 | |
| 27 | ompt_parallel_id_t __ompt_parallel_id_new(int gtid); |
| 28 | ompt_task_id_t __ompt_task_id_new(int gtid); |
| 29 | |
| 30 | ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size); |
| 31 | |
| 32 | ompt_task_info_t *__ompt_get_taskinfo(int depth); |
| 33 | |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 34 | void __ompt_thread_begin(ompt_thread_type_t thread_type, int gtid); |
| 35 | |
| 36 | void __ompt_thread_end(ompt_thread_type_t thread_type, int gtid); |
| 37 | |
| 38 | int __ompt_get_parallel_team_size_internal(int ancestor_level); |
| 39 | |
| 40 | ompt_task_id_t __ompt_get_task_id_internal(int depth); |
| 41 | |
| 42 | ompt_frame_t *__ompt_get_task_frame_internal(int depth); |
| 43 | |
Jonathan Peyton | 69e596a | 2015-10-29 20:56:24 +0000 | [diff] [blame] | 44 | /***************************************************************************** |
| 45 | * macros |
| 46 | ****************************************************************************/ |
Jonathan Peyton | 95246e7 | 2015-11-05 16:54:55 +0000 | [diff] [blame] | 47 | |
Jonathan Peyton | 69e596a | 2015-10-29 20:56:24 +0000 | [diff] [blame] | 48 | #define OMPT_HAVE_WEAK_ATTRIBUTE KMP_HAVE_WEAK_ATTRIBUTE |
| 49 | #define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI |
| 50 | #define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle) |
| 51 | |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 52 | //****************************************************************************** |
| 53 | // inline functions |
| 54 | //****************************************************************************** |
| 55 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 56 | inline ompt_thread_t *ompt_get_thread_gtid(int gtid) { |
| 57 | return (gtid >= 0) ? __kmp_thread_from_gtid(gtid) : NULL; |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 60 | inline ompt_thread_t *ompt_get_thread() { |
| 61 | int gtid = __kmp_get_gtid(); |
| 62 | return ompt_get_thread_gtid(gtid); |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 63 | } |
| 64 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 65 | inline void ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state) { |
| 66 | thread->th.ompt_thread_info.state = state; |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 67 | } |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 68 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 69 | inline const char *ompt_get_runtime_version() { |
| 70 | return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN]; |
Jonathan Peyton | 82a13bf | 2015-09-21 18:01:02 +0000 | [diff] [blame] | 71 | } |
Andrey Churbanov | e5f4492 | 2015-04-29 16:22:07 +0000 | [diff] [blame] | 72 | |
| 73 | #endif |