1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
4 #include "callback.h"
5 #include <omp.h>
6
main()7 int main()
8 {
9 int x = 0;
10 #pragma omp parallel num_threads(2)
11 {
12 #pragma omp master
13 {
14 #pragma omp task
15 {
16 x++;
17 }
18 #pragma omp taskwait
19 print_current_address(1);
20 }
21 }
22
23 // Check if libomp supports the callbacks for this test.
24 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region'
25 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait'
26
27 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
28
29 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
30 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
31 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
32 // CHECK-NEXT: {{^}}[[MASTER_ID]]: ompt_event_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
33 // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
34
35 return 0;
36 }
37