3 // From openmp/runtime/test/ompt/callback.h
4 #define register_ompt_callback_t(name, type) \
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"); \
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;
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 1; // failed but wrongly returning 1
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 0; // success but should return 1 according to the spec
34 void ompt_finalize(ompt_data_t
*tool_data
) {}
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
,
43 return &ompt_start_tool_result
;