1 // RUN: %libomp-compile && %libomp-run | FileCheck %s
7 #pragma omp parallel num_threads(1)
10 ompt_callback_t callback
;
11 ompt_get_callback(ompt_callback_thread_begin
, &callback
);
12 printf("%" PRIu64
": &on_ompt_callback_thread_begin=%p\n",
13 ompt_get_thread_data()->value
, &on_ompt_callback_thread_begin
);
14 printf("%" PRIu64
": ompt_get_callback() result=%p\n",
15 ompt_get_thread_data()->value
, callback
);
18 printf("%" PRIu64
": ompt_get_state()=%d\n", ompt_get_thread_data()->value
,
19 ompt_get_state(NULL
));
21 // ompt_enumerate_states()
22 int state
= ompt_state_undefined
;
23 const char *state_name
;
25 while (ompt_enumerate_states(state
, &state
, &state_name
) && steps
< 1000) {
28 printf("%" PRIu64
": state_name is NULL\n",
29 ompt_get_thread_data()->value
);
32 // enumeration did not end after 1000 steps
33 printf("%" PRIu64
": states enumeration did not end\n",
34 ompt_get_thread_data()->value
);
37 // ompt_enumerate_mutex_impls()
38 int impl
= ompt_mutex_impl_none
;
39 const char *impl_name
;
41 while (ompt_enumerate_mutex_impls(impl
, &impl
, &impl_name
) &&
45 printf("%" PRIu64
": impl_name is NULL\n",
46 ompt_get_thread_data()->value
);
49 // enumeration did not end after 1000 steps
50 printf("%" PRIu64
": mutex_impls enumeration did not end\n",
51 ompt_get_thread_data()->value
);
55 // Check if libomp supports the callbacks for this test.
57 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
59 // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: &on_ompt_callback_thread_begin
60 // CHECK-SAME: =[[FUNCTION_POINTER:0x[0-f]+]]
61 // CHECK: {{^}}[[THREAD_ID]]: ompt_get_callback() result=[[FUNCTION_POINTER]]
63 // CHECK: {{^}}[[THREAD_ID]]: ompt_get_state()=1
65 // CHECK-NOT: {{^}}[[THREAD_ID]]: state_name is NULL
66 // CHECK-NOT: {{^}}[[THREAD_ID]]: states enumeration did not end
68 // CHECK-NOT: {{^}}[[THREAD_ID]]: impl_name is NULL
69 // CHECK-NOT: {{^}}[[THREAD_ID]]: mutex_impls enumeration did not end