Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / ompt / register_both.h
blobafdf094bb4effd84e7f649b82cb97e64bd92f265
1 #include <omp-tools.h>
3 // From openmp/runtime/test/ompt/callback.h
4 #define register_ompt_callback_t(name, type) \
5 do { \
6 type f_##name = &on_##name; \
7 if (ompt_set_callback(name, (ompt_callback_t)f_##name) == ompt_set_never) \
8 printf("0: Could not register callback '" #name "'\n"); \
9 } while (0)
11 #define register_ompt_callback(name) register_ompt_callback_t(name, name##_t)
13 // OMPT entry point handles
14 static ompt_set_callback_t ompt_set_callback = 0;
16 // Init functions
17 int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
18 ompt_data_t *tool_data) {
19 ompt_set_callback = (ompt_set_callback_t)lookup("ompt_set_callback");
21 if (!ompt_set_callback)
22 return 0; // failed
24 register_ompt_callback(ompt_callback_device_initialize);
25 register_ompt_callback(ompt_callback_device_finalize);
26 register_ompt_callback(ompt_callback_device_load);
27 register_ompt_callback(ompt_callback_target_data_op_emi);
28 register_ompt_callback(ompt_callback_target_data_op);
29 register_ompt_callback(ompt_callback_target);
30 register_ompt_callback(ompt_callback_target_emi);
31 register_ompt_callback(ompt_callback_target_submit);
33 return 1; // success
36 void ompt_finalize(ompt_data_t *tool_data) {}
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
42 const char *runtime_version) {
43 static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
44 &ompt_finalize, 0};
45 return &ompt_start_tool_result;
47 #ifdef __cplusplus
49 #endif