xref: /llvm-project/openmp/runtime/test/ompt/tasks/taskloop_dispatch.c (revision a707d0883b5ab9de6a0a864df614ef14909a4de1)
1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 // UNSUPPORTED: gnu, intel-16.0
4 
5 #include "callback.h"
6 #include <omp.h>
7 
main()8 int main() {
9   unsigned int i, x;
10 
11 #pragma omp parallel num_threads(2)
12   {
13 #pragma omp barrier
14 
15 #pragma omp master
16 #pragma omp taskloop grainsize(4)
17     for (i = 0; i < 16; i++) {
18       // Make every iteration takes at least 1ms
19       delay(1000);
20     }
21   }
22   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
23 
24   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
25   // CHECK-SAME: parent_task_id={{[0-9]+}}
26   // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]]
27   // CHECK-SAME: requested_team_size=2
28   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
29   // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
30   // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1:[0-9]+]]
31   // CHECK-SAME: team_size=2, thread_num=0
32 
33   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskloop_begin:
34   // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
35   // CHECK-SAME: task_id=[[IMPLICIT_TASK_ID1]]
36   // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]], count=16
37 
38   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
39   // CHECK-SAME: new_task_id=[[TASK_ID0:[0-9]+]]
40   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
41   // CHECK-SAME: new_task_id=[[TASK_ID1:[0-9]+]]
42   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
43   // CHECK-SAME: new_task_id=[[TASK_ID2:[0-9]+]]
44   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
45   // CHECK-SAME: new_task_id=[[TASK_ID3:[0-9]+]]
46 
47   // CHECK-DAG: {{.*}}: ompt_event_taskloop_chunk_begin:{{.*}}task_id=[[TASK_ID0]]{{.*}}chunk_iterations=4
48   // CHECK-DAG: {{.*}}: ompt_event_taskloop_chunk_begin:{{.*}}task_id=[[TASK_ID1]]{{.*}}chunk_iterations=4
49   // CHECK-DAG: {{.*}}: ompt_event_taskloop_chunk_begin:{{.*}}task_id=[[TASK_ID2]]{{.*}}chunk_iterations=4
50   // CHECK-DAG: {{.*}}: ompt_event_taskloop_chunk_begin:{{.*}}task_id=[[TASK_ID3]]{{.*}}chunk_iterations=4
51 
52   return 0;
53 }
54