Debian Codegraph @

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

raw
1 // clang-format off
2 // RUN: %libomp-compile-and-run | FileCheck %s
3 // REQUIRES: ompt
4 // GCC generates code that does not call the runtime for the master construct
5 // XFAIL: gcc
6 // clang-format on
7
8 #include "callback.h"
9 #include <omp.h>
10
11 int main() {
12 int x = 0;
13 #pragma omp parallel num_threads(2)
14 {
15 #pragma omp master
16 {
17 print_fuzzy_address(1);
18 x++;
19 }
20 print_current_address(2);
21 }
22
23 printf("%" PRIu64 ": x=%d\n", ompt_get_thread_data()->value, x);
24
25 return 0;
26 }
27
28 // clang-format off
29 // Check if libomp supports the callbacks for this test.
30 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_masked'
31
32 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
33
34 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_masked_begin:
35 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]],
36 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]{{[0-f][0-f]}}
37 // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
38 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_masked_end:
39 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]],
40 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS_END:(0x)?[0-f]+]]
41 // CHECK: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS_END]]
42 // clang-format on