xref: /llvm-project/openmp/runtime/test/ompt/worksharing/taskinfo/sections_serialized.c (revision ba02586fbe188c4d66dcce72bc0c39e852228cb0)
1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 
4 #include "callback.h"
5 #include <omp.h>
6 
main()7 int main()
8 {
9 #pragma omp parallel sections num_threads(1)
10   {
11 #pragma omp section
12     {
13       // implicit task info
14       print_ids(0);
15       // initial task info
16       print_ids(1);
17     }
18   }
19 
20   // Check if libomp supports the callbacks for this test.
21   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
22   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
23 
24 
25   // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
26   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[INITIAL_PARALLEL_ID:[0-9]+]], task_id=[[INITIAL_TASK_ID:[0-9]+]], actual_parallelism=1, index=1, flags=1
27 
28   // region 0
29   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin
30   // CHECK-SAME: parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[INITIAL_TASK_FRAME_ENTER:0x[0-f]+]],
31   // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]]
32 
33   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-9]+]]
34 
35   // information about implicit task (exit frame should be set, while enter should be NULL)
36   // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]
37   // CHECK-SAME: exit_frame={{0x[0-f]+}}
38   // CHECK-SAME: reenter_frame=[[NULL]]
39   // CHECK-SAME: task_type=ompt_task_implicit
40 
41   // information about initial task (exit frame should be NULL, while enter frame shoule be set)
42   // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[INITIAL_PARALLEL_ID]], task_id=[[INITIAL_TASK_ID]]
43   // CHECK-SAME: exit_frame=[[NULL]]
44   // CHECK-SAME: reenter_frame=[[INITIAL_TASK_FRAME_ENTER]]
45   // CHECK-SAME: task_type=ompt_task_initial
46 
47   return 0;
48 }
49