LLVM OpenMP
22.0.0git
runtime
test
ompt
tasks
task_in_joinbarrier.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
#define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN
6
#include "
callback.h
"
7
#include <omp.h>
8
9
int
main
() {
10
int
condition
= 0;
11
omp_set_nested
(0);
12
print_frame
(0);
13
#pragma omp parallel num_threads(2)
14
{
15
print_frame_from_outlined_fn(1);
16
print_ids
(0);
17
print_ids
(1);
18
print_frame
(0);
19
#pragma omp master
20
{
21
print_ids
(0);
22
#pragma omp task shared(condition)
23
{
24
OMPT_SIGNAL
(
condition
);
25
print_frame
(1);
26
print_ids
(0);
27
print_ids
(1);
28
print_ids
(2);
29
}
30
OMPT_WAIT
(
condition
, 1);
31
print_ids
(0);
32
}
33
print_ids
(0);
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_task_schedule'
40
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
41
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
42
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
43
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
44
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
45
// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
46
47
48
// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
49
50
// make sure initial data pointers are null
51
// CHECK-NOT: 0: new_task_data initially not null
52
53
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address(0)=[[MAIN_REENTER:(0x)?[0-f]+]]
54
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-f]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{(0x)?[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-f]+]], requested_team_size=2, codeptr_ra={{(0x)?[0-f]+}}, invoker=[[PARALLEL_INVOKER:[0-9]+]]
55
// nested parallel masters
56
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-f]+]]
57
// CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address({{.}})=[[EXIT:(0x)?[0-f]+]]
58
// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
59
// CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-f]+]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame={{(0x)?[0-f]+}}
60
// CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:(0x)?[0-f]+]]
61
// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
62
// <- ompt_event_task_create would be expected here
63
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter={{(0x)?[0-f]+}}, new_task_id=[[TASK_ID:[0-f]+]], codeptr_ra=[[TASK_FUNCTION:(0x)?[0-f]+]]
64
// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
65
// implicit barrier parallel
66
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_implicit_parallel_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
67
// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
68
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_implicit_parallel_end: parallel_id={{[0-f]+}}, task_id=[[IMPLICIT_TASK_ID]]
69
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-f]+}}, task_id=[[IMPLICIT_TASK_ID]]
70
71
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-f]+]]
72
// CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address({{.}})=[[EXIT:(0x)?[0-f]+]]
73
// CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]]
74
// CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame={{(0x)?[0-f]+}}
75
// CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(0)=[[REENTER:(0x)?[0-f]+]]
76
// implicit barrier parallel
77
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_implicit_parallel_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
78
// CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
79
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[TASK_ID]]
80
// CHECK: {{^}}[[THREAD_ID]]: __builtin_frame_address(1)=[[TASK_EXIT:(0x)?[0-f]+]]
81
// CHECK: {{^}}[[THREAD_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], exit_frame=[[TASK_EXIT]], reenter_frame=[[NULL]]
82
// CHECK: {{^}}[[THREAD_ID]]: task level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
83
// CHECK: {{^}}[[THREAD_ID]]: task level 2: parallel_id=[[IMPLICIT_PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame={{(0x)?[0-f]+}}
84
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[TASK_ID]], second_task_id=[[IMPLICIT_TASK_ID]]
85
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_end: task_id=[[TASK_ID]]
86
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_implicit_parallel_end: parallel_id={{[0-f]+}}, task_id=[[IMPLICIT_TASK_ID]]
87
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-f]+}}, task_id=[[IMPLICIT_TASK_ID]]
88
// clang-format on
89
90
return
0;
91
}
callback.h
print_frame
#define print_frame(level)
Definition
callback.h:210
print_ids
static void print_ids(int level)
Definition
callback.h:187
condition
int condition
Definition
interoperability.cpp:17
omp_set_nested
#define omp_set_nested
Definition
kmp_stub.cpp:36
OMPT_WAIT
#define OMPT_WAIT(s, v)
Definition
ompt-signal.h:20
OMPT_SIGNAL
#define OMPT_SIGNAL(s)
Definition
ompt-signal.h:13
main
int main()
Definition
task_in_joinbarrier.c:9
Generated on
for LLVM OpenMP by
1.14.0