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