LLVM OpenMP
22.0.0git
runtime
test
ompt
parallel
region_in_expl_task_task_frames.c
Go to the documentation of this file.
1
// clang-format off
2
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
3
// REQUIRES: ompt
4
// clang-format on
5
6
#include "
callback.h
"
7
#include <omp.h>
8
9
int
main
() {
10
#pragma omp parallel num_threads(2)
11
{
12
if
(omp_get_thread_num() == 0) {
13
// region 0
14
#pragma omp task if (0)
15
{
16
// explicit task immediately executed by the initial master thread
17
#pragma omp parallel num_threads(2)
18
{
19
if
(omp_get_thread_num() == 0) {
20
// Note that this is executed by the initial master thread
21
// region 1
22
// region 1's implicit task
23
print_ids
(0);
24
// explicit task
25
print_ids
(1);
26
// region 0's implicit task
27
print_ids
(2);
28
// initial task
29
print_ids
(3);
30
}
31
}
32
}
33
}
34
}
35
36
// clang-format off
37
// Check if libomp supports the callbacks for this test.
38
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
39
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
40
41
42
// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
43
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_initial_task_begin: parallel_id=[[INITIAL_PARALLEL_ID:[0-f]+]], task_id=[[INITIAL_TASK_ID:[0-f]+]], actual_parallelism=1, index=1, flags=1
44
45
// region 0
46
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin
47
// CHECK-SAME: parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[INITIAL_TASK_FRAME_ENTER:(0x)?[0-f]+]],
48
// CHECK-SAME: parallel_id=[[PARALLEL_ID_0:[0-9]+]]
49
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_0]], task_id=[[TASK_ID_0:[0-9]+]]
50
51
// explicit task
52
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[TASK_ID_0]]
53
// CHECK-SAME: parent_task_frame.exit=[[REGION_0_FRAME_EXIT:(0x)?[0-f]+]]
54
// CHECK-SAME: parent_task_frame.reenter=[[REGION_0_FRAME_ENTER:(0x)?[0-f]+]]
55
// CHECK-SAME: new_task_id=[[TASK_ID_1:[0-9]+]]
56
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[TASK_ID_0]], second_task_id=[[TASK_ID_1]]
57
58
// region 1
59
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin
60
// CHECK-SAME: parent_task_frame.exit=[[EXPLICIT_TASK_FRAME_EXIT:(0x)?[0-f]+]], parent_task_frame.reenter=[[EXPLICIT_TASK_FRAME_ENTER:(0x)?[0-f]+]],
61
// CHECK-SAME: parallel_id=[[PARALLEL_ID_1:[0-9]+]]
62
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_2:[0-9]+]]
63
64
// region 1's implicit task information (exit frame should be set, while enter should be NULL)
65
// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID_1]], task_id=[[TASK_ID_2]]
66
// CHECK-SAME: exit_frame={{(0x)?[0-f]+}}
67
// CHECK-SAME: reenter_frame=[[NULL]]
68
// CHECK-SAME: task_type=ompt_task_implicit
69
70
// explicit task information (both exit and enter frames should be set)
71
// CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[PARALLEL_ID_0]], task_id=[[TASK_ID_1]]
72
// CHECK-SAME: exit_frame=[[EXPLICIT_TASK_FRAME_EXIT]]
73
// CHECK-SAME: reenter_frame=[[EXPLICIT_TASK_FRAME_ENTER]]
74
// CHECK-SAME: task_type=ompt_task_explicit
75
76
// region 0's implicit task information (both exit and enter frames should be set)
77
// CHECK: {{^}}[[MASTER_ID]]: task level 2: parallel_id=[[PARALLEL_ID_0]], task_id=[[TASK_ID_0]]
78
// CHECK-SAME: exit_frame=[[REGION_0_FRAME_EXIT]]
79
// CHECK-SAME: reenter_frame=[[REGION_0_FRAME_ENTER]]
80
// CHECK-SAME: task_type=ompt_task_implicit
81
82
// region 0's initial task information (both exit and enter frames should be set)
83
// CHECK: {{^}}[[MASTER_ID]]: task level 3: parallel_id=[[INITIAL_PARALLEL_ID]], task_id=[[INITIAL_TASK_ID]]
84
// CHECK-SAME: exit_frame=[[NULL]]
85
// CHECK-SAME: reenter_frame=[[INITIAL_TASK_FRAME_ENTER]]
86
// CHECK-SAME: task_type=ompt_task_initial
87
// clang-format on
88
89
return
0;
90
}
callback.h
print_ids
static void print_ids(int level)
Definition
callback.h:187
main
int main()
Definition
region_in_expl_task_task_frames.c:9
Generated on
for LLVM OpenMP by
1.14.0