blob: ba1b90d358de649193e8ee75f06031beff3b909c [file] [log] [blame]
Jim Cownie5e8470a2013-09-27 10:38:44 +00001/*
2 * kmp_gsupport.c
Jim Cownie5e8470a2013-09-27 10:38:44 +00003 */
4
5
6//===----------------------------------------------------------------------===//
7//
8// The LLVM Compiler Infrastructure
9//
10// This file is dual licensed under the MIT and the University of Illinois Open
11// Source Licenses. See LICENSE.txt for details.
12//
13//===----------------------------------------------------------------------===//
14
15
Jim Cownie5e8470a2013-09-27 10:38:44 +000016#include "kmp.h"
17#include "kmp_atomic.h"
18
Andrey Churbanovd7d088f2015-04-29 16:42:24 +000019#if OMPT_SUPPORT
20#include "ompt-specific.h"
21#endif
22
Jim Cownie5e8470a2013-09-27 10:38:44 +000023#ifdef __cplusplus
24 extern "C" {
25#endif // __cplusplus
26
27#define MKLOC(loc,routine) \
28 static ident_t (loc) = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;" };
29
Jim Cownie181b4bb2013-12-23 17:28:57 +000030#include "kmp_ftn_os.h"
Jim Cownie5e8470a2013-09-27 10:38:44 +000031
32void
Jim Cownie181b4bb2013-12-23 17:28:57 +000033xexpand(KMP_API_NAME_GOMP_BARRIER)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +000034{
35 int gtid = __kmp_entry_gtid();
36 MKLOC(loc, "GOMP_barrier");
37 KA_TRACE(20, ("GOMP_barrier: T#%d\n", gtid));
38 __kmpc_barrier(&loc, gtid);
39}
40
41
Jim Cownie5e8470a2013-09-27 10:38:44 +000042//
43// Mutual exclusion
44//
45
46//
47// The symbol that icc/ifort generates for unnamed for unnamed critical
48// sections - .gomp_critical_user_ - is defined using .comm in any objects
49// reference it. We can't reference it directly here in C code, as the
50// symbol contains a ".".
51//
52// The RTL contains an assembly language definition of .gomp_critical_user_
53// with another symbol __kmp_unnamed_critical_addr initialized with it's
54// address.
55//
56extern kmp_critical_name *__kmp_unnamed_critical_addr;
57
58
59void
Jim Cownie181b4bb2013-12-23 17:28:57 +000060xexpand(KMP_API_NAME_GOMP_CRITICAL_START)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +000061{
62 int gtid = __kmp_entry_gtid();
63 MKLOC(loc, "GOMP_critical_start");
64 KA_TRACE(20, ("GOMP_critical_start: T#%d\n", gtid));
65 __kmpc_critical(&loc, gtid, __kmp_unnamed_critical_addr);
66}
67
68
69void
Jim Cownie181b4bb2013-12-23 17:28:57 +000070xexpand(KMP_API_NAME_GOMP_CRITICAL_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +000071{
72 int gtid = __kmp_get_gtid();
73 MKLOC(loc, "GOMP_critical_end");
74 KA_TRACE(20, ("GOMP_critical_end: T#%d\n", gtid));
75 __kmpc_end_critical(&loc, gtid, __kmp_unnamed_critical_addr);
76}
77
78
79void
Jim Cownie181b4bb2013-12-23 17:28:57 +000080xexpand(KMP_API_NAME_GOMP_CRITICAL_NAME_START)(void **pptr)
Jim Cownie5e8470a2013-09-27 10:38:44 +000081{
82 int gtid = __kmp_entry_gtid();
83 MKLOC(loc, "GOMP_critical_name_start");
84 KA_TRACE(20, ("GOMP_critical_name_start: T#%d\n", gtid));
85 __kmpc_critical(&loc, gtid, (kmp_critical_name *)pptr);
86}
87
88
89void
Jim Cownie181b4bb2013-12-23 17:28:57 +000090xexpand(KMP_API_NAME_GOMP_CRITICAL_NAME_END)(void **pptr)
Jim Cownie5e8470a2013-09-27 10:38:44 +000091{
92 int gtid = __kmp_get_gtid();
93 MKLOC(loc, "GOMP_critical_name_end");
94 KA_TRACE(20, ("GOMP_critical_name_end: T#%d\n", gtid));
95 __kmpc_end_critical(&loc, gtid, (kmp_critical_name *)pptr);
96}
97
98
99//
100// The Gnu codegen tries to use locked operations to perform atomic updates
101// inline. If it can't, then it calls GOMP_atomic_start() before performing
102// the update and GOMP_atomic_end() afterward, regardless of the data type.
103//
104
105void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000106xexpand(KMP_API_NAME_GOMP_ATOMIC_START)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000107{
108 int gtid = __kmp_entry_gtid();
109 KA_TRACE(20, ("GOMP_atomic_start: T#%d\n", gtid));
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000110
111#if OMPT_SUPPORT
112 __ompt_thread_assign_wait_id(0);
113#endif
114
Jim Cownie5e8470a2013-09-27 10:38:44 +0000115 __kmp_acquire_atomic_lock(&__kmp_atomic_lock, gtid);
116}
117
118
119void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000120xexpand(KMP_API_NAME_GOMP_ATOMIC_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000121{
122 int gtid = __kmp_get_gtid();
123 KA_TRACE(20, ("GOMP_atomic_start: T#%d\n", gtid));
124 __kmp_release_atomic_lock(&__kmp_atomic_lock, gtid);
125}
126
127
128int
Jim Cownie181b4bb2013-12-23 17:28:57 +0000129xexpand(KMP_API_NAME_GOMP_SINGLE_START)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000130{
131 int gtid = __kmp_entry_gtid();
132 MKLOC(loc, "GOMP_single_start");
133 KA_TRACE(20, ("GOMP_single_start: T#%d\n", gtid));
134
135 if (! TCR_4(__kmp_init_parallel))
136 __kmp_parallel_initialize();
137
138 //
139 // 3rd parameter == FALSE prevents kmp_enter_single from pushing a
140 // workshare when USE_CHECKS is defined. We need to avoid the push,
141 // as there is no corresponding GOMP_single_end() call.
142 //
143 return __kmp_enter_single(gtid, &loc, FALSE);
144}
145
146
147void *
Jim Cownie181b4bb2013-12-23 17:28:57 +0000148xexpand(KMP_API_NAME_GOMP_SINGLE_COPY_START)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000149{
150 void *retval;
151 int gtid = __kmp_entry_gtid();
152 MKLOC(loc, "GOMP_single_copy_start");
153 KA_TRACE(20, ("GOMP_single_copy_start: T#%d\n", gtid));
154
155 if (! TCR_4(__kmp_init_parallel))
156 __kmp_parallel_initialize();
157
158 //
159 // If this is the first thread to enter, return NULL. The generated
160 // code will then call GOMP_single_copy_end() for this thread only,
161 // with the copyprivate data pointer as an argument.
162 //
163 if (__kmp_enter_single(gtid, &loc, FALSE))
164 return NULL;
165
166 //
167 // Wait for the first thread to set the copyprivate data pointer,
168 // and for all other threads to reach this point.
169 //
170 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
171
172 //
173 // Retrieve the value of the copyprivate data point, and wait for all
174 // threads to do likewise, then return.
175 //
176 retval = __kmp_team_from_gtid(gtid)->t.t_copypriv_data;
177 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
178 return retval;
179}
180
181
182void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000183xexpand(KMP_API_NAME_GOMP_SINGLE_COPY_END)(void *data)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000184{
185 int gtid = __kmp_get_gtid();
Jim Cownie5e8470a2013-09-27 10:38:44 +0000186 KA_TRACE(20, ("GOMP_single_copy_end: T#%d\n", gtid));
187
188 //
189 // Set the copyprivate data pointer fo the team, then hit the barrier
190 // so that the other threads will continue on and read it. Hit another
191 // barrier before continuing, so that the know that the copyprivate
192 // data pointer has been propagated to all threads before trying to
193 // reuse the t_copypriv_data field.
194 //
195 __kmp_team_from_gtid(gtid)->t.t_copypriv_data = data;
196 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
197 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
198}
199
200
201void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000202xexpand(KMP_API_NAME_GOMP_ORDERED_START)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000203{
204 int gtid = __kmp_entry_gtid();
205 MKLOC(loc, "GOMP_ordered_start");
206 KA_TRACE(20, ("GOMP_ordered_start: T#%d\n", gtid));
207 __kmpc_ordered(&loc, gtid);
208}
209
210
211void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000212xexpand(KMP_API_NAME_GOMP_ORDERED_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000213{
214 int gtid = __kmp_get_gtid();
215 MKLOC(loc, "GOMP_ordered_end");
216 KA_TRACE(20, ("GOMP_ordered_start: T#%d\n", gtid));
217 __kmpc_end_ordered(&loc, gtid);
218}
219
220
Jim Cownie5e8470a2013-09-27 10:38:44 +0000221//
222// Dispatch macro defs
223//
224// They come in two flavors: 64-bit unsigned, and either 32-bit signed
225// (IA-32 architecture) or 64-bit signed (Intel(R) 64).
226//
227
Jim Cownie181b4bb2013-12-23 17:28:57 +0000228#if KMP_ARCH_X86 || KMP_ARCH_ARM
Jim Cownie5e8470a2013-09-27 10:38:44 +0000229# define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_4
230# define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_4
231# define KMP_DISPATCH_NEXT __kmpc_dispatch_next_4
232#else
233# define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_8
234# define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_8
235# define KMP_DISPATCH_NEXT __kmpc_dispatch_next_8
236#endif /* KMP_ARCH_X86 */
237
238# define KMP_DISPATCH_INIT_ULL __kmp_aux_dispatch_init_8u
239# define KMP_DISPATCH_FINI_CHUNK_ULL __kmp_aux_dispatch_fini_chunk_8u
240# define KMP_DISPATCH_NEXT_ULL __kmpc_dispatch_next_8u
241
242
Jim Cownie5e8470a2013-09-27 10:38:44 +0000243//
244// The parallel contruct
245//
246
Jim Cownie4cc4bb42014-10-07 16:25:50 +0000247#ifndef KMP_DEBUG
Jim Cownie5e8470a2013-09-27 10:38:44 +0000248static
249#endif /* KMP_DEBUG */
250void
251__kmp_GOMP_microtask_wrapper(int *gtid, int *npr, void (*task)(void *),
252 void *data)
253{
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000254#if OMPT_SUPPORT
255 kmp_info_t *thr;
256 ompt_frame_t *ompt_frame;
257 ompt_state_t enclosing_state;
258
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000259 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000260 // get pointer to thread data structure
261 thr = __kmp_threads[*gtid];
262
263 // save enclosing task state; set current state for task
264 enclosing_state = thr->th.ompt_thread_info.state;
265 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
266
267 // set task frame
268 ompt_frame = __ompt_get_task_frame_internal(0);
269 ompt_frame->exit_runtime_frame = __builtin_frame_address(0);
270 }
271#endif
272
Jim Cownie5e8470a2013-09-27 10:38:44 +0000273 task(data);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000274
275#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000276 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000277 // clear task frame
278 ompt_frame->exit_runtime_frame = NULL;
279
280 // restore enclosing state
281 thr->th.ompt_thread_info.state = enclosing_state;
282 }
283#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000284}
285
286
Jim Cownie4cc4bb42014-10-07 16:25:50 +0000287#ifndef KMP_DEBUG
Jim Cownie5e8470a2013-09-27 10:38:44 +0000288static
289#endif /* KMP_DEBUG */
290void
291__kmp_GOMP_parallel_microtask_wrapper(int *gtid, int *npr,
292 void (*task)(void *), void *data, unsigned num_threads, ident_t *loc,
293 enum sched_type schedule, long start, long end, long incr, long chunk_size)
294{
295 //
296 // Intialize the loop worksharing construct.
297 //
298 KMP_DISPATCH_INIT(loc, *gtid, schedule, start, end, incr, chunk_size,
299 schedule != kmp_sch_static);
300
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000301#if OMPT_SUPPORT
302 kmp_info_t *thr;
303 ompt_frame_t *ompt_frame;
304 ompt_state_t enclosing_state;
305
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000306 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000307 thr = __kmp_threads[*gtid];
308 // save enclosing task state; set current state for task
309 enclosing_state = thr->th.ompt_thread_info.state;
310 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
311
312 // set task frame
313 ompt_frame = __ompt_get_task_frame_internal(0);
314 ompt_frame->exit_runtime_frame = __builtin_frame_address(0);
315 }
316#endif
317
Jim Cownie5e8470a2013-09-27 10:38:44 +0000318 //
319 // Now invoke the microtask.
320 //
321 task(data);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000322
323#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000324 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000325 // clear task frame
326 ompt_frame->exit_runtime_frame = NULL;
327
328 // reset enclosing state
329 thr->th.ompt_thread_info.state = enclosing_state;
330 }
331#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000332}
333
334
Jim Cownie4cc4bb42014-10-07 16:25:50 +0000335#ifndef KMP_DEBUG
Jim Cownie5e8470a2013-09-27 10:38:44 +0000336static
337#endif /* KMP_DEBUG */
338void
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000339__kmp_GOMP_fork_call(ident_t *loc, int gtid, void (*unwrapped_task)(void *), microtask_t wrapper, int argc,...)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000340{
341 int rc;
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000342 kmp_info_t *thr = __kmp_threads[gtid];
343 kmp_team_t *team = thr->th.th_team;
344 int tid = __kmp_tid_from_gtid(gtid);
Jim Cownie5e8470a2013-09-27 10:38:44 +0000345
346 va_list ap;
347 va_start(ap, argc);
348
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000349 rc = __kmp_fork_call(loc, gtid, fork_context_gnu, argc,
350#if OMPT_SUPPORT
351 VOLATILE_CAST(void *) unwrapped_task,
352#endif
353 wrapper, __kmp_invoke_task_func,
Andrey Churbanovcbda8682015-01-13 14:43:35 +0000354#if (KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && KMP_OS_LINUX
Jim Cownie5e8470a2013-09-27 10:38:44 +0000355 &ap
356#else
357 ap
358#endif
359 );
360
361 va_end(ap);
362
363 if (rc) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000364 __kmp_run_before_invoked_task(gtid, tid, thr, team);
Jim Cownie5e8470a2013-09-27 10:38:44 +0000365 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000366
Jonathan Peyton61118492016-05-20 19:03:38 +0000367#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000368 if (ompt_enabled) {
Jonathan Peyton122dd762015-07-13 18:55:45 +0000369#if OMPT_TRACE
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000370 ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
371 ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
372
373 // implicit task callback
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000374 if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000375 ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
376 team_info->parallel_id, task_info->task_id);
377 }
Jonathan Peyton122dd762015-07-13 18:55:45 +0000378#endif
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000379 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
380 }
381#endif
382}
383
384static void
385__kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *))
386{
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000387#if OMPT_SUPPORT
Jonas Hahnfeld6c250b72016-03-21 12:37:52 +0000388 ompt_parallel_id_t ompt_parallel_id;
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000389 if (ompt_enabled) {
Jonas Hahnfeld6c250b72016-03-21 12:37:52 +0000390 ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
391 task_info->frame.exit_runtime_frame = NULL;
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000392
Jonas Hahnfeld6c250b72016-03-21 12:37:52 +0000393 ompt_parallel_id = __ompt_parallel_id_new(gtid);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000394
395 // parallel region callback
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000396 if (ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000397 int team_size = 1;
398 ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
Jonas Hahnfeld6c250b72016-03-21 12:37:52 +0000399 task_info->task_id, &task_info->frame, ompt_parallel_id,
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000400 team_size, (void *) task,
401 OMPT_INVOKER(fork_context_gnu));
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000402 }
Jonas Hahnfeld6c250b72016-03-21 12:37:52 +0000403 }
404#endif
405
406 __kmp_serialized_parallel(loc, gtid);
407
408#if OMPT_SUPPORT
409 if (ompt_enabled) {
410 kmp_info_t *thr = __kmp_threads[gtid];
411
412 ompt_task_id_t my_ompt_task_id = __ompt_task_id_new(gtid);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000413
414 // set up lightweight task
415 ompt_lw_taskteam_t *lwt = (ompt_lw_taskteam_t *)
416 __kmp_allocate(sizeof(ompt_lw_taskteam_t));
417 __ompt_lw_taskteam_init(lwt, thr, gtid, (void *) task, ompt_parallel_id);
418 lwt->ompt_task_info.task_id = my_ompt_task_id;
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000419 lwt->ompt_task_info.frame.exit_runtime_frame = NULL;
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000420 __ompt_lw_taskteam_link(lwt, thr);
421
422#if OMPT_TRACE
423 // implicit task callback
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000424 if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000425 ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
426 ompt_parallel_id, my_ompt_task_id);
427 }
428 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
429#endif
430 }
431#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000432}
433
434
435void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000436xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsigned num_threads)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000437{
438 int gtid = __kmp_entry_gtid();
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000439
440#if OMPT_SUPPORT
441 ompt_frame_t *parent_frame;
442
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000443 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000444 parent_frame = __ompt_get_task_frame_internal(0);
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000445 parent_frame->reenter_runtime_frame = __builtin_frame_address(1);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000446 }
447#endif
448
Jim Cownie5e8470a2013-09-27 10:38:44 +0000449 MKLOC(loc, "GOMP_parallel_start");
450 KA_TRACE(20, ("GOMP_parallel_start: T#%d\n", gtid));
451
452 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
453 if (num_threads != 0) {
454 __kmp_push_num_threads(&loc, gtid, num_threads);
455 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000456 __kmp_GOMP_fork_call(&loc, gtid, task,
Jim Cownie5e8470a2013-09-27 10:38:44 +0000457 (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
458 }
459 else {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000460 __kmp_GOMP_serialized_parallel(&loc, gtid, task);
Jim Cownie5e8470a2013-09-27 10:38:44 +0000461 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000462
463#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000464 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000465 parent_frame->reenter_runtime_frame = NULL;
466 }
467#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000468}
469
470
471void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000472xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000473{
474 int gtid = __kmp_get_gtid();
Jonathan Peytone8104ad2015-06-08 18:56:33 +0000475 kmp_info_t *thr;
476
477 thr = __kmp_threads[gtid];
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000478
Jim Cownie5e8470a2013-09-27 10:38:44 +0000479 MKLOC(loc, "GOMP_parallel_end");
480 KA_TRACE(20, ("GOMP_parallel_end: T#%d\n", gtid));
481
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000482
483#if OMPT_SUPPORT
484 ompt_parallel_id_t parallel_id;
Jonas Hahnfeld1c1c7172016-03-24 12:52:04 +0000485 ompt_task_id_t serialized_task_id;
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000486 ompt_frame_t *ompt_frame = NULL;
487
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000488 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000489 ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
490 parallel_id = team_info->parallel_id;
491
Jonas Hahnfeld1c1c7172016-03-24 12:52:04 +0000492 ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
493 serialized_task_id = task_info->task_id;
494
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000495 // Record that we re-entered the runtime system in the implicit
Jonathan Peyton61118492016-05-20 19:03:38 +0000496 // task frame representing the parallel region.
Jonas Hahnfeld1c1c7172016-03-24 12:52:04 +0000497 ompt_frame = &task_info->frame;
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000498 ompt_frame->reenter_runtime_frame = __builtin_frame_address(1);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000499
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000500 // unlink if necessary. no-op if there is not a lightweight task.
501 ompt_lw_taskteam_t *lwt = __ompt_lw_taskteam_unlink(thr);
502 // GOMP allocates/frees lwt since it can't be kept on the stack
Jonathan Peyton61118492016-05-20 19:03:38 +0000503 if (lwt) {
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000504 __kmp_free(lwt);
Jonathan Peyton61118492016-05-20 19:03:38 +0000505
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000506#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000507 if (ompt_enabled) {
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000508 // Since a lightweight task was destroyed, make sure that the
Jonathan Peyton61118492016-05-20 19:03:38 +0000509 // remaining deepest task knows the stack frame where the runtime
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000510 // was reentered.
511 ompt_frame = __ompt_get_task_frame_internal(0);
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000512 ompt_frame->reenter_runtime_frame = __builtin_frame_address(1);
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000513 }
514#endif
515 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000516 }
517#endif
518
Jonathan Peyton57d19ce2015-08-26 19:55:13 +0000519 if (! thr->th.th_team->t.t_serialized) {
Jim Cownie5e8470a2013-09-27 10:38:44 +0000520 __kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
521 thr->th.th_team);
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000522
523#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000524 if (ompt_enabled) {
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000525 // Set reenter frame in parent task, which will become current task
526 // in the midst of join. This is needed before the end_parallel callback.
527 ompt_frame = __ompt_get_task_frame_internal(1);
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000528 ompt_frame->reenter_runtime_frame = __builtin_frame_address(1);
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000529 }
530#endif
531
Jonathan Peytonf89fbbb2015-08-31 18:15:00 +0000532 __kmp_join_call(&loc, gtid
533#if OMPT_SUPPORT
534 , fork_context_gnu
535#endif
536 );
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000537#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000538 if (ompt_enabled) {
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000539 ompt_frame->reenter_runtime_frame = NULL;
540 }
541#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000542 }
543 else {
Jonas Hahnfeld1c1c7172016-03-24 12:52:04 +0000544#if OMPT_SUPPORT && OMPT_TRACE
545 if (ompt_enabled &&
546 ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
547 ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
548 parallel_id, serialized_task_id);
549 }
550#endif
551
Jim Cownie5e8470a2013-09-27 10:38:44 +0000552 __kmpc_end_serialized_parallel(&loc, gtid);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000553
554#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000555 if (ompt_enabled) {
Jonathan Peyton61118492016-05-20 19:03:38 +0000556 // Record that we re-entered the runtime system in the frame that
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000557 // created the parallel region.
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000558 ompt_frame->reenter_runtime_frame = __builtin_frame_address(1);
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000559
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000560 if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000561 ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
562 ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
Jonathan Peyton61118492016-05-20 19:03:38 +0000563 parallel_id, task_info->task_id,
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000564 OMPT_INVOKER(fork_context_gnu));
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000565 }
566
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000567 ompt_frame->reenter_runtime_frame = NULL;
568
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000569 thr->th.ompt_thread_info.state =
570 (((thr->th.th_team)->t.t_serialized) ?
571 ompt_state_work_serial : ompt_state_work_parallel);
572 }
573#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +0000574 }
575}
576
577
Jim Cownie5e8470a2013-09-27 10:38:44 +0000578//
579// Loop worksharing constructs
580//
581
582//
583// The Gnu codegen passes in an exclusive upper bound for the overall range,
584// but the libguide dispatch code expects an inclusive upper bound, hence the
585// "end - incr" 5th argument to KMP_DISPATCH_INIT (and the " ub - str" 11th
586// argument to __kmp_GOMP_fork_call).
587//
588// Conversely, KMP_DISPATCH_NEXT returns and inclusive upper bound in *p_ub,
589// but the Gnu codegen expects an excluside upper bound, so the adjustment
590// "*p_ub += stride" compenstates for the discrepancy.
591//
592// Correction: the gnu codegen always adjusts the upper bound by +-1, not the
593// stride value. We adjust the dispatch parameters accordingly (by +-1), but
594// we still adjust p_ub by the actual stride value.
595//
596// The "runtime" versions do not take a chunk_sz parameter.
597//
598// The profile lib cannot support construct checking of unordered loops that
599// are predetermined by the compiler to be statically scheduled, as the gcc
600// codegen will not always emit calls to GOMP_loop_static_next() to get the
601// next iteration. Instead, it emits inline code to call omp_get_thread_num()
602// num and calculate the iteration space using the result. It doesn't do this
603// with ordered static loop, so they can be checked.
604//
605
606#define LOOP_START(func,schedule) \
607 int func (long lb, long ub, long str, long chunk_sz, long *p_lb, \
608 long *p_ub) \
609 { \
610 int status; \
611 long stride; \
612 int gtid = __kmp_entry_gtid(); \
613 MKLOC(loc, #func); \
614 KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
615 gtid, lb, ub, str, chunk_sz )); \
616 \
617 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
618 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
619 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
620 (schedule) != kmp_sch_static); \
621 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
622 (kmp_int *)p_ub, (kmp_int *)&stride); \
623 if (status) { \
624 KMP_DEBUG_ASSERT(stride == str); \
625 *p_ub += (str > 0) ? 1 : -1; \
626 } \
627 } \
628 else { \
629 status = 0; \
630 } \
631 \
632 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
633 gtid, *p_lb, *p_ub, status)); \
634 return status; \
635 }
636
637
638#define LOOP_RUNTIME_START(func,schedule) \
639 int func (long lb, long ub, long str, long *p_lb, long *p_ub) \
640 { \
641 int status; \
642 long stride; \
643 long chunk_sz = 0; \
644 int gtid = __kmp_entry_gtid(); \
645 MKLOC(loc, #func); \
646 KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
647 gtid, lb, ub, str, chunk_sz )); \
648 \
649 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
650 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
651 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, TRUE); \
652 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
653 (kmp_int *)p_ub, (kmp_int *)&stride); \
654 if (status) { \
655 KMP_DEBUG_ASSERT(stride == str); \
656 *p_ub += (str > 0) ? 1 : -1; \
657 } \
658 } \
659 else { \
660 status = 0; \
661 } \
662 \
663 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
664 gtid, *p_lb, *p_ub, status)); \
665 return status; \
666 }
667
668
669#define LOOP_NEXT(func,fini_code) \
670 int func(long *p_lb, long *p_ub) \
671 { \
672 int status; \
673 long stride; \
674 int gtid = __kmp_get_gtid(); \
675 MKLOC(loc, #func); \
676 KA_TRACE(20, ( #func ": T#%d\n", gtid)); \
677 \
678 fini_code \
679 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
680 (kmp_int *)p_ub, (kmp_int *)&stride); \
681 if (status) { \
682 *p_ub += (stride > 0) ? 1 : -1; \
683 } \
684 \
685 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, stride 0x%lx, " \
686 "returning %d\n", gtid, *p_lb, *p_ub, stride, status)); \
687 return status; \
688 }
689
690
Jim Cownie181b4bb2013-12-23 17:28:57 +0000691LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_STATIC_START), kmp_sch_static)
692LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {})
693LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked)
694LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {})
695LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_GUIDED_START), kmp_sch_guided_chunked)
696LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {})
697LOOP_RUNTIME_START(xexpand(KMP_API_NAME_GOMP_LOOP_RUNTIME_START), kmp_sch_runtime)
698LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {})
Jim Cownie5e8470a2013-09-27 10:38:44 +0000699
Jim Cownie181b4bb2013-12-23 17:28:57 +0000700LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START), kmp_ord_static)
701LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000702 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000703LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START), kmp_ord_dynamic_chunked)
704LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000705 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000706LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START), kmp_ord_guided_chunked)
707LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000708 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000709LOOP_RUNTIME_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START), kmp_ord_runtime)
710LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000711 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
712
713
714void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000715xexpand(KMP_API_NAME_GOMP_LOOP_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000716{
717 int gtid = __kmp_get_gtid();
718 KA_TRACE(20, ("GOMP_loop_end: T#%d\n", gtid))
719
720 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
721
722 KA_TRACE(20, ("GOMP_loop_end exit: T#%d\n", gtid))
723}
724
725
726void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000727xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000728{
729 KA_TRACE(20, ("GOMP_loop_end_nowait: T#%d\n", __kmp_get_gtid()))
730}
731
732
Jim Cownie5e8470a2013-09-27 10:38:44 +0000733//
734// Unsigned long long loop worksharing constructs
735//
736// These are new with gcc 4.4
737//
738
739#define LOOP_START_ULL(func,schedule) \
740 int func (int up, unsigned long long lb, unsigned long long ub, \
741 unsigned long long str, unsigned long long chunk_sz, \
742 unsigned long long *p_lb, unsigned long long *p_ub) \
743 { \
744 int status; \
745 long long str2 = up ? ((long long)str) : -((long long)str); \
746 long long stride; \
747 int gtid = __kmp_entry_gtid(); \
748 MKLOC(loc, #func); \
749 \
750 KA_TRACE(20, ( #func ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str 0x%llx, chunk_sz 0x%llx\n", \
751 gtid, up, lb, ub, str, chunk_sz )); \
752 \
753 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
754 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
755 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
756 (schedule) != kmp_sch_static); \
757 status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, \
758 (kmp_uint64 *)p_lb, (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
759 if (status) { \
760 KMP_DEBUG_ASSERT(stride == str2); \
761 *p_ub += (str > 0) ? 1 : -1; \
762 } \
763 } \
764 else { \
765 status = 0; \
766 } \
767 \
768 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
769 gtid, *p_lb, *p_ub, status)); \
770 return status; \
771 }
772
773
774#define LOOP_RUNTIME_START_ULL(func,schedule) \
775 int func (int up, unsigned long long lb, unsigned long long ub, \
776 unsigned long long str, unsigned long long *p_lb, \
777 unsigned long long *p_ub) \
778 { \
779 int status; \
780 long long str2 = up ? ((long long)str) : -((long long)str); \
781 unsigned long long stride; \
782 unsigned long long chunk_sz = 0; \
783 int gtid = __kmp_entry_gtid(); \
784 MKLOC(loc, #func); \
785 \
786 KA_TRACE(20, ( #func ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str 0x%llx, chunk_sz 0x%llx\n", \
787 gtid, up, lb, ub, str, chunk_sz )); \
788 \
789 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
790 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
791 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, TRUE); \
792 status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, \
793 (kmp_uint64 *)p_lb, (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
794 if (status) { \
Jim Cownie4cc4bb42014-10-07 16:25:50 +0000795 KMP_DEBUG_ASSERT((long long)stride == str2); \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000796 *p_ub += (str > 0) ? 1 : -1; \
797 } \
798 } \
799 else { \
800 status = 0; \
801 } \
802 \
803 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
804 gtid, *p_lb, *p_ub, status)); \
805 return status; \
806 }
807
808
809#define LOOP_NEXT_ULL(func,fini_code) \
810 int func(unsigned long long *p_lb, unsigned long long *p_ub) \
811 { \
812 int status; \
813 long long stride; \
814 int gtid = __kmp_get_gtid(); \
815 MKLOC(loc, #func); \
816 KA_TRACE(20, ( #func ": T#%d\n", gtid)); \
817 \
818 fini_code \
819 status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
820 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
821 if (status) { \
822 *p_ub += (stride > 0) ? 1 : -1; \
823 } \
824 \
825 KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, stride 0x%llx, " \
826 "returning %d\n", gtid, *p_lb, *p_ub, stride, status)); \
827 return status; \
828 }
829
830
Jim Cownie181b4bb2013-12-23 17:28:57 +0000831LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START), kmp_sch_static)
832LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT), {})
833LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START), kmp_sch_dynamic_chunked)
834LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT), {})
835LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START), kmp_sch_guided_chunked)
836LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {})
837LOOP_RUNTIME_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime)
838LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {})
Jim Cownie5e8470a2013-09-27 10:38:44 +0000839
Jim Cownie181b4bb2013-12-23 17:28:57 +0000840LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START), kmp_ord_static)
841LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000842 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000843LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START), kmp_ord_dynamic_chunked)
844LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000845 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000846LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START), kmp_ord_guided_chunked)
847LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000848 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
Jim Cownie181b4bb2013-12-23 17:28:57 +0000849LOOP_RUNTIME_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START), kmp_ord_runtime)
850LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000851 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
852
853
Jim Cownie5e8470a2013-09-27 10:38:44 +0000854//
855// Combined parallel / loop worksharing constructs
856//
857// There are no ull versions (yet).
858//
859
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000860#define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000861 void func (void (*task) (void *), void *data, unsigned num_threads, \
862 long lb, long ub, long str, long chunk_sz) \
863 { \
864 int gtid = __kmp_entry_gtid(); \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000865 MKLOC(loc, #func); \
866 KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
867 gtid, lb, ub, str, chunk_sz )); \
868 \
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000869 ompt_pre(); \
870 \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000871 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
872 if (num_threads != 0) { \
873 __kmp_push_num_threads(&loc, gtid, num_threads); \
874 } \
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000875 __kmp_GOMP_fork_call(&loc, gtid, task, \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000876 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
877 task, data, num_threads, &loc, (schedule), lb, \
878 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
879 } \
880 else { \
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000881 __kmp_GOMP_serialized_parallel(&loc, gtid, task); \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000882 } \
883 \
884 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
885 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
886 (schedule) != kmp_sch_static); \
887 \
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000888 ompt_post(); \
889 \
Jim Cownie5e8470a2013-09-27 10:38:44 +0000890 KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
891 }
892
893
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000894
895#if OMPT_SUPPORT
896
897#define OMPT_LOOP_PRE() \
898 ompt_frame_t *parent_frame; \
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000899 if (ompt_enabled) { \
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000900 parent_frame = __ompt_get_task_frame_internal(0); \
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +0000901 parent_frame->reenter_runtime_frame = __builtin_frame_address(1); \
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000902 }
903
904
905#define OMPT_LOOP_POST() \
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000906 if (ompt_enabled) { \
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000907 parent_frame->reenter_runtime_frame = NULL; \
908 }
909
910#else
911
Jonathan Peyton61118492016-05-20 19:03:38 +0000912#define OMPT_LOOP_PRE()
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000913
914#define OMPT_LOOP_POST()
915
916#endif
917
918
Jonathan Peyton61118492016-05-20 19:03:38 +0000919PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000920 kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST)
Jonathan Peyton61118492016-05-20 19:03:38 +0000921PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000922 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
Jonathan Peyton61118492016-05-20 19:03:38 +0000923PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000924 kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
Jonathan Peyton61118492016-05-20 19:03:38 +0000925PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
Jonathan Peyton3fdf3292015-07-21 18:03:30 +0000926 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000927
928
Jim Cownie5e8470a2013-09-27 10:38:44 +0000929//
930// Tasking constructs
931//
932
933void
Jim Cownie181b4bb2013-12-23 17:28:57 +0000934xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_func)(void *, void *),
Jonas Hahnfeld9dffeff2016-02-09 07:07:30 +0000935 long arg_size, long arg_align, bool if_cond, unsigned gomp_flags)
Jim Cownie5e8470a2013-09-27 10:38:44 +0000936{
937 MKLOC(loc, "GOMP_task");
938 int gtid = __kmp_entry_gtid();
939 kmp_int32 flags = 0;
940 kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *) & flags;
941
942 KA_TRACE(20, ("GOMP_task: T#%d\n", gtid));
943
944 // The low-order bit is the "tied" flag
945 if (gomp_flags & 1) {
946 input_flags->tiedness = 1;
947 }
Jonathan Peyton33d1d282015-10-13 18:36:22 +0000948 // The second low-order bit is the "final" flag
949 if (gomp_flags & 2) {
950 input_flags->final = 1;
951 }
Jim Cownie5e8470a2013-09-27 10:38:44 +0000952 input_flags->native = 1;
953 // __kmp_task_alloc() sets up all other flags
954
955 if (! if_cond) {
956 arg_size = 0;
957 }
958
959 kmp_task_t *task = __kmp_task_alloc(&loc, gtid, input_flags,
960 sizeof(kmp_task_t), arg_size ? arg_size + arg_align - 1 : 0,
961 (kmp_routine_entry_t)func);
962
963 if (arg_size > 0) {
964 if (arg_align > 0) {
965 task->shareds = (void *)((((size_t)task->shareds)
966 + arg_align - 1) / arg_align * arg_align);
967 }
968 //else error??
969
970 if (copy_func) {
971 (*copy_func)(task->shareds, data);
972 }
973 else {
Andrey Churbanov74bf17b2015-04-02 13:27:08 +0000974 KMP_MEMCPY(task->shareds, data, arg_size);
Jim Cownie5e8470a2013-09-27 10:38:44 +0000975 }
976 }
977
978 if (if_cond) {
979 __kmpc_omp_task(&loc, gtid, task);
980 }
981 else {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000982#if OMPT_SUPPORT
983 ompt_thread_info_t oldInfo;
984 kmp_info_t *thread;
985 kmp_taskdata_t *taskdata;
Jonathan Peytonb68a85d2015-09-21 18:11:22 +0000986 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +0000987 // Store the threads states and restore them after the task
988 thread = __kmp_threads[ gtid ];
989 taskdata = KMP_TASK_TO_TASKDATA(task);
990 oldInfo = thread->th.ompt_thread_info;
991 thread->th.ompt_thread_info.wait_id = 0;
992 thread->th.ompt_thread_info.state = ompt_state_work_parallel;
993 taskdata->ompt_task_info.frame.exit_runtime_frame =
994 __builtin_frame_address(0);
995 }
996#endif
997
Jim Cownie5e8470a2013-09-27 10:38:44 +0000998 __kmpc_omp_task_begin_if0(&loc, gtid, task);
999 func(data);
1000 __kmpc_omp_task_complete_if0(&loc, gtid, task);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001001
1002#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +00001003 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001004 thread->th.ompt_thread_info = oldInfo;
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +00001005 taskdata->ompt_task_info.frame.exit_runtime_frame = NULL;
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001006 }
1007#endif
Jim Cownie5e8470a2013-09-27 10:38:44 +00001008 }
1009
1010 KA_TRACE(20, ("GOMP_task exit: T#%d\n", gtid));
1011}
1012
1013
1014void
Jim Cownie181b4bb2013-12-23 17:28:57 +00001015xexpand(KMP_API_NAME_GOMP_TASKWAIT)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +00001016{
1017 MKLOC(loc, "GOMP_taskwait");
1018 int gtid = __kmp_entry_gtid();
1019
1020 KA_TRACE(20, ("GOMP_taskwait: T#%d\n", gtid));
1021
1022 __kmpc_omp_taskwait(&loc, gtid);
1023
1024 KA_TRACE(20, ("GOMP_taskwait exit: T#%d\n", gtid));
1025}
1026
1027
Jim Cownie5e8470a2013-09-27 10:38:44 +00001028//
1029// Sections worksharing constructs
1030//
1031
1032//
1033// For the sections construct, we initialize a dynamically scheduled loop
1034// worksharing construct with lb 1 and stride 1, and use the iteration #'s
1035// that its returns as sections ids.
1036//
1037// There are no special entry points for ordered sections, so we always use
1038// the dynamically scheduled workshare, even if the sections aren't ordered.
1039//
1040
1041unsigned
Jim Cownie181b4bb2013-12-23 17:28:57 +00001042xexpand(KMP_API_NAME_GOMP_SECTIONS_START)(unsigned count)
Jim Cownie5e8470a2013-09-27 10:38:44 +00001043{
1044 int status;
1045 kmp_int lb, ub, stride;
1046 int gtid = __kmp_entry_gtid();
1047 MKLOC(loc, "GOMP_sections_start");
1048 KA_TRACE(20, ("GOMP_sections_start: T#%d\n", gtid));
1049
1050 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1051
1052 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1053 if (status) {
1054 KMP_DEBUG_ASSERT(stride == 1);
1055 KMP_DEBUG_ASSERT(lb > 0);
1056 KMP_ASSERT(lb == ub);
1057 }
1058 else {
1059 lb = 0;
1060 }
1061
1062 KA_TRACE(20, ("GOMP_sections_start exit: T#%d returning %u\n", gtid,
1063 (unsigned)lb));
1064 return (unsigned)lb;
1065}
1066
1067
1068unsigned
Jim Cownie181b4bb2013-12-23 17:28:57 +00001069xexpand(KMP_API_NAME_GOMP_SECTIONS_NEXT)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +00001070{
1071 int status;
1072 kmp_int lb, ub, stride;
1073 int gtid = __kmp_get_gtid();
1074 MKLOC(loc, "GOMP_sections_next");
1075 KA_TRACE(20, ("GOMP_sections_next: T#%d\n", gtid));
1076
1077 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1078 if (status) {
1079 KMP_DEBUG_ASSERT(stride == 1);
1080 KMP_DEBUG_ASSERT(lb > 0);
1081 KMP_ASSERT(lb == ub);
1082 }
1083 else {
1084 lb = 0;
1085 }
1086
1087 KA_TRACE(20, ("GOMP_sections_next exit: T#%d returning %u\n", gtid,
1088 (unsigned)lb));
1089 return (unsigned)lb;
1090}
1091
1092
1093void
Jim Cownie181b4bb2013-12-23 17:28:57 +00001094xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *data,
Jim Cownie5e8470a2013-09-27 10:38:44 +00001095 unsigned num_threads, unsigned count)
1096{
1097 int gtid = __kmp_entry_gtid();
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001098
1099#if OMPT_SUPPORT
1100 ompt_frame_t *parent_frame;
1101
Jonathan Peytonb68a85d2015-09-21 18:11:22 +00001102 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001103 parent_frame = __ompt_get_task_frame_internal(0);
Jonas Hahnfeldfd0614d2016-09-14 13:59:13 +00001104 parent_frame->reenter_runtime_frame = __builtin_frame_address(1);
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001105 }
1106#endif
1107
Jim Cownie5e8470a2013-09-27 10:38:44 +00001108 MKLOC(loc, "GOMP_parallel_sections_start");
1109 KA_TRACE(20, ("GOMP_parallel_sections_start: T#%d\n", gtid));
1110
1111 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1112 if (num_threads != 0) {
1113 __kmp_push_num_threads(&loc, gtid, num_threads);
1114 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001115 __kmp_GOMP_fork_call(&loc, gtid, task,
Jim Cownie5e8470a2013-09-27 10:38:44 +00001116 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
1117 num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
1118 (kmp_int)count, (kmp_int)1, (kmp_int)1);
1119 }
1120 else {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001121 __kmp_GOMP_serialized_parallel(&loc, gtid, task);
Jim Cownie5e8470a2013-09-27 10:38:44 +00001122 }
1123
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001124#if OMPT_SUPPORT
Jonathan Peytonb68a85d2015-09-21 18:11:22 +00001125 if (ompt_enabled) {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001126 parent_frame->reenter_runtime_frame = NULL;
1127 }
1128#endif
1129
Jim Cownie5e8470a2013-09-27 10:38:44 +00001130 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1131
1132 KA_TRACE(20, ("GOMP_parallel_sections_start exit: T#%d\n", gtid));
1133}
1134
1135
1136void
Jim Cownie181b4bb2013-12-23 17:28:57 +00001137xexpand(KMP_API_NAME_GOMP_SECTIONS_END)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +00001138{
1139 int gtid = __kmp_get_gtid();
1140 KA_TRACE(20, ("GOMP_sections_end: T#%d\n", gtid))
1141
1142 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
1143
1144 KA_TRACE(20, ("GOMP_sections_end exit: T#%d\n", gtid))
1145}
1146
1147
1148void
Jim Cownie181b4bb2013-12-23 17:28:57 +00001149xexpand(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT)(void)
Jim Cownie5e8470a2013-09-27 10:38:44 +00001150{
1151 KA_TRACE(20, ("GOMP_sections_end_nowait: T#%d\n", __kmp_get_gtid()))
1152}
1153
Jim Cownie181b4bb2013-12-23 17:28:57 +00001154// libgomp has an empty function for GOMP_taskyield as of 2013-10-10
1155void
1156xexpand(KMP_API_NAME_GOMP_TASKYIELD)(void)
1157{
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001158 KA_TRACE(20, ("GOMP_taskyield: T#%d\n", __kmp_get_gtid()))
1159 return;
Jim Cownie181b4bb2013-12-23 17:28:57 +00001160}
1161
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001162#if OMP_40_ENABLED // these are new GOMP_4.0 entry points
1163
1164void
1165xexpand(KMP_API_NAME_GOMP_PARALLEL)(void (*task)(void *), void *data, unsigned num_threads, unsigned int flags)
1166{
1167 int gtid = __kmp_entry_gtid();
1168 MKLOC(loc, "GOMP_parallel");
1169 KA_TRACE(20, ("GOMP_parallel: T#%d\n", gtid));
1170
1171 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1172 if (num_threads != 0) {
1173 __kmp_push_num_threads(&loc, gtid, num_threads);
1174 }
1175 if(flags != 0) {
1176 __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
1177 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001178 __kmp_GOMP_fork_call(&loc, gtid, task,
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001179 (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
1180 }
1181 else {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001182 __kmp_GOMP_serialized_parallel(&loc, gtid, task);
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001183 }
1184 task(data);
1185 xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
1186}
1187
1188void
1189xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
1190 unsigned num_threads, unsigned count, unsigned flags)
1191{
1192 int gtid = __kmp_entry_gtid();
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001193 MKLOC(loc, "GOMP_parallel_sections");
1194 KA_TRACE(20, ("GOMP_parallel_sections: T#%d\n", gtid));
1195
1196 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1197 if (num_threads != 0) {
1198 __kmp_push_num_threads(&loc, gtid, num_threads);
1199 }
1200 if(flags != 0) {
1201 __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
1202 }
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001203 __kmp_GOMP_fork_call(&loc, gtid, task,
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001204 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
1205 num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
1206 (kmp_int)count, (kmp_int)1, (kmp_int)1);
1207 }
1208 else {
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001209 __kmp_GOMP_serialized_parallel(&loc, gtid, task);
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001210 }
1211
1212 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1213
1214 task(data);
1215 xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
1216 KA_TRACE(20, ("GOMP_parallel_sections exit: T#%d\n", gtid));
1217}
1218
1219#define PARALLEL_LOOP(func, schedule) \
1220 void func (void (*task) (void *), void *data, unsigned num_threads, \
1221 long lb, long ub, long str, long chunk_sz, unsigned flags) \
1222 { \
1223 int gtid = __kmp_entry_gtid(); \
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001224 MKLOC(loc, #func); \
1225 KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1226 gtid, lb, ub, str, chunk_sz )); \
1227 \
1228 if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
1229 if (num_threads != 0) { \
1230 __kmp_push_num_threads(&loc, gtid, num_threads); \
1231 } \
1232 if (flags != 0) { \
1233 __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags); \
1234 } \
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001235 __kmp_GOMP_fork_call(&loc, gtid, task, \
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001236 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
1237 task, data, num_threads, &loc, (schedule), lb, \
1238 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1239 } \
1240 else { \
Andrey Churbanovd7d088f2015-04-29 16:42:24 +00001241 __kmp_GOMP_serialized_parallel(&loc, gtid, task); \
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001242 } \
1243 \
1244 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1245 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1246 (schedule) != kmp_sch_static); \
1247 task(data); \
1248 xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(); \
1249 \
1250 KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
1251 }
1252
1253PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC), kmp_sch_static)
1254PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC), kmp_sch_dynamic_chunked)
1255PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED), kmp_sch_guided_chunked)
1256PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), kmp_sch_runtime)
1257
1258
1259void
1260xexpand(KMP_API_NAME_GOMP_TASKGROUP_START)(void)
1261{
Jonas Hahnfeldad0c42e2016-08-08 13:23:08 +00001262 int gtid = __kmp_entry_gtid();
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001263 MKLOC(loc, "GOMP_taskgroup_start");
1264 KA_TRACE(20, ("GOMP_taskgroup_start: T#%d\n", gtid));
1265
1266 __kmpc_taskgroup(&loc, gtid);
1267
1268 return;
1269}
1270
1271void
1272xexpand(KMP_API_NAME_GOMP_TASKGROUP_END)(void)
1273{
1274 int gtid = __kmp_get_gtid();
1275 MKLOC(loc, "GOMP_taskgroup_end");
1276 KA_TRACE(20, ("GOMP_taskgroup_end: T#%d\n", gtid));
1277
1278 __kmpc_end_taskgroup(&loc, gtid);
1279
1280 return;
1281}
1282
1283#ifndef KMP_DEBUG
1284static
1285#endif /* KMP_DEBUG */
Jonathan Peyton66338292015-06-01 02:37:28 +00001286kmp_int32 __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001287 kmp_int32 cncl_kind = 0;
1288 switch(gomp_kind) {
1289 case 1:
1290 cncl_kind = cancel_parallel;
1291 break;
1292 case 2:
1293 cncl_kind = cancel_loop;
1294 break;
1295 case 4:
1296 cncl_kind = cancel_sections;
1297 break;
1298 case 8:
1299 cncl_kind = cancel_taskgroup;
1300 break;
1301 }
1302 return cncl_kind;
1303}
1304
1305bool
1306xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(int which)
1307{
1308 if(__kmp_omp_cancellation) {
1309 KMP_FATAL(NoGompCancellation);
1310 }
1311 int gtid = __kmp_get_gtid();
1312 MKLOC(loc, "GOMP_cancellation_point");
1313 KA_TRACE(20, ("GOMP_cancellation_point: T#%d\n", gtid));
1314
Jonathan Peyton66338292015-06-01 02:37:28 +00001315 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001316
1317 return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1318}
1319
1320bool
1321xexpand(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void)
1322{
1323 if(__kmp_omp_cancellation) {
1324 KMP_FATAL(NoGompCancellation);
1325 }
1326 KMP_FATAL(NoGompCancellation);
1327 int gtid = __kmp_get_gtid();
1328 MKLOC(loc, "GOMP_barrier_cancel");
1329 KA_TRACE(20, ("GOMP_barrier_cancel: T#%d\n", gtid));
1330
1331 return __kmpc_cancel_barrier(&loc, gtid);
1332}
1333
1334bool
1335xexpand(KMP_API_NAME_GOMP_CANCEL)(int which, bool do_cancel)
1336{
1337 if(__kmp_omp_cancellation) {
1338 KMP_FATAL(NoGompCancellation);
1339 } else {
1340 return FALSE;
1341 }
1342
1343 int gtid = __kmp_get_gtid();
1344 MKLOC(loc, "GOMP_cancel");
1345 KA_TRACE(20, ("GOMP_cancel: T#%d\n", gtid));
1346
Jonathan Peyton66338292015-06-01 02:37:28 +00001347 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001348
1349 if(do_cancel == FALSE) {
1350 return xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(which);
1351 } else {
1352 return __kmpc_cancel(&loc, gtid, cncl_kind);
1353 }
1354}
1355
1356bool
1357xexpand(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void)
1358{
1359 if(__kmp_omp_cancellation) {
1360 KMP_FATAL(NoGompCancellation);
1361 }
1362 int gtid = __kmp_get_gtid();
1363 MKLOC(loc, "GOMP_sections_end_cancel");
1364 KA_TRACE(20, ("GOMP_sections_end_cancel: T#%d\n", gtid));
1365
1366 return __kmpc_cancel_barrier(&loc, gtid);
1367}
1368
1369bool
1370xexpand(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void)
1371{
1372 if(__kmp_omp_cancellation) {
1373 KMP_FATAL(NoGompCancellation);
1374 }
1375 int gtid = __kmp_get_gtid();
1376 MKLOC(loc, "GOMP_loop_end_cancel");
1377 KA_TRACE(20, ("GOMP_loop_end_cancel: T#%d\n", gtid));
1378
1379 return __kmpc_cancel_barrier(&loc, gtid);
1380}
1381
1382// All target functions are empty as of 2014-05-29
1383void
1384xexpand(KMP_API_NAME_GOMP_TARGET)(int device, void (*fn) (void *), const void *openmp_target,
1385 size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds)
1386{
1387 return;
1388}
1389
1390void
1391xexpand(KMP_API_NAME_GOMP_TARGET_DATA)(int device, const void *openmp_target, size_t mapnum,
1392 void **hostaddrs, size_t *sizes, unsigned char *kinds)
1393{
1394 return;
1395}
1396
1397void
1398xexpand(KMP_API_NAME_GOMP_TARGET_END_DATA)(void)
1399{
1400 return;
1401}
1402
1403void
1404xexpand(KMP_API_NAME_GOMP_TARGET_UPDATE)(int device, const void *openmp_target, size_t mapnum,
1405 void **hostaddrs, size_t *sizes, unsigned char *kinds)
1406{
1407 return;
1408}
1409
1410void
1411xexpand(KMP_API_NAME_GOMP_TEAMS)(unsigned int num_teams, unsigned int thread_limit)
1412{
1413 return;
1414}
1415#endif // OMP_40_ENABLED
1416
1417
Jim Cownie181b4bb2013-12-23 17:28:57 +00001418/*
1419 The following sections of code create aliases for the GOMP_* functions,
1420 then create versioned symbols using the assembler directive .symver.
1421 This is only pertinent for ELF .so library
1422 xaliasify and xversionify are defined in kmp_ftn_os.h
1423*/
1424
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001425#ifdef KMP_USE_VERSION_SYMBOLS
Jim Cownie181b4bb2013-12-23 17:28:57 +00001426
1427// GOMP_1.0 aliases
1428xaliasify(KMP_API_NAME_GOMP_ATOMIC_END, 10);
1429xaliasify(KMP_API_NAME_GOMP_ATOMIC_START, 10);
1430xaliasify(KMP_API_NAME_GOMP_BARRIER, 10);
1431xaliasify(KMP_API_NAME_GOMP_CRITICAL_END, 10);
1432xaliasify(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10);
1433xaliasify(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10);
1434xaliasify(KMP_API_NAME_GOMP_CRITICAL_START, 10);
1435xaliasify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10);
1436xaliasify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10);
1437xaliasify(KMP_API_NAME_GOMP_LOOP_END, 10);
1438xaliasify(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10);
1439xaliasify(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10);
1440xaliasify(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10);
1441xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10);
1442xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10);
1443xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10);
1444xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10);
1445xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10);
1446xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10);
1447xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10);
1448xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10);
1449xaliasify(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10);
1450xaliasify(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10);
1451xaliasify(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10);
1452xaliasify(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10);
1453xaliasify(KMP_API_NAME_GOMP_ORDERED_END, 10);
1454xaliasify(KMP_API_NAME_GOMP_ORDERED_START, 10);
1455xaliasify(KMP_API_NAME_GOMP_PARALLEL_END, 10);
1456xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10);
1457xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10);
1458xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10);
1459xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10);
1460xaliasify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10);
1461xaliasify(KMP_API_NAME_GOMP_PARALLEL_START, 10);
1462xaliasify(KMP_API_NAME_GOMP_SECTIONS_END, 10);
1463xaliasify(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10);
1464xaliasify(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10);
1465xaliasify(KMP_API_NAME_GOMP_SECTIONS_START, 10);
1466xaliasify(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10);
1467xaliasify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10);
1468xaliasify(KMP_API_NAME_GOMP_SINGLE_START, 10);
1469
1470// GOMP_2.0 aliases
Jim Cownie181b4bb2013-12-23 17:28:57 +00001471xaliasify(KMP_API_NAME_GOMP_TASK, 20);
1472xaliasify(KMP_API_NAME_GOMP_TASKWAIT, 20);
Jim Cownie181b4bb2013-12-23 17:28:57 +00001473xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20);
1474xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20);
1475xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20);
1476xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20);
1477xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20);
1478xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20);
1479xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20);
1480xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20);
1481xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20);
1482xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20);
1483xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20);
1484xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20);
1485xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20);
1486xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20);
1487xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20);
1488xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20);
1489
1490// GOMP_3.0 aliases
1491xaliasify(KMP_API_NAME_GOMP_TASKYIELD, 30);
1492
1493// GOMP_4.0 aliases
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001494// The GOMP_parallel* entry points below aren't OpenMP 4.0 related.
1495#if OMP_40_ENABLED
1496xaliasify(KMP_API_NAME_GOMP_PARALLEL, 40);
1497xaliasify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40);
1498xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40);
1499xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40);
1500xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40);
1501xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40);
1502xaliasify(KMP_API_NAME_GOMP_TASKGROUP_START, 40);
1503xaliasify(KMP_API_NAME_GOMP_TASKGROUP_END, 40);
1504xaliasify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40);
1505xaliasify(KMP_API_NAME_GOMP_CANCEL, 40);
1506xaliasify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40);
1507xaliasify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40);
1508xaliasify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40);
1509xaliasify(KMP_API_NAME_GOMP_TARGET, 40);
1510xaliasify(KMP_API_NAME_GOMP_TARGET_DATA, 40);
1511xaliasify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40);
1512xaliasify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40);
1513xaliasify(KMP_API_NAME_GOMP_TEAMS, 40);
1514#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +00001515
1516// GOMP_1.0 versioned symbols
1517xversionify(KMP_API_NAME_GOMP_ATOMIC_END, 10, "GOMP_1.0");
1518xversionify(KMP_API_NAME_GOMP_ATOMIC_START, 10, "GOMP_1.0");
1519xversionify(KMP_API_NAME_GOMP_BARRIER, 10, "GOMP_1.0");
1520xversionify(KMP_API_NAME_GOMP_CRITICAL_END, 10, "GOMP_1.0");
1521xversionify(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10, "GOMP_1.0");
1522xversionify(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10, "GOMP_1.0");
1523xversionify(KMP_API_NAME_GOMP_CRITICAL_START, 10, "GOMP_1.0");
1524xversionify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10, "GOMP_1.0");
1525xversionify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10, "GOMP_1.0");
1526xversionify(KMP_API_NAME_GOMP_LOOP_END, 10, "GOMP_1.0");
1527xversionify(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10, "GOMP_1.0");
1528xversionify(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10, "GOMP_1.0");
1529xversionify(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10, "GOMP_1.0");
1530xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10, "GOMP_1.0");
1531xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10, "GOMP_1.0");
1532xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10, "GOMP_1.0");
1533xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10, "GOMP_1.0");
1534xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10, "GOMP_1.0");
1535xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10, "GOMP_1.0");
1536xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10, "GOMP_1.0");
1537xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10, "GOMP_1.0");
1538xversionify(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10, "GOMP_1.0");
1539xversionify(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10, "GOMP_1.0");
1540xversionify(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10, "GOMP_1.0");
1541xversionify(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10, "GOMP_1.0");
1542xversionify(KMP_API_NAME_GOMP_ORDERED_END, 10, "GOMP_1.0");
1543xversionify(KMP_API_NAME_GOMP_ORDERED_START, 10, "GOMP_1.0");
1544xversionify(KMP_API_NAME_GOMP_PARALLEL_END, 10, "GOMP_1.0");
1545xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10, "GOMP_1.0");
1546xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10, "GOMP_1.0");
1547xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10, "GOMP_1.0");
1548xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10, "GOMP_1.0");
1549xversionify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10, "GOMP_1.0");
1550xversionify(KMP_API_NAME_GOMP_PARALLEL_START, 10, "GOMP_1.0");
1551xversionify(KMP_API_NAME_GOMP_SECTIONS_END, 10, "GOMP_1.0");
1552xversionify(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10, "GOMP_1.0");
1553xversionify(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10, "GOMP_1.0");
1554xversionify(KMP_API_NAME_GOMP_SECTIONS_START, 10, "GOMP_1.0");
1555xversionify(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10, "GOMP_1.0");
1556xversionify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10, "GOMP_1.0");
1557xversionify(KMP_API_NAME_GOMP_SINGLE_START, 10, "GOMP_1.0");
1558
1559// GOMP_2.0 versioned symbols
Jim Cownie181b4bb2013-12-23 17:28:57 +00001560xversionify(KMP_API_NAME_GOMP_TASK, 20, "GOMP_2.0");
1561xversionify(KMP_API_NAME_GOMP_TASKWAIT, 20, "GOMP_2.0");
Jim Cownie181b4bb2013-12-23 17:28:57 +00001562xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20, "GOMP_2.0");
1563xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20, "GOMP_2.0");
1564xversionify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20, "GOMP_2.0");
1565xversionify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20, "GOMP_2.0");
1566xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20, "GOMP_2.0");
1567xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20, "GOMP_2.0");
1568xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20, "GOMP_2.0");
1569xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20, "GOMP_2.0");
1570xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20, "GOMP_2.0");
1571xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20, "GOMP_2.0");
1572xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20, "GOMP_2.0");
1573xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20, "GOMP_2.0");
1574xversionify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20, "GOMP_2.0");
1575xversionify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20, "GOMP_2.0");
1576xversionify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20, "GOMP_2.0");
1577xversionify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20, "GOMP_2.0");
1578
1579// GOMP_3.0 versioned symbols
1580xversionify(KMP_API_NAME_GOMP_TASKYIELD, 30, "GOMP_3.0");
1581
1582// GOMP_4.0 versioned symbols
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001583#if OMP_40_ENABLED
1584xversionify(KMP_API_NAME_GOMP_PARALLEL, 40, "GOMP_4.0");
1585xversionify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40, "GOMP_4.0");
1586xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40, "GOMP_4.0");
1587xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40, "GOMP_4.0");
1588xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40, "GOMP_4.0");
1589xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40, "GOMP_4.0");
1590xversionify(KMP_API_NAME_GOMP_TASKGROUP_START, 40, "GOMP_4.0");
1591xversionify(KMP_API_NAME_GOMP_TASKGROUP_END, 40, "GOMP_4.0");
1592xversionify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40, "GOMP_4.0");
1593xversionify(KMP_API_NAME_GOMP_CANCEL, 40, "GOMP_4.0");
1594xversionify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40, "GOMP_4.0");
1595xversionify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40, "GOMP_4.0");
1596xversionify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40, "GOMP_4.0");
1597xversionify(KMP_API_NAME_GOMP_TARGET, 40, "GOMP_4.0");
1598xversionify(KMP_API_NAME_GOMP_TARGET_DATA, 40, "GOMP_4.0");
1599xversionify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40, "GOMP_4.0");
1600xversionify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40, "GOMP_4.0");
1601xversionify(KMP_API_NAME_GOMP_TEAMS, 40, "GOMP_4.0");
1602#endif
Jim Cownie181b4bb2013-12-23 17:28:57 +00001603
Jim Cownie4cc4bb42014-10-07 16:25:50 +00001604#endif // KMP_USE_VERSION_SYMBOLS
Jim Cownie181b4bb2013-12-23 17:28:57 +00001605
Jim Cownie5e8470a2013-09-27 10:38:44 +00001606#ifdef __cplusplus
1607 } //extern "C"
1608#endif // __cplusplus
1609
1610