Debian Codegraph @

openmp/runtime/test/ompt/worksharing/sections_dispatch.c

raw
1 // clang-format off
2 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
3 // REQUIRES: ompt
4 // UNSUPPORTED: intel-15.0, intel-16.0, intel-17.0, intel-18.0
5 // GCC generates code that does not distinguish between sections and loops
6 // UNSUPPORTED: gcc
7 // clang-format on
8
9 #include "callback.h"
10 #include <omp.h>
11
12 int main() {
13 #pragma omp parallel sections num_threads(2)
14 {
15 #pragma omp section
16 {
17 printf("%lu: section 1\n", ompt_get_thread_data()->value);
18 }
19 #pragma omp section
20 {
21 printf("%lu: section 2\n", ompt_get_thread_data()->value);
22 }
23 }
24
25 // clang-format off
26 // Check if libomp supports the callbacks for this test.
27 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'
28 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dispatch'
29
30 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
31
32 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin:
33 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]],
34 // CHECK-SAME: task_id=[[TASK_ID:[0-f]+]],
35 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN:(0x)?[0-f]+]], count=2
36 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_section_begin:
37 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
38 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]]
39 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_sections_end:
40 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}},
41 // CHECK-SAME: codeptr_ra=[[SECT_END:(0x)?[0-f]+]]
42
43 // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin:
44 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-f]+]],
45 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]], count=2
46 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_section_begin:
47 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
48 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]]
49 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end:
50 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}},
51 // CHECK-SAME: codeptr_ra=[[SECT_END]]
52 // clang-format on
53
54 return 0;
55 }