blob: b4f09a41982c2161564b55f08c790f26952187eb [file] [log] [blame]
Andrey Churbanove5f44922015-04-29 16:22:07 +00001#ifndef OMPT_SPECIFIC_H
2#define OMPT_SPECIFIC_H
3
4#include "kmp.h"
5
Jonathan Peyton95246e72015-11-05 16:54:55 +00006/*****************************************************************************
7 * types
8 ****************************************************************************/
9
Jonathan Peyton82a13bf2015-09-21 18:01:02 +000010typedef kmp_info_t ompt_thread_t;
11
Jonathan Peyton95246e72015-11-05 16:54:55 +000012/*****************************************************************************
13 * forward declarations
14 ****************************************************************************/
15
Andrey Churbanove5f44922015-04-29 16:22:07 +000016void __ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid);
17void __ompt_thread_assign_wait_id(void *variable);
18
Jonathan Peyton82a13bf2015-09-21 18:01:02 +000019void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr,
Andrey Churbanove5f44922015-04-29 16:22:07 +000020 int gtid, void *microtask,
21 ompt_parallel_id_t ompt_pid);
22
Jonathan Peyton30419822017-05-12 18:01:32 +000023void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr);
Andrey Churbanove5f44922015-04-29 16:22:07 +000024
Jonathan Peyton30419822017-05-12 18:01:32 +000025ompt_lw_taskteam_t *__ompt_lw_taskteam_unlink(ompt_thread_t *thr);
Andrey Churbanove5f44922015-04-29 16:22:07 +000026
27ompt_parallel_id_t __ompt_parallel_id_new(int gtid);
28ompt_task_id_t __ompt_task_id_new(int gtid);
29
30ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size);
31
32ompt_task_info_t *__ompt_get_taskinfo(int depth);
33
Jonathan Peyton82a13bf2015-09-21 18:01:02 +000034void __ompt_thread_begin(ompt_thread_type_t thread_type, int gtid);
35
36void __ompt_thread_end(ompt_thread_type_t thread_type, int gtid);
37
38int __ompt_get_parallel_team_size_internal(int ancestor_level);
39
40ompt_task_id_t __ompt_get_task_id_internal(int depth);
41
42ompt_frame_t *__ompt_get_task_frame_internal(int depth);
43
Jonathan Peyton69e596a2015-10-29 20:56:24 +000044/*****************************************************************************
45 * macros
46 ****************************************************************************/
Jonathan Peyton95246e72015-11-05 16:54:55 +000047
Jonathan Peyton69e596a2015-10-29 20:56:24 +000048#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 Peyton82a13bf2015-09-21 18:01:02 +000052//******************************************************************************
53// inline functions
54//******************************************************************************
55
Jonathan Peyton30419822017-05-12 18:01:32 +000056inline ompt_thread_t *ompt_get_thread_gtid(int gtid) {
57 return (gtid >= 0) ? __kmp_thread_from_gtid(gtid) : NULL;
Andrey Churbanove5f44922015-04-29 16:22:07 +000058}
59
Jonathan Peyton30419822017-05-12 18:01:32 +000060inline ompt_thread_t *ompt_get_thread() {
61 int gtid = __kmp_get_gtid();
62 return ompt_get_thread_gtid(gtid);
Andrey Churbanove5f44922015-04-29 16:22:07 +000063}
64
Jonathan Peyton30419822017-05-12 18:01:32 +000065inline void ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state) {
66 thread->th.ompt_thread_info.state = state;
Jonathan Peyton82a13bf2015-09-21 18:01:02 +000067}
Andrey Churbanove5f44922015-04-29 16:22:07 +000068
Jonathan Peyton30419822017-05-12 18:01:32 +000069inline const char *ompt_get_runtime_version() {
70 return &__kmp_version_lib_ver[KMP_VERSION_MAGIC_LEN];
Jonathan Peyton82a13bf2015-09-21 18:01:02 +000071}
Andrey Churbanove5f44922015-04-29 16:22:07 +000072
73#endif