Debian Codegraph @

openmp/runtime/test/ompt/synchronization/taskwait.c

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