Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / ompt / register_non_emi.h
blob66c8aaaafd193fb5a99f8088c24d6f7ca44b2ec0
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);
28 register_ompt_callback(ompt_callback_target);
29 register_ompt_callback(ompt_callback_target_submit);
31 return 1; // success
34 void ompt_finalize(ompt_data_t *tool_data) {}
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
40 const char *runtime_version) {
41 static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
42 &ompt_finalize, 0};
43 return &ompt_start_tool_result;
45 #ifdef __cplusplus
47 #endif