14 #include "kmp_atomic.h"
17 #include "ompt-specific.h"
21 KMP_GOMP_TASK_UNTIED_FLAG = 1,
22 KMP_GOMP_TASK_FINAL_FLAG = 2,
23 KMP_GOMP_TASK_DEPENDS_FLAG = 8
28 class kmp_gomp_depends_info_t {
31 size_t num_out, num_mutexinout, num_in;
35 kmp_gomp_depends_info_t(
void **depend) : depend(depend) {
36 size_t ndeps = (kmp_intptr_t)depend[0];
46 num_out = (kmp_intptr_t)depend[1];
47 num_in = ndeps - num_out;
52 ndeps = (kmp_intptr_t)depend[1];
53 num_out = (kmp_intptr_t)depend[2];
54 num_mutexinout = (kmp_intptr_t)depend[3];
55 num_in = (kmp_intptr_t)depend[4];
56 num_doable = num_out + num_mutexinout + num_in;
60 if (ndeps != num_doable) {
61 KMP_FATAL(GompFeatureNotSupported,
"depobj");
63 num_deps =
static_cast<kmp_int32
>(ndeps);
65 kmp_int32 get_num_deps()
const {
return num_deps; }
66 kmp_depend_info_t get_kmp_depend(
size_t index)
const {
67 kmp_depend_info_t retval;
68 memset(&retval,
'\0',
sizeof(retval));
69 KMP_ASSERT(index < (
size_t)num_deps);
70 retval.base_addr = (kmp_intptr_t)depend[offset + index];
75 if (index < num_out) {
78 }
else if (index >= num_out && index < (num_out + num_mutexinout)) {
91 #define MKLOC(loc, routine) \
92 static ident_t loc = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"};
94 #include "kmp_ftn_os.h"
96 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER)(void) {
97 int gtid = __kmp_entry_gtid();
98 MKLOC(loc,
"GOMP_barrier");
99 KA_TRACE(20, (
"GOMP_barrier: T#%d\n", gtid));
100 #if OMPT_SUPPORT && OMPT_OPTIONAL
101 ompt_frame_t *ompt_frame;
102 if (ompt_enabled.enabled) {
103 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
104 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
106 OMPT_STORE_RETURN_ADDRESS(gtid);
109 #if OMPT_SUPPORT && OMPT_OPTIONAL
110 if (ompt_enabled.enabled) {
111 ompt_frame->enter_frame = ompt_data_none;
125 extern kmp_critical_name *__kmp_unnamed_critical_addr;
127 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CRITICAL_START)(void) {
128 int gtid = __kmp_entry_gtid();
129 MKLOC(loc,
"GOMP_critical_start");
130 KA_TRACE(20, (
"GOMP_critical_start: T#%d\n", gtid));
131 #if OMPT_SUPPORT && OMPT_OPTIONAL
132 OMPT_STORE_RETURN_ADDRESS(gtid);
137 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CRITICAL_END)(void) {
138 int gtid = __kmp_get_gtid();
139 MKLOC(loc,
"GOMP_critical_end");
140 KA_TRACE(20, (
"GOMP_critical_end: T#%d\n", gtid));
141 #if OMPT_SUPPORT && OMPT_OPTIONAL
142 OMPT_STORE_RETURN_ADDRESS(gtid);
147 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CRITICAL_NAME_START)(
void **pptr) {
148 int gtid = __kmp_entry_gtid();
149 MKLOC(loc,
"GOMP_critical_name_start");
150 KA_TRACE(20, (
"GOMP_critical_name_start: T#%d\n", gtid));
154 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CRITICAL_NAME_END)(
void **pptr) {
155 int gtid = __kmp_get_gtid();
156 MKLOC(loc,
"GOMP_critical_name_end");
157 KA_TRACE(20, (
"GOMP_critical_name_end: T#%d\n", gtid));
164 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ATOMIC_START)(void) {
165 int gtid = __kmp_entry_gtid();
166 KA_TRACE(20, (
"GOMP_atomic_start: T#%d\n", gtid));
169 __ompt_thread_assign_wait_id(0);
172 __kmp_acquire_atomic_lock(&__kmp_atomic_lock, gtid);
175 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ATOMIC_END)(void) {
176 int gtid = __kmp_get_gtid();
177 KA_TRACE(20, (
"GOMP_atomic_end: T#%d\n", gtid));
178 __kmp_release_atomic_lock(&__kmp_atomic_lock, gtid);
181 int KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_START)(void) {
182 int gtid = __kmp_entry_gtid();
183 MKLOC(loc,
"GOMP_single_start");
184 KA_TRACE(20, (
"GOMP_single_start: T#%d\n", gtid));
186 if (!TCR_4(__kmp_init_parallel))
187 __kmp_parallel_initialize();
188 __kmp_resume_if_soft_paused();
193 kmp_int32 rc = __kmp_enter_single(gtid, &loc, FALSE);
195 #if OMPT_SUPPORT && OMPT_OPTIONAL
196 kmp_info_t *this_thr = __kmp_threads[gtid];
197 kmp_team_t *team = this_thr->th.th_team;
198 int tid = __kmp_tid_from_gtid(gtid);
200 if (ompt_enabled.enabled) {
202 if (ompt_enabled.ompt_callback_work) {
203 ompt_callbacks.ompt_callback(ompt_callback_work)(
204 ompt_work_single_executor, ompt_scope_begin,
205 &(team->t.ompt_team_info.parallel_data),
206 &(team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data),
207 1, OMPT_GET_RETURN_ADDRESS(0));
210 if (ompt_enabled.ompt_callback_work) {
211 ompt_callbacks.ompt_callback(ompt_callback_work)(
212 ompt_work_single_other, ompt_scope_begin,
213 &(team->t.ompt_team_info.parallel_data),
214 &(team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data),
215 1, OMPT_GET_RETURN_ADDRESS(0));
216 ompt_callbacks.ompt_callback(ompt_callback_work)(
217 ompt_work_single_other, ompt_scope_end,
218 &(team->t.ompt_team_info.parallel_data),
219 &(team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data),
220 1, OMPT_GET_RETURN_ADDRESS(0));
229 void *KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_COPY_START)(void) {
231 int gtid = __kmp_entry_gtid();
232 MKLOC(loc,
"GOMP_single_copy_start");
233 KA_TRACE(20, (
"GOMP_single_copy_start: T#%d\n", gtid));
235 if (!TCR_4(__kmp_init_parallel))
236 __kmp_parallel_initialize();
237 __kmp_resume_if_soft_paused();
242 if (__kmp_enter_single(gtid, &loc, FALSE))
248 #if OMPT_SUPPORT && OMPT_OPTIONAL
249 ompt_frame_t *ompt_frame;
250 if (ompt_enabled.enabled) {
251 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
252 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
254 OMPT_STORE_RETURN_ADDRESS(gtid);
256 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
260 retval = __kmp_team_from_gtid(gtid)->t.t_copypriv_data;
262 #if OMPT_SUPPORT && OMPT_OPTIONAL
263 OMPT_STORE_RETURN_ADDRESS(gtid);
265 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
267 #if OMPT_SUPPORT && OMPT_OPTIONAL
268 if (ompt_enabled.enabled) {
269 ompt_frame->enter_frame = ompt_data_none;
275 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_COPY_END)(
void *data) {
276 int gtid = __kmp_get_gtid();
277 KA_TRACE(20, (
"GOMP_single_copy_end: T#%d\n", gtid));
283 __kmp_team_from_gtid(gtid)->t.t_copypriv_data = data;
284 #if OMPT_SUPPORT && OMPT_OPTIONAL
285 ompt_frame_t *ompt_frame;
286 if (ompt_enabled.enabled) {
287 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
288 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
290 OMPT_STORE_RETURN_ADDRESS(gtid);
292 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
294 #if OMPT_SUPPORT && OMPT_OPTIONAL
295 OMPT_STORE_RETURN_ADDRESS(gtid);
297 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
299 #if OMPT_SUPPORT && OMPT_OPTIONAL
300 if (ompt_enabled.enabled) {
301 ompt_frame->enter_frame = ompt_data_none;
306 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ORDERED_START)(void) {
307 int gtid = __kmp_entry_gtid();
308 MKLOC(loc,
"GOMP_ordered_start");
309 KA_TRACE(20, (
"GOMP_ordered_start: T#%d\n", gtid));
310 #if OMPT_SUPPORT && OMPT_OPTIONAL
311 OMPT_STORE_RETURN_ADDRESS(gtid);
316 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ORDERED_END)(void) {
317 int gtid = __kmp_get_gtid();
318 MKLOC(loc,
"GOMP_ordered_end");
319 KA_TRACE(20, (
"GOMP_ordered_start: T#%d\n", gtid));
320 #if OMPT_SUPPORT && OMPT_OPTIONAL
321 OMPT_STORE_RETURN_ADDRESS(gtid);
331 #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS
332 #define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_4
333 #define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_4
334 #define KMP_DISPATCH_NEXT __kmpc_dispatch_next_4
336 #define KMP_DISPATCH_INIT __kmp_aux_dispatch_init_8
337 #define KMP_DISPATCH_FINI_CHUNK __kmp_aux_dispatch_fini_chunk_8
338 #define KMP_DISPATCH_NEXT __kmpc_dispatch_next_8
341 #define KMP_DISPATCH_INIT_ULL __kmp_aux_dispatch_init_8u
342 #define KMP_DISPATCH_FINI_CHUNK_ULL __kmp_aux_dispatch_fini_chunk_8u
343 #define KMP_DISPATCH_NEXT_ULL __kmpc_dispatch_next_8u
351 __kmp_GOMP_microtask_wrapper(
int *gtid,
int *npr,
void (*task)(
void *),
355 ompt_frame_t *ompt_frame;
356 ompt_state_t enclosing_state;
358 if (ompt_enabled.enabled) {
360 thr = __kmp_threads[*gtid];
363 enclosing_state = thr->th.ompt_thread_info.state;
364 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
367 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
368 ompt_frame->exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
375 if (ompt_enabled.enabled) {
377 ompt_frame->exit_frame = ompt_data_none;
380 thr->th.ompt_thread_info.state = enclosing_state;
389 __kmp_GOMP_parallel_microtask_wrapper(
int *gtid,
int *npr,
390 void (*task)(
void *),
void *data,
391 unsigned num_threads,
ident_t *loc,
397 KMP_DISPATCH_INIT(loc, *gtid, schedule, start, end, incr, chunk_size,
402 ompt_frame_t *ompt_frame;
403 ompt_state_t enclosing_state;
405 if (ompt_enabled.enabled) {
406 thr = __kmp_threads[*gtid];
408 enclosing_state = thr->th.ompt_thread_info.state;
409 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
412 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
413 ompt_frame->exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
421 if (ompt_enabled.enabled) {
423 ompt_frame->exit_frame = ompt_data_none;
426 thr->th.ompt_thread_info.state = enclosing_state;
431 static void __kmp_GOMP_fork_call(
ident_t *loc,
int gtid,
unsigned num_threads,
432 unsigned flags,
void (*unwrapped_task)(
void *),
433 microtask_t wrapper,
int argc, ...) {
435 kmp_info_t *thr = __kmp_threads[gtid];
436 kmp_team_t *team = thr->th.th_team;
437 int tid = __kmp_tid_from_gtid(gtid);
442 if (num_threads != 0)
443 __kmp_push_num_threads(loc, gtid, num_threads);
445 __kmp_push_proc_bind(loc, gtid, (kmp_proc_bind_t)flags);
446 rc = __kmp_fork_call(loc, gtid, fork_context_gnu, argc, wrapper,
447 __kmp_invoke_task_func, kmp_va_addr_of(ap));
452 __kmp_run_before_invoked_task(gtid, tid, thr, team);
457 if (ompt_enabled.enabled) {
458 ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
459 ompt_task_info_t *task_info = __ompt_get_task_info_object(0);
462 if (ompt_enabled.ompt_callback_implicit_task) {
463 ompt_team_size = __kmp_team_from_gtid(gtid)->t.t_nproc;
464 ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
465 ompt_scope_begin, &(team_info->parallel_data),
466 &(task_info->task_data), ompt_team_size, __kmp_tid_from_gtid(gtid),
468 task_info->thread_num = __kmp_tid_from_gtid(gtid);
470 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
475 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_START)(void (*task)(
void *),
477 unsigned num_threads) {
478 int gtid = __kmp_entry_gtid();
481 ompt_frame_t *parent_frame, *frame;
483 if (ompt_enabled.enabled) {
484 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL);
485 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
487 OMPT_STORE_RETURN_ADDRESS(gtid);
490 MKLOC(loc,
"GOMP_parallel_start");
491 KA_TRACE(20, (
"GOMP_parallel_start: T#%d\n", gtid));
492 __kmp_GOMP_fork_call(&loc, gtid, num_threads, 0u, task,
493 (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task,
496 if (ompt_enabled.enabled) {
497 __ompt_get_task_info_internal(0, NULL, NULL, &frame, NULL, NULL);
498 frame->exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
502 if (ompd_state & OMPD_ENABLE_BP)
503 ompd_bp_parallel_begin();
507 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
508 int gtid = __kmp_get_gtid();
511 thr = __kmp_threads[gtid];
513 MKLOC(loc,
"GOMP_parallel_end");
514 KA_TRACE(20, (
"GOMP_parallel_end: T#%d\n", gtid));
516 if (!thr->th.th_team->t.t_serialized) {
517 __kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
521 if (ompt_enabled.enabled) {
525 OMPT_CUR_TASK_INFO(thr)->frame.exit_frame = ompt_data_none;
529 __kmp_join_call(&loc, gtid
536 if (ompd_state & OMPD_ENABLE_BP)
537 ompd_bp_parallel_end();
566 #define IF_OMPT_SUPPORT(code) code
568 #define IF_OMPT_SUPPORT(code)
571 #define LOOP_START(func, schedule) \
572 int func(long lb, long ub, long str, long chunk_sz, long *p_lb, \
576 int gtid = __kmp_entry_gtid(); \
577 MKLOC(loc, KMP_STR(func)); \
581 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
582 gtid, lb, ub, str, chunk_sz)); \
584 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
586 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
587 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
588 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
589 (schedule) != kmp_sch_static); \
592 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
593 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
594 (kmp_int *)p_ub, (kmp_int *)&stride); \
597 KMP_DEBUG_ASSERT(stride == str); \
598 *p_ub += (str > 0) ? 1 : -1; \
607 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
608 gtid, *p_lb, *p_ub, status)); \
612 #define LOOP_RUNTIME_START(func, schedule) \
613 int func(long lb, long ub, long str, long *p_lb, long *p_ub) { \
617 int gtid = __kmp_entry_gtid(); \
618 MKLOC(loc, KMP_STR(func)); \
621 (KMP_STR(func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
622 gtid, lb, ub, str, chunk_sz)); \
624 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
626 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
627 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
628 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
632 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
633 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
634 (kmp_int *)p_ub, (kmp_int *)&stride); \
637 KMP_DEBUG_ASSERT(stride == str); \
638 *p_ub += (str > 0) ? 1 : -1; \
647 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
648 gtid, *p_lb, *p_ub, status)); \
652 #define KMP_DOACROSS_FINI(status, gtid) \
653 if (!status && __kmp_threads[gtid]->th.th_dispatch->th_doacross_flags) { \
654 __kmpc_doacross_fini(NULL, gtid); \
657 #define LOOP_NEXT(func, fini_code) \
658 int func(long *p_lb, long *p_ub) { \
661 int gtid = __kmp_get_gtid(); \
662 MKLOC(loc, KMP_STR(func)); \
663 KA_TRACE(20, (KMP_STR(func) ": T#%d\n", gtid)); \
665 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
666 fini_code status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
667 (kmp_int *)p_ub, (kmp_int *)&stride); \
669 *p_ub += (stride > 0) ? 1 : -1; \
671 KMP_DOACROSS_FINI(status, gtid) \
675 (KMP_STR(func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, stride 0x%lx, " \
677 gtid, *p_lb, *p_ub, stride, status)); \
681 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_START),
kmp_sch_static)
682 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {})
683 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START),
684 kmp_sch_dynamic_chunked)
685 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START),
686 kmp_sch_dynamic_chunked)
687 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {})
688 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT), {})
689 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START),
691 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START),
693 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {})
694 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT), {})
695 LOOP_RUNTIME_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START),
697 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {})
699 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START),
702 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START),
705 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT), {})
706 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT), {})
708 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START),
710 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT),
711 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
712 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START),
713 kmp_ord_dynamic_chunked)
714 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT),
715 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
716 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START),
717 kmp_ord_guided_chunked)
718 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT),
719 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
721 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START),
723 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT),
724 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
726 #define LOOP_DOACROSS_START(func, schedule) \
727 bool func(
unsigned ncounts,
long *counts,
long chunk_sz,
long *p_lb, \
730 long stride, lb, ub, str; \
731 int gtid = __kmp_entry_gtid(); \
732 struct kmp_dim *dims = \
733 (
struct kmp_dim *)__kmp_allocate(
sizeof(
struct kmp_dim) * ncounts); \
734 MKLOC(loc, KMP_STR(func)); \
735 for (
unsigned i = 0; i < ncounts; ++i) { \
737 dims[i].up = counts[i] - 1; \
740 __kmpc_doacross_init(&loc, gtid, (
int)ncounts, dims); \
744 KA_TRACE(20, (KMP_STR(func)
": T#%d, ncounts %u, lb 0x%lx, ub 0x%lx, str " \
747 gtid, ncounts, lb, ub, str, chunk_sz)); \
749 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
750 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
751 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
753 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
754 (kmp_int *)p_ub, (kmp_int *)&stride); \
756 KMP_DEBUG_ASSERT(stride == str); \
757 *p_ub += (str > 0) ? 1 : -1; \
762 KMP_DOACROSS_FINI(status, gtid); \
767 func)
" exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
768 gtid, *p_lb, *p_ub, status)); \
773 #define LOOP_DOACROSS_RUNTIME_START(func, schedule) \
774 int func(unsigned ncounts, long *counts, long *p_lb, long *p_ub) { \
776 long stride, lb, ub, str; \
778 int gtid = __kmp_entry_gtid(); \
779 struct kmp_dim *dims = \
780 (struct kmp_dim *)__kmp_allocate(sizeof(struct kmp_dim) * ncounts); \
781 MKLOC(loc, KMP_STR(func)); \
782 for (unsigned i = 0; i < ncounts; ++i) { \
784 dims[i].up = counts[i] - 1; \
787 __kmpc_doacross_init(&loc, gtid, (int)ncounts, dims); \
793 (KMP_STR(func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
794 gtid, lb, ub, str, chunk_sz)); \
796 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
797 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
798 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, TRUE); \
799 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
800 (kmp_int *)p_ub, (kmp_int *)&stride); \
802 KMP_DEBUG_ASSERT(stride == str); \
803 *p_ub += (str > 0) ? 1 : -1; \
808 KMP_DOACROSS_FINI(status, gtid); \
813 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
814 gtid, *p_lb, *p_ub, status)); \
820 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START),
823 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START),
824 kmp_sch_dynamic_chunked)
826 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START),
828 LOOP_DOACROSS_RUNTIME_START(
829 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START),
832 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END)(void) {
833 int gtid = __kmp_get_gtid();
834 KA_TRACE(20, (
"GOMP_loop_end: T#%d\n", gtid))
836 #if OMPT_SUPPORT && OMPT_OPTIONAL
837 ompt_frame_t *ompt_frame;
838 if (ompt_enabled.enabled) {
839 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
840 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
841 OMPT_STORE_RETURN_ADDRESS(gtid);
844 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
845 #if OMPT_SUPPORT && OMPT_OPTIONAL
846 if (ompt_enabled.enabled) {
847 ompt_frame->enter_frame = ompt_data_none;
851 KA_TRACE(20, (
"GOMP_loop_end exit: T#%d\n", gtid))
854 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void) {
855 KA_TRACE(20, (
"GOMP_loop_end_nowait: T#%d\n", __kmp_get_gtid()))
862 #define LOOP_START_ULL(func, schedule) \
863 int func(int up, unsigned long long lb, unsigned long long ub, \
864 unsigned long long str, unsigned long long chunk_sz, \
865 unsigned long long *p_lb, unsigned long long *p_ub) { \
867 long long str2 = up ? ((long long)str) : -((long long)str); \
869 int gtid = __kmp_entry_gtid(); \
870 MKLOC(loc, KMP_STR(func)); \
872 KA_TRACE(20, (KMP_STR(func) ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str " \
873 "0x%llx, chunk_sz 0x%llx\n", \
874 gtid, up, lb, ub, str, chunk_sz)); \
876 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
877 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
878 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
879 (schedule) != kmp_sch_static); \
881 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
882 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
884 KMP_DEBUG_ASSERT(stride == str2); \
885 *p_ub += (str > 0) ? 1 : -1; \
894 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
895 gtid, *p_lb, *p_ub, status)); \
899 #define LOOP_RUNTIME_START_ULL(func, schedule) \
900 int func(int up, unsigned long long lb, unsigned long long ub, \
901 unsigned long long str, unsigned long long *p_lb, \
902 unsigned long long *p_ub) { \
904 long long str2 = up ? ((long long)str) : -((long long)str); \
905 unsigned long long stride; \
906 unsigned long long chunk_sz = 0; \
907 int gtid = __kmp_entry_gtid(); \
908 MKLOC(loc, KMP_STR(func)); \
910 KA_TRACE(20, (KMP_STR(func) ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str " \
911 "0x%llx, chunk_sz 0x%llx\n", \
912 gtid, up, lb, ub, str, chunk_sz)); \
914 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
915 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
916 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
919 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
920 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
922 KMP_DEBUG_ASSERT((long long)stride == str2); \
923 *p_ub += (str > 0) ? 1 : -1; \
932 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
933 gtid, *p_lb, *p_ub, status)); \
937 #define LOOP_NEXT_ULL(func, fini_code) \
938 int func(unsigned long long *p_lb, unsigned long long *p_ub) { \
941 int gtid = __kmp_get_gtid(); \
942 MKLOC(loc, KMP_STR(func)); \
943 KA_TRACE(20, (KMP_STR(func) ": T#%d\n", gtid)); \
946 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
947 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
949 *p_ub += (stride > 0) ? 1 : -1; \
955 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, stride 0x%llx, " \
957 gtid, *p_lb, *p_ub, stride, status)); \
961 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START),
963 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT), {})
964 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START),
965 kmp_sch_dynamic_chunked)
966 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT), {})
967 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START),
969 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {})
971 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START),
972 kmp_sch_dynamic_chunked)
974 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT), {})
976 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START),
979 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT), {})
980 LOOP_RUNTIME_START_ULL(
981 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime)
982 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {})
983 LOOP_RUNTIME_START_ULL(
985 KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START),
987 LOOP_RUNTIME_START_ULL(
988 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START),
991 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT),
994 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT), {})
996 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START),
998 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT),
999 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1001 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START),
1002 kmp_ord_dynamic_chunked)
1003 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT),
1004 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1005 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START),
1006 kmp_ord_guided_chunked)
1007 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT),
1008 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1009 LOOP_RUNTIME_START_ULL(
1010 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START),
1012 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT),
1013 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1015 #define LOOP_DOACROSS_START_ULL(func, schedule) \
1016 int func(
unsigned ncounts,
unsigned long long *counts, \
1017 unsigned long long chunk_sz,
unsigned long long *p_lb, \
1018 unsigned long long *p_ub) { \
1020 long
long stride, str, lb, ub; \
1021 int gtid = __kmp_entry_gtid(); \
1022 struct kmp_dim *dims = \
1023 (
struct kmp_dim *)__kmp_allocate(
sizeof(
struct kmp_dim) * ncounts); \
1024 MKLOC(loc, KMP_STR(func)); \
1025 for (
unsigned i = 0; i < ncounts; ++i) { \
1027 dims[i].up = counts[i] - 1; \
1030 __kmpc_doacross_init(&loc, gtid, (
int)ncounts, dims); \
1035 KA_TRACE(20, (KMP_STR(func)
": T#%d, lb 0x%llx, ub 0x%llx, str " \
1036 "0x%llx, chunk_sz 0x%llx\n", \
1037 gtid, lb, ub, str, chunk_sz)); \
1039 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
1040 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
1041 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1044 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
1045 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
1047 KMP_DEBUG_ASSERT(stride == str); \
1048 *p_ub += (str > 0) ? 1 : -1; \
1053 KMP_DOACROSS_FINI(status, gtid); \
1058 func)
" exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
1059 gtid, *p_lb, *p_ub, status)); \
1064 #define LOOP_DOACROSS_RUNTIME_START_ULL(func, schedule) \
1065 int func(unsigned ncounts, unsigned long long *counts, \
1066 unsigned long long *p_lb, unsigned long long *p_ub) { \
1068 unsigned long long stride, str, lb, ub; \
1069 unsigned long long chunk_sz = 0; \
1070 int gtid = __kmp_entry_gtid(); \
1071 struct kmp_dim *dims = \
1072 (struct kmp_dim *)__kmp_allocate(sizeof(struct kmp_dim) * ncounts); \
1073 MKLOC(loc, KMP_STR(func)); \
1074 for (unsigned i = 0; i < ncounts; ++i) { \
1076 dims[i].up = counts[i] - 1; \
1079 __kmpc_doacross_init(&loc, gtid, (int)ncounts, dims); \
1083 KA_TRACE(20, (KMP_STR(func) ": T#%d, lb 0x%llx, ub 0x%llx, str " \
1084 "0x%llx, chunk_sz 0x%llx\n", \
1085 gtid, lb, ub, str, chunk_sz)); \
1087 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
1088 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
1089 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1092 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
1093 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
1095 KMP_DEBUG_ASSERT(stride == str); \
1096 *p_ub += (str > 0) ? 1 : -1; \
1101 KMP_DOACROSS_FINI(status, gtid); \
1106 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
1107 gtid, *p_lb, *p_ub, status)); \
1112 LOOP_DOACROSS_START_ULL(
1113 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START),
1115 LOOP_DOACROSS_START_ULL(
1116 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START),
1117 kmp_sch_dynamic_chunked)
1118 LOOP_DOACROSS_START_ULL(
1119 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START),
1121 LOOP_DOACROSS_RUNTIME_START_ULL(
1122 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START),
1129 #define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
1130 void func(void (*task)(void *), void *data, unsigned num_threads, long lb, \
1131 long ub, long str, long chunk_sz) { \
1132 int gtid = __kmp_entry_gtid(); \
1133 MKLOC(loc, KMP_STR(func)); \
1137 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1138 gtid, lb, ub, str, chunk_sz)); \
1142 __kmp_GOMP_fork_call(&loc, gtid, num_threads, 0u, task, \
1143 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, \
1144 9, task, data, num_threads, &loc, (schedule), lb, \
1145 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1146 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid)); \
1148 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1149 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1150 (schedule) != kmp_sch_static); \
1154 KA_TRACE(20, (KMP_STR(func) " exit: T#%d\n", gtid)); \
1157 #if OMPT_SUPPORT && OMPT_OPTIONAL
1159 #define OMPT_LOOP_PRE() \
1160 ompt_frame_t *parent_frame; \
1161 if (ompt_enabled.enabled) { \
1162 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL); \
1163 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0); \
1164 OMPT_STORE_RETURN_ADDRESS(gtid); \
1167 #define OMPT_LOOP_POST() \
1168 if (ompt_enabled.enabled) { \
1169 parent_frame->enter_frame = ompt_data_none; \
1174 #define OMPT_LOOP_PRE()
1176 #define OMPT_LOOP_POST()
1180 PARALLEL_LOOP_START(
1181 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
1183 PARALLEL_LOOP_START(
1184 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
1185 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1186 PARALLEL_LOOP_START(
1187 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
1189 PARALLEL_LOOP_START(
1190 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
1191 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1195 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void (*func)(
void *),
void *data,
1196 void (*copy_func)(
void *,
void *),
1197 long arg_size,
long arg_align,
1198 bool if_cond,
unsigned gomp_flags,
1200 MKLOC(loc,
"GOMP_task");
1201 int gtid = __kmp_entry_gtid();
1202 kmp_int32 flags = 0;
1203 kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *)&flags;
1205 KA_TRACE(20, (
"GOMP_task: T#%d\n", gtid));
1208 if (!(gomp_flags & KMP_GOMP_TASK_UNTIED_FLAG)) {
1209 input_flags->tiedness = 1;
1212 if (gomp_flags & KMP_GOMP_TASK_FINAL_FLAG) {
1213 input_flags->final = 1;
1215 input_flags->native = 1;
1222 kmp_task_t *task = __kmp_task_alloc(
1223 &loc, gtid, input_flags,
sizeof(kmp_task_t),
1224 arg_size ? arg_size + arg_align - 1 : 0, (kmp_routine_entry_t)func);
1227 if (arg_align > 0) {
1228 task->shareds = (
void *)((((
size_t)task->shareds) + arg_align - 1) /
1229 arg_align * arg_align);
1234 (*copy_func)(task->shareds, data);
1236 KMP_MEMCPY(task->shareds, data, arg_size);
1241 kmp_taskdata_t *current_task;
1242 if (ompt_enabled.enabled) {
1243 current_task = __kmp_threads[gtid]->th.th_current_task;
1244 current_task->ompt_task_info.frame.enter_frame.ptr =
1245 OMPT_GET_FRAME_ADDRESS(0);
1247 OMPT_STORE_RETURN_ADDRESS(gtid);
1251 if (gomp_flags & KMP_GOMP_TASK_DEPENDS_FLAG) {
1253 kmp_gomp_depends_info_t gomp_depends(depend);
1254 kmp_int32 ndeps = gomp_depends.get_num_deps();
1255 kmp_depend_info_t dep_list[ndeps];
1256 for (kmp_int32 i = 0; i < ndeps; i++)
1257 dep_list[i] = gomp_depends.get_kmp_depend(i);
1258 kmp_int32 ndeps_cnv;
1259 __kmp_type_convert(ndeps, &ndeps_cnv);
1262 __kmpc_omp_task(&loc, gtid, task);
1266 ompt_thread_info_t oldInfo;
1268 kmp_taskdata_t *taskdata;
1269 if (ompt_enabled.enabled) {
1271 thread = __kmp_threads[gtid];
1272 taskdata = KMP_TASK_TO_TASKDATA(task);
1273 oldInfo = thread->th.ompt_thread_info;
1274 thread->th.ompt_thread_info.wait_id = 0;
1275 thread->th.ompt_thread_info.state = ompt_state_work_parallel;
1276 taskdata->ompt_task_info.frame.exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1278 OMPT_STORE_RETURN_ADDRESS(gtid);
1280 if (gomp_flags & KMP_GOMP_TASK_DEPENDS_FLAG) {
1282 kmp_gomp_depends_info_t gomp_depends(depend);
1283 kmp_int32 ndeps = gomp_depends.get_num_deps();
1284 kmp_depend_info_t dep_list[ndeps];
1285 for (kmp_int32 i = 0; i < ndeps; i++)
1286 dep_list[i] = gomp_depends.get_kmp_depend(i);
1290 __kmpc_omp_task_begin_if0(&loc, gtid, task);
1292 __kmpc_omp_task_complete_if0(&loc, gtid, task);
1295 if (ompt_enabled.enabled) {
1296 thread->th.ompt_thread_info = oldInfo;
1297 taskdata->ompt_task_info.frame.exit_frame = ompt_data_none;
1302 if (ompt_enabled.enabled) {
1303 current_task->ompt_task_info.frame.enter_frame = ompt_data_none;
1307 KA_TRACE(20, (
"GOMP_task exit: T#%d\n", gtid));
1310 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKWAIT)(void) {
1311 MKLOC(loc,
"GOMP_taskwait");
1312 int gtid = __kmp_entry_gtid();
1315 OMPT_STORE_RETURN_ADDRESS(gtid);
1318 KA_TRACE(20, (
"GOMP_taskwait: T#%d\n", gtid));
1320 __kmpc_omp_taskwait(&loc, gtid);
1322 KA_TRACE(20, (
"GOMP_taskwait exit: T#%d\n", gtid));
1334 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_START)(
unsigned count) {
1336 kmp_int lb, ub, stride;
1337 int gtid = __kmp_entry_gtid();
1338 MKLOC(loc,
"GOMP_sections_start");
1339 KA_TRACE(20, (
"GOMP_sections_start: T#%d\n", gtid));
1341 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1343 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1345 KMP_DEBUG_ASSERT(stride == 1);
1346 KMP_DEBUG_ASSERT(lb > 0);
1347 KMP_ASSERT(lb == ub);
1352 KA_TRACE(20, (
"GOMP_sections_start exit: T#%d returning %u\n", gtid,
1354 return (
unsigned)lb;
1357 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_NEXT)(void) {
1359 kmp_int lb, ub, stride;
1360 int gtid = __kmp_get_gtid();
1361 MKLOC(loc,
"GOMP_sections_next");
1362 KA_TRACE(20, (
"GOMP_sections_next: T#%d\n", gtid));
1365 OMPT_STORE_RETURN_ADDRESS(gtid);
1368 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1370 KMP_DEBUG_ASSERT(stride == 1);
1371 KMP_DEBUG_ASSERT(lb > 0);
1372 KMP_ASSERT(lb == ub);
1378 20, (
"GOMP_sections_next exit: T#%d returning %u\n", gtid, (
unsigned)lb));
1379 return (
unsigned)lb;
1382 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(
1383 void (*task)(
void *),
void *data,
unsigned num_threads,
unsigned count) {
1384 int gtid = __kmp_entry_gtid();
1387 ompt_frame_t *parent_frame;
1389 if (ompt_enabled.enabled) {
1390 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL);
1391 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1393 OMPT_STORE_RETURN_ADDRESS(gtid);
1396 MKLOC(loc,
"GOMP_parallel_sections_start");
1397 KA_TRACE(20, (
"GOMP_parallel_sections_start: T#%d\n", gtid));
1399 __kmp_GOMP_fork_call(&loc, gtid, num_threads, 0u, task,
1400 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9,
1401 task, data, num_threads, &loc, kmp_nm_dynamic_chunked,
1402 (kmp_int)1, (kmp_int)count, (kmp_int)1, (kmp_int)1);
1405 if (ompt_enabled.enabled) {
1406 parent_frame->enter_frame = ompt_data_none;
1410 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1412 KA_TRACE(20, (
"GOMP_parallel_sections_start exit: T#%d\n", gtid));
1415 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END)(void) {
1416 int gtid = __kmp_get_gtid();
1417 KA_TRACE(20, (
"GOMP_sections_end: T#%d\n", gtid))
1420 ompt_frame_t *ompt_frame;
1421 if (ompt_enabled.enabled) {
1422 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
1423 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1425 OMPT_STORE_RETURN_ADDRESS(gtid);
1427 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
1429 if (ompt_enabled.enabled) {
1430 ompt_frame->enter_frame = ompt_data_none;
1434 KA_TRACE(20, (
"GOMP_sections_end exit: T#%d\n", gtid))
1437 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT)(void) {
1438 KA_TRACE(20, (
"GOMP_sections_end_nowait: T#%d\n", __kmp_get_gtid()))
1442 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKYIELD)(void) {
1443 KA_TRACE(20, (
"GOMP_taskyield: T#%d\n", __kmp_get_gtid()))
1447 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL)(
void (*task)(
void *),
1449 unsigned num_threads,
1450 unsigned int flags) {
1451 int gtid = __kmp_entry_gtid();
1452 MKLOC(loc,
"GOMP_parallel");
1453 KA_TRACE(20, (
"GOMP_parallel: T#%d\n", gtid));
1456 ompt_task_info_t *parent_task_info, *task_info;
1457 if (ompt_enabled.enabled) {
1458 parent_task_info = __ompt_get_task_info_object(0);
1459 parent_task_info->frame.enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1461 OMPT_STORE_RETURN_ADDRESS(gtid);
1463 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
1464 (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task,
1467 if (ompt_enabled.enabled) {
1468 task_info = __ompt_get_task_info_object(0);
1469 task_info->frame.exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1475 OMPT_STORE_RETURN_ADDRESS(gtid);
1477 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
1480 if (ompt_enabled.enabled) {
1481 task_info->frame.exit_frame = ompt_data_none;
1482 parent_task_info->frame.enter_frame = ompt_data_none;
1487 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task)(
void *),
1489 unsigned num_threads,
1492 int gtid = __kmp_entry_gtid();
1493 MKLOC(loc,
"GOMP_parallel_sections");
1494 KA_TRACE(20, (
"GOMP_parallel_sections: T#%d\n", gtid));
1497 OMPT_STORE_RETURN_ADDRESS(gtid);
1500 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
1501 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9,
1502 task, data, num_threads, &loc, kmp_nm_dynamic_chunked,
1503 (kmp_int)1, (kmp_int)count, (kmp_int)1, (kmp_int)1);
1507 OMPT_STORE_RETURN_ADDRESS(gtid);
1510 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1513 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
1514 KA_TRACE(20, (
"GOMP_parallel_sections exit: T#%d\n", gtid));
1517 #define PARALLEL_LOOP(func, schedule, ompt_pre, ompt_post) \
1518 void func(void (*task)(void *), void *data, unsigned num_threads, long lb, \
1519 long ub, long str, long chunk_sz, unsigned flags) { \
1520 int gtid = __kmp_entry_gtid(); \
1521 MKLOC(loc, KMP_STR(func)); \
1525 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1526 gtid, lb, ub, str, chunk_sz)); \
1529 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
1530 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task, \
1531 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, \
1532 9, task, data, num_threads, &loc, (schedule), lb, \
1533 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1536 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
1537 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1538 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1539 (schedule) != kmp_sch_static); \
1542 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(); \
1545 KA_TRACE(20, (KMP_STR(func) " exit: T#%d\n", gtid)); \
1548 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC),
1550 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC),
1551 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1553 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED),
1556 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC),
1557 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1558 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED),
1560 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME),
1561 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1563 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME),
1564 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1566 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME),
1567 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1569 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_START)(void) {
1570 int gtid = __kmp_entry_gtid();
1571 MKLOC(loc,
"GOMP_taskgroup_start");
1572 KA_TRACE(20, (
"GOMP_taskgroup_start: T#%d\n", gtid));
1575 OMPT_STORE_RETURN_ADDRESS(gtid);
1578 __kmpc_taskgroup(&loc, gtid);
1583 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_END)(void) {
1584 int gtid = __kmp_get_gtid();
1585 MKLOC(loc,
"GOMP_taskgroup_end");
1586 KA_TRACE(20, (
"GOMP_taskgroup_end: T#%d\n", gtid));
1589 OMPT_STORE_RETURN_ADDRESS(gtid);
1592 __kmpc_end_taskgroup(&loc, gtid);
1597 static kmp_int32 __kmp_gomp_to_omp_cancellation_kind(
int gomp_kind) {
1598 kmp_int32 cncl_kind = 0;
1599 switch (gomp_kind) {
1601 cncl_kind = cancel_parallel;
1604 cncl_kind = cancel_loop;
1607 cncl_kind = cancel_sections;
1610 cncl_kind = cancel_taskgroup;
1617 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCELLATION_POINT)(
int which) {
1618 int gtid = __kmp_get_gtid();
1619 MKLOC(loc,
"GOMP_cancellation_point");
1620 KA_TRACE(20, (
"GOMP_cancellation_point: T#%d which:%d\n", gtid, which));
1621 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1622 return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1626 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCEL)(
int which,
bool do_cancel) {
1627 int gtid = __kmp_get_gtid();
1628 MKLOC(loc,
"GOMP_cancel");
1629 KA_TRACE(20, (
"GOMP_cancel: T#%d which:%d do_cancel:%d\n", gtid, which,
1631 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1633 if (do_cancel == FALSE) {
1634 return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1636 return __kmpc_cancel(&loc, gtid, cncl_kind);
1641 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void) {
1642 int gtid = __kmp_get_gtid();
1643 KA_TRACE(20, (
"GOMP_barrier_cancel: T#%d\n", gtid));
1644 return __kmp_barrier_gomp_cancel(gtid);
1648 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void) {
1649 int gtid = __kmp_get_gtid();
1650 KA_TRACE(20, (
"GOMP_sections_end_cancel: T#%d\n", gtid));
1651 return __kmp_barrier_gomp_cancel(gtid);
1655 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void) {
1656 int gtid = __kmp_get_gtid();
1657 KA_TRACE(20, (
"GOMP_loop_end_cancel: T#%d\n", gtid));
1658 return __kmp_barrier_gomp_cancel(gtid);
1662 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET)(
int device, void (*fn)(
void *),
1663 const void *openmp_target,
1664 size_t mapnum,
void **hostaddrs,
1666 unsigned char *kinds) {
1670 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_DATA)(
1671 int device,
const void *openmp_target,
size_t mapnum,
void **hostaddrs,
1672 size_t *sizes,
unsigned char *kinds) {
1676 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_END_DATA)(void) {
return; }
1678 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_UPDATE)(
1679 int device,
const void *openmp_target,
size_t mapnum,
void **hostaddrs,
1680 size_t *sizes,
unsigned char *kinds) {
1684 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TEAMS)(
unsigned int num_teams,
1685 unsigned int thread_limit) {
1691 static void __kmp_gomp_task_dup(kmp_task_t *dest, kmp_task_t *src,
1692 kmp_int32 last_private) {
1693 kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(src);
1694 if (taskdata->td_copy_func) {
1695 (taskdata->td_copy_func)(dest->shareds, src->shareds);
1699 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(
1706 template <
typename T>
1707 void __GOMP_taskloop(
void (*func)(
void *),
void *data,
1708 void (*copy_func)(
void *,
void *),
long arg_size,
1709 long arg_align,
unsigned gomp_flags,
1710 unsigned long num_tasks,
int priority, T start, T end,
1712 typedef void (*p_task_dup_t)(kmp_task_t *, kmp_task_t *, kmp_int32);
1713 MKLOC(loc,
"GOMP_taskloop");
1716 int gtid = __kmp_entry_gtid();
1717 kmp_int32 flags = 0;
1718 int if_val = gomp_flags & (1u << 10);
1719 int nogroup = gomp_flags & (1u << 11);
1720 int up = gomp_flags & (1u << 8);
1721 int reductions = gomp_flags & (1u << 12);
1722 p_task_dup_t task_dup = NULL;
1723 kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *)&flags;
1727 buff = __kmp_str_format(
1728 "GOMP_taskloop: T#%%d: func:%%p data:%%p copy_func:%%p "
1729 "arg_size:%%ld arg_align:%%ld gomp_flags:0x%%x num_tasks:%%lu "
1730 "priority:%%d start:%%%s end:%%%s step:%%%s\n",
1731 traits_t<T>::spec, traits_t<T>::spec, traits_t<T>::spec);
1732 KA_TRACE(20, (buff, gtid, func, data, copy_func, arg_size, arg_align,
1733 gomp_flags, num_tasks, priority, start, end, step));
1734 __kmp_str_free(&buff);
1737 KMP_ASSERT((
size_t)arg_size >= 2 *
sizeof(T));
1738 KMP_ASSERT(arg_align > 0);
1740 if (!(gomp_flags & 1)) {
1741 input_flags->tiedness = 1;
1744 if (gomp_flags & 2) {
1745 input_flags->final = 1;
1753 for (
int i =
sizeof(T) * CHAR_BIT - 1; i >= 0L; --i) {
1755 if (step & ((T)1 << i))
1757 step |= ((T)1 << i);
1761 input_flags->native = 1;
1763 if (num_tasks > 0) {
1764 if (gomp_flags & (1u << 9))
1775 __kmp_task_alloc(&loc, gtid, input_flags,
sizeof(kmp_task_t),
1776 arg_size + arg_align - 1, (kmp_routine_entry_t)func);
1777 kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
1778 taskdata->td_copy_func = copy_func;
1779 taskdata->td_size_loop_bounds =
sizeof(T);
1783 task->shareds = (
void *)((((
size_t)task->shareds) + arg_align - 1) /
1784 arg_align * arg_align);
1786 task_dup = __kmp_gomp_task_dup;
1788 KMP_MEMCPY(task->shareds, data, arg_size);
1790 loop_bounds = (T *)task->shareds;
1791 loop_bounds[0] = start;
1792 loop_bounds[1] = end + (up ? -1 : 1);
1795 #if OMPT_SUPPORT && OMPT_OPTIONAL
1796 OMPT_STORE_RETURN_ADDRESS(gtid);
1798 __kmpc_taskgroup(&loc, gtid);
1805 uintptr_t *d = ((data_t *)data)->d;
1806 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(d);
1809 __kmpc_taskloop(&loc, gtid, task, if_val, (kmp_uint64 *)&(loop_bounds[0]),
1810 (kmp_uint64 *)&(loop_bounds[1]), (kmp_int64)step, 1, sched,
1811 (kmp_uint64)num_tasks, (
void *)task_dup);
1813 #if OMPT_SUPPORT && OMPT_OPTIONAL
1814 OMPT_STORE_RETURN_ADDRESS(gtid);
1816 __kmpc_end_taskgroup(&loc, gtid);
1823 template <
typename T,
bool need_conversion = (sizeof(
long) == 4)>
1824 void __kmp_GOMP_doacross_post(T *count);
1826 template <>
void __kmp_GOMP_doacross_post<long, true>(
long *count) {
1827 int gtid = __kmp_entry_gtid();
1828 kmp_info_t *th = __kmp_threads[gtid];
1829 MKLOC(loc,
"GOMP_doacross_post");
1830 kmp_int64 num_dims = th->th.th_dispatch->th_doacross_info[0];
1831 kmp_int64 *vec = (kmp_int64 *)__kmp_thread_malloc(
1832 th, (
size_t)(
sizeof(kmp_int64) * num_dims));
1833 for (kmp_int64 i = 0; i < num_dims; ++i) {
1834 vec[i] = (kmp_int64)count[i];
1836 __kmpc_doacross_post(&loc, gtid, vec);
1837 __kmp_thread_free(th, vec);
1843 template <>
void __kmp_GOMP_doacross_post<long, false>(
long *count) {
1844 int gtid = __kmp_entry_gtid();
1845 MKLOC(loc,
"GOMP_doacross_post");
1846 __kmpc_doacross_post(&loc, gtid, RCAST(kmp_int64 *, count));
1849 template <
typename T>
void __kmp_GOMP_doacross_wait(T first, va_list args) {
1850 int gtid = __kmp_entry_gtid();
1851 kmp_info_t *th = __kmp_threads[gtid];
1852 MKLOC(loc,
"GOMP_doacross_wait");
1853 kmp_int64 num_dims = th->th.th_dispatch->th_doacross_info[0];
1854 kmp_int64 *vec = (kmp_int64 *)__kmp_thread_malloc(
1855 th, (
size_t)(
sizeof(kmp_int64) * num_dims));
1856 vec[0] = (kmp_int64)first;
1857 for (kmp_int64 i = 1; i < num_dims; ++i) {
1858 T item = va_arg(args, T);
1859 vec[i] = (kmp_int64)item;
1861 __kmpc_doacross_wait(&loc, gtid, vec);
1862 __kmp_thread_free(th, vec);
1870 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKLOOP)(
1871 void (*func)(
void *),
void *data,
void (*copy_func)(
void *,
void *),
1872 long arg_size,
long arg_align,
unsigned gomp_flags,
unsigned long num_tasks,
1873 int priority,
long start,
long end,
long step) {
1874 __GOMP_taskloop<long>(func, data, copy_func, arg_size, arg_align, gomp_flags,
1875 num_tasks, priority, start, end, step);
1878 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKLOOP_ULL)(
1879 void (*func)(
void *),
void *data,
void (*copy_func)(
void *,
void *),
1880 long arg_size,
long arg_align,
unsigned gomp_flags,
unsigned long num_tasks,
1881 int priority,
unsigned long long start,
unsigned long long end,
1882 unsigned long long step) {
1883 __GOMP_taskloop<unsigned long long>(func, data, copy_func, arg_size,
1884 arg_align, gomp_flags, num_tasks,
1885 priority, start, end, step);
1888 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_POST)(
long *count) {
1889 __kmp_GOMP_doacross_post(count);
1892 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_WAIT)(
long first, ...) {
1894 va_start(args, first);
1895 __kmp_GOMP_doacross_wait<long>(first, args);
1899 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_ULL_POST)(
1900 unsigned long long *count) {
1901 int gtid = __kmp_entry_gtid();
1902 MKLOC(loc,
"GOMP_doacross_ull_post");
1903 __kmpc_doacross_post(&loc, gtid, RCAST(kmp_int64 *, count));
1906 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_ULL_WAIT)(
1907 unsigned long long first, ...) {
1909 va_start(args, first);
1910 __kmp_GOMP_doacross_wait<unsigned long long>(first, args);
1918 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TEAMS_REG)(void (*fn)(
void *),
1921 unsigned thread_limit,
1923 MKLOC(loc,
"GOMP_teams_reg");
1924 int gtid = __kmp_entry_gtid();
1925 KA_TRACE(20, (
"GOMP_teams_reg: T#%d num_teams=%u thread_limit=%u flag=%u\n",
1926 gtid, num_teams, thread_limit, flags));
1930 KA_TRACE(20, (
"GOMP_teams_reg exit: T#%d\n", gtid));
1933 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKWAIT_DEPEND)(
void **depend) {
1934 MKLOC(loc,
"GOMP_taskwait_depend");
1935 int gtid = __kmp_entry_gtid();
1936 KA_TRACE(20, (
"GOMP_taskwait_depend: T#%d\n", gtid));
1937 kmp_gomp_depends_info_t gomp_depends(depend);
1938 kmp_int32 ndeps = gomp_depends.get_num_deps();
1939 kmp_depend_info_t dep_list[ndeps];
1940 for (kmp_int32 i = 0; i < ndeps; i++)
1941 dep_list[i] = gomp_depends.get_kmp_depend(i);
1943 OMPT_STORE_RETURN_ADDRESS(gtid);
1946 KA_TRACE(20, (
"GOMP_taskwait_depend exit: T#%d\n", gtid));
1950 __kmp_GOMP_taskgroup_reduction_register(uintptr_t *data, kmp_taskgroup_t *tg,
1952 uintptr_t *allocated =
nullptr) {
1954 KMP_ASSERT(nthreads > 0);
1958 data[2] = allocated[2];
1959 data[6] = allocated[6];
1961 data[2] = (uintptr_t)__kmp_allocate(nthreads * data[1]);
1962 data[6] = data[2] + (nthreads * data[1]);
1965 tg->gomp_data = data;
1968 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(
1970 int gtid = __kmp_entry_gtid();
1971 KA_TRACE(20, (
"GOMP_taskgroup_reduction_register: T#%d\n", gtid));
1972 kmp_info_t *thread = __kmp_threads[gtid];
1973 kmp_taskgroup_t *tg = thread->th.th_current_task->td_taskgroup;
1974 int nthreads = thread->th.th_team_nproc;
1975 __kmp_GOMP_taskgroup_reduction_register(data, tg, nthreads);
1978 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER)(
1981 (
"GOMP_taskgroup_reduction_unregister: T#%d\n", __kmp_get_gtid()));
1982 KMP_ASSERT(data && data[2]);
1983 __kmp_free((
void *)data[2]);
1988 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK_REDUCTION_REMAP)(
size_t cnt,
1991 int gtid = __kmp_entry_gtid();
1992 KA_TRACE(20, (
"GOMP_task_reduction_remap: T#%d\n", gtid));
1993 kmp_info_t *thread = __kmp_threads[gtid];
1994 kmp_int32 tid = __kmp_get_tid();
1995 for (
size_t i = 0; i < cnt; ++i) {
1996 uintptr_t address = (uintptr_t)ptrs[i];
1997 void *propagated_address = NULL;
1998 void *mapped_address = NULL;
2000 kmp_taskgroup_t *tg = thread->th.th_current_task->td_taskgroup;
2002 uintptr_t *gomp_data = tg->gomp_data;
2008 size_t num_vars = (size_t)gomp_data[0];
2009 uintptr_t per_thread_size = gomp_data[1];
2010 uintptr_t reduce_data = gomp_data[2];
2011 uintptr_t end_reduce_data = gomp_data[6];
2012 for (
size_t j = 0; j < num_vars; ++j) {
2013 uintptr_t *entry = gomp_data + 7 + 3 * j;
2014 if (entry[0] == address) {
2015 uintptr_t offset = entry[1];
2017 (
void *)(reduce_data + tid * per_thread_size + offset);
2019 propagated_address = (
void *)entry[0];
2026 if (!mapped_address && address >= reduce_data &&
2027 address < end_reduce_data) {
2028 uintptr_t offset = (address - reduce_data) % per_thread_size;
2029 mapped_address = (
void *)(reduce_data + tid * per_thread_size + offset);
2031 for (
size_t j = 0; j < num_vars; ++j) {
2032 uintptr_t *entry = gomp_data + 7 + 3 * j;
2033 if (entry[1] == offset) {
2034 propagated_address = (
void *)entry[0];
2044 KMP_ASSERT(mapped_address);
2045 ptrs[i] = mapped_address;
2047 KMP_ASSERT(propagated_address);
2048 ptrs[cnt + i] = propagated_address;
2053 static void __kmp_GOMP_init_reductions(
int gtid, uintptr_t *data,
int is_ws) {
2054 kmp_info_t *thr = __kmp_threads[gtid];
2055 kmp_team_t *team = thr->th.th_team;
2057 __kmpc_taskgroup(NULL, gtid);
2059 void *reduce_data = KMP_ATOMIC_LD_RLX(&team->t.t_tg_reduce_data[is_ws]);
2060 if (reduce_data == NULL &&
2061 __kmp_atomic_compare_store(&team->t.t_tg_reduce_data[is_ws], reduce_data,
2064 KMP_DEBUG_ASSERT(reduce_data == NULL);
2065 __kmp_GOMP_taskgroup_reduction_register(data, NULL, thr->th.th_team_nproc);
2066 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[is_ws], 0);
2067 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[is_ws], (
void *)data);
2070 while ((reduce_data = KMP_ATOMIC_LD_ACQ(
2071 &team->t.t_tg_reduce_data[is_ws])) == (
void *)1) {
2074 KMP_DEBUG_ASSERT(reduce_data > (
void *)1);
2081 __kmp_GOMP_taskgroup_reduction_register(
2082 data, NULL, thr->th.th_team_nproc,
2083 (uintptr_t *)KMP_ATOMIC_LD_ACQ(&team->t.t_tg_reduce_data[is_ws]));
2085 kmp_taskgroup_t *tg = thr->th.th_current_task->td_taskgroup;
2086 tg->gomp_data = data;
2090 __kmp_GOMP_par_reductions_microtask_wrapper(
int *gtid,
int *npr,
2091 void (*task)(
void *),
void *data) {
2092 kmp_info_t *thr = __kmp_threads[*gtid];
2093 kmp_team_t *team = thr->th.th_team;
2094 uintptr_t *reduce_data = *(uintptr_t **)data;
2095 __kmp_GOMP_init_reductions(*gtid, reduce_data, 0);
2098 ompt_frame_t *ompt_frame;
2099 ompt_state_t enclosing_state;
2101 if (ompt_enabled.enabled) {
2103 enclosing_state = thr->th.ompt_thread_info.state;
2104 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
2107 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
2108 ompt_frame->exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
2115 if (ompt_enabled.enabled) {
2117 ompt_frame->exit_frame = ompt_data_none;
2120 thr->th.ompt_thread_info.state = enclosing_state;
2123 __kmpc_end_taskgroup(NULL, *gtid);
2127 int count = KMP_ATOMIC_INC(&team->t.t_tg_fini_counter[0]);
2128 if (count == thr->th.th_team_nproc - 1) {
2129 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[0], NULL);
2130 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[0], 0);
2132 return (
unsigned)thr->th.th_team_nproc;
2135 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_REDUCTIONS)(
2136 void (*task)(
void *),
void *data,
unsigned num_threads,
2137 unsigned int flags) {
2138 MKLOC(loc,
"GOMP_parallel_reductions");
2139 int gtid = __kmp_entry_gtid();
2140 KA_TRACE(20, (
"GOMP_parallel_reductions: T#%d\n", gtid));
2141 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
2142 (microtask_t)__kmp_GOMP_par_reductions_microtask_wrapper,
2145 __kmp_GOMP_par_reductions_microtask_wrapper(>id, NULL, task, data);
2146 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
2147 KA_TRACE(20, (
"GOMP_parallel_reductions exit: T#%d\n", gtid));
2151 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_START)(
2152 long start,
long end,
long incr,
long sched,
long chunk_size,
long *istart,
2153 long *iend, uintptr_t *reductions,
void **mem) {
2155 int gtid = __kmp_entry_gtid();
2156 KA_TRACE(20, (
"GOMP_loop_start: T#%d, reductions: %p\n", gtid, reductions));
2158 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2160 KMP_FATAL(GompFeatureNotSupported,
"scan");
2163 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2164 long monotonic = sched & MONOTONIC_FLAG;
2165 sched &= ~MONOTONIC_FLAG;
2168 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START)(
2169 start, end, incr, istart, iend);
2171 status = KMP_EXPAND_NAME(
2172 KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START)(
2173 start, end, incr, istart, iend);
2174 }
else if (sched == 1) {
2175 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_START)(
2176 start, end, incr, chunk_size, istart, iend);
2177 }
else if (sched == 2) {
2179 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START)(
2180 start, end, incr, chunk_size, istart, iend);
2183 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START)(
2184 start, end, incr, chunk_size, istart, iend);
2185 }
else if (sched == 3) {
2187 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START)(
2188 start, end, incr, chunk_size, istart, iend);
2191 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START)(
2192 start, end, incr, chunk_size, istart, iend);
2193 }
else if (sched == 4) {
2194 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START)(
2195 start, end, incr, istart, iend);
2202 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_START)(
2203 bool up,
unsigned long long start,
unsigned long long end,
2204 unsigned long long incr,
long sched,
unsigned long long chunk_size,
2205 unsigned long long *istart,
unsigned long long *iend, uintptr_t *reductions,
2208 int gtid = __kmp_entry_gtid();
2210 (
"GOMP_loop_ull_start: T#%d, reductions: %p\n", gtid, reductions));
2212 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2214 KMP_FATAL(GompFeatureNotSupported,
"scan");
2217 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2218 long monotonic = sched & MONOTONIC_FLAG;
2219 sched &= ~MONOTONIC_FLAG;
2222 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START)(
2223 up, start, end, incr, istart, iend);
2225 status = KMP_EXPAND_NAME(
2226 KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START)(
2227 up, start, end, incr, istart, iend);
2228 }
else if (sched == 1) {
2229 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START)(
2230 up, start, end, incr, chunk_size, istart, iend);
2231 }
else if (sched == 2) {
2233 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START)(
2234 up, start, end, incr, chunk_size, istart, iend);
2236 status = KMP_EXPAND_NAME(
2237 KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START)(
2238 up, start, end, incr, chunk_size, istart, iend);
2239 }
else if (sched == 3) {
2241 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START)(
2242 up, start, end, incr, chunk_size, istart, iend);
2245 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START)(
2246 up, start, end, incr, chunk_size, istart, iend);
2247 }
else if (sched == 4) {
2249 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START)(
2250 up, start, end, incr, istart, iend);
2257 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_START)(
2258 unsigned ncounts,
long *counts,
long sched,
long chunk_size,
long *istart,
2259 long *iend, uintptr_t *reductions,
void **mem) {
2261 int gtid = __kmp_entry_gtid();
2262 KA_TRACE(20, (
"GOMP_loop_doacross_start: T#%d, reductions: %p\n", gtid,
2265 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2267 KMP_FATAL(GompFeatureNotSupported,
"scan");
2271 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2272 sched &= ~MONOTONIC_FLAG;
2274 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START)(
2275 ncounts, counts, istart, iend);
2276 }
else if (sched == 1) {
2277 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START)(
2278 ncounts, counts, chunk_size, istart, iend);
2279 }
else if (sched == 2) {
2280 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START)(
2281 ncounts, counts, chunk_size, istart, iend);
2282 }
else if (sched == 3) {
2283 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START)(
2284 ncounts, counts, chunk_size, istart, iend);
2291 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_START)(
2292 unsigned ncounts,
unsigned long long *counts,
long sched,
2293 unsigned long long chunk_size,
unsigned long long *istart,
2294 unsigned long long *iend, uintptr_t *reductions,
void **mem) {
2296 int gtid = __kmp_entry_gtid();
2297 KA_TRACE(20, (
"GOMP_loop_ull_doacross_start: T#%d, reductions: %p\n", gtid,
2300 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2302 KMP_FATAL(GompFeatureNotSupported,
"scan");
2306 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2307 sched &= ~MONOTONIC_FLAG;
2309 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START)(
2310 ncounts, counts, istart, iend);
2311 }
else if (sched == 1) {
2312 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START)(
2313 ncounts, counts, chunk_size, istart, iend);
2314 }
else if (sched == 2) {
2315 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START)(
2316 ncounts, counts, chunk_size, istart, iend);
2317 }
else if (sched == 3) {
2318 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START)(
2319 ncounts, counts, chunk_size, istart, iend);
2326 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_START)(
2327 long start,
long end,
long incr,
long sched,
long chunk_size,
long *istart,
2328 long *iend, uintptr_t *reductions,
void **mem) {
2330 int gtid = __kmp_entry_gtid();
2331 KA_TRACE(20, (
"GOMP_loop_ordered_start: T#%d, reductions: %p\n", gtid,
2334 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2336 KMP_FATAL(GompFeatureNotSupported,
"scan");
2340 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2341 sched &= ~MONOTONIC_FLAG;
2343 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START)(
2344 start, end, incr, istart, iend);
2345 }
else if (sched == 1) {
2346 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START)(
2347 start, end, incr, chunk_size, istart, iend);
2348 }
else if (sched == 2) {
2349 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START)(
2350 start, end, incr, chunk_size, istart, iend);
2351 }
else if (sched == 3) {
2352 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START)(
2353 start, end, incr, chunk_size, istart, iend);
2360 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_START)(
2361 bool up,
unsigned long long start,
unsigned long long end,
2362 unsigned long long incr,
long sched,
unsigned long long chunk_size,
2363 unsigned long long *istart,
unsigned long long *iend, uintptr_t *reductions,
2366 int gtid = __kmp_entry_gtid();
2367 KA_TRACE(20, (
"GOMP_loop_ull_ordered_start: T#%d, reductions: %p\n", gtid,
2370 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2372 KMP_FATAL(GompFeatureNotSupported,
"scan");
2376 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2377 sched &= ~MONOTONIC_FLAG;
2379 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START)(
2380 up, start, end, incr, istart, iend);
2381 }
else if (sched == 1) {
2382 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START)(
2383 up, start, end, incr, chunk_size, istart, iend);
2384 }
else if (sched == 2) {
2385 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START)(
2386 up, start, end, incr, chunk_size, istart, iend);
2387 }
else if (sched == 3) {
2388 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START)(
2389 up, start, end, incr, chunk_size, istart, iend);
2396 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS2_START)(
2397 unsigned count, uintptr_t *reductions,
void **mem) {
2398 int gtid = __kmp_entry_gtid();
2400 (
"GOMP_sections2_start: T#%d, reductions: %p\n", gtid, reductions));
2402 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2404 KMP_FATAL(GompFeatureNotSupported,
"scan");
2405 return KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_START)(count);
2408 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER)(
2410 int gtid = __kmp_get_gtid();
2411 MKLOC(loc,
"GOMP_workshare_task_reduction_unregister");
2412 KA_TRACE(20, (
"GOMP_workshare_task_reduction_unregister: T#%d\n", gtid));
2413 kmp_info_t *thr = __kmp_threads[gtid];
2414 kmp_team_t *team = thr->th.th_team;
2415 __kmpc_end_taskgroup(NULL, gtid);
2419 int count = KMP_ATOMIC_INC(&team->t.t_tg_fini_counter[1]);
2420 if (count == thr->th.th_team_nproc - 1) {
2421 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER)
2422 ((uintptr_t *)KMP_ATOMIC_LD_RLX(&team->t.t_tg_reduce_data[1]));
2423 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[1], NULL);
2424 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[1], 0);
2436 #ifdef KMP_USE_VERSION_SYMBOLS
2438 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ATOMIC_END, 10,
"GOMP_1.0");
2439 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ATOMIC_START, 10,
"GOMP_1.0");
2440 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_BARRIER, 10,
"GOMP_1.0");
2441 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_END, 10,
"GOMP_1.0");
2442 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10,
"GOMP_1.0");
2443 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10,
"GOMP_1.0");
2444 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_START, 10,
"GOMP_1.0");
2445 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10,
"GOMP_1.0");
2446 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10,
"GOMP_1.0");
2447 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END, 10,
"GOMP_1.0");
2448 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10,
"GOMP_1.0");
2449 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10,
"GOMP_1.0");
2450 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10,
"GOMP_1.0");
2451 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10,
"GOMP_1.0");
2452 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10,
2454 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10,
"GOMP_1.0");
2455 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10,
"GOMP_1.0");
2456 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10,
"GOMP_1.0");
2457 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10,
2459 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10,
"GOMP_1.0");
2460 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10,
"GOMP_1.0");
2461 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10,
"GOMP_1.0");
2462 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10,
"GOMP_1.0");
2463 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10,
"GOMP_1.0");
2464 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10,
"GOMP_1.0");
2465 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ORDERED_END, 10,
"GOMP_1.0");
2466 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ORDERED_START, 10,
"GOMP_1.0");
2467 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_END, 10,
"GOMP_1.0");
2468 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10,
2470 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10,
2472 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10,
2474 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10,
2476 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10,
"GOMP_1.0");
2477 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_START, 10,
"GOMP_1.0");
2478 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END, 10,
"GOMP_1.0");
2479 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10,
"GOMP_1.0");
2480 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10,
"GOMP_1.0");
2481 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_START, 10,
"GOMP_1.0");
2482 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10,
"GOMP_1.0");
2483 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10,
"GOMP_1.0");
2484 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_START, 10,
"GOMP_1.0");
2487 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASK, 20,
"GOMP_2.0");
2488 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKWAIT, 20,
"GOMP_2.0");
2489 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20,
"GOMP_2.0");
2490 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20,
"GOMP_2.0");
2491 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20,
"GOMP_2.0");
2492 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20,
"GOMP_2.0");
2493 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20,
2495 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20,
2497 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20,
2499 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20,
2501 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20,
2503 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20,
2505 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20,
2507 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20,
2509 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20,
"GOMP_2.0");
2510 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20,
"GOMP_2.0");
2511 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20,
"GOMP_2.0");
2512 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20,
"GOMP_2.0");
2515 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKYIELD, 30,
"GOMP_3.0");
2518 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL, 40,
"GOMP_4.0");
2519 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40,
"GOMP_4.0");
2520 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40,
"GOMP_4.0");
2521 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40,
"GOMP_4.0");
2522 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40,
"GOMP_4.0");
2523 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40,
"GOMP_4.0");
2524 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_START, 40,
"GOMP_4.0");
2525 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_END, 40,
"GOMP_4.0");
2526 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40,
"GOMP_4.0");
2527 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CANCEL, 40,
"GOMP_4.0");
2528 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40,
"GOMP_4.0");
2529 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40,
"GOMP_4.0");
2530 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40,
"GOMP_4.0");
2531 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET, 40,
"GOMP_4.0");
2532 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_DATA, 40,
"GOMP_4.0");
2533 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_END_DATA, 40,
"GOMP_4.0");
2534 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_UPDATE, 40,
"GOMP_4.0");
2535 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TEAMS, 40,
"GOMP_4.0");
2538 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP, 45,
"GOMP_4.5");
2539 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP_ULL, 45,
"GOMP_4.5");
2540 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_POST, 45,
"GOMP_4.5");
2541 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_WAIT, 45,
"GOMP_4.5");
2542 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START, 45,
2544 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START, 45,
2546 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START, 45,
2548 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START, 45,
2550 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_ULL_POST, 45,
"GOMP_4.5");
2551 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_ULL_WAIT, 45,
"GOMP_4.5");
2552 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START, 45,
2554 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, 45,
2556 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, 45,
2558 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, 45,
2560 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, 45,
2562 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, 45,
2564 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START, 45,
2566 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, 45,
2568 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, 45,
2570 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, 45,
2572 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, 45,
2574 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, 45,
2576 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, 45,
2578 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED, 45,
2582 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT, 50,
2584 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START, 50,
2586 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT, 50,
2588 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START, 50,
2590 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
2592 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
2594 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT, 50,
2596 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START, 50,
2598 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME, 50,
2600 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
2602 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TEAMS_REG, 50,
"GOMP_5.0");
2603 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKWAIT_DEPEND, 50,
"GOMP_5.0");
2604 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER, 50,
2606 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER, 50,
2608 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASK_REDUCTION_REMAP, 50,
"GOMP_5.0");
2609 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_REDUCTIONS, 50,
"GOMP_5.0");
2610 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_START, 50,
"GOMP_5.0");
2611 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_START, 50,
"GOMP_5.0");
2612 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_START, 50,
"GOMP_5.0");
2613 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_START, 50,
"GOMP_5.0");
2614 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_START, 50,
"GOMP_5.0");
2615 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_START, 50,
"GOMP_5.0");
2616 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS2_START, 50,
"GOMP_5.0");
2617 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER, 50,
KMP_EXPORT void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,...)
KMP_EXPORT void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 num_threads)
KMP_EXPORT void __kmpc_barrier(ident_t *, kmp_int32 global_tid)
void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val, kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st, int nogroup, int sched, kmp_uint64 grainsize, void *task_dup)
KMP_EXPORT kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *new_task, kmp_int32 ndeps, kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list)
KMP_EXPORT void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list)
KMP_EXPORT void __kmpc_end_ordered(ident_t *, kmp_int32 global_tid)
KMP_EXPORT void __kmpc_end_critical(ident_t *, kmp_int32 global_tid, kmp_critical_name *)
KMP_EXPORT void __kmpc_ordered(ident_t *, kmp_int32 global_tid)
KMP_EXPORT void __kmpc_critical(ident_t *, kmp_int32 global_tid, kmp_critical_name *)