xref: /freebsd/lib/libomp/omp-tools.h (revision f7c32ed617858bcd22f8d1b03199099d50125721)
1 // $FreeBSD$
2 /*
3  * include/omp-tools.h.var
4  */
5 
6 //===----------------------------------------------------------------------===//
7 //
8 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See https://llvm.org/LICENSE.txt for license information.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef __OMPT__
15 #define __OMPT__
16 
17 /*****************************************************************************
18  * system include files
19  *****************************************************************************/
20 
21 #include <stdint.h>
22 #include <stddef.h>
23 
24 #ifdef DEPRECATION_WARNINGS
25 # ifdef __cplusplus
26 # define DEPRECATED_51 [[deprecated("as of 5.1")]]
27 # else
28 # define DEPRECATED_51 __attribute__((deprecated("as of 5.1")))
29 #endif
30 #else
31 #define DEPRECATED_51
32 #endif
33 
34 /*****************************************************************************
35  * iteration macros
36  *****************************************************************************/
37 
38 #define FOREACH_OMPT_INQUIRY_FN(macro)      \
39     macro (ompt_enumerate_states)           \
40     macro (ompt_enumerate_mutex_impls)      \
41                                             \
42     macro (ompt_set_callback)               \
43     macro (ompt_get_callback)               \
44                                             \
45     macro (ompt_get_state)                  \
46                                             \
47     macro (ompt_get_parallel_info)          \
48     macro (ompt_get_task_info)              \
49     macro (ompt_get_task_memory)            \
50     macro (ompt_get_thread_data)            \
51     macro (ompt_get_unique_id)              \
52     macro (ompt_finalize_tool)              \
53                                             \
54     macro(ompt_get_num_procs)               \
55     macro(ompt_get_num_places)              \
56     macro(ompt_get_place_proc_ids)          \
57     macro(ompt_get_place_num)               \
58     macro(ompt_get_partition_place_nums)    \
59     macro(ompt_get_proc_id)                 \
60                                             \
61     macro(ompt_get_target_info)             \
62     macro(ompt_get_num_devices)
63 
64 #define FOREACH_OMPT_STATE(macro)                                                                \
65                                                                                                 \
66     /* first available state */                                                                 \
67     macro (ompt_state_undefined, 0x102)      /* undefined thread state */                        \
68                                                                                                 \
69     /* work states (0..15) */                                                                   \
70     macro (ompt_state_work_serial, 0x000)    /* working outside parallel */                      \
71     macro (ompt_state_work_parallel, 0x001)  /* working within parallel */                       \
72     macro (ompt_state_work_reduction, 0x002) /* performing a reduction */                        \
73                                                                                                 \
74     /* barrier wait states (16..31) */                                                          \
75     macro (ompt_state_wait_barrier, 0x010)   /* waiting at a barrier */                          \
76     macro (ompt_state_wait_barrier_implicit_parallel, 0x011)                                     \
77                                             /* implicit barrier at the end of parallel region */\
78     macro (ompt_state_wait_barrier_implicit_workshare, 0x012)                                    \
79                                             /* implicit barrier at the end of worksharing */    \
80     macro (ompt_state_wait_barrier_implicit, 0x013)  /* implicit barrier */                      \
81     macro (ompt_state_wait_barrier_explicit, 0x014)  /* explicit barrier */                      \
82                                                                                                 \
83     /* task wait states (32..63) */                                                             \
84     macro (ompt_state_wait_taskwait, 0x020)  /* waiting at a taskwait */                         \
85     macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */                        \
86                                                                                                 \
87     /* mutex wait states (64..127) */                                                           \
88     macro (ompt_state_wait_mutex, 0x040)                                                         \
89     macro (ompt_state_wait_lock, 0x041)      /* waiting for lock */                              \
90     macro (ompt_state_wait_critical, 0x042)  /* waiting for critical */                          \
91     macro (ompt_state_wait_atomic, 0x043)    /* waiting for atomic */                            \
92     macro (ompt_state_wait_ordered, 0x044)   /* waiting for ordered */                           \
93                                                                                                 \
94     /* target wait states (128..255) */                                                         \
95     macro (ompt_state_wait_target, 0x080)        /* waiting for target region */                 \
96     macro (ompt_state_wait_target_map, 0x081)    /* waiting for target data mapping operation */ \
97     macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */       \
98                                                                                                 \
99     /* misc (256..511) */                                                                       \
100     macro (ompt_state_idle, 0x100)           /* waiting for work */                              \
101     macro (ompt_state_overhead, 0x101)       /* overhead excluding wait states */                \
102                                                                                                 \
103     /* implementation-specific states (512..) */
104 
105 
106 #define FOREACH_KMP_MUTEX_IMPL(macro)                                                \
107     macro (kmp_mutex_impl_none, 0)         /* unknown implementation */              \
108     macro (kmp_mutex_impl_spin, 1)         /* based on spin */                       \
109     macro (kmp_mutex_impl_queuing, 2)      /* based on some fair policy */           \
110     macro (kmp_mutex_impl_speculative, 3)  /* based on HW-supported speculation */
111 
112 #define FOREACH_OMPT_EVENT(macro)                                                                                        \
113                                                                                                                          \
114     /*--- Mandatory Events ---*/                                                                                         \
115     macro (ompt_callback_thread_begin,      ompt_callback_thread_begin_t,       1) /* thread begin                    */ \
116     macro (ompt_callback_thread_end,        ompt_callback_thread_end_t,         2) /* thread end                      */ \
117                                                                                                                          \
118     macro (ompt_callback_parallel_begin,    ompt_callback_parallel_begin_t,     3) /* parallel begin                  */ \
119     macro (ompt_callback_parallel_end,      ompt_callback_parallel_end_t,       4) /* parallel end                    */ \
120                                                                                                                          \
121     macro (ompt_callback_task_create,       ompt_callback_task_create_t,        5) /* task begin                      */ \
122     macro (ompt_callback_task_schedule,     ompt_callback_task_schedule_t,      6) /* task schedule                   */ \
123     macro (ompt_callback_implicit_task,     ompt_callback_implicit_task_t,      7) /* implicit task                   */ \
124                                                                                                                          \
125     macro (ompt_callback_target,            ompt_callback_target_t,             8) /* target                          */ \
126     macro (ompt_callback_target_data_op,    ompt_callback_target_data_op_t,     9) /* target data op                  */ \
127     macro (ompt_callback_target_submit,     ompt_callback_target_submit_t,     10) /* target  submit                  */ \
128                                                                                                                          \
129     macro (ompt_callback_control_tool,      ompt_callback_control_tool_t,      11) /* control tool                    */ \
130                                                                                                                          \
131     macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize               */ \
132     macro (ompt_callback_device_finalize,   ompt_callback_device_finalize_t,   13) /* device finalize                 */ \
133                                                                                                                          \
134     macro (ompt_callback_device_load,       ompt_callback_device_load_t,       14) /* device load                     */ \
135     macro (ompt_callback_device_unload,     ompt_callback_device_unload_t,     15) /* device unload                   */ \
136                                                                                                                          \
137     /* Optional Events */                                                                                                \
138     macro (ompt_callback_sync_region_wait,  ompt_callback_sync_region_t,       16) /* sync region wait begin or end   */ \
139                                                                                                                          \
140     macro (ompt_callback_mutex_released,    ompt_callback_mutex_t,             17) /* mutex released                  */ \
141                                                                                                                          \
142     macro (ompt_callback_dependences,       ompt_callback_dependences_t,       18) /* report task dependences         */ \
143     macro (ompt_callback_task_dependence,   ompt_callback_task_dependence_t,   19) /* report task dependence          */ \
144                                                                                                                          \
145     macro (ompt_callback_work,              ompt_callback_work_t,              20) /* task at work begin or end       */ \
146                                                                                                                          \
147     macro (ompt_callback_masked,            ompt_callback_masked_t,            21) /* task at masked begin or end     */ \
148                                                                                                                          \
149     macro (ompt_callback_target_map,        ompt_callback_target_map_t,        22) /* target map                      */ \
150                                                                                                                          \
151     macro (ompt_callback_sync_region,       ompt_callback_sync_region_t,       23) /* sync region begin or end        */ \
152                                                                                                                          \
153     macro (ompt_callback_lock_init,         ompt_callback_mutex_acquire_t,     24) /* lock init                       */ \
154     macro (ompt_callback_lock_destroy,      ompt_callback_mutex_t,             25) /* lock destroy                    */ \
155                                                                                                                          \
156     macro (ompt_callback_mutex_acquire,     ompt_callback_mutex_acquire_t,     26) /* mutex acquire                   */ \
157     macro (ompt_callback_mutex_acquired,    ompt_callback_mutex_t,             27) /* mutex acquired                  */ \
158                                                                                                                          \
159     macro (ompt_callback_nest_lock,         ompt_callback_nest_lock_t,         28) /* nest lock                       */ \
160                                                                                                                          \
161     macro (ompt_callback_flush,             ompt_callback_flush_t,             29) /* after executing flush           */ \
162                                                                                                                          \
163     macro (ompt_callback_cancel,            ompt_callback_cancel_t,            30) /* cancel innermost binding region */ \
164                                                                                                                          \
165     macro (ompt_callback_reduction,         ompt_callback_sync_region_t,       31) /* reduction                       */ \
166                                                                                                                          \
167     macro (ompt_callback_dispatch,          ompt_callback_dispatch_t,          32) /* dispatch of work                */ \
168     macro (ompt_callback_target_emi,        ompt_callback_target_emi_t,        33) /* target                          */ \
169     macro (ompt_callback_target_data_op_emi,ompt_callback_target_data_op_emi_t,34) /* target data op                  */ \
170     macro (ompt_callback_target_submit_emi, ompt_callback_target_submit_emi_t, 35) /* target submit                   */ \
171     macro (ompt_callback_target_map_emi,    ompt_callback_target_map_emi_t,    36) /* target map                      */ \
172     macro (ompt_callback_error,             ompt_callback_error_t,             37) /* error                           */
173 
174 /*****************************************************************************
175  * implementation specific types
176  *****************************************************************************/
177 
178 typedef enum kmp_mutex_impl_t {
179 #define kmp_mutex_impl_macro(impl, code) impl = code,
180     FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
181 #undef kmp_mutex_impl_macro
182 } kmp_mutex_impl_t;
183 
184 /*****************************************************************************
185  * definitions generated from spec
186  *****************************************************************************/
187 
188 typedef enum ompt_callbacks_t {
189   ompt_callback_thread_begin             = 1,
190   ompt_callback_thread_end               = 2,
191   ompt_callback_parallel_begin           = 3,
192   ompt_callback_parallel_end             = 4,
193   ompt_callback_task_create              = 5,
194   ompt_callback_task_schedule            = 6,
195   ompt_callback_implicit_task            = 7,
196   ompt_callback_target                   = 8,
197   ompt_callback_target_data_op           = 9,
198   ompt_callback_target_submit            = 10,
199   ompt_callback_control_tool             = 11,
200   ompt_callback_device_initialize        = 12,
201   ompt_callback_device_finalize          = 13,
202   ompt_callback_device_load              = 14,
203   ompt_callback_device_unload            = 15,
204   ompt_callback_sync_region_wait         = 16,
205   ompt_callback_mutex_released           = 17,
206   ompt_callback_dependences              = 18,
207   ompt_callback_task_dependence          = 19,
208   ompt_callback_work                     = 20,
209   ompt_callback_master     DEPRECATED_51 = 21,
210   ompt_callback_masked                   = 21,
211   ompt_callback_target_map               = 22,
212   ompt_callback_sync_region              = 23,
213   ompt_callback_lock_init                = 24,
214   ompt_callback_lock_destroy             = 25,
215   ompt_callback_mutex_acquire            = 26,
216   ompt_callback_mutex_acquired           = 27,
217   ompt_callback_nest_lock                = 28,
218   ompt_callback_flush                    = 29,
219   ompt_callback_cancel                   = 30,
220   ompt_callback_reduction                = 31,
221   ompt_callback_dispatch                 = 32,
222   ompt_callback_target_emi               = 33,
223   ompt_callback_target_data_op_emi       = 34,
224   ompt_callback_target_submit_emi        = 35,
225   ompt_callback_target_map_emi           = 36,
226   ompt_callback_error                    = 37
227 } ompt_callbacks_t;
228 
229 typedef enum ompt_record_t {
230   ompt_record_ompt               = 1,
231   ompt_record_native             = 2,
232   ompt_record_invalid            = 3
233 } ompt_record_t;
234 
235 typedef enum ompt_record_native_t {
236   ompt_record_native_info  = 1,
237   ompt_record_native_event = 2
238 } ompt_record_native_t;
239 
240 typedef enum ompt_set_result_t {
241   ompt_set_error            = 0,
242   ompt_set_never            = 1,
243   ompt_set_impossible       = 2,
244   ompt_set_sometimes        = 3,
245   ompt_set_sometimes_paired = 4,
246   ompt_set_always           = 5
247 } ompt_set_result_t;
248 
249 typedef uint64_t ompt_id_t;
250 
251 typedef uint64_t ompt_device_time_t;
252 
253 typedef uint64_t ompt_buffer_cursor_t;
254 
255 typedef enum ompt_thread_t {
256   ompt_thread_initial                 = 1,
257   ompt_thread_worker                  = 2,
258   ompt_thread_other                   = 3,
259   ompt_thread_unknown                 = 4
260 } ompt_thread_t;
261 
262 typedef enum ompt_scope_endpoint_t {
263   ompt_scope_begin                    = 1,
264   ompt_scope_end                      = 2,
265   ompt_scope_beginend                 = 3
266 } ompt_scope_endpoint_t;
267 
268 typedef enum ompt_dispatch_t {
269   ompt_dispatch_iteration             = 1,
270   ompt_dispatch_section               = 2
271 } ompt_dispatch_t;
272 
273 typedef enum ompt_sync_region_t {
274   ompt_sync_region_barrier                DEPRECATED_51 = 1,
275   ompt_sync_region_barrier_implicit       DEPRECATED_51 = 2,
276   ompt_sync_region_barrier_explicit       = 3,
277   ompt_sync_region_barrier_implementation = 4,
278   ompt_sync_region_taskwait               = 5,
279   ompt_sync_region_taskgroup              = 6,
280   ompt_sync_region_reduction              = 7,
281   ompt_sync_region_barrier_implicit_workshare = 8,
282   ompt_sync_region_barrier_implicit_parallel = 9,
283   ompt_sync_region_barrier_teams = 10
284 } ompt_sync_region_t;
285 
286 typedef enum ompt_target_data_op_t {
287   ompt_target_data_alloc                      = 1,
288   ompt_target_data_transfer_to_device         = 2,
289   ompt_target_data_transfer_from_device       = 3,
290   ompt_target_data_delete                     = 4,
291   ompt_target_data_associate                  = 5,
292   ompt_target_data_disassociate               = 6,
293   ompt_target_data_alloc_async                = 17,
294   ompt_target_data_transfer_to_device_async   = 18,
295   ompt_target_data_transfer_from_device_async = 19,
296   ompt_target_data_delete_async               = 20
297 } ompt_target_data_op_t;
298 
299 typedef enum ompt_work_t {
300   ompt_work_loop               = 1,
301   ompt_work_sections           = 2,
302   ompt_work_single_executor    = 3,
303   ompt_work_single_other       = 4,
304   ompt_work_workshare          = 5,
305   ompt_work_distribute         = 6,
306   ompt_work_taskloop           = 7,
307   ompt_work_scope              = 8
308 } ompt_work_t;
309 
310 typedef enum ompt_mutex_t {
311   ompt_mutex_lock                     = 1,
312   ompt_mutex_test_lock                = 2,
313   ompt_mutex_nest_lock                = 3,
314   ompt_mutex_test_nest_lock           = 4,
315   ompt_mutex_critical                 = 5,
316   ompt_mutex_atomic                   = 6,
317   ompt_mutex_ordered                  = 7
318 } ompt_mutex_t;
319 
320 typedef enum ompt_native_mon_flag_t {
321   ompt_native_data_motion_explicit    = 0x01,
322   ompt_native_data_motion_implicit    = 0x02,
323   ompt_native_kernel_invocation       = 0x04,
324   ompt_native_kernel_execution        = 0x08,
325   ompt_native_driver                  = 0x10,
326   ompt_native_runtime                 = 0x20,
327   ompt_native_overhead                = 0x40,
328   ompt_native_idleness                = 0x80
329 } ompt_native_mon_flag_t;
330 
331 typedef enum ompt_task_flag_t {
332   ompt_task_initial                   = 0x00000001,
333   ompt_task_implicit                  = 0x00000002,
334   ompt_task_explicit                  = 0x00000004,
335   ompt_task_target                    = 0x00000008,
336   ompt_task_taskwait                  = 0x00000010,
337   ompt_task_undeferred                = 0x08000000,
338   ompt_task_untied                    = 0x10000000,
339   ompt_task_final                     = 0x20000000,
340   ompt_task_mergeable                 = 0x40000000,
341   ompt_task_merged                    = 0x80000000
342 } ompt_task_flag_t;
343 
344 typedef enum ompt_task_status_t {
345   ompt_task_complete      = 1,
346   ompt_task_yield         = 2,
347   ompt_task_cancel        = 3,
348   ompt_task_detach        = 4,
349   ompt_task_early_fulfill = 5,
350   ompt_task_late_fulfill  = 6,
351   ompt_task_switch        = 7,
352   ompt_taskwait_complete  = 8
353 } ompt_task_status_t;
354 
355 typedef enum ompt_target_t {
356   ompt_target                         = 1,
357   ompt_target_enter_data              = 2,
358   ompt_target_exit_data               = 3,
359   ompt_target_update                  = 4,
360   ompt_target_nowait                  = 9,
361   ompt_target_enter_data_nowait       = 10,
362   ompt_target_exit_data_nowait        = 11,
363   ompt_target_update_nowait           = 12
364 } ompt_target_t;
365 
366 typedef enum ompt_parallel_flag_t {
367   ompt_parallel_invoker_program = 0x00000001,
368   ompt_parallel_invoker_runtime = 0x00000002,
369   ompt_parallel_league          = 0x40000000,
370   ompt_parallel_team            = 0x80000000
371 } ompt_parallel_flag_t;
372 
373 typedef enum ompt_target_map_flag_t {
374   ompt_target_map_flag_to             = 0x01,
375   ompt_target_map_flag_from           = 0x02,
376   ompt_target_map_flag_alloc          = 0x04,
377   ompt_target_map_flag_release        = 0x08,
378   ompt_target_map_flag_delete         = 0x10,
379   ompt_target_map_flag_implicit       = 0x20
380 } ompt_target_map_flag_t;
381 
382 typedef enum ompt_dependence_type_t {
383   ompt_dependence_type_in              = 1,
384   ompt_dependence_type_out             = 2,
385   ompt_dependence_type_inout           = 3,
386   ompt_dependence_type_mutexinoutset   = 4,
387   ompt_dependence_type_source          = 5,
388   ompt_dependence_type_sink            = 6,
389   ompt_dependence_type_inoutset        = 7
390 } ompt_dependence_type_t;
391 
392 typedef enum ompt_severity_t {
393   ompt_warning                         = 1,
394   ompt_fatal                           = 2
395 } ompt_severity_t;
396 
397 typedef enum ompt_cancel_flag_t {
398   ompt_cancel_parallel       = 0x01,
399   ompt_cancel_sections       = 0x02,
400   ompt_cancel_loop           = 0x04,
401   ompt_cancel_taskgroup      = 0x08,
402   ompt_cancel_activated      = 0x10,
403   ompt_cancel_detected       = 0x20,
404   ompt_cancel_discarded_task = 0x40
405 } ompt_cancel_flag_t;
406 
407 typedef uint64_t ompt_hwid_t;
408 
409 typedef uint64_t ompt_wait_id_t;
410 
411 typedef enum ompt_frame_flag_t {
412   ompt_frame_runtime        = 0x00,
413   ompt_frame_application    = 0x01,
414   ompt_frame_cfa            = 0x10,
415   ompt_frame_framepointer   = 0x20,
416   ompt_frame_stackaddress   = 0x30
417 } ompt_frame_flag_t;
418 
419 typedef enum ompt_state_t {
420   ompt_state_work_serial                      = 0x000,
421   ompt_state_work_parallel                    = 0x001,
422   ompt_state_work_reduction                   = 0x002,
423 
424   ompt_state_wait_barrier                     DEPRECATED_51 = 0x010,
425   ompt_state_wait_barrier_implicit_parallel   = 0x011,
426   ompt_state_wait_barrier_implicit_workshare  = 0x012,
427   ompt_state_wait_barrier_implicit            DEPRECATED_51 = 0x013,
428   ompt_state_wait_barrier_explicit            = 0x014,
429   ompt_state_wait_barrier_implementation      = 0x015,
430   ompt_state_wait_barrier_teams               = 0x016,
431 
432   ompt_state_wait_taskwait                    = 0x020,
433   ompt_state_wait_taskgroup                   = 0x021,
434 
435   ompt_state_wait_mutex                       = 0x040,
436   ompt_state_wait_lock                        = 0x041,
437   ompt_state_wait_critical                    = 0x042,
438   ompt_state_wait_atomic                      = 0x043,
439   ompt_state_wait_ordered                     = 0x044,
440 
441   ompt_state_wait_target                      = 0x080,
442   ompt_state_wait_target_map                  = 0x081,
443   ompt_state_wait_target_update               = 0x082,
444 
445   ompt_state_idle                             = 0x100,
446   ompt_state_overhead                         = 0x101,
447   ompt_state_undefined                        = 0x102
448 } ompt_state_t;
449 
450 typedef uint64_t (*ompt_get_unique_id_t) (void);
451 
452 typedef uint64_t ompd_size_t;
453 
454 typedef uint64_t ompd_wait_id_t;
455 
456 typedef uint64_t ompd_addr_t;
457 typedef int64_t  ompd_word_t;
458 typedef uint64_t ompd_seg_t;
459 
460 typedef uint64_t ompd_device_t;
461 
462 typedef uint64_t ompd_thread_id_t;
463 
464 typedef enum ompd_scope_t {
465   ompd_scope_global = 1,
466   ompd_scope_address_space = 2,
467   ompd_scope_thread = 3,
468   ompd_scope_parallel = 4,
469   ompd_scope_implicit_task = 5,
470   ompd_scope_task = 6
471 } ompd_scope_t;
472 
473 typedef uint64_t ompd_icv_id_t;
474 
475 typedef enum ompd_rc_t {
476   ompd_rc_ok = 0,
477   ompd_rc_unavailable = 1,
478   ompd_rc_stale_handle = 2,
479   ompd_rc_bad_input = 3,
480   ompd_rc_error = 4,
481   ompd_rc_unsupported = 5,
482   ompd_rc_needs_state_tracking = 6,
483   ompd_rc_incompatible = 7,
484   ompd_rc_device_read_error = 8,
485   ompd_rc_device_write_error = 9,
486   ompd_rc_nomem = 10,
487   ompd_rc_incomplete = 11,
488   ompd_rc_callback_error = 12
489 } ompd_rc_t;
490 
491 typedef void (*ompt_interface_fn_t) (void);
492 
493 typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
494   const char *interface_function_name
495 );
496 
497 typedef union ompt_data_t {
498   uint64_t value;
499   void *ptr;
500 } ompt_data_t;
501 
502 typedef struct ompt_frame_t {
503   ompt_data_t exit_frame;
504   ompt_data_t enter_frame;
505   int exit_frame_flags;
506   int enter_frame_flags;
507 } ompt_frame_t;
508 
509 typedef void (*ompt_callback_t) (void);
510 
511 typedef void ompt_device_t;
512 
513 typedef void ompt_buffer_t;
514 
515 typedef void (*ompt_callback_buffer_request_t) (
516   int device_num,
517   ompt_buffer_t **buffer,
518   size_t *bytes
519 );
520 
521 typedef void (*ompt_callback_buffer_complete_t) (
522   int device_num,
523   ompt_buffer_t *buffer,
524   size_t bytes,
525   ompt_buffer_cursor_t begin,
526   int buffer_owned
527 );
528 
529 typedef void (*ompt_finalize_t) (
530   ompt_data_t *tool_data
531 );
532 
533 typedef int (*ompt_initialize_t) (
534   ompt_function_lookup_t lookup,
535   int initial_device_num,
536   ompt_data_t *tool_data
537 );
538 
539 typedef struct ompt_start_tool_result_t {
540   ompt_initialize_t initialize;
541   ompt_finalize_t finalize;
542   ompt_data_t tool_data;
543 } ompt_start_tool_result_t;
544 
545 typedef struct ompt_record_abstract_t {
546   ompt_record_native_t rclass;
547   const char *type;
548   ompt_device_time_t start_time;
549   ompt_device_time_t end_time;
550   ompt_hwid_t hwid;
551 } ompt_record_abstract_t;
552 
553 typedef struct ompt_dependence_t {
554   ompt_data_t variable;
555   ompt_dependence_type_t dependence_type;
556 } ompt_dependence_t;
557 
558 typedef int (*ompt_enumerate_states_t) (
559   int current_state,
560   int *next_state,
561   const char **next_state_name
562 );
563 
564 typedef int (*ompt_enumerate_mutex_impls_t) (
565   int current_impl,
566   int *next_impl,
567   const char **next_impl_name
568 );
569 
570 typedef ompt_set_result_t (*ompt_set_callback_t) (
571   ompt_callbacks_t event,
572   ompt_callback_t callback
573 );
574 
575 typedef int (*ompt_get_callback_t) (
576   ompt_callbacks_t event,
577   ompt_callback_t *callback
578 );
579 
580 typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
581 
582 typedef int (*ompt_get_num_procs_t) (void);
583 
584 typedef int (*ompt_get_num_places_t) (void);
585 
586 typedef int (*ompt_get_place_proc_ids_t) (
587   int place_num,
588   int ids_size,
589   int *ids
590 );
591 
592 typedef int (*ompt_get_place_num_t) (void);
593 
594 typedef int (*ompt_get_partition_place_nums_t) (
595   int place_nums_size,
596   int *place_nums
597 );
598 
599 typedef int (*ompt_get_proc_id_t) (void);
600 
601 typedef int (*ompt_get_state_t) (
602   ompt_wait_id_t *wait_id
603 );
604 
605 typedef int (*ompt_get_parallel_info_t) (
606   int ancestor_level,
607   ompt_data_t **parallel_data,
608   int *team_size
609 );
610 
611 typedef int (*ompt_get_task_info_t) (
612   int ancestor_level,
613   int *flags,
614   ompt_data_t **task_data,
615   ompt_frame_t **task_frame,
616   ompt_data_t **parallel_data,
617   int *thread_num
618 );
619 
620 typedef int (*ompt_get_task_memory_t)(
621   void **addr,
622   size_t *size,
623   int block
624 );
625 
626 typedef int (*ompt_get_target_info_t) (
627   uint64_t *device_num,
628   ompt_id_t *target_id,
629   ompt_id_t *host_op_id
630 );
631 
632 typedef int (*ompt_get_num_devices_t) (void);
633 
634 typedef void (*ompt_finalize_tool_t) (void);
635 
636 typedef int (*ompt_get_device_num_procs_t) (
637   ompt_device_t *device
638 );
639 
640 typedef ompt_device_time_t (*ompt_get_device_time_t) (
641   ompt_device_t *device
642 );
643 
644 typedef double (*ompt_translate_time_t) (
645   ompt_device_t *device,
646   ompt_device_time_t time
647 );
648 
649 typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
650   ompt_device_t *device,
651   unsigned int enable,
652   unsigned int etype
653 );
654 
655 typedef ompt_set_result_t (*ompt_set_trace_native_t) (
656   ompt_device_t *device,
657   int enable,
658   int flags
659 );
660 
661 typedef int (*ompt_start_trace_t) (
662   ompt_device_t *device,
663   ompt_callback_buffer_request_t request,
664   ompt_callback_buffer_complete_t complete
665 );
666 
667 typedef int (*ompt_pause_trace_t) (
668   ompt_device_t *device,
669   int begin_pause
670 );
671 
672 typedef int (*ompt_flush_trace_t) (
673   ompt_device_t *device
674 );
675 
676 typedef int (*ompt_stop_trace_t) (
677   ompt_device_t *device
678 );
679 
680 typedef int (*ompt_advance_buffer_cursor_t) (
681   ompt_device_t *device,
682   ompt_buffer_t *buffer,
683   size_t size,
684   ompt_buffer_cursor_t current,
685   ompt_buffer_cursor_t *next
686 );
687 
688 typedef ompt_record_t (*ompt_get_record_type_t) (
689   ompt_buffer_t *buffer,
690   ompt_buffer_cursor_t current
691 );
692 
693 typedef void *(*ompt_get_record_native_t) (
694   ompt_buffer_t *buffer,
695   ompt_buffer_cursor_t current,
696   ompt_id_t *host_op_id
697 );
698 
699 typedef ompt_record_abstract_t *
700 (*ompt_get_record_abstract_t) (
701   void *native_record
702 );
703 
704 typedef void (*ompt_callback_thread_begin_t) (
705   ompt_thread_t thread_type,
706   ompt_data_t *thread_data
707 );
708 
709 typedef struct ompt_record_thread_begin_t {
710   ompt_thread_t thread_type;
711 } ompt_record_thread_begin_t;
712 
713 typedef void (*ompt_callback_thread_end_t) (
714   ompt_data_t *thread_data
715 );
716 
717 typedef void (*ompt_callback_parallel_begin_t) (
718   ompt_data_t *encountering_task_data,
719   const ompt_frame_t *encountering_task_frame,
720   ompt_data_t *parallel_data,
721   unsigned int requested_parallelism,
722   int flags,
723   const void *codeptr_ra
724 );
725 
726 typedef struct ompt_record_parallel_begin_t {
727   ompt_id_t encountering_task_id;
728   ompt_id_t parallel_id;
729   unsigned int requested_parallelism;
730   int flags;
731   const void *codeptr_ra;
732 } ompt_record_parallel_begin_t;
733 
734 typedef void (*ompt_callback_parallel_end_t) (
735   ompt_data_t *parallel_data,
736   ompt_data_t *encountering_task_data,
737   int flags,
738   const void *codeptr_ra
739 );
740 
741 typedef struct ompt_record_parallel_end_t {
742   ompt_id_t parallel_id;
743   ompt_id_t encountering_task_id;
744   int flags;
745   const void *codeptr_ra;
746 } ompt_record_parallel_end_t;
747 
748 typedef void (*ompt_callback_work_t) (
749   ompt_work_t wstype,
750   ompt_scope_endpoint_t endpoint,
751   ompt_data_t *parallel_data,
752   ompt_data_t *task_data,
753   uint64_t count,
754   const void *codeptr_ra
755 );
756 
757 typedef struct ompt_record_work_t {
758   ompt_work_t wstype;
759   ompt_scope_endpoint_t endpoint;
760   ompt_id_t parallel_id;
761   ompt_id_t task_id;
762   uint64_t count;
763   const void *codeptr_ra;
764 } ompt_record_work_t;
765 
766 typedef void (*ompt_callback_dispatch_t) (
767   ompt_data_t *parallel_data,
768   ompt_data_t *task_data,
769   ompt_dispatch_t kind,
770   ompt_data_t instance
771 );
772 
773 typedef struct ompt_record_dispatch_t {
774   ompt_id_t parallel_id;
775   ompt_id_t task_id;
776   ompt_dispatch_t kind;
777   ompt_data_t instance;
778 } ompt_record_dispatch_t;
779 
780 typedef void (*ompt_callback_task_create_t) (
781   ompt_data_t *encountering_task_data,
782   const ompt_frame_t *encountering_task_frame,
783   ompt_data_t *new_task_data,
784   int flags,
785   int has_dependences,
786   const void *codeptr_ra
787 );
788 
789 typedef struct ompt_record_task_create_t {
790   ompt_id_t encountering_task_id;
791   ompt_id_t new_task_id;
792   int flags;
793   int has_dependences;
794   const void *codeptr_ra;
795 } ompt_record_task_create_t;
796 
797 typedef void (*ompt_callback_dependences_t) (
798   ompt_data_t *task_data,
799   const ompt_dependence_t *deps,
800   int ndeps
801 );
802 
803 typedef struct ompt_record_dependences_t {
804   ompt_id_t task_id;
805   ompt_dependence_t dep;
806   int ndeps;
807 } ompt_record_dependences_t;
808 
809 typedef void (*ompt_callback_task_dependence_t) (
810   ompt_data_t *src_task_data,
811   ompt_data_t *sink_task_data
812 );
813 
814 typedef struct ompt_record_task_dependence_t {
815   ompt_id_t src_task_id;
816   ompt_id_t sink_task_id;
817 } ompt_record_task_dependence_t;
818 
819 typedef void (*ompt_callback_task_schedule_t) (
820   ompt_data_t *prior_task_data,
821   ompt_task_status_t prior_task_status,
822   ompt_data_t *next_task_data
823 );
824 
825 typedef struct ompt_record_task_schedule_t {
826   ompt_id_t prior_task_id;
827   ompt_task_status_t prior_task_status;
828   ompt_id_t next_task_id;
829 } ompt_record_task_schedule_t;
830 
831 typedef void (*ompt_callback_implicit_task_t) (
832   ompt_scope_endpoint_t endpoint,
833   ompt_data_t *parallel_data,
834   ompt_data_t *task_data,
835   unsigned int actual_parallelism,
836   unsigned int index,
837   int flags
838 );
839 
840 typedef struct ompt_record_implicit_task_t {
841   ompt_scope_endpoint_t endpoint;
842   ompt_id_t parallel_id;
843   ompt_id_t task_id;
844   unsigned int actual_parallelism;
845   unsigned int index;
846   int flags;
847 } ompt_record_implicit_task_t;
848 
849 typedef void (*ompt_callback_masked_t) (
850   ompt_scope_endpoint_t endpoint,
851   ompt_data_t *parallel_data,
852   ompt_data_t *task_data,
853   const void *codeptr_ra
854 );
855 
856 typedef ompt_callback_masked_t ompt_callback_master_t DEPRECATED_51;
857 
858 typedef struct ompt_record_masked_t {
859   ompt_scope_endpoint_t endpoint;
860   ompt_id_t parallel_id;
861   ompt_id_t task_id;
862   const void *codeptr_ra;
863 } ompt_record_masked_t;
864 
865 typedef void (*ompt_callback_sync_region_t) (
866   ompt_sync_region_t kind,
867   ompt_scope_endpoint_t endpoint,
868   ompt_data_t *parallel_data,
869   ompt_data_t *task_data,
870   const void *codeptr_ra
871 );
872 
873 typedef struct ompt_record_sync_region_t {
874   ompt_sync_region_t kind;
875   ompt_scope_endpoint_t endpoint;
876   ompt_id_t parallel_id;
877   ompt_id_t task_id;
878   const void *codeptr_ra;
879 } ompt_record_sync_region_t;
880 
881 typedef void (*ompt_callback_mutex_acquire_t) (
882   ompt_mutex_t kind,
883   unsigned int hint,
884   unsigned int impl,
885   ompt_wait_id_t wait_id,
886   const void *codeptr_ra
887 );
888 
889 typedef struct ompt_record_mutex_acquire_t {
890   ompt_mutex_t kind;
891   unsigned int hint;
892   unsigned int impl;
893   ompt_wait_id_t wait_id;
894   const void *codeptr_ra;
895 } ompt_record_mutex_acquire_t;
896 
897 typedef void (*ompt_callback_mutex_t) (
898   ompt_mutex_t kind,
899   ompt_wait_id_t wait_id,
900   const void *codeptr_ra
901 );
902 
903 typedef struct ompt_record_mutex_t {
904   ompt_mutex_t kind;
905   ompt_wait_id_t wait_id;
906   const void *codeptr_ra;
907 } ompt_record_mutex_t;
908 
909 typedef void (*ompt_callback_nest_lock_t) (
910   ompt_scope_endpoint_t endpoint,
911   ompt_wait_id_t wait_id,
912   const void *codeptr_ra
913 );
914 
915 typedef struct ompt_record_nest_lock_t {
916   ompt_scope_endpoint_t endpoint;
917   ompt_wait_id_t wait_id;
918   const void *codeptr_ra;
919 } ompt_record_nest_lock_t;
920 
921 typedef void (*ompt_callback_flush_t) (
922   ompt_data_t *thread_data,
923   const void *codeptr_ra
924 );
925 
926 typedef struct ompt_record_flush_t {
927   const void *codeptr_ra;
928 } ompt_record_flush_t;
929 
930 typedef void (*ompt_callback_cancel_t) (
931   ompt_data_t *task_data,
932   int flags,
933   const void *codeptr_ra
934 );
935 
936 typedef struct ompt_record_cancel_t {
937   ompt_id_t task_id;
938   int flags;
939   const void *codeptr_ra;
940 } ompt_record_cancel_t;
941 
942 typedef void (*ompt_callback_device_initialize_t) (
943   int device_num,
944   const char *type,
945   ompt_device_t *device,
946   ompt_function_lookup_t lookup,
947   const char *documentation
948 );
949 
950 typedef void (*ompt_callback_device_finalize_t) (
951   int device_num
952 );
953 
954 typedef void (*ompt_callback_device_load_t) (
955   int device_num,
956   const char *filename,
957   int64_t offset_in_file,
958   void *vma_in_file,
959   size_t bytes,
960   void *host_addr,
961   void *device_addr,
962   uint64_t module_id
963 );
964 
965 typedef void (*ompt_callback_device_unload_t) (
966   int device_num,
967   uint64_t module_id
968 );
969 
970 typedef void (*ompt_callback_target_data_op_emi_t) (
971   ompt_scope_endpoint_t endpoint,
972   ompt_data_t *target_task_data,
973   ompt_data_t *target_data,
974   ompt_id_t *host_op_id,
975   ompt_target_data_op_t optype,
976   void *src_addr,
977   int src_device_num,
978   void *dest_addr,
979   int dest_device_num,
980   size_t bytes,
981   const void *codeptr_ra
982 );
983 
984 typedef void (*ompt_callback_target_data_op_t) (
985   ompt_id_t target_id,
986   ompt_id_t host_op_id,
987   ompt_target_data_op_t optype,
988   void *src_addr,
989   int src_device_num,
990   void *dest_addr,
991   int dest_device_num,
992   size_t bytes,
993   const void *codeptr_ra
994 );
995 
996 typedef struct ompt_record_target_data_op_t {
997   ompt_id_t host_op_id;
998   ompt_target_data_op_t optype;
999   void *src_addr;
1000   int src_device_num;
1001   void *dest_addr;
1002   int dest_device_num;
1003   size_t bytes;
1004   ompt_device_time_t end_time;
1005   const void *codeptr_ra;
1006 } ompt_record_target_data_op_t;
1007 
1008 typedef void (*ompt_callback_target_emi_t) (
1009   ompt_target_t kind,
1010   ompt_scope_endpoint_t endpoint,
1011   int device_num,
1012   ompt_data_t *task_data,
1013   ompt_data_t *target_task_data,
1014   ompt_data_t *target_data,
1015   const void *codeptr_ra
1016 );
1017 
1018 typedef void (*ompt_callback_target_t) (
1019   ompt_target_t kind,
1020   ompt_scope_endpoint_t endpoint,
1021   int device_num,
1022   ompt_data_t *task_data,
1023   ompt_id_t target_id,
1024   const void *codeptr_ra
1025 );
1026 
1027 typedef struct ompt_record_target_t {
1028   ompt_target_t kind;
1029   ompt_scope_endpoint_t endpoint;
1030   int device_num;
1031   ompt_id_t task_id;
1032   ompt_id_t target_id;
1033   const void *codeptr_ra;
1034 } ompt_record_target_t;
1035 
1036 typedef void (*ompt_callback_target_map_emi_t) (
1037   ompt_data_t *target_data,
1038   unsigned int nitems,
1039   void **host_addr,
1040   void **device_addr,
1041   size_t *bytes,
1042   unsigned int *mapping_flags,
1043   const void *codeptr_ra
1044 );
1045 
1046 typedef void (*ompt_callback_target_map_t) (
1047   ompt_id_t target_id,
1048   unsigned int nitems,
1049   void **host_addr,
1050   void **device_addr,
1051   size_t *bytes,
1052   unsigned int *mapping_flags,
1053   const void *codeptr_ra
1054 );
1055 
1056 typedef struct ompt_record_target_map_t {
1057   ompt_id_t target_id;
1058   unsigned int nitems;
1059   void **host_addr;
1060   void **device_addr;
1061   size_t *bytes;
1062   unsigned int *mapping_flags;
1063   const void *codeptr_ra;
1064 } ompt_record_target_map_t;
1065 
1066 typedef void (*ompt_callback_target_submit_emi_t) (
1067   ompt_scope_endpoint_t endpoint,
1068   ompt_data_t *target_data,
1069   ompt_id_t *host_op_id,
1070   unsigned int requested_num_teams
1071 );
1072 
1073 typedef void (*ompt_callback_target_submit_t) (
1074   ompt_id_t target_id,
1075   ompt_id_t host_op_id,
1076   unsigned int requested_num_teams
1077 );
1078 
1079 typedef struct ompt_record_target_kernel_t {
1080   ompt_id_t host_op_id;
1081   unsigned int requested_num_teams;
1082   unsigned int granted_num_teams;
1083   ompt_device_time_t end_time;
1084 } ompt_record_target_kernel_t;
1085 
1086 typedef int (*ompt_callback_control_tool_t) (
1087   uint64_t command,
1088   uint64_t modifier,
1089   void *arg,
1090   const void *codeptr_ra
1091 );
1092 
1093 typedef struct ompt_record_control_tool_t {
1094   uint64_t command;
1095   uint64_t modifier;
1096   const void *codeptr_ra;
1097 } ompt_record_control_tool_t;
1098 
1099 typedef void (*ompt_callback_error_t) (
1100   ompt_severity_t severity,
1101   const char *message, size_t length,
1102   const void *codeptr_ra
1103 );
1104 
1105 typedef struct ompt_record_error_t {
1106   ompt_severity_t severity;
1107   const char *message;
1108   size_t length;
1109   const void *codeptr_ra;
1110 } ompt_record_error_t;
1111 
1112 typedef struct ompd_address_t {
1113   ompd_seg_t segment;
1114   ompd_addr_t address;
1115 } ompd_address_t;
1116 
1117 typedef struct ompd_frame_info_t {
1118   ompd_address_t frame_address;
1119   ompd_word_t frame_flag;
1120 } ompd_frame_info_t;
1121 
1122 typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
1123 typedef struct _ompd_thread_handle ompd_thread_handle_t;
1124 typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
1125 typedef struct _ompd_task_handle ompd_task_handle_t;
1126 
1127 typedef struct _ompd_aspace_cont ompd_address_space_context_t;
1128 typedef struct _ompd_thread_cont ompd_thread_context_t;
1129 
1130 typedef struct ompd_device_type_sizes_t {
1131   uint8_t sizeof_char;
1132   uint8_t sizeof_short;
1133   uint8_t sizeof_int;
1134   uint8_t sizeof_long;
1135   uint8_t sizeof_long_long;
1136   uint8_t sizeof_pointer;
1137 } ompd_device_type_sizes_t;
1138 
1139 void ompd_dll_locations_valid(void);
1140 
1141 typedef ompd_rc_t (*ompd_callback_memory_alloc_fn_t)(ompd_size_t nbytes,
1142                                                      void **ptr);
1143 
1144 typedef ompd_rc_t (*ompd_callback_memory_free_fn_t)(void *ptr);
1145 
1146 typedef ompd_rc_t (*ompd_callback_get_thread_context_for_thread_id_fn_t)(
1147     ompd_address_space_context_t *address_space_context, ompd_thread_id_t kind,
1148     ompd_size_t sizeof_thread_id, const void *thread_id,
1149     ompd_thread_context_t **thread_context);
1150 
1151 typedef ompd_rc_t (*ompd_callback_sizeof_fn_t)(
1152     ompd_address_space_context_t *address_space_context,
1153     ompd_device_type_sizes_t *sizes);
1154 
1155 typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t)(
1156     ompd_address_space_context_t *address_space_context,
1157     ompd_thread_context_t *thread_context, const char *symbol_name,
1158     ompd_address_t *symbol_addr, const char *file_name);
1159 
1160 typedef ompd_rc_t (*ompd_callback_memory_read_fn_t)(
1161     ompd_address_space_context_t *address_space_context,
1162     ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1163     ompd_size_t nbytes, void *buffer);
1164 
1165 typedef ompd_rc_t (*ompd_callback_memory_write_fn_t)(
1166     ompd_address_space_context_t *address_space_context,
1167     ompd_thread_context_t *thread_context, const ompd_address_t *addr,
1168     ompd_size_t nbytes, const void *buffer);
1169 
1170 typedef ompd_rc_t (*ompd_callback_device_host_fn_t)(
1171     ompd_address_space_context_t *address_space_context, const void *input,
1172     ompd_size_t unit_size, ompd_size_t count, void *output);
1173 
1174 typedef ompd_rc_t (*ompd_callback_print_string_fn_t)(const char *string,
1175                                                      int category);
1176 
1177 typedef struct ompd_callbacks_t {
1178   ompd_callback_memory_alloc_fn_t alloc_memory;
1179   ompd_callback_memory_free_fn_t free_memory;
1180   ompd_callback_print_string_fn_t print_string;
1181   ompd_callback_sizeof_fn_t sizeof_type;
1182   ompd_callback_symbol_addr_fn_t symbol_addr_lookup;
1183   ompd_callback_memory_read_fn_t read_memory;
1184   ompd_callback_memory_write_fn_t write_memory;
1185   ompd_callback_memory_read_fn_t read_string;
1186   ompd_callback_device_host_fn_t device_to_host;
1187   ompd_callback_device_host_fn_t host_to_device;
1188   ompd_callback_get_thread_context_for_thread_id_fn_t
1189       get_thread_context_for_thread_id;
1190 } ompd_callbacks_t;
1191 
1192 void ompd_bp_parallel_begin(void);
1193 
1194 void ompd_bp_parallel_end(void);
1195 
1196 void ompd_bp_task_begin(void);
1197 
1198 void ompd_bp_task_end(void);
1199 
1200 void ompd_bp_thread_begin(void);
1201 
1202 void ompd_bp_thread_end(void);
1203 
1204 void ompd_bp_device_begin(void);
1205 
1206 void ompd_bp_device_end(void);
1207 
1208 ompd_rc_t ompd_initialize(ompd_word_t api_version,
1209                           const ompd_callbacks_t *callbacks);
1210 
1211 ompd_rc_t ompd_get_api_version(ompd_word_t *version);
1212 
1213 ompd_rc_t ompd_get_version_string(const char **string);
1214 
1215 ompd_rc_t ompd_finalize(void);
1216 
1217 ompd_rc_t ompd_process_initialize(ompd_address_space_context_t *context,
1218                                   ompd_address_space_handle_t **handle);
1219 
1220 ompd_rc_t ompd_device_initialize(ompd_address_space_handle_t *process_handle,
1221                                  ompd_address_space_context_t *device_context,
1222                                  ompd_device_t kind, ompd_size_t sizeof_id,
1223                                  void *id,
1224                                  ompd_address_space_handle_t **device_handle);
1225 
1226 ompd_rc_t ompd_rel_address_space_handle(ompd_address_space_handle_t *handle);
1227 
1228 ompd_rc_t ompd_get_omp_version(ompd_address_space_handle_t *address_space,
1229                                ompd_word_t *omp_version);
1230 
1231 ompd_rc_t
1232 ompd_get_omp_version_string(ompd_address_space_handle_t *address_space,
1233                             const char **string);
1234 
1235 ompd_rc_t ompd_get_thread_in_parallel(ompd_parallel_handle_t *parallel_handle,
1236                                       int thread_num,
1237                                       ompd_thread_handle_t **thread_handle);
1238 
1239 ompd_rc_t ompd_get_thread_handle(ompd_address_space_handle_t *handle,
1240                                  ompd_thread_id_t kind,
1241                                  ompd_size_t sizeof_thread_id,
1242                                  const void *thread_id,
1243                                  ompd_thread_handle_t **thread_handle);
1244 
1245 ompd_rc_t ompd_rel_thread_handle(ompd_thread_handle_t *thread_handle);
1246 
1247 ompd_rc_t ompd_thread_handle_compare(ompd_thread_handle_t *thread_handle_1,
1248                                      ompd_thread_handle_t *thread_handle_2,
1249                                      int *cmp_value);
1250 
1251 ompd_rc_t ompd_get_thread_id(ompd_thread_handle_t *thread_handle,
1252                              ompd_thread_id_t kind,
1253                              ompd_size_t sizeof_thread_id, void *thread_id);
1254 
1255 ompd_rc_t
1256 ompd_get_curr_parallel_handle(ompd_thread_handle_t *thread_handle,
1257                               ompd_parallel_handle_t **parallel_handle);
1258 
1259 ompd_rc_t ompd_get_enclosing_parallel_handle(
1260     ompd_parallel_handle_t *parallel_handle,
1261     ompd_parallel_handle_t **enclosing_parallel_handle);
1262 
1263 ompd_rc_t
1264 ompd_get_task_parallel_handle(ompd_task_handle_t *task_handle,
1265                               ompd_parallel_handle_t **task_parallel_handle);
1266 
1267 ompd_rc_t ompd_rel_parallel_handle(ompd_parallel_handle_t *parallel_handle);
1268 
1269 ompd_rc_t
1270 ompd_parallel_handle_compare(ompd_parallel_handle_t *parallel_handle_1,
1271                              ompd_parallel_handle_t *parallel_handle_2,
1272                              int *cmp_value);
1273 
1274 ompd_rc_t ompd_get_curr_task_handle(ompd_thread_handle_t *thread_handle,
1275                                     ompd_task_handle_t **task_handle);
1276 
1277 ompd_rc_t
1278 ompd_get_generating_task_handle(ompd_task_handle_t *task_handle,
1279                                 ompd_task_handle_t **generating_task_handle);
1280 
1281 ompd_rc_t
1282 ompd_get_scheduling_task_handle(ompd_task_handle_t *task_handle,
1283                                 ompd_task_handle_t **scheduling_task_handle);
1284 
1285 ompd_rc_t ompd_get_task_in_parallel(ompd_parallel_handle_t *parallel_handle,
1286                                     int thread_num,
1287                                     ompd_task_handle_t **task_handle);
1288 
1289 ompd_rc_t ompd_rel_task_handle(ompd_task_handle_t *task_handle);
1290 
1291 ompd_rc_t ompd_task_handle_compare(ompd_task_handle_t *task_handle_1,
1292                                    ompd_task_handle_t *task_handle_2,
1293                                    int *cmp_value);
1294 
1295 ompd_rc_t ompd_get_task_function(ompd_task_handle_t *task_handle,
1296                                  ompd_address_t *entry_point);
1297 
1298 ompd_rc_t ompd_get_task_frame(ompd_task_handle_t *task_handle,
1299                               ompd_frame_info_t *exit_frame,
1300                               ompd_frame_info_t *enter_frame);
1301 
1302 ompd_rc_t
1303 ompd_enumerate_states(ompd_address_space_handle_t *address_space_handle,
1304                       ompd_word_t current_state, ompd_word_t *next_state,
1305                       const char **next_state_name, ompd_word_t *more_enums);
1306 
1307 ompd_rc_t ompd_get_state(ompd_thread_handle_t *thread_handle,
1308                          ompd_word_t *state, ompd_wait_id_t *wait_id);
1309 
1310 ompd_rc_t
1311 ompd_get_display_control_vars(ompd_address_space_handle_t *address_space_handle,
1312                               const char *const **control_vars);
1313 
1314 ompd_rc_t ompd_rel_display_control_vars(const char *const **control_vars);
1315 
1316 ompd_rc_t ompd_enumerate_icvs(ompd_address_space_handle_t *handle,
1317                               ompd_icv_id_t current, ompd_icv_id_t *next_id,
1318                               const char **next_icv_name,
1319                               ompd_scope_t *next_scope, int *more);
1320 
1321 ompd_rc_t ompd_get_icv_from_scope(void *handle, ompd_scope_t scope,
1322                                   ompd_icv_id_t icv_id, ompd_word_t *icv_value);
1323 
1324 ompd_rc_t ompd_get_icv_string_from_scope(void *handle, ompd_scope_t scope,
1325                                          ompd_icv_id_t icv_id,
1326                                          const char **icv_string);
1327 
1328 ompd_rc_t ompd_get_tool_data(void *handle, ompd_scope_t scope,
1329                              ompd_word_t *value, ompd_address_t *ptr);
1330 
1331 typedef struct ompt_record_ompt_t {
1332   ompt_callbacks_t type;
1333   ompt_device_time_t time;
1334   ompt_id_t thread_id;
1335   ompt_id_t target_id;
1336   union {
1337     ompt_record_thread_begin_t thread_begin;
1338     ompt_record_parallel_begin_t parallel_begin;
1339     ompt_record_parallel_end_t parallel_end;
1340     ompt_record_work_t work;
1341     ompt_record_dispatch_t dispatch;
1342     ompt_record_task_create_t task_create;
1343     ompt_record_dependences_t dependences;
1344     ompt_record_task_dependence_t task_dependence;
1345     ompt_record_task_schedule_t task_schedule;
1346     ompt_record_implicit_task_t implicit_task;
1347     ompt_record_masked_t masked;
1348     ompt_record_sync_region_t sync_region;
1349     ompt_record_mutex_acquire_t mutex_acquire;
1350     ompt_record_mutex_t mutex;
1351     ompt_record_nest_lock_t nest_lock;
1352     ompt_record_flush_t flush;
1353     ompt_record_cancel_t cancel;
1354     ompt_record_target_t target;
1355     ompt_record_target_data_op_t target_data_op;
1356     ompt_record_target_map_t target_map;
1357     ompt_record_target_kernel_t target_kernel;
1358     ompt_record_control_tool_t control_tool;
1359   } record;
1360 } ompt_record_ompt_t;
1361 
1362 typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
1363   ompt_buffer_t *buffer,
1364   ompt_buffer_cursor_t current
1365 );
1366 
1367 #define ompt_id_none 0
1368 #define ompt_data_none {0}
1369 #define ompt_time_none 0
1370 #define ompt_hwid_none 0
1371 #define ompt_addr_none ~0
1372 #define ompt_mutex_impl_none 0
1373 #define ompt_wait_id_none 0
1374 
1375 #define ompd_segment_none 0
1376 
1377 #endif /* __OMPT__ */
1378