1// RUN: %libomp-tool -DFIRST_TOOL -o %t.first.tool.so %s && \
2// RUN: %libomp-tool -DSECOND_TOOL -o %t.second.tool.so %s && \
3// RUN: %libomp-compile && \
4// RUN: env OMP_TOOL_LIBRARIES=%t.first.tool.so \
5// RUN: CUSTOM_DATA_STORAGE_TOOL_LIBRARIES=%t.second.tool.so \
6// RUN: %libomp-run | %sort-threads | FileCheck %s
7
8// For GCC we don't get an event for master,
9// see runtime/test/ompt/sycnchronization/master.c
10// UNSUPPORTED: gcc
11
12#if defined(FIRST_TOOL)
13#include "first-tool.h"
14#elif defined(SECOND_TOOL)
15#include "second-tool.h"
16#else /* APP */
17
18#include "../ompt-signal.h"
19#include "omp.h"
20#include <stdio.h>
21
22int main() {
23 int x, s = 0;
24#pragma omp parallel num_threads(2) shared(s)
25 {
26#pragma omp master
27 {
28#pragma omp task shared(s)
29 {
30 omp_control_tool(5, 1, NULL);
31 OMPT_SIGNAL(s);
32 }
33 }
34 if (omp_get_thread_num() == 1)
35 OMPT_WAIT(s, 1);
36 }
37 return 0;
38}
39// Check if libomp supports the callbacks for this test.
40// CHECK-NOT: {{^}}0: Could not register callback
41
42// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
43// CHECK: {{^}}0: NULL_POINTER=[[NULL]]
44// CHECK: {{^}}0: ompt_event_runtime_shutdown
45// CHECK: {{^}}0: ompt_event_runtime_shutdown
46
47// CHECK: {{^}}[[_1ST_MSTR_TID:[0-9]+]]: _first_tool: ompt_event_thread_begin:
48// CHECK-SAME: thread_type=ompt_thread_initial=1,
49// CHECK-SAME: thread_id=[[_1ST_MSTR_TID]]
50
51// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_initial_task_begin:
52// CHECK-SAME: parallel_id=[[_FIRST_INIT_PARALLEL_ID:[0-9]+]],
53// CHECK-SAME: task_id=[[_FIRST_INITIAL_TASK_ID:[0-9]+]], actual_parallelism=1,
54
55// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_parallel_begin:
56// CHECK-SAME: parent_task_id=[[_FIRST_INITIAL_TASK_ID]],
57// CHECK-SAME: parent_task_frame.exit=(nil),
58// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
59// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID:[0-9]+]], requested_team_size=2,
60// CHECK-SAME: codeptr_ra={{0x[0-f]+}}, invoker
61
62// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_implicit_task_begin:
63// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
64// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID:[0-9]+]], team_size=2,
65// CHECK-SAME: thread_num=0
66
67// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_masked_begin:
68// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
69// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
70// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
71
72// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_task_create:
73// CHECK-SAME: parent_task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
74// CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}},
75// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
76// CHECK-SAME: new_task_id=[[_FIRST_EXPLICIT_TASK_ID:[0-9]+]],
77// CHECK-SAME: codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4,
78// CHECK-SAME: has_dependences=no
79
80// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_masked_end:
81// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
82// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
83// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
84
85// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_barrier_begin:
86// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
87// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
88// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
89
90// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_wait_barrier_begin:
91// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
92// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
93// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
94
95// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_task_schedule:
96// CHECK-SAME: first_task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
97// CHECK-SAME: second_task_id=[[_FIRST_EXPLICIT_TASK_ID]],
98// CHECK-SAME: prior_task_status=ompt_task_switch=7
99
100// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_control_tool:
101// CHECK-SAME: command=5, modifier=1, arg=(nil),
102// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
103
104// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: task level 0:
105// CHECK-SAME: task_id=[[_FIRST_EXPLICIT_TASK_ID]]
106
107// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: task level 1:
108// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]]
109
110// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: task level 2:
111// CHECK-SAME: task_id=[[_FIRST_INITIAL_TASK_ID]]
112
113// CHECK: {{^}}[[_1ST_MSTR_TID]]:
114// CHECK-SAME: _first_tool: parallel level 0: parallel_id=[[_FIRST_PARALLEL_ID]]
115
116// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: parallel level 1:
117// CHECK-SAME: parallel_id={{[0-9]+}}
118
119// CHECK: {{^}}[[_1ST_MSTR_TID]]:
120// CHECK-SAME: _first_tool: ompt_event_task_schedule:
121// CHECK-SAME: first_task_id=[[_FIRST_EXPLICIT_TASK_ID]],
122// CHECK-SAME: second_task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
123// CHECK-SAME: prior_task_status=ompt_task_complete=1
124
125// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_task_end:
126// CHECK-SAME: task_id=[[_FIRST_EXPLICIT_TASK_ID]]
127
128// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_wait_barrier_end:
129// CHECK-SAME: parallel_id=0,
130// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
131
132// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_barrier_end:
133// CHECK-SAME: parallel_id=0,
134// CHECK-SAME: task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
135
136// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_implicit_task_end:
137// CHECK-SAME: parallel_id=0, task_id=[[_FIRST_MASTER_IMPLICIT_TASK_ID]],
138// CHECK-SAME: team_size=2, thread_num=0
139
140// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_parallel_end:
141// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
142// CHECK-SAME: task_id=[[_FIRST_INITIAL_TASK_ID]], invoker
143// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
144
145// CHECK: {{^}}[[_1ST_MSTR_TID]]: _first_tool: ompt_event_thread_end:
146// CHECK-SAME: thread_id=[[_1ST_MSTR_TID]]
147
148// CHECK: {{^}}[[_2ND_MSTR_TID:[0-9]+]]: second_tool: ompt_event_thread_begin:
149// CHECK-SAME: thread_type=ompt_thread_initial=1,
150// CHECK-SAME: thread_id=[[_2ND_MSTR_TID]]
151
152// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_initial_task_begin:
153// CHECK-SAME: parallel_id=[[SECOND_INIT_PARALLEL_ID:[0-9]+]],
154// CHECK-SAME: task_id=[[SECOND_INITIAL_TASK_ID:[0-9]+]], actual_parallelism=1,
155// CHECK-SAME: index=1, flags=1
156
157// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_parallel_begin:
158// CHECK-SAME: parent_task_id=[[SECOND_INITIAL_TASK_ID]],
159// CHECK-SAME: parent_task_frame.exit=(nil),
160// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
161// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID:[0-9]+]], requested_team_size=2,
162// CHECK-SAME: codeptr_ra={{0x[0-f]+}}, invoker
163
164// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_implicit_task_begin:
165// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
166// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID:[0-9]+]], team_size=2,
167// CHECK-SAME: thread_num=0
168
169// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_masked_begin:
170// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
171// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
172// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
173
174// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_task_create:
175// CHECK-SAME: parent_task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
176// CHECK-SAME: parent_task_frame.exit={{0x[0-f]+}},
177// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
178// CHECK-SAME: new_task_id=[[SECOND_EXPLICIT_TASK_ID:[0-9]+]],
179// CHECK-SAME: codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4,
180// CHECK-SAME: has_dependences=no
181
182// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_masked_end:
183// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
184// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
185// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
186
187// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_barrier_begin:
188// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
189// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
190// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
191
192// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_wait_barrier_begin:
193// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
194// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
195// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
196
197// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_task_schedule:
198// CHECK-SAME: first_task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
199// CHECK-SAME: second_task_id=[[SECOND_EXPLICIT_TASK_ID]],
200// CHECK-SAME: prior_task_status=ompt_task_switch=7
201
202// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_control_tool:
203// CHECK-SAME: command=5, modifier=1, arg=(nil),
204// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
205
206// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: task level 0:
207// CHECK-SAME: task_id=[[SECOND_EXPLICIT_TASK_ID]]
208
209// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: task level 1:
210// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]]
211
212// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: task level 2:
213// CHECK-SAME: task_id=[[SECOND_INITIAL_TASK_ID]]
214
215// CHECK: {{^}}[[_2ND_MSTR_TID]]:
216// CHECK-SAME: second_tool: parallel level 0: parallel_id=[[SECOND_PARALLEL_ID]]
217
218// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: parallel level 1:
219// CHECK-SAME: parallel_id={{[0-9]+}}
220
221// CHECK: {{^}}[[_2ND_MSTR_TID]]:
222// CHECK-SAME: second_tool: ompt_event_task_schedule:
223// CHECK-SAME: first_task_id=[[SECOND_EXPLICIT_TASK_ID]],
224// CHECK-SAME: second_task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]],
225// CHECK-SAME: prior_task_status=ompt_task_complete=1
226
227// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_task_end:
228// CHECK-SAME: task_id=[[SECOND_EXPLICIT_TASK_ID]]
229
230// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_wait_barrier_end:
231// CHECK-SAME: parallel_id=0,
232// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
233
234// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_barrier_end:
235// CHECK-SAME: parallel_id=0,
236// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
237
238// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_implicit_task_end:
239// CHECK-SAME: parallel_id=0,
240// CHECK-SAME: task_id=[[SECOND_MASTER_IMPLICIT_TASK_ID]], team_size=2,
241// CHECK-SAME: thread_num=0
242
243// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_parallel_end:
244// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
245// CHECK-SAME: task_id=[[SECOND_INITIAL_TASK_ID]], invoker
246// CHECK-SAME: codeptr_ra={{0x[0-f]+}}
247
248// CHECK: {{^}}[[_2ND_MSTR_TID]]: second_tool: ompt_event_thread_end:
249// CHECK-SAME: thread_id=[[_2ND_MSTR_TID]]
250
251// CHECK: {{^}}[[_1ST_WRKR_TID:[0-9]+]]: _first_tool: ompt_event_thread_begin:
252// CHECK-SAME: thread_type=ompt_thread_worker=2,
253// CHECK-SAME: thread_id=[[_1ST_WRKR_TID]]
254
255// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_implicit_task_begin:
256// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
257// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID:[0-9]+]], team_size=2,
258// CHECK-SAME: thread_num=1
259
260// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_begin:
261// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
262// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
263
264// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_begin:
265// CHECK-SAME: parallel_id=[[_FIRST_PARALLEL_ID]],
266// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
267
268// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_wait_barrier_end:
269// CHECK-SAME: parallel_id=0,
270// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
271
272// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_barrier_end:
273// CHECK-SAME: parallel_id=0,
274// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
275
276// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_implicit_task_end:
277// CHECK-SAME: parallel_id=0,
278// CHECK-SAME: task_id=[[_FIRST_WORKER_IMPLICIT_TASK_ID]], team_size=0,
279// thread_num=1
280
281// CHECK: {{^}}[[_1ST_WRKR_TID]]: _first_tool: ompt_event_thread_end:
282// CHECK-SAME: thread_id=[[_1ST_WRKR_TID]]
283
284// CHECK: {{^}}[[_2ND_WRKR_TID:[0-9]+]]: second_tool: ompt_event_thread_begin:
285// CHECK-SAME: thread_type=ompt_thread_worker=2,
286// CHECK-SAME: thread_id=[[_2ND_WRKR_TID]]
287
288// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_implicit_task_begin:
289// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
290// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID:[0-9]+]], team_size=2,
291// CHECK-SAME: thread_num=1
292
293// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_begin:
294// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
295// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
296
297// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_begin:
298// CHECK-SAME: parallel_id=[[SECOND_PARALLEL_ID]],
299// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
300
301// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_wait_barrier_end:
302// CHECK-SAME: parallel_id=0,
303// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
304
305// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_barrier_end:
306// CHECK-SAME: parallel_id=0,
307// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], codeptr_ra=(nil)
308
309// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_implicit_task_end:
310// CHECK-SAME: parallel_id=0,
311// CHECK-SAME: task_id=[[SECOND_WORKER_IMPLICIT_TASK_ID]], team_size=0,
312// CHECK-SAME: thread_num=1
313
314// CHECK: {{^}}[[_2ND_WRKR_TID]]: second_tool: ompt_event_thread_end:
315// CHECK-SAME: thread_id=[[_2ND_WRKR_TID]]
316
317#endif /* APP */
318

source code of openmp/tools/multiplex/tests/custom_data_storage/custom_data_storage.c