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);
503 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
504 int gtid = __kmp_get_gtid();
507 thr = __kmp_threads[gtid];
509 MKLOC(loc,
"GOMP_parallel_end");
510 KA_TRACE(20, (
"GOMP_parallel_end: T#%d\n", gtid));
512 if (!thr->th.th_team->t.t_serialized) {
513 __kmp_run_after_invoked_task(gtid, __kmp_tid_from_gtid(gtid), thr,
517 if (ompt_enabled.enabled) {
521 OMPT_CUR_TASK_INFO(thr)->frame.exit_frame = ompt_data_none;
525 __kmp_join_call(&loc, gtid
558 #define IF_OMPT_SUPPORT(code) code
560 #define IF_OMPT_SUPPORT(code)
563 #define LOOP_START(func, schedule) \
564 int func(long lb, long ub, long str, long chunk_sz, long *p_lb, \
568 int gtid = __kmp_entry_gtid(); \
569 MKLOC(loc, KMP_STR(func)); \
573 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
574 gtid, lb, ub, str, chunk_sz)); \
576 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
578 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
579 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
580 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
581 (schedule) != kmp_sch_static); \
584 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
585 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
586 (kmp_int *)p_ub, (kmp_int *)&stride); \
589 KMP_DEBUG_ASSERT(stride == str); \
590 *p_ub += (str > 0) ? 1 : -1; \
599 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
600 gtid, *p_lb, *p_ub, status)); \
604 #define LOOP_RUNTIME_START(func, schedule) \
605 int func(long lb, long ub, long str, long *p_lb, long *p_ub) { \
609 int gtid = __kmp_entry_gtid(); \
610 MKLOC(loc, KMP_STR(func)); \
613 (KMP_STR(func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
614 gtid, lb, ub, str, chunk_sz)); \
616 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
618 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
619 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
620 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
624 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
625 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
626 (kmp_int *)p_ub, (kmp_int *)&stride); \
629 KMP_DEBUG_ASSERT(stride == str); \
630 *p_ub += (str > 0) ? 1 : -1; \
639 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
640 gtid, *p_lb, *p_ub, status)); \
644 #define KMP_DOACROSS_FINI(status, gtid) \
645 if (!status && __kmp_threads[gtid]->th.th_dispatch->th_doacross_flags) { \
646 __kmpc_doacross_fini(NULL, gtid); \
649 #define LOOP_NEXT(func, fini_code) \
650 int func(long *p_lb, long *p_ub) { \
653 int gtid = __kmp_get_gtid(); \
654 MKLOC(loc, KMP_STR(func)); \
655 KA_TRACE(20, (KMP_STR(func) ": T#%d\n", gtid)); \
657 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
658 fini_code status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
659 (kmp_int *)p_ub, (kmp_int *)&stride); \
661 *p_ub += (stride > 0) ? 1 : -1; \
663 KMP_DOACROSS_FINI(status, gtid) \
667 (KMP_STR(func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, stride 0x%lx, " \
669 gtid, *p_lb, *p_ub, stride, status)); \
673 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_START),
kmp_sch_static)
674 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {})
675 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START),
676 kmp_sch_dynamic_chunked)
677 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START),
678 kmp_sch_dynamic_chunked)
679 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {})
680 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT), {})
681 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START),
683 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START),
685 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {})
686 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT), {})
687 LOOP_RUNTIME_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START),
689 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {})
691 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START),
694 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START),
697 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT), {})
698 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT), {})
700 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START),
702 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT),
703 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
704 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START),
705 kmp_ord_dynamic_chunked)
706 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT),
707 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
708 LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START),
709 kmp_ord_guided_chunked)
710 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT),
711 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
713 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START),
715 LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT),
716 { KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
718 #define LOOP_DOACROSS_START(func, schedule) \
719 bool func(
unsigned ncounts,
long *counts,
long chunk_sz,
long *p_lb, \
722 long stride, lb, ub, str; \
723 int gtid = __kmp_entry_gtid(); \
724 struct kmp_dim *dims = \
725 (
struct kmp_dim *)__kmp_allocate(
sizeof(
struct kmp_dim) * ncounts); \
726 MKLOC(loc, KMP_STR(func)); \
727 for (
unsigned i = 0; i < ncounts; ++i) { \
729 dims[i].up = counts[i] - 1; \
732 __kmpc_doacross_init(&loc, gtid, (
int)ncounts, dims); \
736 KA_TRACE(20, (KMP_STR(func)
": T#%d, ncounts %u, lb 0x%lx, ub 0x%lx, str " \
739 gtid, ncounts, lb, ub, str, chunk_sz)); \
741 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
742 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
743 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
745 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
746 (kmp_int *)p_ub, (kmp_int *)&stride); \
748 KMP_DEBUG_ASSERT(stride == str); \
749 *p_ub += (str > 0) ? 1 : -1; \
754 KMP_DOACROSS_FINI(status, gtid); \
759 func)
" exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
760 gtid, *p_lb, *p_ub, status)); \
765 #define LOOP_DOACROSS_RUNTIME_START(func, schedule) \
766 int func(unsigned ncounts, long *counts, long *p_lb, long *p_ub) { \
768 long stride, lb, ub, str; \
770 int gtid = __kmp_entry_gtid(); \
771 struct kmp_dim *dims = \
772 (struct kmp_dim *)__kmp_allocate(sizeof(struct kmp_dim) * ncounts); \
773 MKLOC(loc, KMP_STR(func)); \
774 for (unsigned i = 0; i < ncounts; ++i) { \
776 dims[i].up = counts[i] - 1; \
779 __kmpc_doacross_init(&loc, gtid, (int)ncounts, dims); \
785 (KMP_STR(func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz %d\n", \
786 gtid, lb, ub, str, chunk_sz)); \
788 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
789 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
790 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, TRUE); \
791 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb, \
792 (kmp_int *)p_ub, (kmp_int *)&stride); \
794 KMP_DEBUG_ASSERT(stride == str); \
795 *p_ub += (str > 0) ? 1 : -1; \
800 KMP_DOACROSS_FINI(status, gtid); \
805 func) " exit: T#%d, *p_lb 0x%lx, *p_ub 0x%lx, returning %d\n", \
806 gtid, *p_lb, *p_ub, status)); \
812 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START),
815 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START),
816 kmp_sch_dynamic_chunked)
818 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START),
820 LOOP_DOACROSS_RUNTIME_START(
821 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START),
824 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END)(void) {
825 int gtid = __kmp_get_gtid();
826 KA_TRACE(20, (
"GOMP_loop_end: T#%d\n", gtid))
828 #if OMPT_SUPPORT && OMPT_OPTIONAL
829 ompt_frame_t *ompt_frame;
830 if (ompt_enabled.enabled) {
831 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
832 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
833 OMPT_STORE_RETURN_ADDRESS(gtid);
836 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
837 #if OMPT_SUPPORT && OMPT_OPTIONAL
838 if (ompt_enabled.enabled) {
839 ompt_frame->enter_frame = ompt_data_none;
843 KA_TRACE(20, (
"GOMP_loop_end exit: T#%d\n", gtid))
846 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END_NOWAIT)(void) {
847 KA_TRACE(20, (
"GOMP_loop_end_nowait: T#%d\n", __kmp_get_gtid()))
854 #define LOOP_START_ULL(func, schedule) \
855 int func(int up, unsigned long long lb, unsigned long long ub, \
856 unsigned long long str, unsigned long long chunk_sz, \
857 unsigned long long *p_lb, unsigned long long *p_ub) { \
859 long long str2 = up ? ((long long)str) : -((long long)str); \
861 int gtid = __kmp_entry_gtid(); \
862 MKLOC(loc, KMP_STR(func)); \
864 KA_TRACE(20, (KMP_STR(func) ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str " \
865 "0x%llx, chunk_sz 0x%llx\n", \
866 gtid, up, lb, ub, str, chunk_sz)); \
868 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
869 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
870 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
871 (schedule) != kmp_sch_static); \
873 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
874 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
876 KMP_DEBUG_ASSERT(stride == str2); \
877 *p_ub += (str > 0) ? 1 : -1; \
886 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
887 gtid, *p_lb, *p_ub, status)); \
891 #define LOOP_RUNTIME_START_ULL(func, schedule) \
892 int func(int up, unsigned long long lb, unsigned long long ub, \
893 unsigned long long str, unsigned long long *p_lb, \
894 unsigned long long *p_ub) { \
896 long long str2 = up ? ((long long)str) : -((long long)str); \
897 unsigned long long stride; \
898 unsigned long long chunk_sz = 0; \
899 int gtid = __kmp_entry_gtid(); \
900 MKLOC(loc, KMP_STR(func)); \
902 KA_TRACE(20, (KMP_STR(func) ": T#%d, up %d, lb 0x%llx, ub 0x%llx, str " \
903 "0x%llx, chunk_sz 0x%llx\n", \
904 gtid, up, lb, ub, str, chunk_sz)); \
906 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
907 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
908 (str2 > 0) ? (ub - 1) : (ub + 1), str2, chunk_sz, \
911 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
912 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
914 KMP_DEBUG_ASSERT((long long)stride == str2); \
915 *p_ub += (str > 0) ? 1 : -1; \
924 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
925 gtid, *p_lb, *p_ub, status)); \
929 #define LOOP_NEXT_ULL(func, fini_code) \
930 int func(unsigned long long *p_lb, unsigned long long *p_ub) { \
933 int gtid = __kmp_get_gtid(); \
934 MKLOC(loc, KMP_STR(func)); \
935 KA_TRACE(20, (KMP_STR(func) ": T#%d\n", gtid)); \
938 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
939 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
941 *p_ub += (stride > 0) ? 1 : -1; \
947 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, stride 0x%llx, " \
949 gtid, *p_lb, *p_ub, stride, status)); \
953 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START),
955 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT), {})
956 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START),
957 kmp_sch_dynamic_chunked)
958 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT), {})
959 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START),
961 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {})
963 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START),
964 kmp_sch_dynamic_chunked)
966 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT), {})
968 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START),
971 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT), {})
972 LOOP_RUNTIME_START_ULL(
973 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime)
974 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {})
975 LOOP_RUNTIME_START_ULL(
977 KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START),
979 LOOP_RUNTIME_START_ULL(
980 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START),
983 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT),
986 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT), {})
988 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START),
990 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT),
991 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
993 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START),
994 kmp_ord_dynamic_chunked)
995 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT),
996 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
997 LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START),
998 kmp_ord_guided_chunked)
999 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT),
1000 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1001 LOOP_RUNTIME_START_ULL(
1002 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START),
1004 LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT),
1005 { KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
1007 #define LOOP_DOACROSS_START_ULL(func, schedule) \
1008 int func(
unsigned ncounts,
unsigned long long *counts, \
1009 unsigned long long chunk_sz,
unsigned long long *p_lb, \
1010 unsigned long long *p_ub) { \
1012 long
long stride, str, lb, ub; \
1013 int gtid = __kmp_entry_gtid(); \
1014 struct kmp_dim *dims = \
1015 (
struct kmp_dim *)__kmp_allocate(
sizeof(
struct kmp_dim) * ncounts); \
1016 MKLOC(loc, KMP_STR(func)); \
1017 for (
unsigned i = 0; i < ncounts; ++i) { \
1019 dims[i].up = counts[i] - 1; \
1022 __kmpc_doacross_init(&loc, gtid, (
int)ncounts, dims); \
1027 KA_TRACE(20, (KMP_STR(func)
": T#%d, lb 0x%llx, ub 0x%llx, str " \
1028 "0x%llx, chunk_sz 0x%llx\n", \
1029 gtid, lb, ub, str, chunk_sz)); \
1031 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
1032 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
1033 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1036 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
1037 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
1039 KMP_DEBUG_ASSERT(stride == str); \
1040 *p_ub += (str > 0) ? 1 : -1; \
1045 KMP_DOACROSS_FINI(status, gtid); \
1050 func)
" exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
1051 gtid, *p_lb, *p_ub, status)); \
1056 #define LOOP_DOACROSS_RUNTIME_START_ULL(func, schedule) \
1057 int func(unsigned ncounts, unsigned long long *counts, \
1058 unsigned long long *p_lb, unsigned long long *p_ub) { \
1060 unsigned long long stride, str, lb, ub; \
1061 unsigned long long chunk_sz = 0; \
1062 int gtid = __kmp_entry_gtid(); \
1063 struct kmp_dim *dims = \
1064 (struct kmp_dim *)__kmp_allocate(sizeof(struct kmp_dim) * ncounts); \
1065 MKLOC(loc, KMP_STR(func)); \
1066 for (unsigned i = 0; i < ncounts; ++i) { \
1068 dims[i].up = counts[i] - 1; \
1071 __kmpc_doacross_init(&loc, gtid, (int)ncounts, dims); \
1075 KA_TRACE(20, (KMP_STR(func) ": T#%d, lb 0x%llx, ub 0x%llx, str " \
1076 "0x%llx, chunk_sz 0x%llx\n", \
1077 gtid, lb, ub, str, chunk_sz)); \
1079 if ((str > 0) ? (lb < ub) : (lb > ub)) { \
1080 KMP_DISPATCH_INIT_ULL(&loc, gtid, (schedule), lb, \
1081 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1084 KMP_DISPATCH_NEXT_ULL(&loc, gtid, NULL, (kmp_uint64 *)p_lb, \
1085 (kmp_uint64 *)p_ub, (kmp_int64 *)&stride); \
1087 KMP_DEBUG_ASSERT(stride == str); \
1088 *p_ub += (str > 0) ? 1 : -1; \
1093 KMP_DOACROSS_FINI(status, gtid); \
1098 func) " exit: T#%d, *p_lb 0x%llx, *p_ub 0x%llx, returning %d\n", \
1099 gtid, *p_lb, *p_ub, status)); \
1104 LOOP_DOACROSS_START_ULL(
1105 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START),
1107 LOOP_DOACROSS_START_ULL(
1108 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START),
1109 kmp_sch_dynamic_chunked)
1110 LOOP_DOACROSS_START_ULL(
1111 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START),
1113 LOOP_DOACROSS_RUNTIME_START_ULL(
1114 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START),
1121 #define PARALLEL_LOOP_START(func, schedule, ompt_pre, ompt_post) \
1122 void func(void (*task)(void *), void *data, unsigned num_threads, long lb, \
1123 long ub, long str, long chunk_sz) { \
1124 int gtid = __kmp_entry_gtid(); \
1125 MKLOC(loc, KMP_STR(func)); \
1129 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1130 gtid, lb, ub, str, chunk_sz)); \
1134 __kmp_GOMP_fork_call(&loc, gtid, num_threads, 0u, task, \
1135 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, \
1136 9, task, data, num_threads, &loc, (schedule), lb, \
1137 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1138 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid)); \
1140 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1141 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1142 (schedule) != kmp_sch_static); \
1146 KA_TRACE(20, (KMP_STR(func) " exit: T#%d\n", gtid)); \
1149 #if OMPT_SUPPORT && OMPT_OPTIONAL
1151 #define OMPT_LOOP_PRE() \
1152 ompt_frame_t *parent_frame; \
1153 if (ompt_enabled.enabled) { \
1154 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL); \
1155 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0); \
1156 OMPT_STORE_RETURN_ADDRESS(gtid); \
1159 #define OMPT_LOOP_POST() \
1160 if (ompt_enabled.enabled) { \
1161 parent_frame->enter_frame = ompt_data_none; \
1166 #define OMPT_LOOP_PRE()
1168 #define OMPT_LOOP_POST()
1172 PARALLEL_LOOP_START(
1173 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START),
1175 PARALLEL_LOOP_START(
1176 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START),
1177 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1178 PARALLEL_LOOP_START(
1179 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START),
1181 PARALLEL_LOOP_START(
1182 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START),
1183 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1187 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void (*func)(
void *),
void *data,
1188 void (*copy_func)(
void *,
void *),
1189 long arg_size,
long arg_align,
1190 bool if_cond,
unsigned gomp_flags,
1192 MKLOC(loc,
"GOMP_task");
1193 int gtid = __kmp_entry_gtid();
1194 kmp_int32 flags = 0;
1195 kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *)&flags;
1197 KA_TRACE(20, (
"GOMP_task: T#%d\n", gtid));
1200 if (!(gomp_flags & KMP_GOMP_TASK_UNTIED_FLAG)) {
1201 input_flags->tiedness = 1;
1204 if (gomp_flags & KMP_GOMP_TASK_FINAL_FLAG) {
1205 input_flags->final = 1;
1207 input_flags->native = 1;
1214 kmp_task_t *task = __kmp_task_alloc(
1215 &loc, gtid, input_flags,
sizeof(kmp_task_t),
1216 arg_size ? arg_size + arg_align - 1 : 0, (kmp_routine_entry_t)func);
1219 if (arg_align > 0) {
1220 task->shareds = (
void *)((((
size_t)task->shareds) + arg_align - 1) /
1221 arg_align * arg_align);
1226 (*copy_func)(task->shareds, data);
1228 KMP_MEMCPY(task->shareds, data, arg_size);
1233 kmp_taskdata_t *current_task;
1234 if (ompt_enabled.enabled) {
1235 current_task = __kmp_threads[gtid]->th.th_current_task;
1236 current_task->ompt_task_info.frame.enter_frame.ptr =
1237 OMPT_GET_FRAME_ADDRESS(0);
1239 OMPT_STORE_RETURN_ADDRESS(gtid);
1243 if (gomp_flags & KMP_GOMP_TASK_DEPENDS_FLAG) {
1245 kmp_gomp_depends_info_t gomp_depends(depend);
1246 kmp_int32 ndeps = gomp_depends.get_num_deps();
1247 kmp_depend_info_t dep_list[ndeps];
1248 for (kmp_int32 i = 0; i < ndeps; i++)
1249 dep_list[i] = gomp_depends.get_kmp_depend(i);
1250 kmp_int32 ndeps_cnv;
1251 __kmp_type_convert(ndeps, &ndeps_cnv);
1254 __kmpc_omp_task(&loc, gtid, task);
1258 ompt_thread_info_t oldInfo;
1260 kmp_taskdata_t *taskdata;
1261 if (ompt_enabled.enabled) {
1263 thread = __kmp_threads[gtid];
1264 taskdata = KMP_TASK_TO_TASKDATA(task);
1265 oldInfo = thread->th.ompt_thread_info;
1266 thread->th.ompt_thread_info.wait_id = 0;
1267 thread->th.ompt_thread_info.state = ompt_state_work_parallel;
1268 taskdata->ompt_task_info.frame.exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1270 OMPT_STORE_RETURN_ADDRESS(gtid);
1272 if (gomp_flags & KMP_GOMP_TASK_DEPENDS_FLAG) {
1274 kmp_gomp_depends_info_t gomp_depends(depend);
1275 kmp_int32 ndeps = gomp_depends.get_num_deps();
1276 kmp_depend_info_t dep_list[ndeps];
1277 for (kmp_int32 i = 0; i < ndeps; i++)
1278 dep_list[i] = gomp_depends.get_kmp_depend(i);
1282 __kmpc_omp_task_begin_if0(&loc, gtid, task);
1284 __kmpc_omp_task_complete_if0(&loc, gtid, task);
1287 if (ompt_enabled.enabled) {
1288 thread->th.ompt_thread_info = oldInfo;
1289 taskdata->ompt_task_info.frame.exit_frame = ompt_data_none;
1294 if (ompt_enabled.enabled) {
1295 current_task->ompt_task_info.frame.enter_frame = ompt_data_none;
1299 KA_TRACE(20, (
"GOMP_task exit: T#%d\n", gtid));
1302 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKWAIT)(void) {
1303 MKLOC(loc,
"GOMP_taskwait");
1304 int gtid = __kmp_entry_gtid();
1307 OMPT_STORE_RETURN_ADDRESS(gtid);
1310 KA_TRACE(20, (
"GOMP_taskwait: T#%d\n", gtid));
1312 __kmpc_omp_taskwait(&loc, gtid);
1314 KA_TRACE(20, (
"GOMP_taskwait exit: T#%d\n", gtid));
1326 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_START)(
unsigned count) {
1328 kmp_int lb, ub, stride;
1329 int gtid = __kmp_entry_gtid();
1330 MKLOC(loc,
"GOMP_sections_start");
1331 KA_TRACE(20, (
"GOMP_sections_start: T#%d\n", gtid));
1333 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1335 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1337 KMP_DEBUG_ASSERT(stride == 1);
1338 KMP_DEBUG_ASSERT(lb > 0);
1339 KMP_ASSERT(lb == ub);
1344 KA_TRACE(20, (
"GOMP_sections_start exit: T#%d returning %u\n", gtid,
1346 return (
unsigned)lb;
1349 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_NEXT)(void) {
1351 kmp_int lb, ub, stride;
1352 int gtid = __kmp_get_gtid();
1353 MKLOC(loc,
"GOMP_sections_next");
1354 KA_TRACE(20, (
"GOMP_sections_next: T#%d\n", gtid));
1357 OMPT_STORE_RETURN_ADDRESS(gtid);
1360 status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride);
1362 KMP_DEBUG_ASSERT(stride == 1);
1363 KMP_DEBUG_ASSERT(lb > 0);
1364 KMP_ASSERT(lb == ub);
1370 20, (
"GOMP_sections_next exit: T#%d returning %u\n", gtid, (
unsigned)lb));
1371 return (
unsigned)lb;
1374 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START)(
1375 void (*task)(
void *),
void *data,
unsigned num_threads,
unsigned count) {
1376 int gtid = __kmp_entry_gtid();
1379 ompt_frame_t *parent_frame;
1381 if (ompt_enabled.enabled) {
1382 __ompt_get_task_info_internal(0, NULL, NULL, &parent_frame, NULL, NULL);
1383 parent_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1385 OMPT_STORE_RETURN_ADDRESS(gtid);
1388 MKLOC(loc,
"GOMP_parallel_sections_start");
1389 KA_TRACE(20, (
"GOMP_parallel_sections_start: T#%d\n", gtid));
1391 __kmp_GOMP_fork_call(&loc, gtid, num_threads, 0u, task,
1392 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9,
1393 task, data, num_threads, &loc, kmp_nm_dynamic_chunked,
1394 (kmp_int)1, (kmp_int)count, (kmp_int)1, (kmp_int)1);
1397 if (ompt_enabled.enabled) {
1398 parent_frame->enter_frame = ompt_data_none;
1402 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1404 KA_TRACE(20, (
"GOMP_parallel_sections_start exit: T#%d\n", gtid));
1407 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END)(void) {
1408 int gtid = __kmp_get_gtid();
1409 KA_TRACE(20, (
"GOMP_sections_end: T#%d\n", gtid))
1412 ompt_frame_t *ompt_frame;
1413 if (ompt_enabled.enabled) {
1414 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
1415 ompt_frame->enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1417 OMPT_STORE_RETURN_ADDRESS(gtid);
1419 __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
1421 if (ompt_enabled.enabled) {
1422 ompt_frame->enter_frame = ompt_data_none;
1426 KA_TRACE(20, (
"GOMP_sections_end exit: T#%d\n", gtid))
1429 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT)(void) {
1430 KA_TRACE(20, (
"GOMP_sections_end_nowait: T#%d\n", __kmp_get_gtid()))
1434 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKYIELD)(void) {
1435 KA_TRACE(20, (
"GOMP_taskyield: T#%d\n", __kmp_get_gtid()))
1439 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL)(
void (*task)(
void *),
1441 unsigned num_threads,
1442 unsigned int flags) {
1443 int gtid = __kmp_entry_gtid();
1444 MKLOC(loc,
"GOMP_parallel");
1445 KA_TRACE(20, (
"GOMP_parallel: T#%d\n", gtid));
1448 ompt_task_info_t *parent_task_info, *task_info;
1449 if (ompt_enabled.enabled) {
1450 parent_task_info = __ompt_get_task_info_object(0);
1451 parent_task_info->frame.enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1453 OMPT_STORE_RETURN_ADDRESS(gtid);
1455 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
1456 (microtask_t)__kmp_GOMP_microtask_wrapper, 2, task,
1459 if (ompt_enabled.enabled) {
1460 task_info = __ompt_get_task_info_object(0);
1461 task_info->frame.exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
1467 OMPT_STORE_RETURN_ADDRESS(gtid);
1469 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
1472 if (ompt_enabled.enabled) {
1473 task_info->frame.exit_frame = ompt_data_none;
1474 parent_task_info->frame.enter_frame = ompt_data_none;
1479 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task)(
void *),
1481 unsigned num_threads,
1484 int gtid = __kmp_entry_gtid();
1485 MKLOC(loc,
"GOMP_parallel_sections");
1486 KA_TRACE(20, (
"GOMP_parallel_sections: T#%d\n", gtid));
1489 OMPT_STORE_RETURN_ADDRESS(gtid);
1492 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
1493 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, 9,
1494 task, data, num_threads, &loc, kmp_nm_dynamic_chunked,
1495 (kmp_int)1, (kmp_int)count, (kmp_int)1, (kmp_int)1);
1499 OMPT_STORE_RETURN_ADDRESS(gtid);
1502 KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE);
1505 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
1506 KA_TRACE(20, (
"GOMP_parallel_sections exit: T#%d\n", gtid));
1509 #define PARALLEL_LOOP(func, schedule, ompt_pre, ompt_post) \
1510 void func(void (*task)(void *), void *data, unsigned num_threads, long lb, \
1511 long ub, long str, long chunk_sz, unsigned flags) { \
1512 int gtid = __kmp_entry_gtid(); \
1513 MKLOC(loc, KMP_STR(func)); \
1517 func) ": T#%d, lb 0x%lx, ub 0x%lx, str 0x%lx, chunk_sz 0x%lx\n", \
1518 gtid, lb, ub, str, chunk_sz)); \
1521 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
1522 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task, \
1523 (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, \
1524 9, task, data, num_threads, &loc, (schedule), lb, \
1525 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \
1528 IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid);) \
1529 KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \
1530 (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz, \
1531 (schedule) != kmp_sch_static); \
1534 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(); \
1537 KA_TRACE(20, (KMP_STR(func) " exit: T#%d\n", gtid)); \
1540 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC),
1542 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC),
1543 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1545 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED),
1548 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC),
1549 kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1550 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED),
1552 PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME),
1553 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1555 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME),
1556 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1558 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME),
1559 kmp_sch_runtime, OMPT_LOOP_PRE, OMPT_LOOP_POST)
1561 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_START)(void) {
1562 int gtid = __kmp_entry_gtid();
1563 MKLOC(loc,
"GOMP_taskgroup_start");
1564 KA_TRACE(20, (
"GOMP_taskgroup_start: T#%d\n", gtid));
1567 OMPT_STORE_RETURN_ADDRESS(gtid);
1570 __kmpc_taskgroup(&loc, gtid);
1575 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_END)(void) {
1576 int gtid = __kmp_get_gtid();
1577 MKLOC(loc,
"GOMP_taskgroup_end");
1578 KA_TRACE(20, (
"GOMP_taskgroup_end: T#%d\n", gtid));
1581 OMPT_STORE_RETURN_ADDRESS(gtid);
1584 __kmpc_end_taskgroup(&loc, gtid);
1589 static kmp_int32 __kmp_gomp_to_omp_cancellation_kind(
int gomp_kind) {
1590 kmp_int32 cncl_kind = 0;
1591 switch (gomp_kind) {
1593 cncl_kind = cancel_parallel;
1596 cncl_kind = cancel_loop;
1599 cncl_kind = cancel_sections;
1602 cncl_kind = cancel_taskgroup;
1609 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCELLATION_POINT)(
int which) {
1610 int gtid = __kmp_get_gtid();
1611 MKLOC(loc,
"GOMP_cancellation_point");
1612 KA_TRACE(20, (
"GOMP_cancellation_point: T#%d which:%d\n", gtid, which));
1613 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1614 return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1618 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCEL)(
int which,
bool do_cancel) {
1619 int gtid = __kmp_get_gtid();
1620 MKLOC(loc,
"GOMP_cancel");
1621 KA_TRACE(20, (
"GOMP_cancel: T#%d which:%d do_cancel:%d\n", gtid, which,
1623 kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
1625 if (do_cancel == FALSE) {
1626 return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
1628 return __kmpc_cancel(&loc, gtid, cncl_kind);
1633 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void) {
1634 int gtid = __kmp_get_gtid();
1635 KA_TRACE(20, (
"GOMP_barrier_cancel: T#%d\n", gtid));
1636 return __kmp_barrier_gomp_cancel(gtid);
1640 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void) {
1641 int gtid = __kmp_get_gtid();
1642 KA_TRACE(20, (
"GOMP_sections_end_cancel: T#%d\n", gtid));
1643 return __kmp_barrier_gomp_cancel(gtid);
1647 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void) {
1648 int gtid = __kmp_get_gtid();
1649 KA_TRACE(20, (
"GOMP_loop_end_cancel: T#%d\n", gtid));
1650 return __kmp_barrier_gomp_cancel(gtid);
1654 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET)(
int device, void (*fn)(
void *),
1655 const void *openmp_target,
1656 size_t mapnum,
void **hostaddrs,
1658 unsigned char *kinds) {
1662 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_DATA)(
1663 int device,
const void *openmp_target,
size_t mapnum,
void **hostaddrs,
1664 size_t *sizes,
unsigned char *kinds) {
1668 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_END_DATA)(void) {
return; }
1670 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TARGET_UPDATE)(
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_TEAMS)(
unsigned int num_teams,
1677 unsigned int thread_limit) {
1683 static void __kmp_gomp_task_dup(kmp_task_t *dest, kmp_task_t *src,
1684 kmp_int32 last_private) {
1685 kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(src);
1686 if (taskdata->td_copy_func) {
1687 (taskdata->td_copy_func)(dest->shareds, src->shareds);
1691 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(
1698 template <
typename T>
1699 void __GOMP_taskloop(
void (*func)(
void *),
void *data,
1700 void (*copy_func)(
void *,
void *),
long arg_size,
1701 long arg_align,
unsigned gomp_flags,
1702 unsigned long num_tasks,
int priority, T start, T end,
1704 typedef void (*p_task_dup_t)(kmp_task_t *, kmp_task_t *, kmp_int32);
1705 MKLOC(loc,
"GOMP_taskloop");
1708 int gtid = __kmp_entry_gtid();
1709 kmp_int32 flags = 0;
1710 int if_val = gomp_flags & (1u << 10);
1711 int nogroup = gomp_flags & (1u << 11);
1712 int up = gomp_flags & (1u << 8);
1713 int reductions = gomp_flags & (1u << 12);
1714 p_task_dup_t task_dup = NULL;
1715 kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *)&flags;
1719 buff = __kmp_str_format(
1720 "GOMP_taskloop: T#%%d: func:%%p data:%%p copy_func:%%p "
1721 "arg_size:%%ld arg_align:%%ld gomp_flags:0x%%x num_tasks:%%lu "
1722 "priority:%%d start:%%%s end:%%%s step:%%%s\n",
1723 traits_t<T>::spec, traits_t<T>::spec, traits_t<T>::spec);
1724 KA_TRACE(20, (buff, gtid, func, data, copy_func, arg_size, arg_align,
1725 gomp_flags, num_tasks, priority, start, end, step));
1726 __kmp_str_free(&buff);
1729 KMP_ASSERT((
size_t)arg_size >= 2 *
sizeof(T));
1730 KMP_ASSERT(arg_align > 0);
1732 if (!(gomp_flags & 1)) {
1733 input_flags->tiedness = 1;
1736 if (gomp_flags & 2) {
1737 input_flags->final = 1;
1745 for (
int i =
sizeof(T) * CHAR_BIT - 1; i >= 0L; --i) {
1747 if (step & ((T)1 << i))
1749 step |= ((T)1 << i);
1753 input_flags->native = 1;
1755 if (num_tasks > 0) {
1756 if (gomp_flags & (1u << 9))
1767 __kmp_task_alloc(&loc, gtid, input_flags,
sizeof(kmp_task_t),
1768 arg_size + arg_align - 1, (kmp_routine_entry_t)func);
1769 kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
1770 taskdata->td_copy_func = copy_func;
1771 taskdata->td_size_loop_bounds =
sizeof(T);
1775 task->shareds = (
void *)((((
size_t)task->shareds) + arg_align - 1) /
1776 arg_align * arg_align);
1778 task_dup = __kmp_gomp_task_dup;
1780 KMP_MEMCPY(task->shareds, data, arg_size);
1782 loop_bounds = (T *)task->shareds;
1783 loop_bounds[0] = start;
1784 loop_bounds[1] = end + (up ? -1 : 1);
1787 #if OMPT_SUPPORT && OMPT_OPTIONAL
1788 OMPT_STORE_RETURN_ADDRESS(gtid);
1790 __kmpc_taskgroup(&loc, gtid);
1797 uintptr_t *d = ((data_t *)data)->d;
1798 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(d);
1801 __kmpc_taskloop(&loc, gtid, task, if_val, (kmp_uint64 *)&(loop_bounds[0]),
1802 (kmp_uint64 *)&(loop_bounds[1]), (kmp_int64)step, 1, sched,
1803 (kmp_uint64)num_tasks, (
void *)task_dup);
1805 #if OMPT_SUPPORT && OMPT_OPTIONAL
1806 OMPT_STORE_RETURN_ADDRESS(gtid);
1808 __kmpc_end_taskgroup(&loc, gtid);
1815 template <
typename T,
bool need_conversion = (sizeof(
long) == 4)>
1816 void __kmp_GOMP_doacross_post(T *count);
1818 template <>
void __kmp_GOMP_doacross_post<long, true>(
long *count) {
1819 int gtid = __kmp_entry_gtid();
1820 kmp_info_t *th = __kmp_threads[gtid];
1821 MKLOC(loc,
"GOMP_doacross_post");
1822 kmp_int64 num_dims = th->th.th_dispatch->th_doacross_info[0];
1823 kmp_int64 *vec = (kmp_int64 *)__kmp_thread_malloc(
1824 th, (
size_t)(
sizeof(kmp_int64) * num_dims));
1825 for (kmp_int64 i = 0; i < num_dims; ++i) {
1826 vec[i] = (kmp_int64)count[i];
1828 __kmpc_doacross_post(&loc, gtid, vec);
1829 __kmp_thread_free(th, vec);
1835 template <>
void __kmp_GOMP_doacross_post<long, false>(
long *count) {
1836 int gtid = __kmp_entry_gtid();
1837 MKLOC(loc,
"GOMP_doacross_post");
1838 __kmpc_doacross_post(&loc, gtid, RCAST(kmp_int64 *, count));
1841 template <
typename T>
void __kmp_GOMP_doacross_wait(T first, va_list args) {
1842 int gtid = __kmp_entry_gtid();
1843 kmp_info_t *th = __kmp_threads[gtid];
1844 MKLOC(loc,
"GOMP_doacross_wait");
1845 kmp_int64 num_dims = th->th.th_dispatch->th_doacross_info[0];
1846 kmp_int64 *vec = (kmp_int64 *)__kmp_thread_malloc(
1847 th, (
size_t)(
sizeof(kmp_int64) * num_dims));
1848 vec[0] = (kmp_int64)first;
1849 for (kmp_int64 i = 1; i < num_dims; ++i) {
1850 T item = va_arg(args, T);
1851 vec[i] = (kmp_int64)item;
1853 __kmpc_doacross_wait(&loc, gtid, vec);
1854 __kmp_thread_free(th, vec);
1862 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKLOOP)(
1863 void (*func)(
void *),
void *data,
void (*copy_func)(
void *,
void *),
1864 long arg_size,
long arg_align,
unsigned gomp_flags,
unsigned long num_tasks,
1865 int priority,
long start,
long end,
long step) {
1866 __GOMP_taskloop<long>(func, data, copy_func, arg_size, arg_align, gomp_flags,
1867 num_tasks, priority, start, end, step);
1870 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKLOOP_ULL)(
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,
unsigned long long start,
unsigned long long end,
1874 unsigned long long step) {
1875 __GOMP_taskloop<unsigned long long>(func, data, copy_func, arg_size,
1876 arg_align, gomp_flags, num_tasks,
1877 priority, start, end, step);
1880 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_POST)(
long *count) {
1881 __kmp_GOMP_doacross_post(count);
1884 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_WAIT)(
long first, ...) {
1886 va_start(args, first);
1887 __kmp_GOMP_doacross_wait<long>(first, args);
1891 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_ULL_POST)(
1892 unsigned long long *count) {
1893 int gtid = __kmp_entry_gtid();
1894 MKLOC(loc,
"GOMP_doacross_ull_post");
1895 __kmpc_doacross_post(&loc, gtid, RCAST(kmp_int64 *, count));
1898 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_ULL_WAIT)(
1899 unsigned long long first, ...) {
1901 va_start(args, first);
1902 __kmp_GOMP_doacross_wait<unsigned long long>(first, args);
1910 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TEAMS_REG)(void (*fn)(
void *),
1913 unsigned thread_limit,
1915 MKLOC(loc,
"GOMP_teams_reg");
1916 int gtid = __kmp_entry_gtid();
1917 KA_TRACE(20, (
"GOMP_teams_reg: T#%d num_teams=%u thread_limit=%u flag=%u\n",
1918 gtid, num_teams, thread_limit, flags));
1922 KA_TRACE(20, (
"GOMP_teams_reg exit: T#%d\n", gtid));
1925 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKWAIT_DEPEND)(
void **depend) {
1926 MKLOC(loc,
"GOMP_taskwait_depend");
1927 int gtid = __kmp_entry_gtid();
1928 KA_TRACE(20, (
"GOMP_taskwait_depend: T#%d\n", gtid));
1929 kmp_gomp_depends_info_t gomp_depends(depend);
1930 kmp_int32 ndeps = gomp_depends.get_num_deps();
1931 kmp_depend_info_t dep_list[ndeps];
1932 for (kmp_int32 i = 0; i < ndeps; i++)
1933 dep_list[i] = gomp_depends.get_kmp_depend(i);
1935 OMPT_STORE_RETURN_ADDRESS(gtid);
1938 KA_TRACE(20, (
"GOMP_taskwait_depend exit: T#%d\n", gtid));
1942 __kmp_GOMP_taskgroup_reduction_register(uintptr_t *data, kmp_taskgroup_t *tg,
1944 uintptr_t *allocated =
nullptr) {
1946 KMP_ASSERT(nthreads > 0);
1950 data[2] = allocated[2];
1951 data[6] = allocated[6];
1953 data[2] = (uintptr_t)__kmp_allocate(nthreads * data[1]);
1954 data[6] = data[2] + (nthreads * data[1]);
1957 tg->gomp_data = data;
1960 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER)(
1962 int gtid = __kmp_entry_gtid();
1963 KA_TRACE(20, (
"GOMP_taskgroup_reduction_register: T#%d\n", gtid));
1964 kmp_info_t *thread = __kmp_threads[gtid];
1965 kmp_taskgroup_t *tg = thread->th.th_current_task->td_taskgroup;
1966 int nthreads = thread->th.th_team_nproc;
1967 __kmp_GOMP_taskgroup_reduction_register(data, tg, nthreads);
1970 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER)(
1973 (
"GOMP_taskgroup_reduction_unregister: T#%d\n", __kmp_get_gtid()));
1974 KMP_ASSERT(data && data[2]);
1975 __kmp_free((
void *)data[2]);
1980 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK_REDUCTION_REMAP)(
size_t cnt,
1983 int gtid = __kmp_entry_gtid();
1984 KA_TRACE(20, (
"GOMP_task_reduction_remap: T#%d\n", gtid));
1985 kmp_info_t *thread = __kmp_threads[gtid];
1986 kmp_int32 tid = __kmp_get_tid();
1987 for (
size_t i = 0; i < cnt; ++i) {
1988 uintptr_t address = (uintptr_t)ptrs[i];
1989 void *propagated_address = NULL;
1990 void *mapped_address = NULL;
1992 kmp_taskgroup_t *tg = thread->th.th_current_task->td_taskgroup;
1994 uintptr_t *gomp_data = tg->gomp_data;
2000 size_t num_vars = (size_t)gomp_data[0];
2001 uintptr_t per_thread_size = gomp_data[1];
2002 uintptr_t reduce_data = gomp_data[2];
2003 uintptr_t end_reduce_data = gomp_data[6];
2004 for (
size_t j = 0; j < num_vars; ++j) {
2005 uintptr_t *entry = gomp_data + 7 + 3 * j;
2006 if (entry[0] == address) {
2007 uintptr_t offset = entry[1];
2009 (
void *)(reduce_data + tid * per_thread_size + offset);
2011 propagated_address = (
void *)entry[0];
2018 if (!mapped_address && address >= reduce_data &&
2019 address < end_reduce_data) {
2020 uintptr_t offset = (address - reduce_data) % per_thread_size;
2021 mapped_address = (
void *)(reduce_data + tid * per_thread_size + offset);
2023 for (
size_t j = 0; j < num_vars; ++j) {
2024 uintptr_t *entry = gomp_data + 7 + 3 * j;
2025 if (entry[1] == offset) {
2026 propagated_address = (
void *)entry[0];
2036 KMP_ASSERT(mapped_address);
2037 ptrs[i] = mapped_address;
2039 KMP_ASSERT(propagated_address);
2040 ptrs[cnt + i] = propagated_address;
2045 static void __kmp_GOMP_init_reductions(
int gtid, uintptr_t *data,
int is_ws) {
2046 kmp_info_t *thr = __kmp_threads[gtid];
2047 kmp_team_t *team = thr->th.th_team;
2049 __kmpc_taskgroup(NULL, gtid);
2051 void *reduce_data = KMP_ATOMIC_LD_RLX(&team->t.t_tg_reduce_data[is_ws]);
2052 if (reduce_data == NULL &&
2053 __kmp_atomic_compare_store(&team->t.t_tg_reduce_data[is_ws], reduce_data,
2056 KMP_DEBUG_ASSERT(reduce_data == NULL);
2057 __kmp_GOMP_taskgroup_reduction_register(data, NULL, thr->th.th_team_nproc);
2058 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[is_ws], 0);
2059 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[is_ws], (
void *)data);
2062 while ((reduce_data = KMP_ATOMIC_LD_ACQ(
2063 &team->t.t_tg_reduce_data[is_ws])) == (
void *)1) {
2066 KMP_DEBUG_ASSERT(reduce_data > (
void *)1);
2073 __kmp_GOMP_taskgroup_reduction_register(
2074 data, NULL, thr->th.th_team_nproc,
2075 (uintptr_t *)KMP_ATOMIC_LD_ACQ(&team->t.t_tg_reduce_data[is_ws]));
2077 kmp_taskgroup_t *tg = thr->th.th_current_task->td_taskgroup;
2078 tg->gomp_data = data;
2082 __kmp_GOMP_par_reductions_microtask_wrapper(
int *gtid,
int *npr,
2083 void (*task)(
void *),
void *data) {
2084 kmp_info_t *thr = __kmp_threads[*gtid];
2085 kmp_team_t *team = thr->th.th_team;
2086 uintptr_t *reduce_data = *(uintptr_t **)data;
2087 __kmp_GOMP_init_reductions(*gtid, reduce_data, 0);
2090 ompt_frame_t *ompt_frame;
2091 ompt_state_t enclosing_state;
2093 if (ompt_enabled.enabled) {
2095 enclosing_state = thr->th.ompt_thread_info.state;
2096 thr->th.ompt_thread_info.state = ompt_state_work_parallel;
2099 __ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
2100 ompt_frame->exit_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
2107 if (ompt_enabled.enabled) {
2109 ompt_frame->exit_frame = ompt_data_none;
2112 thr->th.ompt_thread_info.state = enclosing_state;
2115 __kmpc_end_taskgroup(NULL, *gtid);
2119 int count = KMP_ATOMIC_INC(&team->t.t_tg_fini_counter[0]);
2120 if (count == thr->th.th_team_nproc - 1) {
2121 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[0], NULL);
2122 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[0], 0);
2124 return (
unsigned)thr->th.th_team_nproc;
2127 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_REDUCTIONS)(
2128 void (*task)(
void *),
void *data,
unsigned num_threads,
2129 unsigned int flags) {
2130 MKLOC(loc,
"GOMP_parallel_reductions");
2131 int gtid = __kmp_entry_gtid();
2132 KA_TRACE(20, (
"GOMP_parallel_reductions: T#%d\n", gtid));
2133 __kmp_GOMP_fork_call(&loc, gtid, num_threads, flags, task,
2134 (microtask_t)__kmp_GOMP_par_reductions_microtask_wrapper,
2137 __kmp_GOMP_par_reductions_microtask_wrapper(>id, NULL, task, data);
2138 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)();
2139 KA_TRACE(20, (
"GOMP_parallel_reductions exit: T#%d\n", gtid));
2143 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_START)(
2144 long start,
long end,
long incr,
long sched,
long chunk_size,
long *istart,
2145 long *iend, uintptr_t *reductions,
void **mem) {
2147 int gtid = __kmp_entry_gtid();
2148 KA_TRACE(20, (
"GOMP_loop_start: T#%d, reductions: %p\n", gtid, reductions));
2150 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2152 KMP_FATAL(GompFeatureNotSupported,
"scan");
2155 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2156 long monotonic = sched & MONOTONIC_FLAG;
2157 sched &= ~MONOTONIC_FLAG;
2160 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START)(
2161 start, end, incr, istart, iend);
2163 status = KMP_EXPAND_NAME(
2164 KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START)(
2165 start, end, incr, istart, iend);
2166 }
else if (sched == 1) {
2167 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_START)(
2168 start, end, incr, chunk_size, istart, iend);
2169 }
else if (sched == 2) {
2171 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START)(
2172 start, end, incr, chunk_size, istart, iend);
2175 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START)(
2176 start, end, incr, chunk_size, istart, iend);
2177 }
else if (sched == 3) {
2179 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START)(
2180 start, end, incr, chunk_size, istart, iend);
2183 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START)(
2184 start, end, incr, chunk_size, istart, iend);
2185 }
else if (sched == 4) {
2186 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START)(
2187 start, end, incr, istart, iend);
2194 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_START)(
2195 bool up,
unsigned long long start,
unsigned long long end,
2196 unsigned long long incr,
long sched,
unsigned long long chunk_size,
2197 unsigned long long *istart,
unsigned long long *iend, uintptr_t *reductions,
2200 int gtid = __kmp_entry_gtid();
2202 (
"GOMP_loop_ull_start: T#%d, reductions: %p\n", gtid, reductions));
2204 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2206 KMP_FATAL(GompFeatureNotSupported,
"scan");
2209 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2210 long monotonic = sched & MONOTONIC_FLAG;
2211 sched &= ~MONOTONIC_FLAG;
2214 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START)(
2215 up, start, end, incr, istart, iend);
2217 status = KMP_EXPAND_NAME(
2218 KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START)(
2219 up, start, end, incr, istart, iend);
2220 }
else if (sched == 1) {
2221 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START)(
2222 up, start, end, incr, chunk_size, istart, iend);
2223 }
else if (sched == 2) {
2225 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START)(
2226 up, start, end, incr, chunk_size, istart, iend);
2228 status = KMP_EXPAND_NAME(
2229 KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START)(
2230 up, start, end, incr, chunk_size, istart, iend);
2231 }
else if (sched == 3) {
2233 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START)(
2234 up, start, end, incr, chunk_size, istart, iend);
2237 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START)(
2238 up, start, end, incr, chunk_size, istart, iend);
2239 }
else if (sched == 4) {
2241 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START)(
2242 up, start, end, incr, istart, iend);
2249 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_START)(
2250 unsigned ncounts,
long *counts,
long sched,
long chunk_size,
long *istart,
2251 long *iend, uintptr_t *reductions,
void **mem) {
2253 int gtid = __kmp_entry_gtid();
2254 KA_TRACE(20, (
"GOMP_loop_doacross_start: T#%d, reductions: %p\n", gtid,
2257 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2259 KMP_FATAL(GompFeatureNotSupported,
"scan");
2263 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2264 sched &= ~MONOTONIC_FLAG;
2266 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START)(
2267 ncounts, counts, istart, iend);
2268 }
else if (sched == 1) {
2269 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START)(
2270 ncounts, counts, chunk_size, istart, iend);
2271 }
else if (sched == 2) {
2272 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START)(
2273 ncounts, counts, chunk_size, istart, iend);
2274 }
else if (sched == 3) {
2275 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START)(
2276 ncounts, counts, chunk_size, istart, iend);
2283 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_START)(
2284 unsigned ncounts,
unsigned long long *counts,
long sched,
2285 unsigned long long chunk_size,
unsigned long long *istart,
2286 unsigned long long *iend, uintptr_t *reductions,
void **mem) {
2288 int gtid = __kmp_entry_gtid();
2289 KA_TRACE(20, (
"GOMP_loop_ull_doacross_start: T#%d, reductions: %p\n", gtid,
2292 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2294 KMP_FATAL(GompFeatureNotSupported,
"scan");
2298 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2299 sched &= ~MONOTONIC_FLAG;
2301 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START)(
2302 ncounts, counts, istart, iend);
2303 }
else if (sched == 1) {
2304 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START)(
2305 ncounts, counts, chunk_size, istart, iend);
2306 }
else if (sched == 2) {
2307 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START)(
2308 ncounts, counts, chunk_size, istart, iend);
2309 }
else if (sched == 3) {
2310 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START)(
2311 ncounts, counts, chunk_size, istart, iend);
2318 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_START)(
2319 long start,
long end,
long incr,
long sched,
long chunk_size,
long *istart,
2320 long *iend, uintptr_t *reductions,
void **mem) {
2322 int gtid = __kmp_entry_gtid();
2323 KA_TRACE(20, (
"GOMP_loop_ordered_start: T#%d, reductions: %p\n", gtid,
2326 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2328 KMP_FATAL(GompFeatureNotSupported,
"scan");
2332 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2333 sched &= ~MONOTONIC_FLAG;
2335 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START)(
2336 start, end, incr, istart, iend);
2337 }
else if (sched == 1) {
2338 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START)(
2339 start, end, incr, chunk_size, istart, iend);
2340 }
else if (sched == 2) {
2341 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START)(
2342 start, end, incr, chunk_size, istart, iend);
2343 }
else if (sched == 3) {
2344 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START)(
2345 start, end, incr, chunk_size, istart, iend);
2352 bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_START)(
2353 bool up,
unsigned long long start,
unsigned long long end,
2354 unsigned long long incr,
long sched,
unsigned long long chunk_size,
2355 unsigned long long *istart,
unsigned long long *iend, uintptr_t *reductions,
2358 int gtid = __kmp_entry_gtid();
2359 KA_TRACE(20, (
"GOMP_loop_ull_ordered_start: T#%d, reductions: %p\n", gtid,
2362 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2364 KMP_FATAL(GompFeatureNotSupported,
"scan");
2368 const long MONOTONIC_FLAG = (long)(kmp_sched_monotonic);
2369 sched &= ~MONOTONIC_FLAG;
2371 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START)(
2372 up, start, end, incr, istart, iend);
2373 }
else if (sched == 1) {
2374 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START)(
2375 up, start, end, incr, chunk_size, istart, iend);
2376 }
else if (sched == 2) {
2377 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START)(
2378 up, start, end, incr, chunk_size, istart, iend);
2379 }
else if (sched == 3) {
2380 status = KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START)(
2381 up, start, end, incr, chunk_size, istart, iend);
2388 unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS2_START)(
2389 unsigned count, uintptr_t *reductions,
void **mem) {
2390 int gtid = __kmp_entry_gtid();
2392 (
"GOMP_sections2_start: T#%d, reductions: %p\n", gtid, reductions));
2394 __kmp_GOMP_init_reductions(gtid, reductions, 1);
2396 KMP_FATAL(GompFeatureNotSupported,
"scan");
2397 return KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_START)(count);
2400 void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER)(
2402 int gtid = __kmp_get_gtid();
2403 MKLOC(loc,
"GOMP_workshare_task_reduction_unregister");
2404 KA_TRACE(20, (
"GOMP_workshare_task_reduction_unregister: T#%d\n", gtid));
2405 kmp_info_t *thr = __kmp_threads[gtid];
2406 kmp_team_t *team = thr->th.th_team;
2407 __kmpc_end_taskgroup(NULL, gtid);
2411 int count = KMP_ATOMIC_INC(&team->t.t_tg_fini_counter[1]);
2412 if (count == thr->th.th_team_nproc - 1) {
2413 KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER)
2414 ((uintptr_t *)KMP_ATOMIC_LD_RLX(&team->t.t_tg_reduce_data[1]));
2415 KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[1], NULL);
2416 KMP_ATOMIC_ST_REL(&team->t.t_tg_fini_counter[1], 0);
2428 #ifdef KMP_USE_VERSION_SYMBOLS
2430 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ATOMIC_END, 10,
"GOMP_1.0");
2431 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ATOMIC_START, 10,
"GOMP_1.0");
2432 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_BARRIER, 10,
"GOMP_1.0");
2433 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_END, 10,
"GOMP_1.0");
2434 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_NAME_END, 10,
"GOMP_1.0");
2435 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_NAME_START, 10,
"GOMP_1.0");
2436 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CRITICAL_START, 10,
"GOMP_1.0");
2437 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT, 10,
"GOMP_1.0");
2438 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START, 10,
"GOMP_1.0");
2439 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END, 10,
"GOMP_1.0");
2440 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END_NOWAIT, 10,
"GOMP_1.0");
2441 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT, 10,
"GOMP_1.0");
2442 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_GUIDED_START, 10,
"GOMP_1.0");
2443 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_NEXT, 10,
"GOMP_1.0");
2444 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_DYNAMIC_START, 10,
2446 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_NEXT, 10,
"GOMP_1.0");
2447 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_GUIDED_START, 10,
"GOMP_1.0");
2448 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT, 10,
"GOMP_1.0");
2449 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_START, 10,
2451 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_NEXT, 10,
"GOMP_1.0");
2452 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_STATIC_START, 10,
"GOMP_1.0");
2453 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT, 10,
"GOMP_1.0");
2454 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_RUNTIME_START, 10,
"GOMP_1.0");
2455 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT, 10,
"GOMP_1.0");
2456 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_STATIC_START, 10,
"GOMP_1.0");
2457 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ORDERED_END, 10,
"GOMP_1.0");
2458 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ORDERED_START, 10,
"GOMP_1.0");
2459 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_END, 10,
"GOMP_1.0");
2460 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC_START, 10,
2462 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED_START, 10,
2464 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME_START, 10,
2466 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC_START, 10,
2468 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_SECTIONS_START, 10,
"GOMP_1.0");
2469 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_START, 10,
"GOMP_1.0");
2470 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END, 10,
"GOMP_1.0");
2471 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END_NOWAIT, 10,
"GOMP_1.0");
2472 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_NEXT, 10,
"GOMP_1.0");
2473 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_START, 10,
"GOMP_1.0");
2474 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_COPY_END, 10,
"GOMP_1.0");
2475 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_COPY_START, 10,
"GOMP_1.0");
2476 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SINGLE_START, 10,
"GOMP_1.0");
2479 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASK, 20,
"GOMP_2.0");
2480 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKWAIT, 20,
"GOMP_2.0");
2481 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_NEXT, 20,
"GOMP_2.0");
2482 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DYNAMIC_START, 20,
"GOMP_2.0");
2483 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT, 20,
"GOMP_2.0");
2484 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START, 20,
"GOMP_2.0");
2485 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_NEXT, 20,
2487 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_DYNAMIC_START, 20,
2489 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_NEXT, 20,
2491 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_GUIDED_START, 20,
2493 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT, 20,
2495 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_START, 20,
2497 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT, 20,
2499 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_STATIC_START, 20,
2501 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT, 20,
"GOMP_2.0");
2502 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START, 20,
"GOMP_2.0");
2503 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_NEXT, 20,
"GOMP_2.0");
2504 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20,
"GOMP_2.0");
2507 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKYIELD, 30,
"GOMP_3.0");
2510 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL, 40,
"GOMP_4.0");
2511 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40,
"GOMP_4.0");
2512 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40,
"GOMP_4.0");
2513 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED, 40,
"GOMP_4.0");
2514 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME, 40,
"GOMP_4.0");
2515 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_STATIC, 40,
"GOMP_4.0");
2516 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_START, 40,
"GOMP_4.0");
2517 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_END, 40,
"GOMP_4.0");
2518 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_BARRIER_CANCEL, 40,
"GOMP_4.0");
2519 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CANCEL, 40,
"GOMP_4.0");
2520 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_CANCELLATION_POINT, 40,
"GOMP_4.0");
2521 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_END_CANCEL, 40,
"GOMP_4.0");
2522 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL, 40,
"GOMP_4.0");
2523 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET, 40,
"GOMP_4.0");
2524 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_DATA, 40,
"GOMP_4.0");
2525 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_END_DATA, 40,
"GOMP_4.0");
2526 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_UPDATE, 40,
"GOMP_4.0");
2527 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TEAMS, 40,
"GOMP_4.0");
2530 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP, 45,
"GOMP_4.5");
2531 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP_ULL, 45,
"GOMP_4.5");
2532 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_POST, 45,
"GOMP_4.5");
2533 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_WAIT, 45,
"GOMP_4.5");
2534 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_STATIC_START, 45,
2536 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_DYNAMIC_START, 45,
2538 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_GUIDED_START, 45,
2540 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START, 45,
2542 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_ULL_POST, 45,
"GOMP_4.5");
2543 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_ULL_WAIT, 45,
"GOMP_4.5");
2544 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_STATIC_START, 45,
2546 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START, 45,
2548 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, 45,
2550 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, 45,
2552 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, 45,
2554 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, 45,
2556 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START, 45,
2558 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, 45,
2560 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, 45,
2562 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, 45,
2564 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, 45,
2566 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, 45,
2568 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, 45,
2570 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED, 45,
2574 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT, 50,
2576 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START, 50,
2578 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT, 50,
2580 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_RUNTIME_START, 50,
2582 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
2584 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
2586 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT, 50,
2588 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START, 50,
2590 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME, 50,
2592 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
2594 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TEAMS_REG, 50,
"GOMP_5.0");
2595 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKWAIT_DEPEND, 50,
"GOMP_5.0");
2596 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_REGISTER, 50,
2598 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKGROUP_REDUCTION_UNREGISTER, 50,
2600 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASK_REDUCTION_REMAP, 50,
"GOMP_5.0");
2601 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_REDUCTIONS, 50,
"GOMP_5.0");
2602 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_START, 50,
"GOMP_5.0");
2603 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_START, 50,
"GOMP_5.0");
2604 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_DOACROSS_START, 50,
"GOMP_5.0");
2605 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_START, 50,
"GOMP_5.0");
2606 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ORDERED_START, 50,
"GOMP_5.0");
2607 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_START, 50,
"GOMP_5.0");
2608 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS2_START, 50,
"GOMP_5.0");
2609 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 *)