LLVM OpenMP* Runtime Library
kmp_gsupport.c
1 /*
2  * kmp_gsupport.c
3  */
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 
16 #include "kmp.h"
17 #include "kmp_atomic.h"
18 
19 #if OMPT_SUPPORT
20 #include "ompt-specific.h"
21 #endif
22 
23 #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 
30 #include "kmp_ftn_os.h"
31 
32 void
33 xexpand(KMP_API_NAME_GOMP_BARRIER)(void)
34 {
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 
42 //
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 //
56 extern kmp_critical_name *__kmp_unnamed_critical_addr;
57 
58 
59 void
60 xexpand(KMP_API_NAME_GOMP_CRITICAL_START)(void)
61 {
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 
69 void
70 xexpand(KMP_API_NAME_GOMP_CRITICAL_END)(void)
71 {
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 
79 void
80 xexpand(KMP_API_NAME_GOMP_CRITICAL_NAME_START)(void **pptr)
81 {
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 
89 void
90 xexpand(KMP_API_NAME_GOMP_CRITICAL_NAME_END)(void **pptr)
91 {
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 
105 void
106 xexpand(KMP_API_NAME_GOMP_ATOMIC_START)(void)
107 {
108  int gtid = __kmp_entry_gtid();
109  KA_TRACE(20, ("GOMP_atomic_start: T#%d\n", gtid));
110 
111 #if OMPT_SUPPORT
112  __ompt_thread_assign_wait_id(0);
113 #endif
114 
115  __kmp_acquire_atomic_lock(&__kmp_atomic_lock, gtid);
116 }
117 
118 
119 void
120 xexpand(KMP_API_NAME_GOMP_ATOMIC_END)(void)
121 {
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 
128 int
129 xexpand(KMP_API_NAME_GOMP_SINGLE_START)(void)
130 {
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 
147 void *
148 xexpand(KMP_API_NAME_GOMP_SINGLE_COPY_START)(void)
149 {
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 
182 void
183 xexpand(KMP_API_NAME_GOMP_SINGLE_COPY_END)(void *data)
184 {
185  int gtid = __kmp_get_gtid();
186  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 
201 void
202 xexpand(KMP_API_NAME_GOMP_ORDERED_START)(void)
203 {
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 
211 void
212 xexpand(KMP_API_NAME_GOMP_ORDERED_END)(void)
213 {
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 
221 //
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 
228 #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_MIPS64
229 # 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 
243 //
244 // The parallel contruct
245 //
246 
247 #ifndef KMP_DEBUG
248 static
249 #endif /* KMP_DEBUG */
250 void
251 __kmp_GOMP_microtask_wrapper(int *gtid, int *npr, void (*task)(void *),
252  void *data)
253 {
254 #if OMPT_SUPPORT
255  kmp_info_t *thr;
256  ompt_frame_t *ompt_frame;
257  ompt_state_t enclosing_state;
258 
259  if (ompt_enabled) {
260  // 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 
273  task(data);
274 
275 #if OMPT_SUPPORT
276  if (ompt_enabled) {
277  // 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
284 }
285 
286 
287 #ifndef KMP_DEBUG
288 static
289 #endif /* KMP_DEBUG */
290 void
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 
301 #if OMPT_SUPPORT
302  kmp_info_t *thr;
303  ompt_frame_t *ompt_frame;
304  ompt_state_t enclosing_state;
305 
306  if (ompt_enabled) {
307  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 
318  //
319  // Now invoke the microtask.
320  //
321  task(data);
322 
323 #if OMPT_SUPPORT
324  if (ompt_enabled) {
325  // 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
332 }
333 
334 
335 #ifndef KMP_DEBUG
336 static
337 #endif /* KMP_DEBUG */
338 void
339 __kmp_GOMP_fork_call(ident_t *loc, int gtid, void (*unwrapped_task)(void *), microtask_t wrapper, int argc,...)
340 {
341  int rc;
342  kmp_info_t *thr = __kmp_threads[gtid];
343  kmp_team_t *team = thr->th.th_team;
344  int tid = __kmp_tid_from_gtid(gtid);
345 
346  va_list ap;
347  va_start(ap, argc);
348 
349  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,
354 #if (KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && KMP_OS_LINUX
355  &ap
356 #else
357  ap
358 #endif
359  );
360 
361  va_end(ap);
362 
363  if (rc) {
364  __kmp_run_before_invoked_task(gtid, tid, thr, team);
365  }
366 
367 #if OMPT_SUPPORT
368  if (ompt_enabled) {
369 #if OMPT_TRACE
370  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
374  if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
375  ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
376  team_info->parallel_id, task_info->task_id);
377  }
378 #endif
379  thr->th.ompt_thread_info.state = ompt_state_work_parallel;
380  }
381 #endif
382 }
383 
384 static void
385 __kmp_GOMP_serialized_parallel(ident_t *loc, kmp_int32 gtid, void (*task)(void *))
386 {
387  __kmp_serialized_parallel(loc, gtid);
388 
389 #if OMPT_SUPPORT
390  if (ompt_enabled) {
391  ompt_task_id_t ompt_task_id = __ompt_get_task_id_internal(0);
392  ompt_frame_t *ompt_frame = __ompt_get_task_frame_internal(0);
393  kmp_info_t *thr = __kmp_threads[gtid];
394 
395  ompt_parallel_id_t ompt_parallel_id = __ompt_parallel_id_new(gtid);
396  ompt_task_id_t my_ompt_task_id = __ompt_task_id_new(gtid);
397 
398  ompt_frame->exit_runtime_frame = NULL;
399 
400  // parallel region callback
401  if (ompt_callbacks.ompt_callback(ompt_event_parallel_begin)) {
402  int team_size = 1;
403  ompt_callbacks.ompt_callback(ompt_event_parallel_begin)(
404  ompt_task_id, ompt_frame, ompt_parallel_id,
405  team_size, (void *) task,
406  OMPT_INVOKER(fork_context_gnu));
407  }
408 
409  // set up lightweight task
410  ompt_lw_taskteam_t *lwt = (ompt_lw_taskteam_t *)
411  __kmp_allocate(sizeof(ompt_lw_taskteam_t));
412  __ompt_lw_taskteam_init(lwt, thr, gtid, (void *) task, ompt_parallel_id);
413  lwt->ompt_task_info.task_id = my_ompt_task_id;
414  lwt->ompt_task_info.frame.exit_runtime_frame = 0;
415  __ompt_lw_taskteam_link(lwt, thr);
416 
417 #if OMPT_TRACE
418  // implicit task callback
419  if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)) {
420  ompt_callbacks.ompt_callback(ompt_event_implicit_task_begin)(
421  ompt_parallel_id, my_ompt_task_id);
422  }
423  thr->th.ompt_thread_info.state = ompt_state_work_parallel;
424 #endif
425  }
426 #endif
427 }
428 
429 
430 void
431 xexpand(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(void *), void *data, unsigned num_threads)
432 {
433  int gtid = __kmp_entry_gtid();
434 
435 #if OMPT_SUPPORT
436  ompt_frame_t *parent_frame;
437 
438  if (ompt_enabled) {
439  parent_frame = __ompt_get_task_frame_internal(0);
440  parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
441  }
442 #endif
443 
444  MKLOC(loc, "GOMP_parallel_start");
445  KA_TRACE(20, ("GOMP_parallel_start: T#%d\n", gtid));
446 
447  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
448  if (num_threads != 0) {
449  __kmp_push_num_threads(&loc, gtid, num_threads);
450  }
451  __kmp_GOMP_fork_call(&loc, gtid, task,
452  (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
453  }
454  else {
455  __kmp_GOMP_serialized_parallel(&loc, gtid, task);
456  }
457 
458 #if OMPT_SUPPORT
459  if (ompt_enabled) {
460  parent_frame->reenter_runtime_frame = NULL;
461  }
462 #endif
463 }
464 
465 
466 void
467 xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(void)
468 {
469  int gtid = __kmp_get_gtid();
470  kmp_info_t *thr;
471 
472  thr = __kmp_threads[gtid];
473 
474  MKLOC(loc, "GOMP_parallel_end");
475  KA_TRACE(20, ("GOMP_parallel_end: T#%d\n", gtid));
476 
477 
478 #if OMPT_SUPPORT
479  ompt_parallel_id_t parallel_id;
480  ompt_frame_t *ompt_frame = NULL;
481 
482  if (ompt_enabled) {
483  ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
484  parallel_id = team_info->parallel_id;
485 
486  // Record that we re-entered the runtime system in the implicit
487  // task frame representing the parallel region.
488  ompt_frame = __ompt_get_task_frame_internal(0);
489  ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
490 
491 #if OMPT_TRACE
492  if (ompt_enabled &&
493  ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
494  ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
495  ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
496  parallel_id, task_info->task_id);
497  }
498 #endif
499 
500  // 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
503  if (lwt) {
504  __kmp_free(lwt);
505 
506 #if OMPT_SUPPORT
507  if (ompt_enabled) {
508  // Since a lightweight task was destroyed, make sure that the
509  // remaining deepest task knows the stack frame where the runtime
510  // was reentered.
511  ompt_frame = __ompt_get_task_frame_internal(0);
512  ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
513  }
514 #endif
515  }
516  }
517 #endif
518 
519  if (! thr->th.th_team->t.t_serialized) {
520  __kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
521  thr->th.th_team);
522 
523 #if OMPT_SUPPORT
524  if (ompt_enabled) {
525  // 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);
528  ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
529  }
530 #endif
531 
532  __kmp_join_call(&loc, gtid
533 #if OMPT_SUPPORT
534  , fork_context_gnu
535 #endif
536  );
537 #if OMPT_SUPPORT
538  if (ompt_enabled) {
539  ompt_frame->reenter_runtime_frame = NULL;
540  }
541 #endif
542  }
543  else {
544  __kmpc_end_serialized_parallel(&loc, gtid);
545 
546 #if OMPT_SUPPORT
547  if (ompt_enabled) {
548  // Record that we re-entered the runtime system in the frame that
549  // created the parallel region.
550  ompt_frame->reenter_runtime_frame = __builtin_frame_address(0);
551 
552  if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) {
553  ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
554  ompt_callbacks.ompt_callback(ompt_event_parallel_end)(
555  parallel_id, task_info->task_id,
556  OMPT_INVOKER(fork_context_gnu));
557  }
558 
559  ompt_frame->reenter_runtime_frame = NULL;
560 
561  thr->th.ompt_thread_info.state =
562  (((thr->th.th_team)->t.t_serialized) ?
563  ompt_state_work_serial : ompt_state_work_parallel);
564  }
565 #endif
566  }
567 }
568 
569 
570 //
571 // Loop worksharing constructs
572 //
573 
574 //
575 // The Gnu codegen passes in an exclusive upper bound for the overall range,
576 // but the libguide dispatch code expects an inclusive upper bound, hence the
577 // "end - incr" 5th argument to KMP_DISPATCH_INIT (and the " ub - str" 11th
578 // argument to __kmp_GOMP_fork_call).
579 //
580 // Conversely, KMP_DISPATCH_NEXT returns and inclusive upper bound in *p_ub,
581 // but the Gnu codegen expects an excluside upper bound, so the adjustment
582 // "*p_ub += stride" compenstates for the discrepancy.
583 //
584 // Correction: the gnu codegen always adjusts the upper bound by +-1, not the
585 // stride value. We adjust the dispatch parameters accordingly (by +-1), but
586 // we still adjust p_ub by the actual stride value.
587 //
588 // The "runtime" versions do not take a chunk_sz parameter.
589 //
590 // The profile lib cannot support construct checking of unordered loops that
591 // are predetermined by the compiler to be statically scheduled, as the gcc
592 // codegen will not always emit calls to GOMP_loop_static_next() to get the
593 // next iteration. Instead, it emits inline code to call omp_get_thread_num()
594 // num and calculate the iteration space using the result. It doesn't do this
595 // with ordered static loop, so they can be checked.
596 //
597 
598 #define LOOP_START(func,schedule) \
599  int func (long lb, long ub, long str, long chunk_sz, long *p_lb, \
600  long *p_ub) \
601  { \
602  int status; \
603  long stride; \
604  int gtid = __kmp_entry_gtid(); \
605  MKLOC(loc, #func); \
606  KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
607  gtid, lb, ub, str, chunk_sz )); \
608  \
609  if ((str > 0) ? (lb < ub) : (lb > ub)) { \
610  KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
611  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
612  (schedule) != kmp_sch_static); \
613  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
614  (kmp_int *)p_ub, (kmp_int *)&stride); \
615  if (status) { \
616  KMP_DEBUG_ASSERT(stride == str); \
617  *p_ub += (str > 0) ? 1 : -1; \
618  } \
619  } \
620  else { \
621  status = 0; \
622  } \
623  \
624  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
625  gtid, *p_lb, *p_ub, status)); \
626  return status; \
627  }
628 
629 
630 #define LOOP_RUNTIME_START(func,schedule) \
631  int func (long lb, long ub, long str, long *p_lb, long *p_ub) \
632  { \
633  int status; \
634  long stride; \
635  long chunk_sz = 0; \
636  int gtid = __kmp_entry_gtid(); \
637  MKLOC(loc, #func); \
638  KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
639  gtid, lb, ub, str, chunk_sz )); \
640  \
641  if ((str > 0) ? (lb < ub) : (lb > ub)) { \
642  KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
643  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, TRUE); \
644  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
645  (kmp_int *)p_ub, (kmp_int *)&stride); \
646  if (status) { \
647  KMP_DEBUG_ASSERT(stride == str); \
648  *p_ub += (str > 0) ? 1 : -1; \
649  } \
650  } \
651  else { \
652  status = 0; \
653  } \
654  \
655  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
656  gtid, *p_lb, *p_ub, status)); \
657  return status; \
658  }
659 
660 
661 #define LOOP_NEXT(func,fini_code) \
662  int func(long *p_lb, long *p_ub) \
663  { \
664  int status; \
665  long stride; \
666  int gtid = __kmp_get_gtid(); \
667  MKLOC(loc, #func); \
668  KA_TRACE(20, ( #func ": T#%d\n", gtid)); \
669  \
670  fini_code \
671  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
672  (kmp_int *)p_ub, (kmp_int *)&stride); \
673  if (status) { \
674  *p_ub += (stride > 0) ? 1 : -1; \
675  } \
676  \
677  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, stride 0x%lx, " \
678  "returning %d\n", gtid, *p_lb, *p_ub, stride, status)); \
679  return status; \
680  }
681 
682 
683 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_STATIC_START), kmp_sch_static)
684 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {})
685 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked)
686 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {})
687 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_GUIDED_START), kmp_sch_guided_chunked)
688 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {})
689 LOOP_RUNTIME_START(xexpand(KMP_API_NAME_GOMP_LOOP_RUNTIME_START), kmp_sch_runtime)
690 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {})
691 
692 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START), kmp_ord_static)
693 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT), \
694  { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
695 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START), kmp_ord_dynamic_chunked)
696 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT), \
697  { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
698 LOOP_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START), kmp_ord_guided_chunked)
699 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT), \
700  { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
701 LOOP_RUNTIME_START(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START), kmp_ord_runtime)
702 LOOP_NEXT(xexpand(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT), \
703  { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
704 
705 
706 void
707 xexpand(KMP_API_NAME_GOMP_LOOP_END)(void)
708 {
709  int gtid = __kmp_get_gtid();
710  KA_TRACE(20, ("GOMP_loop_end: T#%d\n", gtid))
711 
712  __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
713 
714  KA_TRACE(20, ("GOMP_loop_end exit: T#%d\n", gtid))
715 }
716 
717 
718 void
719 xexpand(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void)
720 {
721  KA_TRACE(20, ("GOMP_loop_end_nowait: T#%d\n", __kmp_get_gtid()))
722 }
723 
724 
725 //
726 // Unsigned long long loop worksharing constructs
727 //
728 // These are new with gcc 4.4
729 //
730 
731 #define LOOP_START_ULL(func,schedule) \
732  int func (int up, unsigned long long lb, unsigned long long ub, \
733  unsigned long long str, unsigned long long chunk_sz, \
734  unsigned long long *p_lb, unsigned long long *p_ub) \
735  { \
736  int status; \
737  long long str2 = up ? ((long long)str) : -((long long)str); \
738  long long stride; \
739  int gtid = __kmp_entry_gtid(); \
740  MKLOC(loc, #func); \
741  \
742  KA_TRACE(20, ( #func ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str 0x%llx, chunk_sz 0x%llx\n", \
743  gtid, up, lb, ub, str, chunk_sz )); \
744  \
745  if ((str > 0) ? (lb < ub) : (lb > ub)) { \
746  KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
747  (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
748  (schedule) != kmp_sch_static); \
749  status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, \
750  (kmp_uint64 *)p_lb, (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
751  if (status) { \
752  KMP_DEBUG_ASSERT(stride == str2); \
753  *p_ub += (str > 0) ? 1 : -1; \
754  } \
755  } \
756  else { \
757  status = 0; \
758  } \
759  \
760  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
761  gtid, *p_lb, *p_ub, status)); \
762  return status; \
763  }
764 
765 
766 #define LOOP_RUNTIME_START_ULL(func,schedule) \
767  int func (int up, unsigned long long lb, unsigned long long ub, \
768  unsigned long long str, unsigned long long *p_lb, \
769  unsigned long long *p_ub) \
770  { \
771  int status; \
772  long long str2 = up ? ((long long)str) : -((long long)str); \
773  unsigned long long stride; \
774  unsigned long long chunk_sz = 0; \
775  int gtid = __kmp_entry_gtid(); \
776  MKLOC(loc, #func); \
777  \
778  KA_TRACE(20, ( #func ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str 0x%llx, chunk_sz 0x%llx\n", \
779  gtid, up, lb, ub, str, chunk_sz )); \
780  \
781  if ((str > 0) ? (lb < ub) : (lb > ub)) { \
782  KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
783  (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, TRUE); \
784  status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, \
785  (kmp_uint64 *)p_lb, (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
786  if (status) { \
787  KMP_DEBUG_ASSERT((long long)stride == str2); \
788  *p_ub += (str > 0) ? 1 : -1; \
789  } \
790  } \
791  else { \
792  status = 0; \
793  } \
794  \
795  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
796  gtid, *p_lb, *p_ub, status)); \
797  return status; \
798  }
799 
800 
801 #define LOOP_NEXT_ULL(func,fini_code) \
802  int func(unsigned long long *p_lb, unsigned long long *p_ub) \
803  { \
804  int status; \
805  long long stride; \
806  int gtid = __kmp_get_gtid(); \
807  MKLOC(loc, #func); \
808  KA_TRACE(20, ( #func ": T#%d\n", gtid)); \
809  \
810  fini_code \
811  status = KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
812  (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
813  if (status) { \
814  *p_ub += (stride > 0) ? 1 : -1; \
815  } \
816  \
817  KA_TRACE(20, ( #func " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, stride 0x%llx, " \
818  "returning %d\n", gtid, *p_lb, *p_ub, stride, status)); \
819  return status; \
820  }
821 
822 
823 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START), kmp_sch_static)
824 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT), {})
825 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START), kmp_sch_dynamic_chunked)
826 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT), {})
827 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START), kmp_sch_guided_chunked)
828 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {})
829 LOOP_RUNTIME_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime)
830 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {})
831 
832 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START), kmp_ord_static)
833 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT), \
834  { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
835 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START), kmp_ord_dynamic_chunked)
836 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT), \
837  { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
838 LOOP_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START), kmp_ord_guided_chunked)
839 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT), \
840  { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
841 LOOP_RUNTIME_START_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START), kmp_ord_runtime)
842 LOOP_NEXT_ULL(xexpand(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), \
843  { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
844 
845 
846 //
847 // Combined parallel / loop worksharing constructs
848 //
849 // There are no ull versions (yet).
850 //
851 
852 #define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
853  void func (void (*task) (void *), void *data, unsigned num_threads, \
854  long lb, long ub, long str, long chunk_sz) \
855  { \
856  int gtid = __kmp_entry_gtid(); \
857  MKLOC(loc, #func); \
858  KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
859  gtid, lb, ub, str, chunk_sz )); \
860  \
861  ompt_pre(); \
862  \
863  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
864  if (num_threads != 0) { \
865  __kmp_push_num_threads(&loc, gtid, num_threads); \
866  } \
867  __kmp_GOMP_fork_call(&loc, gtid, task, \
868  (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
869  task, data, num_threads, &loc, (schedule), lb, \
870  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
871  } \
872  else { \
873  __kmp_GOMP_serialized_parallel(&loc, gtid, task); \
874  } \
875  \
876  KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
877  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
878  (schedule) != kmp_sch_static); \
879  \
880  ompt_post(); \
881  \
882  KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
883  }
884 
885 
886 
887 #if OMPT_SUPPORT
888 
889 #define OMPT_LOOP_PRE() \
890  ompt_frame_t *parent_frame; \
891  if (ompt_enabled) { \
892  parent_frame = __ompt_get_task_frame_internal(0); \
893  parent_frame->reenter_runtime_frame = __builtin_frame_address(0); \
894  }
895 
896 
897 #define OMPT_LOOP_POST() \
898  if (ompt_enabled) { \
899  parent_frame->reenter_runtime_frame = NULL; \
900  }
901 
902 #else
903 
904 #define OMPT_LOOP_PRE()
905 
906 #define OMPT_LOOP_POST()
907 
908 #endif
909 
910 
911 PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
912  kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST)
913 PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
914  kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
915 PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
916  kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
917 PARALLEL_LOOP_START(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
918  kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
919 
920 
921 //
922 // Tasking constructs
923 //
924 
925 void
926 xexpand(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data, void (*copy_func)(void *, void *),
927  long arg_size, long arg_align, int if_cond, unsigned gomp_flags)
928 {
929  MKLOC(loc, "GOMP_task");
930  int gtid = __kmp_entry_gtid();
931  kmp_int32 flags = 0;
932  kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *) & flags;
933 
934  KA_TRACE(20, ("GOMP_task: T#%d\n", gtid));
935 
936  // The low-order bit is the "tied" flag
937  if (gomp_flags & 1) {
938  input_flags->tiedness = 1;
939  }
940  // The second low-order bit is the "final" flag
941  if (gomp_flags & 2) {
942  input_flags->final = 1;
943  }
944  input_flags->native = 1;
945  // __kmp_task_alloc() sets up all other flags
946 
947  if (! if_cond) {
948  arg_size = 0;
949  }
950 
951  kmp_task_t *task = __kmp_task_alloc(&loc, gtid, input_flags,
952  sizeof(kmp_task_t), arg_size ? arg_size + arg_align - 1 : 0,
953  (kmp_routine_entry_t)func);
954 
955  if (arg_size > 0) {
956  if (arg_align > 0) {
957  task->shareds = (void *)((((size_t)task->shareds)
958  + arg_align - 1) / arg_align * arg_align);
959  }
960  //else error??
961 
962  if (copy_func) {
963  (*copy_func)(task->shareds, data);
964  }
965  else {
966  KMP_MEMCPY(task->shareds, data, arg_size);
967  }
968  }
969 
970  if (if_cond) {
971  __kmpc_omp_task(&loc, gtid, task);
972  }
973  else {
974 #if OMPT_SUPPORT
975  ompt_thread_info_t oldInfo;
976  kmp_info_t *thread;
977  kmp_taskdata_t *taskdata;
978  if (ompt_enabled) {
979  // Store the threads states and restore them after the task
980  thread = __kmp_threads[ gtid ];
981  taskdata = KMP_TASK_TO_TASKDATA(task);
982  oldInfo = thread->th.ompt_thread_info;
983  thread->th.ompt_thread_info.wait_id = 0;
984  thread->th.ompt_thread_info.state = ompt_state_work_parallel;
985  taskdata->ompt_task_info.frame.exit_runtime_frame =
986  __builtin_frame_address(0);
987  }
988 #endif
989 
990  __kmpc_omp_task_begin_if0(&loc, gtid, task);
991  func(data);
992  __kmpc_omp_task_complete_if0(&loc, gtid, task);
993 
994 #if OMPT_SUPPORT
995  if (ompt_enabled) {
996  thread->th.ompt_thread_info = oldInfo;
997  taskdata->ompt_task_info.frame.exit_runtime_frame = 0;
998  }
999 #endif
1000  }
1001 
1002  KA_TRACE(20, ("GOMP_task exit: T#%d\n", gtid));
1003 }
1004 
1005 
1006 void
1007 xexpand(KMP_API_NAME_GOMP_TASKWAIT)(void)
1008 {
1009  MKLOC(loc, "GOMP_taskwait");
1010  int gtid = __kmp_entry_gtid();
1011 
1012  KA_TRACE(20, ("GOMP_taskwait: T#%d\n", gtid));
1013 
1014  __kmpc_omp_taskwait(&loc, gtid);
1015 
1016  KA_TRACE(20, ("GOMP_taskwait exit: T#%d\n", gtid));
1017 }
1018 
1019 
1020 //
1021 // Sections worksharing constructs
1022 //
1023 
1024 //
1025 // For the sections construct, we initialize a dynamically scheduled loop
1026 // worksharing construct with lb 1 and stride 1, and use the iteration #'s
1027 // that its returns as sections ids.
1028 //
1029 // There are no special entry points for ordered sections, so we always use
1030 // the dynamically scheduled workshare, even if the sections aren't ordered.
1031 //
1032 
1033 unsigned
1034 xexpand(KMP_API_NAME_GOMP_SECTIONS_START)(unsigned count)
1035 {
1036  int status;
1037  kmp_int lb, ub, stride;
1038  int gtid = __kmp_entry_gtid();
1039  MKLOC(loc, "GOMP_sections_start");
1040  KA_TRACE(20, ("GOMP_sections_start: T#%d\n", gtid));
1041 
1042  KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1043 
1044  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1045  if (status) {
1046  KMP_DEBUG_ASSERT(stride == 1);
1047  KMP_DEBUG_ASSERT(lb > 0);
1048  KMP_ASSERT(lb == ub);
1049  }
1050  else {
1051  lb = 0;
1052  }
1053 
1054  KA_TRACE(20, ("GOMP_sections_start exit: T#%d returning %u\n", gtid,
1055  (unsigned)lb));
1056  return (unsigned)lb;
1057 }
1058 
1059 
1060 unsigned
1061 xexpand(KMP_API_NAME_GOMP_SECTIONS_NEXT)(void)
1062 {
1063  int status;
1064  kmp_int lb, ub, stride;
1065  int gtid = __kmp_get_gtid();
1066  MKLOC(loc, "GOMP_sections_next");
1067  KA_TRACE(20, ("GOMP_sections_next: T#%d\n", gtid));
1068 
1069  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1070  if (status) {
1071  KMP_DEBUG_ASSERT(stride == 1);
1072  KMP_DEBUG_ASSERT(lb > 0);
1073  KMP_ASSERT(lb == ub);
1074  }
1075  else {
1076  lb = 0;
1077  }
1078 
1079  KA_TRACE(20, ("GOMP_sections_next exit: T#%d returning %u\n", gtid,
1080  (unsigned)lb));
1081  return (unsigned)lb;
1082 }
1083 
1084 
1085 void
1086 xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(void (*task) (void *), void *data,
1087  unsigned num_threads, unsigned count)
1088 {
1089  int gtid = __kmp_entry_gtid();
1090 
1091 #if OMPT_SUPPORT
1092  ompt_frame_t *parent_frame;
1093 
1094  if (ompt_enabled) {
1095  parent_frame = __ompt_get_task_frame_internal(0);
1096  parent_frame->reenter_runtime_frame = __builtin_frame_address(0);
1097  }
1098 #endif
1099 
1100  MKLOC(loc, "GOMP_parallel_sections_start");
1101  KA_TRACE(20, ("GOMP_parallel_sections_start: T#%d\n", gtid));
1102 
1103  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1104  if (num_threads != 0) {
1105  __kmp_push_num_threads(&loc, gtid, num_threads);
1106  }
1107  __kmp_GOMP_fork_call(&loc, gtid, task,
1108  (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
1109  num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
1110  (kmp_int)count, (kmp_int)1, (kmp_int)1);
1111  }
1112  else {
1113  __kmp_GOMP_serialized_parallel(&loc, gtid, task);
1114  }
1115 
1116 #if OMPT_SUPPORT
1117  if (ompt_enabled) {
1118  parent_frame->reenter_runtime_frame = NULL;
1119  }
1120 #endif
1121 
1122  KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1123 
1124  KA_TRACE(20, ("GOMP_parallel_sections_start exit: T#%d\n", gtid));
1125 }
1126 
1127 
1128 void
1129 xexpand(KMP_API_NAME_GOMP_SECTIONS_END)(void)
1130 {
1131  int gtid = __kmp_get_gtid();
1132  KA_TRACE(20, ("GOMP_sections_end: T#%d\n", gtid))
1133 
1134  __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
1135 
1136  KA_TRACE(20, ("GOMP_sections_end exit: T#%d\n", gtid))
1137 }
1138 
1139 
1140 void
1141 xexpand(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT)(void)
1142 {
1143  KA_TRACE(20, ("GOMP_sections_end_nowait: T#%d\n", __kmp_get_gtid()))
1144 }
1145 
1146 // libgomp has an empty function for GOMP_taskyield as of 2013-10-10
1147 void
1148 xexpand(KMP_API_NAME_GOMP_TASKYIELD)(void)
1149 {
1150  KA_TRACE(20, ("GOMP_taskyield: T#%d\n", __kmp_get_gtid()))
1151  return;
1152 }
1153 
1154 #if OMP_40_ENABLED // these are new GOMP_4.0 entry points
1155 
1156 void
1157 xexpand(KMP_API_NAME_GOMP_PARALLEL)(void (*task)(void *), void *data, unsigned num_threads, unsigned int flags)
1158 {
1159  int gtid = __kmp_entry_gtid();
1160  MKLOC(loc, "GOMP_parallel");
1161  KA_TRACE(20, ("GOMP_parallel: T#%d\n", gtid));
1162 
1163  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1164  if (num_threads != 0) {
1165  __kmp_push_num_threads(&loc, gtid, num_threads);
1166  }
1167  if(flags != 0) {
1168  __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
1169  }
1170  __kmp_GOMP_fork_call(&loc, gtid, task,
1171  (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task, data);
1172  }
1173  else {
1174  __kmp_GOMP_serialized_parallel(&loc, gtid, task);
1175  }
1176  task(data);
1177  xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
1178 }
1179 
1180 void
1181 xexpand(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task) (void *), void *data,
1182  unsigned num_threads, unsigned count, unsigned flags)
1183 {
1184  int gtid = __kmp_entry_gtid();
1185  MKLOC(loc, "GOMP_parallel_sections");
1186  KA_TRACE(20, ("GOMP_parallel_sections: T#%d\n", gtid));
1187 
1188  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) {
1189  if (num_threads != 0) {
1190  __kmp_push_num_threads(&loc, gtid, num_threads);
1191  }
1192  if(flags != 0) {
1193  __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags);
1194  }
1195  __kmp_GOMP_fork_call(&loc, gtid, task,
1196  (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, task, data,
1197  num_threads, &loc, kmp_nm_dynamic_chunked, (kmp_int)1,
1198  (kmp_int)count, (kmp_int)1, (kmp_int)1);
1199  }
1200  else {
1201  __kmp_GOMP_serialized_parallel(&loc, gtid, task);
1202  }
1203 
1204  KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1205 
1206  task(data);
1207  xexpand(KMP_API_NAME_GOMP_PARALLEL_END)();
1208  KA_TRACE(20, ("GOMP_parallel_sections exit: T#%d\n", gtid));
1209 }
1210 
1211 #define PARALLEL_LOOP(func, schedule) \
1212  void func (void (*task) (void *), void *data, unsigned num_threads, \
1213  long lb, long ub, long str, long chunk_sz, unsigned flags) \
1214  { \
1215  int gtid = __kmp_entry_gtid(); \
1216  MKLOC(loc, #func); \
1217  KA_TRACE(20, ( #func ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1218  gtid, lb, ub, str, chunk_sz )); \
1219  \
1220  if (__kmpc_ok_to_fork(&loc) && (num_threads != 1)) { \
1221  if (num_threads != 0) { \
1222  __kmp_push_num_threads(&loc, gtid, num_threads); \
1223  } \
1224  if (flags != 0) { \
1225  __kmp_push_proc_bind(&loc, gtid, (kmp_proc_bind_t)flags); \
1226  } \
1227  __kmp_GOMP_fork_call(&loc, gtid, task, \
1228  (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9, \
1229  task, data, num_threads, &loc, (schedule), lb, \
1230  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1231  } \
1232  else { \
1233  __kmp_GOMP_serialized_parallel(&loc, gtid, task); \
1234  } \
1235  \
1236  KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1237  (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1238  (schedule) != kmp_sch_static); \
1239  task(data); \
1240  xexpand(KMP_API_NAME_GOMP_PARALLEL_END)(); \
1241  \
1242  KA_TRACE(20, ( #func " exit: T#%d\n", gtid)); \
1243  }
1244 
1245 PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC), kmp_sch_static)
1246 PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC), kmp_sch_dynamic_chunked)
1247 PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED), kmp_sch_guided_chunked)
1248 PARALLEL_LOOP(xexpand(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), kmp_sch_runtime)
1249 
1250 
1251 void
1252 xexpand(KMP_API_NAME_GOMP_TASKGROUP_START)(void)
1253 {
1254  int gtid = __kmp_get_gtid();
1255  MKLOC(loc, "GOMP_taskgroup_start");
1256  KA_TRACE(20, ("GOMP_taskgroup_start: T#%d\n", gtid));
1257 
1258  __kmpc_taskgroup(&loc, gtid);
1259 
1260  return;
1261 }
1262 
1263 void
1264 xexpand(KMP_API_NAME_GOMP_TASKGROUP_END)(void)
1265 {
1266  int gtid = __kmp_get_gtid();
1267  MKLOC(loc, "GOMP_taskgroup_end");
1268  KA_TRACE(20, ("GOMP_taskgroup_end: T#%d\n", gtid));
1269 
1270  __kmpc_end_taskgroup(&loc, gtid);
1271 
1272  return;
1273 }
1274 
1275 #ifndef KMP_DEBUG
1276 static
1277 #endif /* KMP_DEBUG */
1278 kmp_int32 __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
1279  kmp_int32 cncl_kind = 0;
1280  switch(gomp_kind) {
1281  case 1:
1282  cncl_kind = cancel_parallel;
1283  break;
1284  case 2:
1285  cncl_kind = cancel_loop;
1286  break;
1287  case 4:
1288  cncl_kind = cancel_sections;
1289  break;
1290  case 8:
1291  cncl_kind = cancel_taskgroup;
1292  break;
1293  }
1294  return cncl_kind;
1295 }
1296 
1297 bool
1298 xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(int which)
1299 {
1300  if(__kmp_omp_cancellation) {
1301  KMP_FATAL(NoGompCancellation);
1302  }
1303  int gtid = __kmp_get_gtid();
1304  MKLOC(loc, "GOMP_cancellation_point");
1305  KA_TRACE(20, ("GOMP_cancellation_point: T#%d\n", gtid));
1306 
1307  kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1308 
1309  return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1310 }
1311 
1312 bool
1313 xexpand(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void)
1314 {
1315  if(__kmp_omp_cancellation) {
1316  KMP_FATAL(NoGompCancellation);
1317  }
1318  KMP_FATAL(NoGompCancellation);
1319  int gtid = __kmp_get_gtid();
1320  MKLOC(loc, "GOMP_barrier_cancel");
1321  KA_TRACE(20, ("GOMP_barrier_cancel: T#%d\n", gtid));
1322 
1323  return __kmpc_cancel_barrier(&loc, gtid);
1324 }
1325 
1326 bool
1327 xexpand(KMP_API_NAME_GOMP_CANCEL)(int which, bool do_cancel)
1328 {
1329  if(__kmp_omp_cancellation) {
1330  KMP_FATAL(NoGompCancellation);
1331  } else {
1332  return FALSE;
1333  }
1334 
1335  int gtid = __kmp_get_gtid();
1336  MKLOC(loc, "GOMP_cancel");
1337  KA_TRACE(20, ("GOMP_cancel: T#%d\n", gtid));
1338 
1339  kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1340 
1341  if(do_cancel == FALSE) {
1342  return xexpand(KMP_API_NAME_GOMP_CANCELLATION_POINT)(which);
1343  } else {
1344  return __kmpc_cancel(&loc, gtid, cncl_kind);
1345  }
1346 }
1347 
1348 bool
1349 xexpand(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void)
1350 {
1351  if(__kmp_omp_cancellation) {
1352  KMP_FATAL(NoGompCancellation);
1353  }
1354  int gtid = __kmp_get_gtid();
1355  MKLOC(loc, "GOMP_sections_end_cancel");
1356  KA_TRACE(20, ("GOMP_sections_end_cancel: T#%d\n", gtid));
1357 
1358  return __kmpc_cancel_barrier(&loc, gtid);
1359 }
1360 
1361 bool
1362 xexpand(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void)
1363 {
1364  if(__kmp_omp_cancellation) {
1365  KMP_FATAL(NoGompCancellation);
1366  }
1367  int gtid = __kmp_get_gtid();
1368  MKLOC(loc, "GOMP_loop_end_cancel");
1369  KA_TRACE(20, ("GOMP_loop_end_cancel: T#%d\n", gtid));
1370 
1371  return __kmpc_cancel_barrier(&loc, gtid);
1372 }
1373 
1374 // All target functions are empty as of 2014-05-29
1375 void
1376 xexpand(KMP_API_NAME_GOMP_TARGET)(int device, void (*fn) (void *), const void *openmp_target,
1377  size_t mapnum, void **hostaddrs, size_t *sizes, unsigned char *kinds)
1378 {
1379  return;
1380 }
1381 
1382 void
1383 xexpand(KMP_API_NAME_GOMP_TARGET_DATA)(int device, const void *openmp_target, size_t mapnum,
1384  void **hostaddrs, size_t *sizes, unsigned char *kinds)
1385 {
1386  return;
1387 }
1388 
1389 void
1390 xexpand(KMP_API_NAME_GOMP_TARGET_END_DATA)(void)
1391 {
1392  return;
1393 }
1394 
1395 void
1396 xexpand(KMP_API_NAME_GOMP_TARGET_UPDATE)(int device, const void *openmp_target, size_t mapnum,
1397  void **hostaddrs, size_t *sizes, unsigned char *kinds)
1398 {
1399  return;
1400 }
1401 
1402 void
1403 xexpand(KMP_API_NAME_GOMP_TEAMS)(unsigned int num_teams, unsigned int thread_limit)
1404 {
1405  return;
1406 }
1407 #endif // OMP_40_ENABLED
1408 
1409 
1410 /*
1411  The following sections of code create aliases for the GOMP_* functions,
1412  then create versioned symbols using the assembler directive .symver.
1413  This is only pertinent for ELF .so library
1414  xaliasify and xversionify are defined in kmp_ftn_os.h
1415 */
1416 
1417 #ifdef KMP_USE_VERSION_SYMBOLS
1418 
1419 // GOMP_1.0 aliases
1420 xaliasify(KMP_API_NAME_GOMP_ATOMIC_END, 10);
1421 xaliasify(KMP_API_NAME_GOMP_ATOMIC_START, 10);
1422 xaliasify(KMP_API_NAME_GOMP_BARRIER, 10);
1423 xaliasify(KMP_API_NAME_GOMP_CRITICAL_END, 10);
1424 xaliasify(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10);
1425 xaliasify(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10);
1426 xaliasify(KMP_API_NAME_GOMP_CRITICAL_START, 10);
1427 xaliasify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10);
1428 xaliasify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10);
1429 xaliasify(KMP_API_NAME_GOMP_LOOP_END, 10);
1430 xaliasify(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10);
1431 xaliasify(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10);
1432 xaliasify(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10);
1433 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10);
1434 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10);
1435 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10);
1436 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10);
1437 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10);
1438 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10);
1439 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10);
1440 xaliasify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10);
1441 xaliasify(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10);
1442 xaliasify(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10);
1443 xaliasify(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10);
1444 xaliasify(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10);
1445 xaliasify(KMP_API_NAME_GOMP_ORDERED_END, 10);
1446 xaliasify(KMP_API_NAME_GOMP_ORDERED_START, 10);
1447 xaliasify(KMP_API_NAME_GOMP_PARALLEL_END, 10);
1448 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10);
1449 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10);
1450 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10);
1451 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10);
1452 xaliasify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10);
1453 xaliasify(KMP_API_NAME_GOMP_PARALLEL_START, 10);
1454 xaliasify(KMP_API_NAME_GOMP_SECTIONS_END, 10);
1455 xaliasify(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10);
1456 xaliasify(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10);
1457 xaliasify(KMP_API_NAME_GOMP_SECTIONS_START, 10);
1458 xaliasify(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10);
1459 xaliasify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10);
1460 xaliasify(KMP_API_NAME_GOMP_SINGLE_START, 10);
1461 
1462 // GOMP_2.0 aliases
1463 xaliasify(KMP_API_NAME_GOMP_TASK, 20);
1464 xaliasify(KMP_API_NAME_GOMP_TASKWAIT, 20);
1465 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20);
1466 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20);
1467 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20);
1468 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20);
1469 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20);
1470 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20);
1471 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20);
1472 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20);
1473 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20);
1474 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20);
1475 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20);
1476 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20);
1477 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20);
1478 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20);
1479 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20);
1480 xaliasify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20);
1481 
1482 // GOMP_3.0 aliases
1483 xaliasify(KMP_API_NAME_GOMP_TASKYIELD, 30);
1484 
1485 // GOMP_4.0 aliases
1486 // The GOMP_parallel* entry points below aren't OpenMP 4.0 related.
1487 #if OMP_40_ENABLED
1488 xaliasify(KMP_API_NAME_GOMP_PARALLEL, 40);
1489 xaliasify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40);
1490 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40);
1491 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40);
1492 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40);
1493 xaliasify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40);
1494 xaliasify(KMP_API_NAME_GOMP_TASKGROUP_START, 40);
1495 xaliasify(KMP_API_NAME_GOMP_TASKGROUP_END, 40);
1496 xaliasify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40);
1497 xaliasify(KMP_API_NAME_GOMP_CANCEL, 40);
1498 xaliasify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40);
1499 xaliasify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40);
1500 xaliasify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40);
1501 xaliasify(KMP_API_NAME_GOMP_TARGET, 40);
1502 xaliasify(KMP_API_NAME_GOMP_TARGET_DATA, 40);
1503 xaliasify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40);
1504 xaliasify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40);
1505 xaliasify(KMP_API_NAME_GOMP_TEAMS, 40);
1506 #endif
1507 
1508 // GOMP_1.0 versioned symbols
1509 xversionify(KMP_API_NAME_GOMP_ATOMIC_END, 10, "GOMP_1.0");
1510 xversionify(KMP_API_NAME_GOMP_ATOMIC_START, 10, "GOMP_1.0");
1511 xversionify(KMP_API_NAME_GOMP_BARRIER, 10, "GOMP_1.0");
1512 xversionify(KMP_API_NAME_GOMP_CRITICAL_END, 10, "GOMP_1.0");
1513 xversionify(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10, "GOMP_1.0");
1514 xversionify(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10, "GOMP_1.0");
1515 xversionify(KMP_API_NAME_GOMP_CRITICAL_START, 10, "GOMP_1.0");
1516 xversionify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10, "GOMP_1.0");
1517 xversionify(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10, "GOMP_1.0");
1518 xversionify(KMP_API_NAME_GOMP_LOOP_END, 10, "GOMP_1.0");
1519 xversionify(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10, "GOMP_1.0");
1520 xversionify(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10, "GOMP_1.0");
1521 xversionify(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10, "GOMP_1.0");
1522 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10, "GOMP_1.0");
1523 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10, "GOMP_1.0");
1524 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10, "GOMP_1.0");
1525 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10, "GOMP_1.0");
1526 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10, "GOMP_1.0");
1527 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10, "GOMP_1.0");
1528 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10, "GOMP_1.0");
1529 xversionify(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10, "GOMP_1.0");
1530 xversionify(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10, "GOMP_1.0");
1531 xversionify(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10, "GOMP_1.0");
1532 xversionify(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10, "GOMP_1.0");
1533 xversionify(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10, "GOMP_1.0");
1534 xversionify(KMP_API_NAME_GOMP_ORDERED_END, 10, "GOMP_1.0");
1535 xversionify(KMP_API_NAME_GOMP_ORDERED_START, 10, "GOMP_1.0");
1536 xversionify(KMP_API_NAME_GOMP_PARALLEL_END, 10, "GOMP_1.0");
1537 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10, "GOMP_1.0");
1538 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10, "GOMP_1.0");
1539 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10, "GOMP_1.0");
1540 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10, "GOMP_1.0");
1541 xversionify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10, "GOMP_1.0");
1542 xversionify(KMP_API_NAME_GOMP_PARALLEL_START, 10, "GOMP_1.0");
1543 xversionify(KMP_API_NAME_GOMP_SECTIONS_END, 10, "GOMP_1.0");
1544 xversionify(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10, "GOMP_1.0");
1545 xversionify(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10, "GOMP_1.0");
1546 xversionify(KMP_API_NAME_GOMP_SECTIONS_START, 10, "GOMP_1.0");
1547 xversionify(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10, "GOMP_1.0");
1548 xversionify(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10, "GOMP_1.0");
1549 xversionify(KMP_API_NAME_GOMP_SINGLE_START, 10, "GOMP_1.0");
1550 
1551 // GOMP_2.0 versioned symbols
1552 xversionify(KMP_API_NAME_GOMP_TASK, 20, "GOMP_2.0");
1553 xversionify(KMP_API_NAME_GOMP_TASKWAIT, 20, "GOMP_2.0");
1554 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20, "GOMP_2.0");
1555 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20, "GOMP_2.0");
1556 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20, "GOMP_2.0");
1557 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20, "GOMP_2.0");
1558 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20, "GOMP_2.0");
1559 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20, "GOMP_2.0");
1560 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20, "GOMP_2.0");
1561 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20, "GOMP_2.0");
1562 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20, "GOMP_2.0");
1563 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20, "GOMP_2.0");
1564 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20, "GOMP_2.0");
1565 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20, "GOMP_2.0");
1566 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20, "GOMP_2.0");
1567 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20, "GOMP_2.0");
1568 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20, "GOMP_2.0");
1569 xversionify(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20, "GOMP_2.0");
1570 
1571 // GOMP_3.0 versioned symbols
1572 xversionify(KMP_API_NAME_GOMP_TASKYIELD, 30, "GOMP_3.0");
1573 
1574 // GOMP_4.0 versioned symbols
1575 #if OMP_40_ENABLED
1576 xversionify(KMP_API_NAME_GOMP_PARALLEL, 40, "GOMP_4.0");
1577 xversionify(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40, "GOMP_4.0");
1578 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40, "GOMP_4.0");
1579 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40, "GOMP_4.0");
1580 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40, "GOMP_4.0");
1581 xversionify(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40, "GOMP_4.0");
1582 xversionify(KMP_API_NAME_GOMP_TASKGROUP_START, 40, "GOMP_4.0");
1583 xversionify(KMP_API_NAME_GOMP_TASKGROUP_END, 40, "GOMP_4.0");
1584 xversionify(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40, "GOMP_4.0");
1585 xversionify(KMP_API_NAME_GOMP_CANCEL, 40, "GOMP_4.0");
1586 xversionify(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40, "GOMP_4.0");
1587 xversionify(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40, "GOMP_4.0");
1588 xversionify(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40, "GOMP_4.0");
1589 xversionify(KMP_API_NAME_GOMP_TARGET, 40, "GOMP_4.0");
1590 xversionify(KMP_API_NAME_GOMP_TARGET_DATA, 40, "GOMP_4.0");
1591 xversionify(KMP_API_NAME_GOMP_TARGET_END_DATA, 40, "GOMP_4.0");
1592 xversionify(KMP_API_NAME_GOMP_TARGET_UPDATE, 40, "GOMP_4.0");
1593 xversionify(KMP_API_NAME_GOMP_TEAMS, 40, "GOMP_4.0");
1594 #endif
1595 
1596 #endif // KMP_USE_VERSION_SYMBOLS
1597 
1598 #ifdef __cplusplus
1599  } //extern "C"
1600 #endif // __cplusplus
1601 
1602 
KMP_EXPORT void __kmpc_end_ordered(ident_t *, kmp_int32 global_tid)
Definition: kmp_csupport.c:889
KMP_EXPORT void __kmpc_end_serialized_parallel(ident_t *, kmp_int32 global_tid)
Definition: kmp_csupport.c:489
KMP_EXPORT void __kmpc_ordered(ident_t *, kmp_int32 global_tid)
Definition: kmp_csupport.c:825
KMP_EXPORT void __kmpc_critical(ident_t *, kmp_int32 global_tid, kmp_critical_name *)
Definition: kmp.h:200
KMP_EXPORT kmp_int32 __kmpc_ok_to_fork(ident_t *)
Definition: kmp_csupport.c:161
KMP_EXPORT void __kmpc_barrier(ident_t *, kmp_int32 global_tid)
Definition: kmp_csupport.c:697
KMP_EXPORT void __kmpc_end_critical(ident_t *, kmp_int32 global_tid, kmp_critical_name *)
sched_type
Definition: kmp.h:302