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