LLVM OpenMP 22.0.0git
OmptTester.cpp
Go to the documentation of this file.
1//===- OmptTester.cpp - ompTest OMPT tool implementation --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file represents the core implementation file for the ompTest library.
11/// It provides the actual OMPT tool implementation: registers callbacks, etc.
12/// OMPT callbacks are passed to their corresponding handler, which in turn
13/// notifies all registered asserters.
14///
15//===----------------------------------------------------------------------===//
16
17#include "OmptTester.h"
18
19#include <atomic>
20#include <cassert>
21#include <cstdlib>
22#include <cstring>
23
24using namespace omptest;
25
26// Callback handler, which receives and relays OMPT callbacks
28
29// EventListener, which actually prints the OMPT events
31
32// From openmp/runtime/test/ompt/callback.h
33#define register_ompt_callback_t(name, type) \
34 do { \
35 type f_##name = &on_##name; \
36 if (ompt_set_callback(name, (ompt_callback_t)f_##name) == ompt_set_never) \
37 printf("0: Could not register callback '" #name "'\n"); \
38 } while (0)
39
40#define register_ompt_callback(name) register_ompt_callback_t(name, name##_t)
41
42#define OMPT_BUFFER_REQUEST_SIZE 256
43
44#ifdef OPENMP_LIBOMPTEST_BUILD_STANDALONE
45std::vector<std::pair<std::string, TestSuite>> TestRegistrar::Tests;
46#endif
47
48static std::atomic<ompt_id_t> NextOpId{0x8000000000000001};
49static bool UseEMICallbacks = false;
50static bool UseTracing = false;
51static bool RunAsTestSuite = false;
52static bool ColoredLog = false;
53
54// OMPT entry point handles
55static ompt_set_trace_ompt_t ompt_set_trace_ompt = 0;
56static ompt_start_trace_t ompt_start_trace = 0;
57static ompt_flush_trace_t ompt_flush_trace = 0;
58static ompt_stop_trace_t ompt_stop_trace = 0;
59static ompt_get_record_ompt_t ompt_get_record_ompt = 0;
60static ompt_advance_buffer_cursor_t ompt_advance_buffer_cursor = 0;
61static ompt_get_record_type_t ompt_get_record_type_fn = 0;
62
63// OMPT device side tracing: Currently traced devices
64typedef std::unordered_set<ompt_device_t *> OmptDeviceSetTy;
65typedef std::unique_ptr<OmptDeviceSetTy> OmptDeviceSetPtrTy;
67
68// OMPT callbacks
69
70// Trace record callbacks
71static void on_ompt_callback_buffer_request(int device_num,
72 ompt_buffer_t **buffer,
73 size_t *bytes) {
75 *buffer = malloc(*bytes);
76 OmptCallbackHandler::get().handleBufferRequest(device_num, buffer, bytes);
77}
78
79// Note: This callback must handle a null begin cursor. Currently,
80// ompt_get_record_ompt, print_record_ompt, and
81// ompt_advance_buffer_cursor handle a null cursor.
83 int device_num, ompt_buffer_t *buffer,
84 size_t bytes, /* bytes returned in this callback */
85 ompt_buffer_cursor_t begin, int buffer_owned) {
86 OmptCallbackHandler::get().handleBufferComplete(device_num, buffer, bytes,
87 begin, buffer_owned);
88
89 int Status = 1;
90 ompt_buffer_cursor_t CurrentPos = begin;
91 while (Status) {
92 ompt_record_ompt_t *Record = ompt_get_record_ompt(buffer, CurrentPos);
93 if (ompt_get_record_type_fn(buffer, CurrentPos) != ompt_record_ompt) {
94 printf("Warning: received non-ompt type buffer object\n");
95 }
96 // TODO: Sometimes it may happen that the retrieved record may be null?!
97 // Only handle non-null records
98 if (Record != nullptr)
100 Status = ompt_advance_buffer_cursor(/*device=*/NULL, buffer, bytes,
101 CurrentPos, &CurrentPos);
102 }
103 if (buffer_owned) {
105 free(buffer);
106 }
107}
108
109static ompt_set_result_t set_trace_ompt(ompt_device_t *Device) {
111 return ompt_set_error;
112
113 if (UseEMICallbacks) {
114 ompt_set_trace_ompt(Device, /*enable=*/1,
115 /*etype=*/ompt_callback_target_emi);
116 ompt_set_trace_ompt(Device, /*enable=*/1,
117 /*etype=*/ompt_callback_target_data_op_emi);
118 ompt_set_trace_ompt(Device, /*enable=*/1,
119 /*etype=*/ompt_callback_target_submit_emi);
120 } else {
121 ompt_set_trace_ompt(Device, /*enable=*/1, /*etype=*/ompt_callback_target);
122 ompt_set_trace_ompt(Device, /*enable=*/1,
123 /*etype=*/ompt_callback_target_data_op);
124 ompt_set_trace_ompt(Device, /*enable=*/1,
125 /*etype=*/ompt_callback_target_submit);
126 }
127
128 return ompt_set_always;
129}
130
131/////// HOST-RELATED //////
132
133static void on_ompt_callback_thread_begin(ompt_thread_t thread_type,
134 ompt_data_t *thread_data) {
135 OmptCallbackHandler::get().handleThreadBegin(thread_type, thread_data);
136}
137
138static void on_ompt_callback_thread_end(ompt_data_t *thread_data) {
140}
141
143 ompt_data_t *encountering_task_data,
144 const ompt_frame_t *encountering_task_frame, ompt_data_t *parallel_data,
145 unsigned int requested_parallelism, int flags, const void *codeptr_ra) {
147 encountering_task_data, encountering_task_frame, parallel_data,
148 requested_parallelism, flags, codeptr_ra);
149}
150
151static void on_ompt_callback_parallel_end(ompt_data_t *parallel_data,
152 ompt_data_t *encountering_task_data,
153 int flags, const void *codeptr_ra) {
155 parallel_data, encountering_task_data, flags, codeptr_ra);
156}
157
158static void
159on_ompt_callback_task_create(ompt_data_t *encountering_task_data,
160 const ompt_frame_t *encountering_task_frame,
161 ompt_data_t *new_task_data, int flags,
162 int has_dependences, const void *codeptr_ra) {
164 encountering_task_data, encountering_task_frame, new_task_data, flags,
165 has_dependences, codeptr_ra);
166}
167
168static void on_ompt_callback_task_schedule(ompt_data_t *prior_task_data,
169 ompt_task_status_t prior_task_status,
170 ompt_data_t *next_task_data) {
172 prior_task_data, prior_task_status, next_task_data);
173}
174
175static void on_ompt_callback_implicit_task(ompt_scope_endpoint_t endpoint,
176 ompt_data_t *parallel_data,
177 ompt_data_t *task_data,
178 unsigned int actual_parallelism,
179 unsigned int index, int flags) {
181 endpoint, parallel_data, task_data, actual_parallelism, index, flags);
182}
183
184// Callbacks as of Table 19.4, which are not considered required for a minimal
185// conforming OMPT implementation.
186static void on_ompt_callback_work(ompt_work_t work_type,
187 ompt_scope_endpoint_t endpoint,
188 ompt_data_t *parallel_data,
189 ompt_data_t *task_data, uint64_t count,
190 const void *codeptr_ra) {
191 OmptCallbackHandler::get().handleWork(work_type, endpoint, parallel_data,
192 task_data, count, codeptr_ra);
193}
194
195static void on_ompt_callback_dispatch(ompt_data_t *parallel_data,
196 ompt_data_t *task_data,
197 ompt_dispatch_t kind,
198 ompt_data_t instance) {
199 OmptCallbackHandler::get().handleDispatch(parallel_data, task_data, kind,
200 instance);
201}
202
203static void on_ompt_callback_sync_region(ompt_sync_region_t kind,
204 ompt_scope_endpoint_t endpoint,
205 ompt_data_t *parallel_data,
206 ompt_data_t *task_data,
207 const void *codeptr_ra) {
208 OmptCallbackHandler::get().handleSyncRegion(kind, endpoint, parallel_data,
209 task_data, codeptr_ra);
210}
211
212/////// DEVICE-RELATED //////
213
214// Synchronous callbacks
215static void on_ompt_callback_device_initialize(int device_num, const char *type,
216 ompt_device_t *device,
217 ompt_function_lookup_t lookup,
218 const char *documentation) {
220 lookup, documentation);
221 if (!UseTracing)
222 return;
223
224 if (!lookup) {
225 printf("Trace collection disabled on device %d\n", device_num);
226 return;
227 }
228
229 ompt_set_trace_ompt = (ompt_set_trace_ompt_t)lookup("ompt_set_trace_ompt");
230 ompt_start_trace = (ompt_start_trace_t)lookup("ompt_start_trace");
231 ompt_flush_trace = (ompt_flush_trace_t)lookup("ompt_flush_trace");
232 ompt_stop_trace = (ompt_stop_trace_t)lookup("ompt_stop_trace");
233 ompt_get_record_ompt = (ompt_get_record_ompt_t)lookup("ompt_get_record_ompt");
235 (ompt_advance_buffer_cursor_t)lookup("ompt_advance_buffer_cursor");
236
238 (ompt_get_record_type_t)lookup("ompt_get_record_type");
240 printf("Warning: No function ompt_get_record_type found in device "
241 "callbacks\n");
242 }
243
244 static bool IsDeviceMapInitialized = false;
245 if (!IsDeviceMapInitialized) {
246 TracedDevices = std::make_unique<OmptDeviceSetTy>();
247 IsDeviceMapInitialized = true;
248 }
249
250 set_trace_ompt(device);
251
252 // In many scenarios, this is a good place to start the
253 // trace. If start_trace is called from the main program before this
254 // callback is dispatched, the start_trace handle will be null. This
255 // is because this device_init callback is invoked during the first
256 // target construct implementation.
257
258 start_trace(device);
259}
260
261static void on_ompt_callback_device_finalize(int device_num) {
263}
264
265static void on_ompt_callback_device_load(int device_num, const char *filename,
266 int64_t offset_in_file,
267 void *vma_in_file, size_t bytes,
268 void *host_addr, void *device_addr,
269 uint64_t module_id) {
271 device_num, filename, offset_in_file, vma_in_file, bytes, host_addr,
272 device_addr, module_id);
273}
274
275static void on_ompt_callback_device_unload(int device_num, uint64_t module_id) {
276 OmptCallbackHandler::get().handleDeviceUnload(device_num, module_id);
277}
278
280 ompt_id_t target_id, ompt_id_t host_op_id, ompt_target_data_op_t optype,
281 void *src_addr, int src_device_num, void *dest_addr, int dest_device_num,
282 size_t bytes, const void *codeptr_ra) {
284 target_id, host_op_id, optype, src_addr, src_device_num, dest_addr,
285 dest_device_num, bytes, codeptr_ra);
286}
287
288static void on_ompt_callback_target(ompt_target_t kind,
289 ompt_scope_endpoint_t endpoint,
290 int device_num, ompt_data_t *task_data,
291 ompt_id_t target_id,
292 const void *codeptr_ra) {
293 OmptCallbackHandler::get().handleTarget(kind, endpoint, device_num, task_data,
294 target_id, codeptr_ra);
295}
296
297static void on_ompt_callback_target_submit(ompt_id_t target_id,
298 ompt_id_t host_op_id,
299 unsigned int requested_num_teams) {
300 OmptCallbackHandler::get().handleTargetSubmit(target_id, host_op_id,
301 requested_num_teams);
302}
303
305 ompt_scope_endpoint_t endpoint, ompt_data_t *target_task_data,
306 ompt_data_t *target_data, ompt_id_t *host_op_id,
307 ompt_target_data_op_t optype, void *src_addr, int src_device_num,
308 void *dest_addr, int dest_device_num, size_t bytes,
309 const void *codeptr_ra) {
310 assert(codeptr_ra != 0 && "Unexpected null codeptr");
311 // Both src and dest must not be null
312 // However, for omp_target_alloc only the END call holds a value for one of
313 // the two entries
314 if (optype != ompt_target_data_alloc)
315 assert((src_addr != 0 || dest_addr != 0) && "Both src and dest addr null");
316 if (endpoint == ompt_scope_begin)
317 *host_op_id = NextOpId.fetch_add(1, std::memory_order_relaxed);
319 endpoint, target_task_data, target_data, host_op_id, optype, src_addr,
320 src_device_num, dest_addr, dest_device_num, bytes, codeptr_ra);
321}
322
323static void on_ompt_callback_target_emi(ompt_target_t kind,
324 ompt_scope_endpoint_t endpoint,
325 int device_num, ompt_data_t *task_data,
326 ompt_data_t *target_task_data,
327 ompt_data_t *target_data,
328 const void *codeptr_ra) {
329 assert(codeptr_ra != 0 && "Unexpected null codeptr");
330 if (endpoint == ompt_scope_begin)
331 target_data->value = NextOpId.fetch_add(1, std::memory_order_relaxed);
332 OmptCallbackHandler::get().handleTargetEmi(kind, endpoint, device_num,
333 task_data, target_task_data,
334 target_data, codeptr_ra);
335}
336
338 ompt_scope_endpoint_t endpoint, ompt_data_t *target_data,
339 ompt_id_t *host_op_id, unsigned int requested_num_teams) {
341 endpoint, target_data, host_op_id, requested_num_teams);
342}
343
344static void on_ompt_callback_target_map(ompt_id_t target_id,
345 unsigned int nitems, void **host_addr,
346 void **device_addr, size_t *bytes,
347 unsigned int *mapping_flags,
348 const void *codeptr_ra) {
349 assert(0 && "Target map callback is unimplemented");
350}
351
352static void on_ompt_callback_target_map_emi(ompt_data_t *target_data,
353 unsigned int nitems,
354 void **host_addr,
355 void **device_addr, size_t *bytes,
356 unsigned int *mapping_flags,
357 const void *codeptr_ra) {
358 assert(0 && "Target map emi callback is unimplemented");
359}
360
361/// Load the value of a given boolean environmental variable.
362bool getBoolEnvironmentVariable(const char *VariableName) {
363 if (VariableName == nullptr)
364 return false;
365 if (const char *EnvValue = std::getenv(VariableName)) {
366 std::string S{EnvValue};
367 for (auto &C : S)
368 C = (char)std::tolower(C);
369 if (S == "1" || S == "on" || S == "true" || S == "yes")
370 return true;
371 }
372 return false;
373}
374
375/// Called by the OMP runtime to initialize the OMPT
376int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
377 ompt_data_t *tool_data) {
378 ompt_set_callback_t ompt_set_callback = nullptr;
379 ompt_set_callback = (ompt_set_callback_t)lookup("ompt_set_callback");
381 return 0; // failure
382
383 UseEMICallbacks = getBoolEnvironmentVariable("OMPTEST_USE_OMPT_EMI");
384 UseTracing = getBoolEnvironmentVariable("OMPTEST_USE_OMPT_TRACING");
385 RunAsTestSuite = getBoolEnvironmentVariable("OMPTEST_RUN_AS_TESTSUITE");
386 ColoredLog = getBoolEnvironmentVariable("OMPTEST_LOG_COLORED");
387
388 register_ompt_callback(ompt_callback_thread_begin);
389 register_ompt_callback(ompt_callback_thread_end);
390 register_ompt_callback(ompt_callback_parallel_begin);
391 register_ompt_callback(ompt_callback_parallel_end);
392 register_ompt_callback(ompt_callback_work);
393 // register_ompt_callback(ompt_callback_dispatch);
394 register_ompt_callback(ompt_callback_task_create);
395 // register_ompt_callback(ompt_callback_dependences);
396 // register_ompt_callback(ompt_callback_task_dependence);
397 register_ompt_callback(ompt_callback_task_schedule);
398 register_ompt_callback(ompt_callback_implicit_task);
399 // register_ompt_callback(ompt_callback_masked);
400 register_ompt_callback(ompt_callback_sync_region);
401 // register_ompt_callback(ompt_callback_mutex_acquire);
402 // register_ompt_callback(ompt_callback_mutex);
403 // register_ompt_callback(ompt_callback_nestLock);
404 // register_ompt_callback(ompt_callback_flush);
405 // register_ompt_callback(ompt_callback_cancel);
406 register_ompt_callback(ompt_callback_device_initialize);
407 register_ompt_callback(ompt_callback_device_finalize);
408 register_ompt_callback(ompt_callback_device_load);
409 register_ompt_callback(ompt_callback_device_unload);
410
411 if (UseEMICallbacks) {
412 register_ompt_callback(ompt_callback_target_emi);
413 register_ompt_callback(ompt_callback_target_submit_emi);
414 register_ompt_callback(ompt_callback_target_data_op_emi);
415 register_ompt_callback(ompt_callback_target_map_emi);
416 } else {
417 register_ompt_callback(ompt_callback_target);
418 register_ompt_callback(ompt_callback_target_submit);
419 register_ompt_callback(ompt_callback_target_data_op);
420 register_ompt_callback(ompt_callback_target_map);
421 }
422
423 // Construct & subscribe the reporter, so it gets notified of events
426
427 if (RunAsTestSuite)
428 EventReporter->setActive(false);
429
430 return 1; // success
431}
432
433void ompt_finalize(ompt_data_t *tool_data) {
434 assert(Handler && "Callback handler should be present at this point");
435 assert(EventReporter && "EventReporter should be present at this point");
436 delete Handler;
437 delete EventReporter;
438}
439
440#ifdef __cplusplus
441extern "C" {
442#endif
443/// Called from the OMP Runtime to start / initialize the tool
445 const char *runtime_version) {
449}
450
451int start_trace(ompt_device_t *Device) {
452 if (!ompt_start_trace)
453 return 0;
454
455 // Start tracing this device (add to set)
456 assert(TracedDevices->find(Device) == TracedDevices->end() &&
457 "Device already present in the map");
458 TracedDevices->insert(Device);
459
462}
463
464int flush_trace(ompt_device_t *Device) {
465 if (!ompt_flush_trace)
466 return 0;
467 return ompt_flush_trace(Device);
468}
469
471 if (!ompt_flush_trace || TracedDevices == nullptr)
472 return 0;
473
474 size_t NumFlushedDevices = 0;
475 for (auto Device : *TracedDevices)
476 if (ompt_flush_trace(Device) == 1)
477 ++NumFlushedDevices;
478
479 // Provide time to process triggered assert events
480 std::this_thread::sleep_for(std::chrono::milliseconds(1));
481
482 return (NumFlushedDevices == TracedDevices->size());
483}
484
485int stop_trace(ompt_device_t *Device) {
486 if (!ompt_stop_trace)
487 return 0;
488
489 // Stop tracing this device (erase from set)
490 assert(TracedDevices->find(Device) != TracedDevices->end() &&
491 "Device not present in the map");
492 TracedDevices->erase(Device);
493
494 return ompt_stop_trace(Device);
495}
496
497// This is primarily used to stop unwanted prints from happening.
499 assert(EventReporter && "EventReporter should be present at this point");
500 EventReporter->setActive(State);
501}
502#ifdef __cplusplus
503}
504#endif
static OmptEventReporter * EventReporter
Definition: OmptTester.cpp:30
static ompt_get_record_ompt_t ompt_get_record_ompt
Definition: OmptTester.cpp:59
static void on_ompt_callback_target_map(ompt_id_t target_id, unsigned int nitems, void **host_addr, void **device_addr, size_t *bytes, unsigned int *mapping_flags, const void *codeptr_ra)
Definition: OmptTester.cpp:344
static void on_ompt_callback_target_map_emi(ompt_data_t *target_data, unsigned int nitems, void **host_addr, void **device_addr, size_t *bytes, unsigned int *mapping_flags, const void *codeptr_ra)
Definition: OmptTester.cpp:352
static OmptDeviceSetPtrTy TracedDevices
Definition: OmptTester.cpp:66
OmptCallbackHandler * Handler
static ompt_set_result_t set_trace_ompt(ompt_device_t *Device)
Definition: OmptTester.cpp:109
bool getBoolEnvironmentVariable(const char *VariableName)
Load the value of a given boolean environmental variable.
Definition: OmptTester.cpp:362
static void on_ompt_callback_buffer_complete(int device_num, ompt_buffer_t *buffer, size_t bytes, ompt_buffer_cursor_t begin, int buffer_owned)
Definition: OmptTester.cpp:82
std::unique_ptr< OmptDeviceSetTy > OmptDeviceSetPtrTy
Definition: OmptTester.cpp:65
static bool RunAsTestSuite
Definition: OmptTester.cpp:51
static void on_ompt_callback_target_data_op(ompt_id_t target_id, ompt_id_t host_op_id, ompt_target_data_op_t optype, void *src_addr, int src_device_num, void *dest_addr, int dest_device_num, size_t bytes, const void *codeptr_ra)
Definition: OmptTester.cpp:279
static ompt_set_trace_ompt_t ompt_set_trace_ompt
Definition: OmptTester.cpp:55
#define register_ompt_callback(name)
Definition: OmptTester.cpp:40
static void on_ompt_callback_parallel_end(ompt_data_t *parallel_data, ompt_data_t *encountering_task_data, int flags, const void *codeptr_ra)
Definition: OmptTester.cpp:151
static void on_ompt_callback_device_initialize(int device_num, const char *type, ompt_device_t *device, ompt_function_lookup_t lookup, const char *documentation)
Definition: OmptTester.cpp:215
int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num, ompt_data_t *tool_data)
Called by the OMP runtime to initialize the OMPT.
Definition: OmptTester.cpp:376
static void on_ompt_callback_target(ompt_target_t kind, ompt_scope_endpoint_t endpoint, int device_num, ompt_data_t *task_data, ompt_id_t target_id, const void *codeptr_ra)
Definition: OmptTester.cpp:288
static void on_ompt_callback_target_emi(ompt_target_t kind, ompt_scope_endpoint_t endpoint, int device_num, ompt_data_t *task_data, ompt_data_t *target_task_data, ompt_data_t *target_data, const void *codeptr_ra)
Definition: OmptTester.cpp:323
static void on_ompt_callback_target_submit(ompt_id_t target_id, ompt_id_t host_op_id, unsigned int requested_num_teams)
Definition: OmptTester.cpp:297
static void on_ompt_callback_device_finalize(int device_num)
Definition: OmptTester.cpp:261
void ompt_finalize(ompt_data_t *tool_data)
Definition: OmptTester.cpp:433
static void on_ompt_callback_target_submit_emi(ompt_scope_endpoint_t endpoint, ompt_data_t *target_data, ompt_id_t *host_op_id, unsigned int requested_num_teams)
Definition: OmptTester.cpp:337
static bool UseTracing
Definition: OmptTester.cpp:50
static void on_ompt_callback_device_load(int device_num, const char *filename, int64_t offset_in_file, void *vma_in_file, size_t bytes, void *host_addr, void *device_addr, uint64_t module_id)
Definition: OmptTester.cpp:265
int start_trace(ompt_device_t *Device)
Definition: OmptTester.cpp:451
static void on_ompt_callback_task_schedule(ompt_data_t *prior_task_data, ompt_task_status_t prior_task_status, ompt_data_t *next_task_data)
Definition: OmptTester.cpp:168
static void on_ompt_callback_thread_end(ompt_data_t *thread_data)
Definition: OmptTester.cpp:138
static ompt_start_trace_t ompt_start_trace
Definition: OmptTester.cpp:56
static void on_ompt_callback_parallel_begin(ompt_data_t *encountering_task_data, const ompt_frame_t *encountering_task_frame, ompt_data_t *parallel_data, unsigned int requested_parallelism, int flags, const void *codeptr_ra)
Definition: OmptTester.cpp:142
static bool UseEMICallbacks
Definition: OmptTester.cpp:49
static void on_ompt_callback_sync_region(ompt_sync_region_t kind, ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, const void *codeptr_ra)
Definition: OmptTester.cpp:203
std::unordered_set< ompt_device_t * > OmptDeviceSetTy
Definition: OmptTester.cpp:64
int flush_trace(ompt_device_t *Device)
Definition: OmptTester.cpp:464
static ompt_get_record_type_t ompt_get_record_type_fn
Definition: OmptTester.cpp:61
#define OMPT_BUFFER_REQUEST_SIZE
Definition: OmptTester.cpp:42
static ompt_stop_trace_t ompt_stop_trace
Definition: OmptTester.cpp:58
void libomptest_global_eventreporter_set_active(bool State)
Definition: OmptTester.cpp:498
static bool ColoredLog
Definition: OmptTester.cpp:52
static void on_ompt_callback_target_data_op_emi(ompt_scope_endpoint_t endpoint, ompt_data_t *target_task_data, ompt_data_t *target_data, ompt_id_t *host_op_id, ompt_target_data_op_t optype, void *src_addr, int src_device_num, void *dest_addr, int dest_device_num, size_t bytes, const void *codeptr_ra)
Definition: OmptTester.cpp:304
static std::atomic< ompt_id_t > NextOpId
Definition: OmptTester.cpp:48
static void on_ompt_callback_implicit_task(ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, unsigned int actual_parallelism, unsigned int index, int flags)
Definition: OmptTester.cpp:175
static ompt_advance_buffer_cursor_t ompt_advance_buffer_cursor
Definition: OmptTester.cpp:60
static void on_ompt_callback_device_unload(int device_num, uint64_t module_id)
Definition: OmptTester.cpp:275
static void on_ompt_callback_work(ompt_work_t work_type, ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, uint64_t count, const void *codeptr_ra)
Definition: OmptTester.cpp:186
int flush_traced_devices()
Definition: OmptTester.cpp:470
static void on_ompt_callback_buffer_request(int device_num, ompt_buffer_t **buffer, size_t *bytes)
Definition: OmptTester.cpp:71
static void on_ompt_callback_thread_begin(ompt_thread_t thread_type, ompt_data_t *thread_data)
Definition: OmptTester.cpp:133
static void on_ompt_callback_task_create(ompt_data_t *encountering_task_data, const ompt_frame_t *encountering_task_frame, ompt_data_t *new_task_data, int flags, int has_dependences, const void *codeptr_ra)
Definition: OmptTester.cpp:159
static void on_ompt_callback_dispatch(ompt_data_t *parallel_data, ompt_data_t *task_data, ompt_dispatch_t kind, ompt_data_t instance)
Definition: OmptTester.cpp:195
int stop_trace(ompt_device_t *Device)
Definition: OmptTester.cpp:485
static ompt_flush_trace_t ompt_flush_trace
Definition: OmptTester.cpp:57
This file represents the main header file for usage of the ompTest library.
static ompt_set_callback_t ompt_set_callback
Definition: callback.h:153
Handler class to do whatever is needed to be done when a callback is invoked by the OMP runtime Suppo...
void handleImplicitTask(ompt_scope_endpoint_t Endpoint, ompt_data_t *ParallelData, ompt_data_t *TaskData, unsigned int ActualParallelism, unsigned int Index, int Flags)
void handleDeviceFinalize(int DeviceNum)
void handleTaskCreate(ompt_data_t *EncounteringTaskData, const ompt_frame_t *EncounteringTaskFrame, ompt_data_t *NewTaskData, int Flags, int HasDependences, const void *CodeptrRA)
void handleTargetSubmitEmi(ompt_scope_endpoint_t Endpoint, ompt_data_t *TargetData, ompt_id_t *HostOpId, unsigned int RequestedNumTeams)
void handleThreadEnd(ompt_data_t *ThreadData)
void subscribe(OmptListener *Listener)
Subscribe a listener to be notified for OMPT events.
void handleBufferComplete(int DeviceNum, ompt_buffer_t *Buffer, size_t Bytes, ompt_buffer_cursor_t Begin, int BufferOwned)
void handleDeviceUnload(int DeviceNum, uint64_t ModuleId)
void handleTargetSubmit(ompt_id_t TargetId, ompt_id_t HostOpId, unsigned int RequestedNumTeams)
void handleSyncRegion(ompt_sync_region_t Kind, ompt_scope_endpoint_t Endpoint, ompt_data_t *ParallelData, ompt_data_t *TaskData, const void *CodeptrRA)
void handleThreadBegin(ompt_thread_t ThreadType, ompt_data_t *ThreadData)
void handleDispatch(ompt_data_t *ParallelData, ompt_data_t *TaskData, ompt_dispatch_t Kind, ompt_data_t Instance)
void handleBufferRecord(ompt_record_ompt_t *Record)
void handleTaskSchedule(ompt_data_t *PriorTaskData, ompt_task_status_t PriorTaskStatus, ompt_data_t *NextTaskData)
void handleBufferRequest(int DeviceNum, ompt_buffer_t **Buffer, size_t *Bytes)
void handleTargetDataOp(ompt_id_t TargetId, ompt_id_t HostOpId, ompt_target_data_op_t OpType, void *SrcAddr, int SrcDeviceNum, void *DstAddr, int DstDeviceNum, size_t Bytes, const void *CodeptrRA)
void handleBufferRecordDeallocation(ompt_buffer_t *Buffer)
void handleTarget(ompt_target_t Kind, ompt_scope_endpoint_t Endpoint, int DeviceNum, ompt_data_t *TaskData, ompt_id_t TargetId, const void *CodeptrRA)
void handleParallelEnd(ompt_data_t *ParallelData, ompt_data_t *EncounteringTaskData, int Flags, const void *CodeptrRA)
void handleDeviceLoad(int DeviceNum, const char *Filename, int64_t OffsetInFile, void *VmaInFile, size_t Bytes, void *HostAddr, void *DeviceAddr, uint64_t ModuleId)
void handleTargetEmi(ompt_target_t Kind, ompt_scope_endpoint_t Endpoint, int DeviceNum, ompt_data_t *TaskData, ompt_data_t *TargetTaskData, ompt_data_t *TargetData, const void *CodeptrRA)
void handleTargetDataOpEmi(ompt_scope_endpoint_t Endpoint, ompt_data_t *TargetTaskData, ompt_data_t *TargetData, ompt_id_t *HostOpId, ompt_target_data_op_t OpType, void *SrcAddr, int SrcDeviceNum, void *DstAddr, int DstDeviceNum, size_t Bytes, const void *CodeptrRA)
void handleDeviceInitialize(int DeviceNum, const char *Type, ompt_device_t *Device, ompt_function_lookup_t LookupFn, const char *DocumentationStr)
void handleParallelBegin(ompt_data_t *EncounteringTaskData, const ompt_frame_t *EncounteringTaskFrame, ompt_data_t *ParallelData, unsigned int RequestedParallelism, int Flags, const void *CodeptrRA)
static OmptCallbackHandler & get()
Singleton handler.
void handleWork(ompt_work_t WorkType, ompt_scope_endpoint_t Endpoint, ompt_data_t *ParallelData, ompt_data_t *TaskData, uint64_t Count, const void *CodeptrRA)
Not needed for a conforming minimal OMPT implementation.
Class that reports the occurred events.
Definition: OmptAsserter.h:238
void setActive(bool Enabled)
Control whether this asserter should be considered 'active'.
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp begin
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance * instance
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t count
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
char
struct ompt_start_tool_result_t ompt_start_tool_result_t
#define C
static ompt_start_tool_result_t * ompt_start_tool_result
#define ompt_start_tool