1// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2// REQUIRES: ompt
3#include <omp.h>
4#include "callback.h"
5
6int main() {
7 omp_set_nested(1);
8#pragma omp parallel num_threads(2)
9 {
10#pragma omp barrier
11#pragma omp parallel num_threads(2)
12 { print_frame(0); }
13 }
14
15 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
16
17 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin:
18 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]]
19 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
20 // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
21 // CHECK-SAME: thread_num=[[OUTER_THREAD_NUM1:[0-9]+]]
22 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin:
23 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID1:[0-9]+]]
24 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin:
25 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID1]]
26 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM1:[0-9]+]]
27 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end
28 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM1]]
29 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end:
30 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID1]]
31 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end
32 // CHECK-SAME: thread_num=[[OUTER_THREAD_NUM1]]
33 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end:
34 // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
35
36 // CHECK: {{^}}[[WORKER_ID1:[0-9]+]]: ompt_event_implicit_task_begin:
37 // CHECK-SAME: parallel_id=[[PARALLEL_ID]]
38 // CHECK-SAME: thread_num=[[OUTER_THREAD_NUM2:[0-9]+]]
39 // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_parallel_begin:
40 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID2:[0-9]+]]
41 // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_implicit_task_begin:
42 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID2]]
43 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM2:[0-9]+]]
44 // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_implicit_task_end
45 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM2]]
46 // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_parallel_end:
47 // CHECK-SAME: parallel_id=[[INNER_PARALLEL_ID2]]
48 // CHECK: {{^}}[[WORKER_ID1]]: ompt_event_implicit_task_end
49 // CHECK-SAME: thread_num=[[OUTER_THREAD_NUM2]]
50
51 // CHECK: {{^}}[[WORKER_ID2:[0-9]+]]: ompt_event_implicit_task_begin:
52 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM3:[0-9]+]]
53 // CHECK: {{^}}[[WORKER_ID2]]: ompt_event_implicit_task_end
54 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM3]]
55
56 // CHECK: {{^}}[[WORKER_ID3:[0-9]+]]: ompt_event_implicit_task_begin:
57 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM4:[0-9]+]]
58 // CHECK: {{^}}[[WORKER_ID3]]: ompt_event_implicit_task_end
59 // CHECK-SAME: thread_num=[[INNER_THREAD_NUM4]]
60
61 return 0;
62}
63

source code of openmp/runtime/test/ompt/parallel/nested_threadnum.c