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