39#if OMP_PROFILING_SUPPORT
40#include "llvm/Support/TimeProfiler.h"
41static char *ProfileTraceFile =
nullptr;
45#define KMP_USE_PRCTL 0
61#if defined(KMP_GOMP_COMPAT)
74#define KMP_MIN(x, y) ((x) < (y) ? (x) : (y))
91#if KMP_AFFINITY_SUPPORTED
92static void __kmp_partition_places(
kmp_team_t *team,
93 int update_master_only = 0);
96#if ENABLE_LIBOMPTARGET
97static void __kmp_target_init(
void);
104#ifdef USE_LOAD_BALANCE
105static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc);
110static int __kmp_unregister_root_other_thread(
int gtid);
127 new_nested_nth->
nth[
i] = 0;
129 new_nested_nth->
nth[
i] = thr->th.th_set_nested_nth[
j];
131 return new_nested_nth;
147 (
"*** __kmp_get_global_thread_id: entering, nproc=%d all_nproc=%d\n",
160 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using TDATA\n"));
165 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using keyed TLS\n"));
168 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using internal alg.\n"));
170 stack_addr = (
char *)&stack_data;
190 stack_size = (size_t)
TCR_PTR(thr->th.th_info.ds.ds_stacksize);
191 stack_base = (
char *)
TCR_PTR(thr->th.th_info.ds.ds_stackbase);
195 if (stack_addr <= stack_base) {
196 size_t stack_diff = stack_base - stack_addr;
198 if (stack_diff <= stack_size) {
214 (
"*** __kmp_get_global_thread_id: internal alg. failed to find "
215 "thread, using TLS\n"));
232 if (!
TCR_4(other_threads[
i]->th.th_info.ds.ds_stackgrow)) {
236 stack_base = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
237 if (stack_addr > stack_base) {
238 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stackbase, stack_addr);
239 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
240 other_threads[
i]->th.th_info.ds.ds_stacksize + stack_addr -
243 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
244 stack_base - stack_addr);
249 char *stack_end = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
250 char *stack_beg = stack_end - other_threads[
i]->th.th_info.ds.ds_stacksize;
252 other_threads[
i]->th.th_info.ds.ds_stacksize,
253 "th_%d stack (refinement)",
i);
266 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using TDATA\n"));
271 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using keyed TLS\n"));
275 (
"*** __kmp_get_global_thread_id_reg: using internal alg.\n"));
282 (
"__kmp_get_global_thread_id_reg: Encountered new root thread. "
283 "Registering a new gtid.\n"));
303 char *stack_beg = NULL;
304 char *stack_end = NULL;
307 KA_TRACE(10, (
"__kmp_check_stack_overlap: called\n"));
309 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
310 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
316 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
317 "th_%s stack (%s)",
"mon",
318 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
321 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
322 "th_%d stack (%s)", gtid,
323 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
332 (
"__kmp_check_stack_overlap: performing extensive checking\n"));
333 if (stack_beg == NULL) {
334 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
335 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
341 if (f_th && f_th != th) {
342 char *other_stack_end =
343 (
char *)
TCR_PTR(f_th->th.th_info.ds.ds_stackbase);
344 char *other_stack_beg =
345 other_stack_end - (size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize);
346 if ((stack_beg > other_stack_beg && stack_beg < other_stack_end) ||
347 (stack_end > other_stack_beg && stack_end < other_stack_end)) {
352 -1, other_stack_beg, other_stack_end,
353 (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize),
362 KA_TRACE(10, (
"__kmp_check_stack_overlap: returning\n"));
368 static int done =
FALSE;
375#define MAX_MESSAGE 512
378 char const *format, ...) {
382 va_start(ap, format);
383 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP storage map: %p %p%8lu %s\n", p1,
384 p2, (
unsigned long)
size, format);
387#if KMP_PRINT_DATA_PLACEMENT
390 if (p1 <= p2 && (
char *)p2 - (
char *)p1 ==
size) {
392 node = __kmp_get_host_node(p1);
398 int localProc = __kmp_get_cpu_from_gtid(gtid);
402 p1 = (
void *)((
size_t)p1 & ~((
size_t)page_size - 1));
403 p2 = (
void *)(((
size_t)p2 - 1) & ~((
size_t)page_size - 1));
417 (
char *)p1 += page_size;
418 }
while (p1 <= p2 && (node = __kmp_get_host_node(p1)) == lastNode);
424 (
char *)p1 + (page_size - 1),
425 __kmp_get_host_node(p1));
428 (
char *)p2 + (page_size - 1),
429 __kmp_get_host_node(p2));
451 va_start(ap, format);
453 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP warning: %s\n", format);
537#if KMP_FAST_REDUCTION_BARRIER
549 int team_id,
int num_thr) {
557 "%s_%d.t_bar", header, team_id);
567 "%s_%d.t_bar[forkjoin]", header, team_id);
569#if KMP_FAST_REDUCTION_BARRIER
573 "%s_%d.t_bar[reduction]", header, team_id);
577 -1, &team->
t.t_dispatch[0], &team->
t.t_dispatch[num_thr],
578 sizeof(
kmp_disp_t) * num_thr,
"%s_%d.t_dispatch", header, team_id);
581 -1, &team->
t.t_threads[0], &team->
t.t_threads[num_thr],
582 sizeof(
kmp_info_t *) * num_thr,
"%s_%d.t_threads", header, team_id);
585 &team->
t.t_disp_buffer[num_disp_buff],
587 "%s_%d.t_disp_buffer", header, team_id);
601#if ENABLE_LIBOMPTARGET
602static void __kmp_init_omptarget() {
603 __kmp_init_target_task();
612BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
617 case DLL_PROCESS_ATTACH:
618 KA_TRACE(10, (
"DllMain: PROCESS_ATTACH\n"));
622 case DLL_PROCESS_DETACH:
636 if (lpReserved == NULL)
641 case DLL_THREAD_ATTACH:
642 KA_TRACE(10, (
"DllMain: THREAD_ATTACH\n"));
648 case DLL_THREAD_DETACH:
663 int gtid = *gtid_ref;
664#ifdef BUILD_PARALLEL_ORDERED
670#if KMP_USE_DYNAMIC_LOCK
676#ifdef BUILD_PARALLEL_ORDERED
677 if (!team->
t.t_serialized) {
688 int gtid = *gtid_ref;
689#ifdef BUILD_PARALLEL_ORDERED
698#ifdef BUILD_PARALLEL_ORDERED
699 if (!team->
t.t_serialized) {
704 team->
t.t_ordered.dt.t_value = ((tid + 1) % team->
t.t_nproc);
724 team = th->th.th_team;
727 th->th.th_ident = id_ref;
729 if (team->
t.t_serialized) {
732 kmp_int32 old_this = th->th.th_local.this_construct;
734 ++th->th.th_local.this_construct;
738 if (team->
t.t_construct == old_this) {
740 th->th.th_local.this_construct);
743 if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
745 team->
t.t_active_level == 1) {
747 __kmp_itt_metadata_single(id_ref);
761 __kmp_itt_single_start(gtid);
769 __kmp_itt_single_end(gtid);
782 int master_tid,
int set_nthreads,
788 kmp_info_t *this_thr = parent_team->
t.t_threads[master_tid];
792 new_nthreads = set_nthreads;
796#ifdef USE_LOAD_BALANCE
797 else if (
__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
798 new_nthreads = __kmp_load_balance_nproc(root, set_nthreads);
799 if (new_nthreads == 1) {
800 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
801 "reservation to 1 thread\n",
805 if (new_nthreads < set_nthreads) {
806 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
807 "reservation to %d threads\n",
808 master_tid, new_nthreads));
814 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
815 if (new_nthreads <= 1) {
816 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
817 "reservation to 1 thread\n",
821 if (new_nthreads < set_nthreads) {
822 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
823 "reservation to %d threads\n",
824 master_tid, new_nthreads));
826 new_nthreads = set_nthreads;
829 if (set_nthreads > 2) {
831 new_nthreads = (new_nthreads % set_nthreads) + 1;
832 if (new_nthreads == 1) {
833 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
834 "reservation to 1 thread\n",
838 if (new_nthreads < set_nthreads) {
839 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
840 "reservation to %d threads\n",
841 master_tid, new_nthreads));
850 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
853 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
854 if (tl_nthreads <= 0) {
862 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
865 if (tl_nthreads == 1) {
866 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT "
867 "reduced reservation to 1 thread\n",
871 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT reduced "
872 "reservation to %d threads\n",
873 master_tid, tl_nthreads));
874 new_nthreads = tl_nthreads;
878 int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
879 int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
880 if (cg_nthreads + new_nthreads -
881 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
883 int tl_nthreads = max_cg_threads - cg_nthreads +
884 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
885 if (tl_nthreads <= 0) {
893 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
896 if (tl_nthreads == 1) {
897 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT "
898 "reduced reservation to 1 thread\n",
902 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT reduced "
903 "reservation to %d threads\n",
904 master_tid, tl_nthreads));
905 new_nthreads = tl_nthreads;
922 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
925 int slotsRequired =
__kmp_nth + new_nthreads -
926 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) -
929 if (slotsAdded < slotsRequired) {
931 new_nthreads -= (slotsRequired - slotsAdded);
939 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
944 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
952 if (new_nthreads == 1) {
954 (
"__kmp_reserve_threads: T#%d serializing team after reclaiming "
955 "dead roots and rechecking; requested %d threads\n",
958 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d allocating %d threads; requested"
964 if (this_thr->th.th_nt_strict && new_nthreads < set_nthreads) {
965 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
966 this_thr->th.th_nt_msg);
976 int fork_teams_workers) {
980 KA_TRACE(10, (
"__kmp_fork_team_threads: new_nprocs = %d\n", team->
t.t_nproc));
985 master_th->th.th_info.ds.ds_tid = 0;
986 master_th->th.th_team = team;
987 master_th->th.th_team_nproc = team->
t.t_nproc;
988 master_th->th.th_team_master = master_th;
989 master_th->th.th_team_serialized =
FALSE;
990 master_th->th.th_dispatch = &team->
t.t_dispatch[0];
997 int level = team->
t.t_active_level - 1;
998 if (master_th->th.th_teams_microtask) {
999 if (master_th->th.th_teams_size.nteams > 1) {
1004 master_th->th.th_teams_level == team->
t.t_level) {
1010 if (hot_teams[
level].hot_team) {
1023 if (!use_hot_team) {
1026 team->
t.t_threads[0] = master_th;
1030 for (
i = 1;
i < team->
t.t_nproc;
i++) {
1034 team->
t.t_threads[
i] = thr;
1038 KA_TRACE(20, (
"__kmp_fork_team_threads: T#%d(%d:%d) init arrived "
1039 "T#%d(%d:%d) join =%llu, plain=%llu\n",
1044 thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
1045 thr->th.th_teams_level = master_th->th.th_teams_level;
1046 thr->th.th_teams_size = master_th->th.th_teams_size;
1051 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
1054 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
1060#if KMP_AFFINITY_SUPPORTED
1064 if (!fork_teams_workers) {
1065 __kmp_partition_places(team);
1069 if (team->
t.t_nproc > 1 &&
1071 team->
t.b->update_num_threads(team->
t.t_nproc);
1082 (
"__kmp_fork_team_threads: Primary T#%d pushing task_team %p / team "
1083 "%p, new task_team %p / team %p\n",
1085 team->
t.t_parent, team->
t.t_task_team[master_th->th.th_task_state],
1090 master_th->th.th_task_state);
1094 if (team->
t.t_nproc > 1) {
1096 team->
t.t_threads[1]->th.th_task_state == 1);
1098 team->
t.t_threads[1]->th.th_task_state);
1100 master_th->th.th_task_state = 0;
1105 master_th->th.th_task_state);
1107 master_th->th.th_task_state = 0;
1112 for (
i = 0;
i < team->
t.t_nproc;
i++) {
1114 if (thr->th.th_prev_num_threads != team->
t.t_nproc ||
1115 thr->th.th_prev_level != team->
t.t_level) {
1116 team->
t.t_display_affinity = 1;
1125#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1130 if (__kmp_inherit_fp_control) {
1135 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1136 __kmp_store_mxcsr(&mxcsr);
1137 mxcsr &= KMP_X86_MXCSR_MASK;
1163 if (__kmp_inherit_fp_control && team->
t.t_fp_control_saved) {
1168 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1169 __kmp_store_mxcsr(&mxcsr);
1170 mxcsr &= KMP_X86_MXCSR_MASK;
1172 if (team->
t.t_x87_fpu_control_word != x87_fpu_control_word) {
1173 __kmp_clear_x87_fpu_status_word();
1174 __kmp_load_x87_fpu_control_word(&team->
t.t_x87_fpu_control_word);
1177 if (team->
t.t_mxcsr != mxcsr) {
1178 __kmp_load_mxcsr(&team->
t.t_mxcsr);
1183#define propagateFPControl(x) ((void)0)
1184#define updateHWFPControl(x) ((void)0)
1196 KC_TRACE(10, (
"__kmpc_serialized_parallel: called by T#%d\n", global_tid));
1208 serial_team = this_thr->th.th_serial_team;
1215 if (this_thr->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1220 proc_bind = this_thr->th.th_current_task->td_icvs.proc_bind;
1228 if (this_thr->th.th_nt_strict && this_thr->th.th_set_nproc > 1)
1229 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
1230 this_thr->th.th_nt_msg);
1232 this_thr->th.th_set_nproc = 0;
1235 ompt_data_t ompt_parallel_data = ompt_data_none;
1236 void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
1238 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1241 parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
1249 &ompt_parallel_data, team_size,
1250 ompt_parallel_invoker_program | ompt_parallel_team, codeptr);
1255 if (this_thr->th.th_team != serial_team) {
1257 int level = this_thr->th.th_team->t.t_level;
1259 if (serial_team->
t.t_serialized) {
1267 this_thr->th.th_root, 1, 1,
1271 proc_bind, &this_thr->th.th_current_task->td_icvs, 0, NULL);
1276 new_team->
t.t_threads[0] = this_thr;
1277 new_team->
t.t_parent = this_thr->th.th_team;
1278 serial_team = new_team;
1279 this_thr->th.th_serial_team = serial_team;
1283 (
"__kmpc_serialized_parallel: T#%d allocated new serial team %p\n",
1284 global_tid, serial_team));
1292 (
"__kmpc_serialized_parallel: T#%d reusing cached serial team %p\n",
1293 global_tid, serial_team));
1300 serial_team->
t.t_ident =
loc;
1301 serial_team->
t.t_serialized = 1;
1302 serial_team->
t.t_nproc = 1;
1303 serial_team->
t.t_parent = this_thr->th.th_team;
1304 if (this_thr->th.th_team->t.t_nested_nth)
1305 serial_team->
t.t_nested_nth = this_thr->th.th_team->t.t_nested_nth;
1309 serial_team->
t.t_primary_task_state = this_thr->th.th_task_state;
1310 serial_team->
t.t_sched.sched = this_thr->th.th_team->t.t_sched.sched;
1311 this_thr->th.th_team = serial_team;
1312 serial_team->
t.t_master_tid = this_thr->th.th_info.ds.ds_tid;
1314 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d curtask=%p\n", global_tid,
1315 this_thr->th.th_current_task));
1316 KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 1);
1317 this_thr->th.th_current_task->td_flags.executing = 0;
1324 copy_icvs(&this_thr->th.th_current_task->td_icvs,
1325 &this_thr->th.th_current_task->td_parent->td_icvs);
1330 if (this_thr->th.th_team->t.t_nested_nth)
1331 nested_nth = this_thr->th.th_team->t.t_nested_nth;
1333 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1338 this_thr->th.th_current_task->td_icvs.proc_bind =
1345 this_thr->th.th_info.ds.ds_tid = 0;
1348 this_thr->th.th_team_nproc = 1;
1349 this_thr->th.th_team_master = this_thr;
1350 this_thr->th.th_team_serialized = 1;
1351 this_thr->th.th_task_team = NULL;
1352 this_thr->th.th_task_state = 0;
1354 serial_team->
t.t_level = serial_team->
t.t_parent->t.t_level + 1;
1355 serial_team->
t.t_active_level = serial_team->
t.t_parent->t.t_active_level;
1356 serial_team->
t.t_def_allocator = this_thr->th.th_def_allocator;
1362 if (!serial_team->
t.t_dispatch->th_disp_buffer) {
1363 serial_team->
t.t_dispatch->th_disp_buffer =
1367 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1377 ++serial_team->
t.t_serialized;
1378 this_thr->th.th_team_serialized = serial_team->
t.t_serialized;
1381 int level = this_thr->th.th_team->t.t_level;
1386 if (serial_team->
t.t_nested_nth)
1387 nested_nth = serial_team->
t.t_nested_nth;
1389 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1392 serial_team->
t.t_level++;
1393 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d increasing nesting level "
1394 "of serial team %p to %d\n",
1395 global_tid, serial_team, serial_team->
t.t_level));
1403 disp_buffer->next = serial_team->
t.t_dispatch->th_disp_buffer;
1404 serial_team->
t.t_dispatch->th_disp_buffer = disp_buffer;
1406 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1418 if (this_thr->th.th_prev_level != serial_team->
t.t_level ||
1419 this_thr->th.th_prev_num_threads != 1) {
1422 this_thr->th.th_prev_level = serial_team->
t.t_level;
1423 this_thr->th.th_prev_num_threads = 1;
1430 serial_team->
t.ompt_team_info.master_return_address = codeptr;
1432 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1433 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1438 &ompt_parallel_data, codeptr);
1446 ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
1448 ompt_task_implicit);
1449 OMPT_CUR_TASK_INFO(this_thr)->thread_num =
1454 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
1455 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1465 return (master_th->th.th_teams_microtask && ap &&
1473 return ((ap == NULL && active_level == 0) ||
1474 (ap && teams_level > 0 && teams_level ==
level));
1486 ompt_data_t ompt_parallel_data,
void *return_address,
1492 parent_team->
t.t_ident =
loc;
1494 parent_team->
t.t_argc = argc;
1495 argv = (
void **)parent_team->
t.t_argv;
1496 for (
i = argc - 1;
i >= 0; --
i) {
1500 if (parent_team == master_th->th.th_serial_team) {
1508 parent_team->
t.t_serialized--;
1518 void **exit_frame_p;
1519 ompt_data_t *implicit_task_data;
1524 &ompt_parallel_data, return_address);
1531 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1535 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), implicit_task_data,
1536 1, OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1540 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1542 exit_frame_p = &dummy;
1548 parent_team->
t.t_serialized--;
1563 *exit_frame_p = NULL;
1564 OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
1567 ompt_scope_end, NULL, implicit_task_data, 1,
1568 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1570 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1574 &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th),
1575 OMPT_INVOKER(call_context) | ompt_parallel_team, return_address);
1577 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1584 parent_team->
t.t_invoke = invoker;
1586 parent_team->
t.t_active_level++;
1587 parent_team->
t.t_level++;
1588 parent_team->
t.t_def_allocator = master_th->th.th_def_allocator;
1595 master_th->th.th_teams_size.nth = parent_team->
t.t_nproc;
1607 if (master_set_numthreads) {
1608 if (master_set_numthreads <= master_th->th.th_teams_size.nth) {
1610 kmp_info_t **other_threads = parent_team->
t.t_threads;
1613 int old_proc = master_th->th.th_teams_size.nth;
1618 parent_team->
t.t_nproc = master_set_numthreads;
1619 for (
i = 0;
i < master_set_numthreads; ++
i) {
1620 other_threads[
i]->th.th_team_nproc = master_set_numthreads;
1624 master_th->th.th_set_nproc = 0;
1629 int nth = __kmp_omp_num_threads(
loc);
1631 master_set_numthreads = nth;
1640 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1645 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
1653 master_th->th.th_current_task->td_icvs.proc_bind)) {
1660 master_th->th.th_current_task->td_icvs.proc_bind != proc_bind_icv) {
1661 kmp_info_t **other_threads = parent_team->
t.t_threads;
1662 for (
i = 0;
i < master_th->th.th_team_nproc; ++
i) {
1663 other_threads[
i]->th.th_current_task->td_icvs.proc_bind = proc_bind_icv;
1669#if USE_ITT_BUILD && USE_ITT_NOTIFY
1670 if (((__itt_frame_submit_v3_ptr && __itt_get_timestamp_ptr) ||
1672 __kmp_forkjoin_frames_mode == 3 &&
1673 parent_team->
t.t_active_level == 1
1674 && master_th->th.th_teams_size.nteams == 1) {
1676 master_th->th.th_frame_time = tmp_time;
1677 parent_team->
t.t_region_time = tmp_time;
1679 if (__itt_stack_caller_create_ptr) {
1682 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
1685#if KMP_AFFINITY_SUPPORTED
1686 __kmp_partition_places(parent_team);
1689 KF_TRACE(10, (
"__kmp_fork_in_teams: before internal fork: root=%p, team=%p, "
1690 "master_th=%p, gtid=%d\n",
1691 root, parent_team, master_th, gtid));
1693 KF_TRACE(10, (
"__kmp_fork_in_teams: after internal fork: root=%p, team=%p, "
1694 "master_th=%p, gtid=%d\n",
1695 root, parent_team, master_th, gtid));
1701 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) invoke microtask = %p\n", gtid,
1702 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1704 if (!parent_team->
t.t_invoke(gtid)) {
1705 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
1707 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) done microtask = %p\n", gtid,
1708 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1711 KA_TRACE(20, (
"__kmp_fork_in_teams: parallel exit T#%d\n", gtid));
1722 ompt_data_t *ompt_parallel_data,
void **return_address,
1723 ompt_data_t **parent_task_data,
1731#if KMP_OS_LINUX && \
1732 (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
1740 20, (
"__kmp_serial_fork_call: T#%d serializing parallel region\n", gtid));
1745 master_th->th.th_serial_team->t.t_pkfn =
microtask;
1750 master_th->th.th_serial_team->t.t_ident =
loc;
1753 master_th->th.th_serial_team->t.t_level--;
1758 void **exit_frame_p;
1764 ompt_parallel_data, *return_address);
1768 task_info = OMPT_CUR_TASK_INFO(master_th);
1769 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1773 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1775 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1779 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1781 exit_frame_p = &dummy;
1798 *exit_frame_p = NULL;
1801 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1802 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1804 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1808 ompt_parallel_data, *parent_task_data,
1809 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1811 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1816 team = master_th->th.th_team;
1818 team->
t.t_invoke = invoker;
1820 team->
t.t_argc = argc;
1821 argv = (
void **)team->
t.t_argv;
1822 for (
i = argc - 1;
i >= 0; --
i)
1834 ompt_scope_end, NULL, &(task_info->
task_data), 0,
1835 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial);
1839 ompt_parallel_data, *parent_task_data,
1843 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1848 for (
i = argc - 1;
i >= 0; --
i)
1854 void **exit_frame_p;
1857 ompt_data_t *implicit_task_data;
1861 ompt_parallel_data, *return_address);
1864 task_info = OMPT_CUR_TASK_INFO(master_th);
1865 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1868 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1871 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1873 ompt_task_implicit);
1878 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1880 exit_frame_p = &dummy;
1897 *exit_frame_p = NULL;
1900 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1901 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1904 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1908 ompt_parallel_data, *parent_task_data,
1909 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1911 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1929 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1933 "__kmp_serial_fork_call: unknown fork_context parameter");
1936 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1950 int master_this_cons;
1957 int master_set_numthreads;
1958 int task_thread_limit = 0;
1967 KA_TRACE(20, (
"__kmp_fork_call: enter T#%d\n", gtid));
1989 parent_team = master_th->th.th_team;
1990 master_tid = master_th->th.th_info.ds.ds_tid;
1991 master_this_cons = master_th->th.th_local.this_construct;
1992 root = master_th->th.th_root;
1993 master_active = root->r.r_active;
1994 master_set_numthreads = master_th->th.th_set_nproc;
1996 master_th->th.th_current_task->td_icvs.task_thread_limit;
1999 ompt_data_t ompt_parallel_data = ompt_data_none;
2000 ompt_data_t *parent_task_data = NULL;
2001 ompt_frame_t *ompt_frame = NULL;
2002 void *return_address = NULL;
2007 return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
2015 level = parent_team->
t.t_level;
2017 active_level = parent_team->
t.t_active_level;
2019 teams_level = master_th->th.th_teams_level;
2020 p_hot_teams = &master_th->th.th_hot_teams;
2024 (*p_hot_teams)[0].
hot_team = root->r.r_hot_team;
2026 (*p_hot_teams)[0].hot_team_nth = 1;
2032 int team_size = master_set_numthreads
2033 ? master_set_numthreads
2037 ? ompt_parallel_league
2038 : ompt_parallel_team);
2040 parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags,
2043 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2047 master_th->th.th_ident =
loc;
2053 master_set_numthreads,
level,
2055 ompt_parallel_data, return_address,
2069 if ((!enter_teams &&
2070 (parent_team->
t.t_active_level >=
2071 master_th->th.th_current_task->td_icvs.max_active_levels)) ||
2073 KC_TRACE(10, (
"__kmp_fork_call: T#%d serializing team\n", gtid));
2076 nthreads = master_set_numthreads
2077 ? master_set_numthreads
2082 nthreads = task_thread_limit > 0 && task_thread_limit < nthreads
2095 nthreads, enter_teams);
2096 if (nthreads == 1) {
2107 master_th->th.th_set_nproc = 0;
2109 if (nthreads == 1) {
2111 invoker, master_th, parent_team,
2113 &ompt_parallel_data, &return_address,
2121 KF_TRACE(10, (
"__kmp_fork_call: parent_team_aclevel=%d, master_th=%p, "
2122 "curtask=%p, curtask_max_aclevel=%d\n",
2123 parent_team->
t.t_active_level, master_th,
2124 master_th->th.th_current_task,
2125 master_th->th.th_current_task->td_icvs.max_active_levels));
2129 master_th->th.th_current_task->td_flags.executing = 0;
2131 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2137 int nthreads_icv = master_th->th.th_current_task->td_icvs.nproc;
2139 if (!master_th->th.th_set_nested_nth &&
2140 (
level + 1 < parent_team->
t.t_nested_nth->used) &&
2141 (parent_team->
t.t_nested_nth->nth[
level + 1] != nthreads_icv)) {
2142 nthreads_icv = parent_team->
t.t_nested_nth->nth[
level + 1];
2143 }
else if (master_th->th.th_set_nested_nth) {
2146 (nested_nth->
nth[
level + 1] != nthreads_icv))
2147 nthreads_icv = nested_nth->
nth[
level + 1];
2158 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
2164 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
2167 if (master_th->th.th_teams_microtask &&
2177 master_th->th.th_current_task->td_icvs.proc_bind)) {
2180 if (!master_th->th.th_teams_microtask ||
2191 copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
2192 new_icvs.
next = NULL;
2193 if (nthreads_icv > 0) {
2194 new_icvs.
nproc = nthreads_icv;
2201 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2206 proc_bind, &new_icvs, argc, master_th);
2211 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2213 root, nthreads, nthreads,
2217 proc_bind, &master_th->th.th_current_task->td_icvs, argc, master_th);
2220 &master_th->th.th_current_task->td_icvs);
2223 10, (
"__kmp_fork_call: after __kmp_allocate_team - team = %p\n", team));
2237 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2238 int new_level = parent_team->
t.t_level + 1;
2240 new_level = parent_team->
t.t_active_level + 1;
2244 int new_level = parent_team->
t.t_level;
2246 new_level = parent_team->
t.t_active_level;
2257 if (team->
t.t_nested_nth &&
2258 team->
t.t_nested_nth != parent_team->
t.t_nested_nth) {
2261 team->
t.t_nested_nth = NULL;
2263 team->
t.t_nested_nth = parent_team->
t.t_nested_nth;
2264 if (master_th->th.th_set_nested_nth) {
2267 team->
t.t_nested_nth = nested_nth;
2269 master_th->th.th_set_nested_nth = NULL;
2270 master_th->th.th_set_nested_nth_sz = 0;
2271 master_th->th.th_nt_strict =
false;
2277 if (ompd_state & OMPD_ENABLE_BP)
2278 ompd_bp_parallel_begin();
2283 (
"__kmp_fork_call: T#%d(%d:%d)->(%d:0) created a team of %d threads\n",
2284 gtid, parent_team->
t.t_id, team->
t.t_master_tid, team->
t.t_id,
2287 (team->
t.t_master_tid == 0 &&
2288 (team->
t.t_parent == root->r.r_root_team ||
2289 team->
t.t_parent->t.t_serialized)));
2293 argv = (
void **)team->
t.t_argv;
2295 for (
i = argc - 1;
i >= 0; --
i) {
2301 for (
i = 0;
i < argc; ++
i) {
2309 if (!root->r.r_active)
2310 root->r.r_active =
TRUE;
2314 &master_th->th.th_current_task->td_icvs,
loc);
2317 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
2323 if (team->
t.t_active_level == 1
2324 && !master_th->th.th_teams_microtask) {
2326 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2327 (__kmp_forkjoin_frames_mode == 3 ||
2328 __kmp_forkjoin_frames_mode == 1)) {
2330 if (__itt_get_timestamp_ptr)
2331 tmp_time = __itt_get_timestamp();
2333 master_th->th.th_frame_time = tmp_time;
2334 if (__kmp_forkjoin_frames_mode == 3)
2335 team->
t.t_region_time = tmp_time;
2339 if ((__itt_frame_begin_v3_ptr || KMP_ITT_DEBUG) &&
2340 __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) {
2342 __kmp_itt_region_forking(gtid, team->
t.t_nproc, 0);
2351 (
"__kmp_internal_fork : root=%p, team=%p, master_th=%p, gtid=%d\n",
2352 root, team, master_th, gtid));
2355 if (__itt_stack_caller_create_ptr) {
2359 team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2360 }
else if (parent_team->
t.t_serialized) {
2366 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2375 KF_TRACE(10, (
"__kmp_internal_fork : after : root=%p, team=%p, "
2376 "master_th=%p, gtid=%d\n",
2377 root, team, master_th, gtid));
2381 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2386 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) invoke microtask = %p\n", gtid,
2387 team->
t.t_id, team->
t.t_pkfn));
2390#if KMP_STATS_ENABLED
2398 if (!team->
t.t_invoke(gtid)) {
2399 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
2402#if KMP_STATS_ENABLED
2409 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
2410 team->
t.t_id, team->
t.t_pkfn));
2413 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2416 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2424static inline void __kmp_join_restore_state(
kmp_info_t *thread,
2427 thread->th.ompt_thread_info.state =
2428 ((team->
t.t_serialized) ? ompt_state_work_serial
2429 : ompt_state_work_parallel);
2432static inline void __kmp_join_ompt(
int gtid,
kmp_info_t *thread,
2433 kmp_team_t *team, ompt_data_t *parallel_data,
2434 int flags,
void *codeptr) {
2438 parallel_data, &(task_info->
task_data), flags, codeptr);
2441 task_info->
frame.enter_frame = ompt_data_none;
2442 __kmp_join_restore_state(thread, team);
2460 KA_TRACE(20, (
"__kmp_join_call: enter T#%d\n", gtid));
2464 root = master_th->th.th_root;
2465 team = master_th->th.th_team;
2466 parent_team = team->
t.t_parent;
2468 master_th->th.th_ident =
loc;
2471 void *team_microtask = (
void *)team->
t.t_pkfn;
2477 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2483 KA_TRACE(20, (
"__kmp_join_call: T#%d, old team = %p old task_team = %p, "
2484 "th_task_team = %p\n",
2486 team->
t.t_task_team[master_th->th.th_task_state],
2487 master_th->th.th_task_team));
2492 if (team->
t.t_serialized) {
2493 if (master_th->th.th_teams_microtask) {
2495 int level = team->
t.t_level;
2496 int tlevel = master_th->th.th_teams_level;
2497 if (
level == tlevel) {
2501 }
else if (
level == tlevel + 1) {
2505 team->
t.t_serialized++;
2515 __kmp_join_restore_state(master_th, parent_team);
2522 master_active = team->
t.t_master_active;
2529 if (__itt_stack_caller_create_ptr) {
2532 __kmp_itt_stack_caller_destroy((__itt_caller)team->
t.t_stack_id);
2533 team->
t.t_stack_id = NULL;
2537 master_th->th.th_task_state =
2540 if (__itt_stack_caller_create_ptr && parent_team->
t.t_serialized) {
2545 __kmp_itt_stack_caller_destroy((__itt_caller)parent_team->
t.t_stack_id);
2546 parent_team->
t.t_stack_id = NULL;
2554 ompt_data_t *parallel_data = &(team->
t.ompt_team_info.parallel_data);
2555 void *codeptr = team->
t.ompt_team_info.master_return_address;
2560 if (team->
t.t_active_level == 1 &&
2561 (!master_th->th.th_teams_microtask ||
2562 master_th->th.th_teams_size.nteams == 1)) {
2563 master_th->th.th_ident =
loc;
2566 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2567 __kmp_forkjoin_frames_mode == 3)
2568 __kmp_itt_frame_submit(gtid, team->
t.t_region_time,
2569 master_th->th.th_frame_time, 0,
loc,
2570 master_th->th.th_team_nproc, 1);
2571 else if ((__itt_frame_end_v3_ptr || KMP_ITT_DEBUG) &&
2572 !__kmp_forkjoin_frames_mode && __kmp_forkjoin_frames)
2573 __kmp_itt_region_joined(gtid);
2577#if KMP_AFFINITY_SUPPORTED
2580 master_th->th.th_first_place = team->
t.t_first_place;
2581 master_th->th.th_last_place = team->
t.t_last_place;
2585 if (master_th->th.th_teams_microtask && !exit_teams &&
2587 team->
t.t_level == master_th->th.th_teams_level + 1) {
2592 ompt_data_t ompt_parallel_data = ompt_data_none;
2596 int ompt_team_size = team->
t.t_nproc;
2598 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2599 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
2601 task_info->
frame.exit_frame = ompt_data_none;
2603 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
2609 team->
t.t_active_level--;
2616 if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
2617 int old_num = master_th->th.th_team_nproc;
2618 int new_num = master_th->th.th_teams_size.nth;
2620 team->
t.t_nproc = new_num;
2621 for (
int i = 0;
i < old_num; ++
i) {
2622 other_threads[
i]->th.th_team_nproc = new_num;
2625 for (
int i = old_num;
i < new_num; ++
i) {
2630 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
2633 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
2638 other_threads[
i]->th.th_task_state = master_th->th.th_task_state;
2645 __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data,
2646 OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr);
2654 master_th->th.th_info.ds.ds_tid = team->
t.t_master_tid;
2655 master_th->th.th_local.this_construct = team->
t.t_master_this_cons;
2657 master_th->th.th_dispatch = &parent_team->
t.t_dispatch[team->
t.t_master_tid];
2664 if (!master_th->th.th_teams_microtask ||
2665 team->
t.t_level > master_th->th.th_teams_level) {
2677 : ompt_task_implicit;
2678 int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->
t.t_nproc;
2680 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2681 OMPT_CUR_TASK_INFO(master_th)->thread_num, flags);
2683 task_info->
frame.exit_frame = ompt_data_none;
2688 KF_TRACE(10, (
"__kmp_join_call1: T#%d, this_thread=%p team=%p\n", 0,
2692 master_th->th.th_def_allocator = team->
t.t_def_allocator;
2695 if (ompd_state & OMPD_ENABLE_BP)
2696 ompd_bp_parallel_end();
2700 if (root->r.r_active != master_active)
2701 root->r.r_active = master_active;
2710 master_th->th.th_team = parent_team;
2711 master_th->th.th_team_nproc = parent_team->
t.t_nproc;
2712 master_th->th.th_team_master = parent_team->
t.t_threads[0];
2713 master_th->th.th_team_serialized = parent_team->
t.t_serialized;
2716 if (parent_team->
t.t_serialized &&
2717 parent_team != master_th->th.th_serial_team &&
2718 parent_team != root->r.r_root_team) {
2720 master_th->th.th_serial_team = parent_team;
2726 team->
t.t_primary_task_state == 1);
2727 master_th->th.th_task_state = (
kmp_uint8)team->
t.t_primary_task_state;
2730 master_th->th.th_task_team =
2731 parent_team->
t.t_task_team[master_th->th.th_task_state];
2733 (
"__kmp_join_call: Primary T#%d restoring task_team %p, team %p\n",
2741 master_th->th.th_current_task->td_flags.executing = 1;
2745#if KMP_AFFINITY_SUPPORTED
2746 if (master_th->th.th_team->t.t_level == 0 && __kmp_affinity.flags.reset) {
2754 : ompt_parallel_team);
2756 __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags,
2762 KA_TRACE(20, (
"__kmp_join_call: exit T#%d\n", gtid));
2769 if (thread->th.th_team != thread->th.th_serial_team) {
2772 if (thread->th.th_team->t.t_serialized > 1) {
2775 if (thread->th.th_team->t.t_control_stack_top == NULL) {
2778 if (thread->th.th_team->t.t_control_stack_top->serial_nesting_level !=
2779 thread->th.th_team->t.t_serialized) {
2788 copy_icvs(control, &thread->th.th_current_task->td_icvs);
2792 control->
next = thread->th.th_team->t.t_control_stack_top;
2793 thread->th.th_team->t.t_control_stack_top = control;
2803 KF_TRACE(10, (
"__kmp_set_num_threads: new __kmp_nth = %d\n", new_nth));
2813 if (thread->th.th_current_task->td_icvs.nproc == new_nth)
2823 root = thread->th.th_root;
2836 for (
f = new_nth;
f < hot_team->
t.t_nproc;
f++) {
2841 hot_team->
t.t_threads[
f]->th.th_task_team = NULL;
2844 hot_team->
t.t_threads[
f] = NULL;
2846 hot_team->
t.t_nproc = new_nth;
2847 if (thread->th.th_hot_teams) {
2849 thread->th.th_hot_teams[0].hot_team_nth = new_nth;
2853 hot_team->
t.b->update_num_threads(new_nth);
2860 for (
f = 0;
f < new_nth;
f++) {
2862 hot_team->
t.t_threads[
f]->th.th_team_nproc = new_nth;
2865 hot_team->
t.t_size_changed = -1;
2873 KF_TRACE(10, (
"__kmp_set_max_active_levels: new max_active_levels for thread "
2875 gtid, max_active_levels));
2879 if (max_active_levels < 0) {
2880 KMP_WARNING(ActiveLevelsNegative, max_active_levels);
2885 KF_TRACE(10, (
"__kmp_set_max_active_levels: the call is ignored: new "
2886 "max_active_levels for thread %d = (%d)\n",
2887 gtid, max_active_levels));
2895 KMP_WARNING(ActiveLevelsExceedLimit, max_active_levels,
2903 KF_TRACE(10, (
"__kmp_set_max_active_levels: after validation: new "
2904 "max_active_levels for thread %d = (%d)\n",
2905 gtid, max_active_levels));
2918 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d\n", gtid));
2923 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d, curtask=%p, "
2924 "curtask_maxaclevel=%d\n",
2925 gtid, thread->th.th_current_task,
2926 thread->th.th_current_task->td_icvs.max_active_levels));
2927 return thread->th.th_current_task->td_icvs.max_active_levels;
2952 KF_TRACE(10, (
"__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
2953 gtid, (
int)kind, chunk));
2967 KMP_HNT(DefaultScheduleKindUsed,
"static, no chunk"),
2981 thread->th.th_current_task->td_icvs.sched.r_sched_type =
kmp_sch_static;
2983 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2989 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2994 orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
2999 thread->th.th_current_task->td_icvs.sched.chunk = chunk;
3008 KF_TRACE(10, (
"__kmp_get_schedule: thread %d\n", gtid));
3013 th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
3039#if KMP_STATIC_STEAL_ENABLED
3041 *kind = kmp_sched_static_steal;
3045 KMP_FATAL(UnknownSchedulingType, th_type);
3049 *chunk = thread->th.th_current_task->td_icvs.sched.chunk;
3058 KF_TRACE(10, (
"__kmp_get_ancestor_thread_num: thread %d %d\n", gtid,
level));
3067 team = thr->th.th_team;
3068 ii = team->
t.t_level;
3072 if (thr->th.th_teams_microtask) {
3074 int tlevel = thr->th.th_teams_level;
3091 dd = team->
t.t_serialized;
3094 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3096 if ((team->
t.t_serialized) && (!dd)) {
3097 team = team->
t.t_parent;
3101 team = team->
t.t_parent;
3102 dd = team->
t.t_serialized;
3107 return (dd > 1) ? (0) : (team->
t.t_master_tid);
3116 KF_TRACE(10, (
"__kmp_get_team_size: thread %d %d\n", gtid,
level));
3125 team = thr->th.th_team;
3126 ii = team->
t.t_level;
3130 if (thr->th.th_teams_microtask) {
3132 int tlevel = thr->th.th_teams_level;
3147 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3149 if (team->
t.t_serialized && (!dd)) {
3150 team = team->
t.t_parent;
3154 team = team->
t.t_parent;
3159 return team->
t.t_nproc;
3201 if (!realloc || argc > team->
t.t_max_argc) {
3203 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: needed entries=%d, "
3204 "current entries=%d\n",
3205 team->
t.t_id, argc, (realloc) ? team->
t.t_max_argc : 0));
3207 if (realloc && team->
t.t_argv != &team->
t.t_inline_argv[0])
3213 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: inline allocate %d "
3215 team->
t.t_id, team->
t.t_max_argc));
3216 team->
t.t_argv = &team->
t.t_inline_argv[0];
3219 -1, &team->
t.t_inline_argv[0],
3229 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: dynamic allocate %d "
3231 team->
t.t_id, team->
t.t_max_argc));
3236 &team->
t.t_argv[team->
t.t_max_argc],
3237 sizeof(
void *) * team->
t.t_max_argc,
3238 "team_%d.t_argv", team->
t.t_id);
3251 team->
t.t_dispatch =
3253 team->
t.t_implicit_task_taskdata =
3255 team->
t.t_max_nproc = max_nth;
3258 for (
i = 0;
i < num_disp_buff; ++
i) {
3259 team->
t.t_disp_buffer[
i].buffer_index =
i;
3260 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
3267 for (
i = 0;
i < team->
t.t_max_nproc; ++
i) {
3268 if (team->
t.t_dispatch[
i].th_disp_buffer != NULL) {
3270 team->
t.t_dispatch[
i].th_disp_buffer = NULL;
3273#if KMP_USE_HIER_SCHED
3280 team->
t.t_threads = NULL;
3281 team->
t.t_disp_buffer = NULL;
3282 team->
t.t_dispatch = NULL;
3283 team->
t.t_implicit_task_taskdata = 0;
3341 copy_icvs(&gx_icvs, &team->
t.t_threads[0]->th.th_current_task->td_icvs);
3342 gx_icvs.
next = NULL;
3351 int hot_team_max_nth;
3360 root->r.r_begin =
FALSE;
3361 root->r.r_active =
FALSE;
3362 root->r.r_in_parallel = 0;
3364#if KMP_AFFINITY_SUPPORTED
3365 root->r.r_affinity_assigned =
FALSE;
3370 KF_TRACE(10, (
"__kmp_initialize_root: before root_team\n"));
3388 KF_TRACE(10, (
"__kmp_initialize_root: after root_team = %p\n", root_team));
3390 root->r.r_root_team = root_team;
3391 root_team->
t.t_control_stack_top = NULL;
3394 root_team->
t.t_threads[0] = NULL;
3395 root_team->
t.t_nproc = 1;
3396 root_team->
t.t_serialized = 1;
3398 root_team->
t.t_sched.sched = r_sched.
sched;
3402 (
"__kmp_initialize_root: init root team %d arrived: join=%u, plain=%u\n",
3407 KF_TRACE(10, (
"__kmp_initialize_root: before hot_team\n"));
3419 KF_TRACE(10, (
"__kmp_initialize_root: after hot_team = %p\n", hot_team));
3421 root->r.r_hot_team = hot_team;
3422 root_team->
t.t_control_stack_top = NULL;
3425 hot_team->
t.t_parent = root_team;
3428 hot_team_max_nth = hot_team->
t.t_max_nproc;
3429 for (
f = 0;
f < hot_team_max_nth; ++
f) {
3430 hot_team->
t.t_threads[
f] = NULL;
3432 hot_team->
t.t_nproc = 1;
3434 hot_team->
t.t_sched.sched = r_sched.
sched;
3435 hot_team->
t.t_size_changed = 0;
3441typedef struct kmp_team_list_item {
3443 struct kmp_team_list_item *next;
3444} kmp_team_list_item_t;
3445typedef kmp_team_list_item_t *kmp_team_list_t;
3447static void __kmp_print_structure_team_accum(
3448 kmp_team_list_t list,
3464 __kmp_print_structure_team_accum(list, team->
t.t_parent);
3465 __kmp_print_structure_team_accum(list, team->
t.t_next_pool);
3469 while (l->next != NULL && l->entry != team) {
3472 if (l->next != NULL) {
3478 while (l->next != NULL && l->entry->t.t_id <= team->
t.t_id) {
3485 sizeof(kmp_team_list_item_t));
3492static void __kmp_print_structure_team(
char const *title,
kmp_team_p const *team
3503static void __kmp_print_structure_thread(
char const *title,
3506 if (thread != NULL) {
3515 kmp_team_list_t list;
3523 __kmp_printf(
"\n------------------------------\nGlobal Thread "
3524 "Table\n------------------------------\n");
3540 __kmp_printf(
"\n------------------------------\nThreads\n--------------------"
3546 if (thread != NULL) {
3549 __kmp_print_structure_team(
" Our Team: ", thread->th.th_team);
3550 __kmp_print_structure_team(
" Serial Team: ",
3551 thread->th.th_serial_team);
3552 __kmp_printf(
" Threads: %2d\n", thread->th.th_team_nproc);
3553 __kmp_print_structure_thread(
" Primary: ",
3554 thread->th.th_team_master);
3555 __kmp_printf(
" Serialized?: %2d\n", thread->th.th_team_serialized);
3556 __kmp_printf(
" Set NProc: %2d\n", thread->th.th_set_nproc);
3557 __kmp_printf(
" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
3558 __kmp_print_structure_thread(
" Next in pool: ",
3559 thread->th.th_next_pool);
3561 __kmp_print_structure_team_accum(list, thread->th.th_team);
3562 __kmp_print_structure_team_accum(list, thread->th.th_serial_team);
3570 __kmp_printf(
"\n------------------------------\nUbers\n----------------------"
3578 __kmp_print_structure_team(
" Root Team: ", root->r.r_root_team);
3579 __kmp_print_structure_team(
" Hot Team: ", root->r.r_hot_team);
3580 __kmp_print_structure_thread(
" Uber Thread: ",
3581 root->r.r_uber_thread);
3586 __kmp_print_structure_team_accum(list, root->r.r_root_team);
3587 __kmp_print_structure_team_accum(list, root->r.r_hot_team);
3594 __kmp_printf(
"\n------------------------------\nTeams\n----------------------"
3596 while (list->next != NULL) {
3600 __kmp_print_structure_team(
" Parent Team: ", team->
t.t_parent);
3603 __kmp_printf(
" Levels of serial: %2d\n", team->
t.t_serialized);
3605 for (
i = 0;
i < team->
t.t_nproc; ++
i) {
3607 __kmp_print_structure_thread(
"", team->
t.t_threads[
i]);
3609 __kmp_print_structure_team(
" Next in pool: ", team->
t.t_next_pool);
3615 __kmp_printf(
"\n------------------------------\nPools\n----------------------"
3617 __kmp_print_structure_thread(
"Thread pool: ",
3619 __kmp_print_structure_team(
"Team pool: ",
3624 while (list != NULL) {
3625 kmp_team_list_item_t *item = list;
3637 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, 0xba5703f5, 0xb495a877,
3638 0xe1626741, 0x79695e6b, 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231,
3639 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, 0xbe4d6fe9, 0x5f15e201,
3640 0x99afc3fd, 0xf3f16801, 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3,
3641 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, 0x085a3d61, 0x46eb5ea7,
3642 0x3d9910ed, 0x2e687b5b, 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9,
3643 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, 0x54581edb, 0xf2480f45,
3644 0x0bb9288f, 0xef1affc7, 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7,
3645 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, 0xfc411073, 0xc3749363,
3646 0xb892d829, 0x3549366b, 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3,
3647 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f};
3652 unsigned x = thread->th.th_x;
3653 unsigned short r = (
unsigned short)(x >> 16);
3655 thread->th.th_x = x * thread->th.th_a + 1;
3657 KA_TRACE(30, (
"__kmp_get_random: THREAD: %d, RETURN: %u\n",
3658 thread->th.th_info.ds.ds_tid,
r));
3665 unsigned seed = thread->th.th_info.ds.ds_tid;
3669 thread->th.th_x = (seed + 1) * thread->th.th_a + 1;
3671 (
"__kmp_init_random: THREAD: %u; A: %u\n", seed, thread->th.th_a));
3677static int __kmp_reclaim_dead_roots(
void) {
3685 r += __kmp_unregister_root_other_thread(
i);
3712 int minimumRequiredCapacity;
3721#if KMP_OS_WINDOWS && !KMP_DYNAMIC_LIB
3724 added = __kmp_reclaim_dead_roots();
3766 }
while (newCapacity < minimumRequiredCapacity);
3810 KA_TRACE(20, (
"__kmp_register_root: entered\n"));
3864 KA_TRACE(1, (
"__kmp_register_root: found slot in threads array for "
3865 "hidden helper thread: T#%d\n",
3879 1, (
"__kmp_register_root: found slot in threads array: T#%d\n", gtid));
3901#ifdef KMP_ADJUST_BLOCKTIME
3906 __kmp_zero_bt =
TRUE;
3917#if KMP_STATS_ENABLED
3919 __kmp_stats_thread_ptr = __kmp_stats_list->push_back(gtid);
3920 __kmp_stats_thread_ptr->startLife();
3927 if (root->r.r_uber_thread) {
3928 root_thread = root->r.r_uber_thread;
3934 root_thread->th.th_info.ds.ds_gtid = gtid;
3936 root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
3938 root_thread->th.th_root = root;
3943 __kmp_initialize_fast_memory(root_thread);
3954 if (!root_thread->th.th_serial_team) {
3956 KF_TRACE(10, (
"__kmp_register_root: before serial_team\n"));
3957 root_thread->th.th_serial_team =
3965 KF_TRACE(10, (
"__kmp_register_root: after serial_team = %p\n",
3966 root_thread->th.th_serial_team));
3971 root->r.r_root_team->t.t_threads[0] = root_thread;
3972 root->r.r_hot_team->t.t_threads[0] = root_thread;
3973 root_thread->th.th_serial_team->t.t_threads[0] = root_thread;
3975 root_thread->th.th_serial_team->t.t_serialized = 0;
3976 root->r.r_uber_thread = root_thread;
3986 __kmp_itt_thread_name(gtid);
3989#ifdef KMP_TDATA_GTID
3995 KA_TRACE(20, (
"__kmp_register_root: T#%d init T#%d(%d:%d) arrived: join=%u, "
4005 root_thread->th.th_bar[
b].bb.b_worker_arrived = 0;
4012#if KMP_AFFINITY_SUPPORTED
4013 root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
4014 root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
4015 root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
4016 root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
4019 root_thread->th.th_prev_level = 0;
4020 root_thread->th.th_prev_num_threads = 1;
4026 KA_TRACE(100, (
"__kmp_register_root: Thread %p created node %p with"
4027 " cg_nthreads init to 1\n",
4030 root_thread->th.th_cg_roots = tmp;
4039 ompt_set_thread_state(root_thread, ompt_state_overhead);
4045 ompt_data_t *task_data;
4046 ompt_data_t *parallel_data;
4051 ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
4054 ompt_set_thread_state(root_thread, ompt_state_work_serial);
4058 if (ompd_state & OMPD_ENABLE_BP)
4059 ompd_bp_thread_begin();
4069 const int max_level) {
4072 if (!hot_teams || !hot_teams[
level].hot_team) {
4079 if (
level < max_level - 1) {
4080 for (
i = 0;
i < nth; ++
i) {
4083 if (
i > 0 && th->th.th_hot_teams) {
4085 th->th.th_hot_teams = NULL;
4098 int n = hot_team->
t.t_nproc;
4103 root->r.r_root_team = NULL;
4104 root->r.r_hot_team = NULL;
4110 for (
i = 0;
i < hot_team->
t.t_nproc; ++
i) {
4115 if (th->th.th_hot_teams) {
4117 th->th.th_hot_teams = NULL;
4135 (LPVOID) & (root->r.r_uber_thread->th),
4136 root->r.r_uber_thread->th.th_info.ds.ds_thread));
4141 if (ompd_state & OMPD_ENABLE_BP)
4142 ompd_bp_thread_end();
4146 ompt_data_t *task_data;
4147 ompt_data_t *parallel_data;
4152 ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
4156 &(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
4162 i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
4163 KA_TRACE(100, (
"__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
4165 root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
4166 root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
4170 root->r.r_uber_thread->th.th_cg_roots->cg_root);
4172 __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
4173 root->r.r_uber_thread->th.th_cg_roots = NULL;
4179 root->r.r_uber_thread = NULL;
4181 root->r.r_begin =
FALSE;
4187 KA_TRACE(1, (
"__kmp_unregister_root_current_thread: enter T#%d\n", gtid));
4193 KC_TRACE(10, (
"__kmp_unregister_root_current_thread: already finished, "
4217 thread->th.ompt_thread_info.state = ompt_state_undefined;
4226 (
"__kmp_unregister_root_current_thread: T#%d unregistered\n", gtid));
4235static int __kmp_unregister_root_other_thread(
int gtid) {
4239 KA_TRACE(1, (
"__kmp_unregister_root_other_thread: enter T#%d\n", gtid));
4247 (
"__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid));
4253void __kmp_task_info() {
4258 kmp_team_t *steam = this_thr->th.th_serial_team;
4262 "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
4264 gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
4265 team->
t.t_implicit_task_taskdata[tid].td_parent);
4273 int tid,
int gtid) {
4290 this_thr->th.th_info.ds.ds_tid = tid;
4291 this_thr->th.th_set_nproc = 0;
4300#if KMP_AFFINITY_SUPPORTED
4301 this_thr->th.th_new_place = this_thr->th.th_current_place;
4303 this_thr->th.th_root = master->th.th_root;
4306 this_thr->th.th_team_nproc = team->
t.t_nproc;
4307 this_thr->th.th_team_master = master;
4308 this_thr->th.th_team_serialized = team->
t.t_serialized;
4312 KF_TRACE(10, (
"__kmp_initialize_info1: T#%d:%d this_thread=%p curtask=%p\n",
4313 tid, gtid, this_thr, this_thr->th.th_current_task));
4318 KF_TRACE(10, (
"__kmp_initialize_info2: T#%d:%d this_thread=%p curtask=%p\n",
4319 tid, gtid, this_thr, this_thr->th.th_current_task));
4324 this_thr->th.th_dispatch = &team->
t.t_dispatch[tid];
4326 this_thr->th.th_local.this_construct = 0;
4328 if (!this_thr->th.th_pri_common) {
4329 this_thr->th.th_pri_common =
4333 gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1,
4334 sizeof(
struct common_table),
"th_%d.th_pri_common\n", gtid);
4336 this_thr->th.th_pri_head = NULL;
4339 if (this_thr != master &&
4340 this_thr->th.th_cg_roots != master->th.th_cg_roots) {
4347 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p decrement cg_nthreads"
4348 " on node %p of thread %p to %d\n",
4354 this_thr->th.th_cg_roots = master->th.th_cg_roots;
4356 this_thr->th.th_cg_roots->cg_nthreads++;
4357 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p increment cg_nthreads on"
4358 " node %p of thread %p to %d\n",
4359 this_thr, this_thr->th.th_cg_roots,
4360 this_thr->th.th_cg_roots->cg_root,
4361 this_thr->th.th_cg_roots->cg_nthreads));
4362 this_thr->th.th_current_task->td_icvs.thread_limit =
4363 this_thr->th.th_cg_roots->cg_thread_limit;
4368 volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
4373 KD_TRACE(10, (
"__kmp_initialize_info: T#%d max_nproc: %d\n", gtid,
4374 team->
t.t_max_nproc));
4392 "th_%d.th_dispatch.th_disp_buffer "
4393 "(team_%d.t_dispatch[%d].th_disp_buffer)",
4394 gtid, team->
t.t_id, gtid);
4407 this_thr->th.th_next_pool = NULL;
4442 if (new_thr->th.th_active_in_pool ==
TRUE) {
4445 new_thr->th.th_active_in_pool =
FALSE;
4449 KA_TRACE(20, (
"__kmp_allocate_thread: T#%d using thread T#%d\n",
4456 new_thr->th.th_info.ds.ds_gtid);
4461 new_thr->th.th_task_state = 0;
4469#ifdef KMP_ADJUST_BLOCKTIME
4474 __kmp_zero_bt =
TRUE;
4488 KF_TRACE(10, (
"__kmp_allocate_thread: T#%d using thread %p T#%d\n",
4502 if (!
TCR_4(__kmp_init_monitor)) {
4504 if (!
TCR_4(__kmp_init_monitor)) {
4505 KF_TRACE(10, (
"before __kmp_create_monitor\n"));
4506 TCW_4(__kmp_init_monitor, 1);
4508 KF_TRACE(10, (
"after __kmp_create_monitor\n"));
4519 while (
TCR_4(__kmp_init_monitor) < 2) {
4522 KF_TRACE(10, (
"after monitor thread has started\n"));
4549 new_thr->th.th_nt_strict =
false;
4550 new_thr->th.th_nt_loc = NULL;
4552 new_thr->th.th_nt_msg = NULL;
4556#if USE_ITT_BUILD && USE_ITT_NOTIFY && KMP_DEBUG
4559 __itt_suppress_mark_range(
4560 __itt_suppress_range, __itt_suppress_threading_errors,
4561 &new_thr->th.th_sleep_loc,
sizeof(new_thr->th.th_sleep_loc));
4562 __itt_suppress_mark_range(
4563 __itt_suppress_range, __itt_suppress_threading_errors,
4564 &new_thr->th.th_reap_state,
sizeof(new_thr->th.th_reap_state));
4566 __itt_suppress_mark_range(
4567 __itt_suppress_range, __itt_suppress_threading_errors,
4568 &new_thr->th.th_suspend_init,
sizeof(new_thr->th.th_suspend_init));
4570 __itt_suppress_mark_range(__itt_suppress_range,
4571 __itt_suppress_threading_errors,
4572 &new_thr->th.th_suspend_init_count,
4573 sizeof(new_thr->th.th_suspend_init_count));
4576 __itt_suppress_mark_range(__itt_suppress_range,
4577 __itt_suppress_threading_errors,
4579 sizeof(new_thr->th.th_bar[0].bb.b_go));
4580 __itt_suppress_mark_range(__itt_suppress_range,
4581 __itt_suppress_threading_errors,
4583 sizeof(new_thr->th.th_bar[1].bb.b_go));
4584 __itt_suppress_mark_range(__itt_suppress_range,
4585 __itt_suppress_threading_errors,
4587 sizeof(new_thr->th.th_bar[2].bb.b_go));
4596 KF_TRACE(10, (
"__kmp_allocate_thread: before th_serial/serial_team\n"));
4597 new_thr->th.th_serial_team = serial_team =
4605 serial_team->
t.t_serialized = 0;
4607 serial_team->
t.t_threads[0] = new_thr;
4609 (
"__kmp_allocate_thread: after th_serial/serial_team : new_thr=%p\n",
4616 __kmp_initialize_fast_memory(new_thr);
4628 (
"__kmp_allocate_thread: T#%d init go fork=%u, plain=%u\n",
4635 balign[
b].
bb.team = NULL;
4637 balign[
b].
bb.use_oncore_barrier = 0;
4640 TCW_PTR(new_thr->th.th_sleep_loc, NULL);
4643 new_thr->th.th_spin_here =
FALSE;
4644 new_thr->th.th_next_waiting = 0;
4646 new_thr->th.th_blocking =
false;
4649#if KMP_AFFINITY_SUPPORTED
4650 new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
4651 new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
4652 new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
4653 new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
4656 new_thr->th.th_prev_level = 0;
4657 new_thr->th.th_prev_num_threads = 1;
4660 new_thr->th.th_active_in_pool =
FALSE;
4663 new_thr->th.th_set_nested_nth = NULL;
4664 new_thr->th.th_set_nested_nth_sz = 0;
4684#ifdef KMP_ADJUST_BLOCKTIME
4689 __kmp_zero_bt =
TRUE;
4694#if KMP_AFFINITY_SUPPORTED
4696 __kmp_affinity_set_init_mask(new_gtid,
FALSE);
4701 10, (
"__kmp_allocate_thread: before __kmp_create_worker: %p\n", new_thr));
4704 (
"__kmp_allocate_thread: after __kmp_create_worker: %p\n", new_thr));
4720 KF_TRACE(10, (
"__kmp_reinitialize_team: enter this_thread=%p team=%p\n",
4721 team->
t.t_threads[0], team));
4729 copy_icvs(&team->
t.t_implicit_task_taskdata[0].td_icvs, new_icvs);
4731 KF_TRACE(10, (
"__kmp_reinitialize_team: exit this_thread=%p team=%p\n",
4732 team->
t.t_threads[0], team));
4741 KF_TRACE(10, (
"__kmp_initialize_team: enter: team=%p\n", team));
4749 team->
t.t_master_tid = 0;
4751 team->
t.t_serialized = new_nproc > 1 ? 0 : 1;
4752 team->
t.t_nproc = new_nproc;
4755 team->
t.t_next_pool = NULL;
4760 team->
t.t_invoke = NULL;
4765#if KMP_ARCH_X86 || KMP_ARCH_X86_64
4766 team->
t.t_fp_control_saved =
FALSE;
4767 team->
t.t_x87_fpu_control_word = 0;
4768 team->
t.t_mxcsr = 0;
4771 team->
t.t_construct = 0;
4773 team->
t.t_ordered.dt.t_value = 0;
4774 team->
t.t_master_active =
FALSE;
4777 team->
t.t_copypriv_data = NULL;
4780 team->
t.t_copyin_counter = 0;
4783 team->
t.t_control_stack_top = NULL;
4788 KF_TRACE(10, (
"__kmp_initialize_team: exit: team=%p\n", team));
4791#if KMP_AFFINITY_SUPPORTED
4793 int first,
int last,
int newp) {
4794 th->th.th_first_place = first;
4795 th->th.th_last_place = last;
4796 th->th.th_new_place = newp;
4797 if (newp != th->th.th_current_place) {
4799 team->
t.t_display_affinity = 1;
4801 th->th.th_topology_ids = __kmp_affinity.ids[th->th.th_new_place];
4802 th->th.th_topology_attrs = __kmp_affinity.attrs[th->th.th_new_place];
4810static void __kmp_partition_places(
kmp_team_t *team,
int update_master_only) {
4818 int first_place = master_th->th.th_first_place;
4819 int last_place = master_th->th.th_last_place;
4820 int masters_place = master_th->th.th_current_place;
4821 int num_masks = __kmp_affinity.num_masks;
4822 team->
t.t_first_place = first_place;
4823 team->
t.t_last_place = last_place;
4825 KA_TRACE(20, (
"__kmp_partition_places: enter: proc_bind = %d T#%d(%d:0) "
4826 "bound to place %d partition = [%d,%d]\n",
4828 team->
t.t_id, masters_place, first_place, last_place));
4830 switch (proc_bind) {
4840 int n_th = team->
t.t_nproc;
4841 for (
f = 1;
f < n_th;
f++) {
4844 __kmp_set_thread_place(team, th, first_place, last_place, masters_place);
4846 KA_TRACE(100, (
"__kmp_partition_places: primary: T#%d(%d:%d) place %d "
4847 "partition = [%d,%d]\n",
4849 f, masters_place, first_place, last_place));
4855 int n_th = team->
t.t_nproc;
4857 if (first_place <= last_place) {
4858 n_places = last_place - first_place + 1;
4860 n_places = num_masks - first_place + last_place + 1;
4862 if (n_th <= n_places) {
4863 int place = masters_place;
4864 for (
f = 1;
f < n_th;
f++) {
4868 if (place == last_place) {
4869 place = first_place;
4870 }
else if (place == (num_masks - 1)) {
4875 __kmp_set_thread_place(team, th, first_place, last_place, place);
4877 KA_TRACE(100, (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4878 "partition = [%d,%d]\n",
4880 team->
t.t_id,
f, place, first_place, last_place));
4883 int S, rem, gap, s_count;
4884 S = n_th / n_places;
4886 rem = n_th - (
S * n_places);
4887 gap = rem > 0 ? n_places / rem : n_places;
4888 int place = masters_place;
4890 for (
f = 0;
f < n_th;
f++) {
4894 __kmp_set_thread_place(team, th, first_place, last_place, place);
4897 if ((s_count ==
S) && rem && (gap_ct == gap)) {
4899 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
4901 if (place == last_place) {
4902 place = first_place;
4903 }
else if (place == (num_masks - 1)) {
4911 }
else if (s_count ==
S) {
4912 if (place == last_place) {
4913 place = first_place;
4914 }
else if (place == (num_masks - 1)) {
4924 (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4925 "partition = [%d,%d]\n",
4927 th->th.th_new_place, first_place, last_place));
4935 int n_th = team->
t.t_nproc;
4938 if (first_place <= last_place) {
4939 n_places = last_place - first_place + 1;
4941 n_places = num_masks - first_place + last_place + 1;
4943 if (n_th <= n_places) {
4946 if (n_places != num_masks) {
4947 int S = n_places / n_th;
4948 int s_count, rem, gap, gap_ct;
4950 place = masters_place;
4951 rem = n_places - n_th *
S;
4952 gap = rem ? n_th / rem : 1;
4955 if (update_master_only == 1)
4957 for (
f = 0;
f < thidx;
f++) {
4961 int fplace = place, nplace = place;
4963 while (s_count <
S) {
4964 if (place == last_place) {
4965 place = first_place;
4966 }
else if (place == (num_masks - 1)) {
4973 if (rem && (gap_ct == gap)) {
4974 if (place == last_place) {
4975 place = first_place;
4976 }
else if (place == (num_masks - 1)) {
4984 __kmp_set_thread_place(team, th, fplace, place, nplace);
4987 if (place == last_place) {
4988 place = first_place;
4989 }
else if (place == (num_masks - 1)) {
4996 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
4997 "partition = [%d,%d], num_masks: %u\n",
4999 f, th->th.th_new_place, th->th.th_first_place,
5000 th->th.th_last_place, num_masks));
5006 double current =
static_cast<double>(masters_place);
5008 (
static_cast<double>(n_places + 1) /
static_cast<double>(n_th));
5013 if (update_master_only == 1)
5015 for (
f = 0;
f < thidx;
f++) {
5016 first =
static_cast<int>(current);
5017 last =
static_cast<int>(current + spacing) - 1;
5019 if (first >= n_places) {
5020 if (masters_place) {
5023 if (first == (masters_place + 1)) {
5027 if (last == masters_place) {
5037 if (last >= n_places) {
5038 last = (n_places - 1);
5048 th = team->
t.t_threads[
f];
5050 __kmp_set_thread_place(team, th, first, last, place);
5052 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5053 "partition = [%d,%d], spacing = %.4f\n",
5055 team->
t.t_id,
f, th->th.th_new_place,
5056 th->th.th_first_place, th->th.th_last_place, spacing));
5062 int S, rem, gap, s_count;
5063 S = n_th / n_places;
5065 rem = n_th - (
S * n_places);
5066 gap = rem > 0 ? n_places / rem : n_places;
5067 int place = masters_place;
5070 if (update_master_only == 1)
5072 for (
f = 0;
f < thidx;
f++) {
5076 __kmp_set_thread_place(team, th, place, place, place);
5079 if ((s_count ==
S) && rem && (gap_ct == gap)) {
5081 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
5083 if (place == last_place) {
5084 place = first_place;
5085 }
else if (place == (num_masks - 1)) {
5093 }
else if (s_count ==
S) {
5094 if (place == last_place) {
5095 place = first_place;
5096 }
else if (place == (num_masks - 1)) {
5105 KA_TRACE(100, (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5106 "partition = [%d,%d]\n",
5108 team->
t.t_id,
f, th->th.th_new_place,
5109 th->th.th_first_place, th->th.th_last_place));
5119 KA_TRACE(20, (
"__kmp_partition_places: exit T#%d\n", team->
t.t_id));
5128 ompt_data_t ompt_parallel_data,
5136 int use_hot_team = !root->r.r_active;
5138 int do_place_partition = 1;
5140 KA_TRACE(20, (
"__kmp_allocate_team: called\n"));
5147 team = master->th.th_team;
5148 level = team->
t.t_active_level;
5149 if (master->th.th_teams_microtask) {
5150 if (master->th.th_teams_size.nteams > 1 &&
5154 master->th.th_teams_level <
5161 if ((master->th.th_teams_size.nteams == 1 &&
5162 master->th.th_teams_level >= team->
t.t_level) ||
5164 do_place_partition = 0;
5166 hot_teams = master->th.th_hot_teams;
5168 hot_teams[
level].hot_team) {
5179 if (use_hot_team && new_nproc > 1) {
5184 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5185 "task_team[1] = %p before reinit\n",
5186 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5190 if (team->
t.t_nproc != new_nproc &&
5193 int old_nthr = team->
t.t_nproc;
5199 if (do_place_partition == 0)
5204 if (team->
t.t_nproc == new_nproc) {
5205 KA_TRACE(20, (
"__kmp_allocate_team: reusing hot team\n"));
5208 if (team->
t.t_size_changed == -1) {
5209 team->
t.t_size_changed = 1;
5220 root->r.r_uber_thread->th.th_ident);
5222 KF_TRACE(10, (
"__kmp_allocate_team2: T#%d, this_thread=%p team=%p\n", 0,
5223 team->
t.t_threads[0], team));
5226#if KMP_AFFINITY_SUPPORTED
5227 if ((team->
t.t_size_changed == 0) &&
5228 (team->
t.t_proc_bind == new_proc_bind)) {
5230 if (do_place_partition) {
5232 __kmp_partition_places(team, 1);
5235 KA_TRACE(200, (
"__kmp_allocate_team: reusing hot team #%d bindings: "
5236 "proc_bind = %d, partition = [%d,%d]\n",
5237 team->
t.t_id, new_proc_bind, team->
t.t_first_place,
5238 team->
t.t_last_place));
5240 if (do_place_partition) {
5242 __kmp_partition_places(team);
5248 }
else if (team->
t.t_nproc > new_nproc) {
5250 (
"__kmp_allocate_team: decreasing hot team thread count to %d\n",
5253 team->
t.t_size_changed = 1;
5262 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5265 th->th.th_task_team = NULL;
5274 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5277 team->
t.t_threads[
f] = NULL;
5283 for (
f = new_nproc;
f < team->
t.t_nproc; ++
f) {
5294 team->
t.t_nproc = new_nproc;
5298 root->r.r_uber_thread->th.th_ident);
5301 for (
f = 0;
f < new_nproc; ++
f) {
5302 team->
t.t_threads[
f]->th.th_team_nproc = new_nproc;
5307 KF_TRACE(10, (
"__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
5308 team->
t.t_threads[0], team));
5313 for (
f = 0;
f < team->
t.t_nproc;
f++) {
5315 team->
t.t_threads[
f]->th.th_team_nproc ==
5320 if (do_place_partition) {
5322#if KMP_AFFINITY_SUPPORTED
5323 __kmp_partition_places(team);
5329 (
"__kmp_allocate_team: increasing hot team thread count to %d\n",
5331 int old_nproc = team->
t.t_nproc;
5332 team->
t.t_size_changed = 1;
5335 if (new_nproc < avail_threads)
5336 avail_threads = new_nproc;
5338 for (
f = team->
t.t_nproc;
f < avail_threads; ++
f) {
5344 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5347 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5351 if (hot_teams[
level].hot_team_nth >= new_nproc) {
5355 team->
t.t_nproc = new_nproc;
5361 if (team->
t.t_max_nproc < new_nproc) {
5367#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5368 KMP_AFFINITY_SUPPORTED
5374 kmp_affinity_raii_t new_temp_affinity{__kmp_affin_fullMask};
5378 for (
f = team->
t.t_nproc;
f < new_nproc;
f++) {
5381 team->
t.t_threads[
f] = new_worker;
5384 (
"__kmp_allocate_team: team %d init T#%d arrived: "
5385 "join=%llu, plain=%llu\n",
5394 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5398 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5404#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5405 KMP_AFFINITY_SUPPORTED
5407 new_temp_affinity.restore();
5418 root->r.r_uber_thread->th.th_ident);
5422 for (
f = 0;
f < team->
t.t_nproc; ++
f)
5427 kmp_uint8 old_state = team->
t.t_threads[old_nproc - 1]->th.th_task_state;
5428 for (
f = old_nproc;
f < team->
t.t_nproc; ++
f)
5429 team->
t.t_threads[
f]->th.th_task_state = old_state;
5432 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5434 team->
t.t_threads[
f]->th.th_team_nproc ==
5439 if (do_place_partition) {
5441#if KMP_AFFINITY_SUPPORTED
5442 __kmp_partition_places(team);
5447 if (master->th.th_teams_microtask) {
5448 for (
f = 1;
f < new_nproc; ++
f) {
5451 thr->th.th_teams_microtask = master->th.th_teams_microtask;
5452 thr->th.th_teams_level = master->th.th_teams_level;
5453 thr->th.th_teams_size = master->th.th_teams_size;
5459 for (
f = 1;
f < new_nproc; ++
f) {
5464 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5467 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5479 KF_TRACE(10, (
" hot_team = %p\n", team));
5483 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5484 "task_team[1] = %p after reinit\n",
5485 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5503 if (team->
t.t_max_nproc >= max_nproc) {
5507 if (max_nproc > 1 &&
5517 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and "
5518 "task_team[1] %p to NULL\n",
5519 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5520 team->
t.t_task_team[0] = NULL;
5521 team->
t.t_task_team[1] = NULL;
5528 20, (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5535 team->
t.t_bar[
b].b_master_arrived = 0;
5536 team->
t.t_bar[
b].b_team_arrived = 0;
5541 team->
t.t_proc_bind = new_proc_bind;
5543 KA_TRACE(20, (
"__kmp_allocate_team: using team from pool %d.\n",
5550 team->
t.t_nested_nth = NULL;
5570 team->
t.t_max_nproc = max_nproc;
5571 if (max_nproc > 1 &&
5581 KA_TRACE(20, (
"__kmp_allocate_team: making a new team\n"));
5584 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and task_team[1] "
5586 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5587 team->
t.t_task_team[0] = NULL;
5589 team->
t.t_task_team[1] = NULL;
5598 team->
t.t_argc = argc;
5601 (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5608 team->
t.t_bar[
b].b_master_arrived = 0;
5609 team->
t.t_bar[
b].b_team_arrived = 0;
5614 team->
t.t_proc_bind = new_proc_bind;
5618 team->
t.ompt_serialized_team_info = NULL;
5623 team->
t.t_nested_nth = NULL;
5625 KA_TRACE(20, (
"__kmp_allocate_team: done creating a new team %d.\n",
5647 int use_hot_team = team == root->r.r_hot_team;
5650 level = team->
t.t_active_level - 1;
5651 if (master->th.th_teams_microtask) {
5652 if (master->th.th_teams_size.nteams > 1) {
5657 master->th.th_teams_level == team->
t.t_level) {
5675 team->
t.t_copyin_counter = 0;
5680 if (!use_hot_team) {
5683 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5686 volatile kmp_uint32 *state = &th->th.th_reap_state;
5697 if (th->th.th_sleep_loc)
5705 for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
5707 if (task_team != NULL) {
5708 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5710 team->
t.t_threads[
f]->th.th_task_team = NULL;
5714 (
"__kmp_free_team: T#%d deactivating task_team %p on team %d\n",
5717 team->
t.t_task_team[tt_idx] = NULL;
5724 team->
t.t_nested_nth != team->
t.t_parent->t.t_nested_nth) {
5728 team->
t.t_nested_nth = NULL;
5731 team->
t.t_parent = NULL;
5732 team->
t.t_level = 0;
5733 team->
t.t_active_level = 0;
5736 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5740 &(team->
t.t_threads[
f]->th.th_used_in_team), 1, 2);
5748 team->
t.b->go_release();
5750 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5751 if (team->
t.b->sleep[
f].sleep) {
5753 team->
t.t_threads[
f]->th.th_info.ds.ds_gtid,
5759 for (
int f = 1;
f < team->
t.t_nproc; ++
f) {
5760 while (team->
t.t_threads[
f]->th.th_used_in_team.load() != 0)
5766 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5767 team->
t.t_threads[
f] = NULL;
5770 if (team->
t.t_max_nproc > 1 &&
5782 team->
t.t_threads[1]->th.th_cg_roots);
5783 if (team->
t.t_threads[1]->th.th_cg_roots->cg_root == team->
t.t_threads[1]) {
5785 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5788 thr->th.th_cg_roots->cg_root == thr);
5791 thr->th.th_cg_roots = tmp->
up;
5792 KA_TRACE(100, (
"__kmp_free_team: Thread %p popping node %p and moving"
5793 " up to node %p. cg_nthreads was %d\n",
5794 thr, tmp, thr->th.th_cg_roots, tmp->
cg_nthreads));
5800 if (thr->th.th_cg_roots)
5801 thr->th.th_current_task->td_icvs.thread_limit =
5802 thr->th.th_cg_roots->cg_thread_limit;
5824 if (team->
t.t_argv != &team->
t.t_inline_argv[0])
5861 KA_TRACE(20, (
"__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
5873 balign[
b].
bb.team = NULL;
5874 balign[
b].
bb.leaf_kids = 0;
5876 this_th->th.th_task_state = 0;
5880 TCW_PTR(this_th->th.th_team, NULL);
5881 TCW_PTR(this_th->th.th_root, NULL);
5882 TCW_PTR(this_th->th.th_dispatch, NULL);
5884 while (this_th->th.th_cg_roots) {
5885 this_th->th.th_cg_roots->cg_nthreads--;
5886 KA_TRACE(100, (
"__kmp_free_thread: Thread %p decrement cg_nthreads on node"
5887 " %p of thread %p to %d\n",
5888 this_th, this_th->th.th_cg_roots,
5889 this_th->th.th_cg_roots->cg_root,
5890 this_th->th.th_cg_roots->cg_nthreads));
5892 if (tmp->
cg_root == this_th) {
5895 5, (
"__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
5896 this_th->th.th_cg_roots = tmp->
up;
5902 this_th->th.th_cg_roots = NULL;
5913 this_th->th.th_current_task = NULL;
5917 gtid = this_th->th.th_info.ds.ds_gtid;
5935 for (; (*scan != NULL) && ((*scan)->th.th_info.ds.ds_gtid < gtid);
5936 scan = &((*scan)->th.th_next_pool))
5941 TCW_PTR(this_th->th.th_next_pool, *scan);
5944 (this_th->th.th_info.ds.ds_gtid <
5945 this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
5949 if (this_th->th.th_active ==
TRUE) {
5951 this_th->th.th_active_in_pool =
TRUE;
5962#ifdef KMP_ADJUST_BLOCKTIME
5968 __kmp_zero_bt =
FALSE;
5979#if OMP_PROFILING_SUPPORT
5980 ProfileTraceFile = getenv(
"LIBOMPTARGET_PROFILE");
5982 if (ProfileTraceFile)
5983 llvm::timeTraceProfilerInitialize(500 ,
"libomptarget");
5986 int gtid = this_thr->th.th_info.ds.ds_gtid;
5991 KA_TRACE(10, (
"__kmp_launch_thread: T#%d start\n", gtid));
5998 if (ompd_state & OMPD_ENABLE_BP)
5999 ompd_bp_thread_begin();
6003 ompt_data_t *thread_data =
nullptr;
6005 thread_data = &(this_thr->th.ompt_thread_info.thread_data);
6006 *thread_data = ompt_data_none;
6008 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6009 this_thr->th.ompt_thread_info.wait_id = 0;
6011 this_thr->th.ompt_thread_info.parallel_flags = 0;
6014 ompt_thread_worker, thread_data);
6016 this_thr->th.ompt_thread_info.state = ompt_state_idle;
6026 KA_TRACE(20, (
"__kmp_launch_thread: T#%d waiting for work\n", gtid));
6033 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6037 pteam = &this_thr->th.th_team;
6045 (
"__kmp_launch_thread: T#%d(%d:%d) invoke microtask = %p\n",
6047 (*pteam)->t.t_pkfn));
6053 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
6057 rc = (*pteam)->t.t_invoke(gtid);
6061 KA_TRACE(20, (
"__kmp_launch_thread: T#%d(%d:%d) done microtask = %p\n",
6063 (*pteam)->t.t_pkfn));
6070 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6079 if (ompd_state & OMPD_ENABLE_BP)
6080 ompd_bp_thread_end();
6085 ompt_callbacks.ompt_callback(ompt_callback_thread_end)(thread_data);
6089 this_thr->th.th_task_team = NULL;
6093 KA_TRACE(10, (
"__kmp_launch_thread: T#%d done\n", gtid));
6096#if OMP_PROFILING_SUPPORT
6097 llvm::timeTraceProfilerFinishThread();
6109 KA_TRACE(30, (
"__kmp_internal_end_dest: T#%d\n", gtid));
6116#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
6127 KA_TRACE(30, (
"__kmp_internal_end_atexit\n"));
6164 gtid = thread->th.th_info.ds.ds_gtid;
6170 20, (
"__kmp_reap_thread: releasing T#%d from fork barrier for reap\n",
6199 if (thread->th.th_active_in_pool) {
6200 thread->th.th_active_in_pool =
FALSE;
6210 __kmp_free_fast_memory(thread);
6221#ifdef KMP_ADJUST_BLOCKTIME
6227 __kmp_zero_bt =
FALSE;
6234 if (thread->th.th_cons) {
6236 thread->th.th_cons = NULL;
6240 if (thread->th.th_pri_common != NULL) {
6242 thread->th.th_pri_common = NULL;
6246 if (thread->th.th_local.bget_data != NULL) {
6251#if KMP_AFFINITY_SUPPORTED
6252 if (thread->th.th_affin_mask != NULL) {
6253 KMP_CPU_FREE(thread->th.th_affin_mask);
6254 thread->th.th_affin_mask = NULL;
6258#if KMP_USE_HIER_SCHED
6259 if (thread->th.th_hier_bar_data != NULL) {
6261 thread->th.th_hier_bar_data = NULL;
6266 thread->th.th_serial_team = NULL;
6275 if (__kmp_itt_region_domains.count > 0) {
6276 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6277 kmp_itthash_entry_t *bucket = __kmp_itt_region_domains.buckets[
i];
6279 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6285 if (__kmp_itt_barrier_domains.count > 0) {
6286 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6287 kmp_itthash_entry_t *bucket = __kmp_itt_barrier_domains.buckets[
i];
6289 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6309 __kmp_reclaim_dead_roots();
6333 if (
TCR_4(__kmp_init_monitor)) {
6335 TCW_4(__kmp_init_monitor, 0);
6338 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6363 thread->th.th_next_pool = NULL;
6364 thread->th.th_in_pool =
FALSE;
6375 team->
t.t_next_pool = NULL;
6402 KA_TRACE(10, (
"__kmp_internal_end: all workers reaped\n"));
6411 if (
TCR_4(__kmp_init_monitor)) {
6413 TCW_4(__kmp_init_monitor, 0);
6416 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6436 KA_TRACE(11, (
"__kmp_internal_end_library: abort, exiting\n"));
6441 KA_TRACE(10, (
"__kmp_internal_end_library: already finished\n"));
6460 10, (
"__kmp_internal_end_library: enter T#%d (%d)\n", gtid, gtid_req));
6462 KA_TRACE(10, (
"__kmp_internal_end_library: !__kmp_init_runtime, system "
6463 "already shutdown\n"));
6466 KA_TRACE(10, (
"__kmp_internal_end_library: monitor thread, gtid not "
6467 "registered, or system shutdown\n"));
6470 KA_TRACE(10, (
"__kmp_internal_end_library: gtid not registered or system "
6480 (
"__kmp_internal_end_library: root still active, abort T#%d\n",
6487 (
"__kmp_internal_end_library: unregistering sibling T#%d\n", gtid));
6495#ifdef DUMP_DEBUG_ON_EXIT
6511 KA_TRACE(10, (
"__kmp_internal_end_library: abort, exiting\n"));
6534 KA_TRACE(10, (
"__kmp_internal_end_library: exit\n"));
6536#ifdef DUMP_DEBUG_ON_EXIT
6559 KA_TRACE(11, (
"__kmp_internal_end_thread: abort, exiting\n"));
6564 KA_TRACE(10, (
"__kmp_internal_end_thread: already finished\n"));
6584 (
"__kmp_internal_end_thread: enter T#%d (%d)\n", gtid, gtid_req));
6586 KA_TRACE(10, (
"__kmp_internal_end_thread: !__kmp_init_runtime, system "
6587 "already shutdown\n"));
6590 KA_TRACE(10, (
"__kmp_internal_end_thread: monitor thread, gtid not "
6591 "registered, or system shutdown\n"));
6594 KA_TRACE(10, (
"__kmp_internal_end_thread: gtid not registered or system "
6604 (
"__kmp_internal_end_thread: root still active, abort T#%d\n",
6608 KA_TRACE(10, (
"__kmp_internal_end_thread: unregistering sibling T#%d\n",
6614 KA_TRACE(10, (
"__kmp_internal_end_thread: worker thread T#%d\n", gtid));
6621 (
"__kmp_internal_end_thread: worker thread done, exiting T#%d\n",
6631 KA_TRACE(10, (
"__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
6640 KA_TRACE(10, (
"__kmp_internal_end_thread: abort, exiting\n"));
6663 (
"__kmp_internal_end_thread: remaining sibling task: gtid==%d\n",
i));
6677 KA_TRACE(10, (
"__kmp_internal_end_thread: exit T#%d\n", gtid_req));
6679#ifdef DUMP_DEBUG_ON_EXIT
6699#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
6707#if defined(KMP_USE_SHM)
6708bool __kmp_shm_available =
false;
6709bool __kmp_tmp_available =
false;
6711char *temp_reg_status_file_name =
nullptr;
6722#if KMP_ARCH_X86 || KMP_ARCH_X86_64
6731 KA_TRACE(50, (
"__kmp_register_library_startup: %s=\"%s\"\n",
name,
6738#if defined(KMP_USE_SHM)
6739 char *shm_name =
nullptr;
6740 char *data1 =
nullptr;
6742 if (__kmp_shm_available) {
6745 int shm_preexist = 0;
6746 fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6747 if ((fd1 == -1) && (errno == EEXIST)) {
6750 fd1 = shm_open(shm_name, O_RDWR, 0600);
6753 __kmp_shm_available =
false;
6758 if (__kmp_shm_available && shm_preexist == 0) {
6759 if (ftruncate(fd1, SHM_SIZE) == -1) {
6760 KMP_WARNING(FunctionError,
"Can't set size of SHM");
6761 __kmp_shm_available =
false;
6764 if (__kmp_shm_available) {
6765 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6767 if (data1 == MAP_FAILED) {
6769 __kmp_shm_available =
false;
6772 if (__kmp_shm_available) {
6773 if (shm_preexist == 0) {
6778 munmap(data1, SHM_SIZE);
6783 if (!__kmp_shm_available)
6785 if (!__kmp_shm_available && __kmp_tmp_available) {
6793 int tmp_preexist = 0;
6794 fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6795 if ((fd1 == -1) && (errno == EEXIST)) {
6798 fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
6801 __kmp_tmp_available =
false;
6806 if (__kmp_tmp_available && tmp_preexist == 0) {
6808 if (ftruncate(fd1, SHM_SIZE) == -1) {
6809 KMP_WARNING(FunctionError,
"Can't set size of /tmp file");
6810 __kmp_tmp_available =
false;
6813 if (__kmp_tmp_available) {
6814 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6816 if (data1 == MAP_FAILED) {
6818 __kmp_tmp_available =
false;
6821 if (__kmp_tmp_available) {
6822 if (tmp_preexist == 0) {
6827 munmap(data1, SHM_SIZE);
6832 if (!__kmp_shm_available && !__kmp_tmp_available) {
6853 char *flag_addr_str = NULL;
6854 char *flag_val_str = NULL;
6855 char const *file_name = NULL;
6860 unsigned long *flag_addr = 0;
6861 unsigned long flag_val = 0;
6864 if (flag_addr != 0 && flag_val != 0 && strcmp(file_name,
"") != 0) {
6882 file_name =
"unknown library";
6899#if defined(KMP_USE_SHM)
6900 if (__kmp_shm_available) {
6901 shm_unlink(shm_name);
6902 }
else if (__kmp_tmp_available) {
6903 unlink(temp_reg_status_file_name);
6919#if defined(KMP_USE_SHM)
6940#if defined(KMP_USE_SHM)
6941 char *shm_name =
nullptr;
6943 if (__kmp_shm_available) {
6945 fd1 = shm_open(shm_name, O_RDONLY, 0600);
6947 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6948 if (data1 != MAP_FAILED) {
6950 munmap(data1, SHM_SIZE);
6954 }
else if (__kmp_tmp_available) {
6955 fd1 = open(temp_reg_status_file_name, O_RDONLY);
6957 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6958 if (data1 != MAP_FAILED) {
6960 munmap(data1, SHM_SIZE);
6975#if defined(KMP_USE_SHM)
6976 if (__kmp_shm_available) {
6977 shm_unlink(shm_name);
6978 }
else if (__kmp_tmp_available) {
6979 unlink(temp_reg_status_file_name);
6988#if defined(KMP_USE_SHM)
6991 if (temp_reg_status_file_name)
7007#if KMP_MIC_SUPPORTED
7009static void __kmp_check_mic_type() {
7010 kmp_cpuid_t cpuid_state = {0};
7011 kmp_cpuid_t *cs_p = &cpuid_state;
7012 __kmp_x86_cpuid(1, 0, cs_p);
7014 if ((cs_p->eax & 0xff0) == 0xB10) {
7015 __kmp_mic_type = mic2;
7016 }
else if ((cs_p->eax & 0xf0ff0) == 0x50670) {
7017 __kmp_mic_type = mic3;
7019 __kmp_mic_type = non_mic;
7026static void __kmp_user_level_mwait_init() {
7027 struct kmp_cpuid
buf;
7028 __kmp_x86_cpuid(7, 0, &
buf);
7029 __kmp_waitpkg_enabled = ((
buf.ecx >> 5) & 1);
7030 __kmp_umwait_enabled = __kmp_waitpkg_enabled && __kmp_user_level_mwait;
7031 __kmp_tpause_enabled = __kmp_waitpkg_enabled && (__kmp_tpause_state > 0);
7032 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_umwait_enabled = %d\n",
7033 __kmp_umwait_enabled));
7036#ifndef AT_INTELPHIUSERMWAIT
7039#define AT_INTELPHIUSERMWAIT 10000
7045unsigned long getauxval(
unsigned long) {
return 0; }
7047static void __kmp_user_level_mwait_init() {
7052 if (__kmp_mic_type == mic3) {
7053 unsigned long res = getauxval(AT_INTELPHIUSERMWAIT);
7054 if ((
res & 0x1) || __kmp_user_level_mwait) {
7055 __kmp_mwait_enabled =
TRUE;
7056 if (__kmp_user_level_mwait) {
7060 __kmp_mwait_enabled =
FALSE;
7063 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_mic_type = %d, "
7064 "__kmp_mwait_enabled = %d\n",
7065 __kmp_mic_type, __kmp_mwait_enabled));
7073 KA_TRACE(10, (
"__kmp_do_serial_initialize: enter\n"));
7091#if ENABLE_LIBOMPTARGET
7093 __kmp_init_omptarget();
7108 KA_TRACE(10, (
"__kmp_do_serial_initialize: reinitialization of library\n"));
7115#if KMP_USE_ADAPTIVE_LOCKS
7116#if KMP_DEBUG_ADAPTIVE_LOCKS
7117 __kmp_init_speculative_stats();
7120#if KMP_STATS_ENABLED
7148#if KMP_MIC_SUPPORTED
7149 __kmp_check_mic_type();
7151#if ENABLE_LIBOMPTARGET
7152 __kmp_target_init();
7181 __kmp_monitor_wakeups =
7183 __kmp_bt_intervals =
7196#if KMP_FAST_REDUCTION_BARRIER
7197#define kmp_reduction_barrier_gather_bb ((int)1)
7198#define kmp_reduction_barrier_release_bb ((int)1)
7199#define kmp_reduction_barrier_gather_pat __kmp_barrier_gather_pat_dflt
7200#define kmp_reduction_barrier_release_pat __kmp_barrier_release_pat_dflt
7207#if KMP_FAST_REDUCTION_BARRIER
7217#if KMP_FAST_REDUCTION_BARRIER
7218#undef kmp_reduction_barrier_release_pat
7219#undef kmp_reduction_barrier_gather_pat
7220#undef kmp_reduction_barrier_release_bb
7221#undef kmp_reduction_barrier_gather_bb
7223#if KMP_MIC_SUPPORTED
7224 if (__kmp_mic_type == mic2) {
7232#if KMP_FAST_REDUCTION_BARRIER
7233 if (__kmp_mic_type == mic2) {
7257#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
7258 __kmp_user_level_mwait_init();
7309 KA_TRACE(10, (
"__kmp_do_serial_initialize T#%d\n", gtid));
7322#if !KMP_DYNAMIC_LIB || \
7323 ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
7336#if KMP_HANDLE_SIGNALS
7342 __kmp_install_signals(
FALSE);
7345 __kmp_install_signals(
TRUE);
7372 KA_TRACE(10, (
"__kmp_do_serial_initialize: exit\n"));
7390 int prev_dflt_team_nth;
7396 KA_TRACE(10, (
"__kmp_middle_initialize: enter\n"));
7408#if KMP_AFFINITY_SUPPORTED
7411 __kmp_affinity_initialize(__kmp_affinity);
7430#ifdef KMP_DFLT_NTH_CORES
7433 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7434 "__kmp_ncores (%d)\n",
7439 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7440 "__kmp_avail_proc(%d)\n",
7468 if (thread->th.th_current_task->td_icvs.nproc != 0)
7476 (
"__kmp_middle_initialize: final value for __kmp_dflt_team_nth = %d\n",
7479#ifdef KMP_ADJUST_BLOCKTIME
7484 __kmp_zero_bt =
TRUE;
7492 KA_TRACE(10, (
"__kmp_do_middle_initialize: exit\n"));
7524 (
"__kmp_parallel_initialize: attempt to init while shutting down\n"));
7538 KA_TRACE(10, (
"__kmp_parallel_initialize: enter\n"));
7541#if KMP_ARCH_X86 || KMP_ARCH_X86_64
7544 __kmp_store_x87_fpu_control_word(&__kmp_init_x87_fpu_control_word);
7545 __kmp_store_mxcsr(&__kmp_init_mxcsr);
7546 __kmp_init_mxcsr &= KMP_X86_MXCSR_MASK;
7550#if KMP_HANDLE_SIGNALS
7552 __kmp_install_signals(
TRUE);
7558#if defined(USE_LOAD_BALANCE)
7576 KA_TRACE(10, (
"__kmp_parallel_initialize: exit\n"));
7597#if KMP_AFFINITY_SUPPORTED
7601 if (!__kmp_hh_affinity.flags.initialized)
7602 __kmp_affinity_initialize(__kmp_hh_affinity);
7633 this_thr->th.th_local.this_construct = 0;
7667 if (__itt_stack_caller_create_ptr) {
7669 if (team->
t.t_stack_id != NULL) {
7670 __kmp_itt_stack_callee_enter((__itt_caller)team->
t.t_stack_id);
7673 __kmp_itt_stack_callee_enter(
7674 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7678#if INCLUDE_SSC_MARKS
7679 SSC_MARK_INVOKING();
7684 void **exit_frame_p;
7685 ompt_data_t *my_task_data;
7686 ompt_data_t *my_parallel_data;
7690 exit_frame_p = &(team->
t.t_implicit_task_taskdata[tid]
7691 .ompt_task_info.frame.exit_frame.ptr);
7693 exit_frame_p = &dummy;
7697 &(team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data);
7698 my_parallel_data = &(team->
t.ompt_team_info.parallel_data);
7700 ompt_team_size = team->
t.t_nproc;
7702 ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
7708#if KMP_STATS_ENABLED
7710 if (previous_state == stats_state_e::TEAMS_REGION) {
7719 tid, (
int)team->
t.t_argc, (
void **)team->
t.t_argv
7726 *exit_frame_p = NULL;
7727 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_team;
7730#if KMP_STATS_ENABLED
7731 if (previous_state == stats_state_e::TEAMS_REGION) {
7738 if (__itt_stack_caller_create_ptr) {
7740 if (team->
t.t_stack_id != NULL) {
7741 __kmp_itt_stack_callee_leave((__itt_caller)team->
t.t_stack_id);
7744 __kmp_itt_stack_callee_leave(
7745 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7759 thr->th.th_set_nproc = thr->th.th_teams_size.nth;
7762 KA_TRACE(20, (
"__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
7771 KA_TRACE(100, (
"__kmp_teams_master: Thread %p created node %p and init"
7772 " cg_nthreads to 1\n",
7774 tmp->
up = thr->th.th_cg_roots;
7775 thr->th.th_cg_roots = tmp;
7779#if INCLUDE_SSC_MARKS
7785#if INCLUDE_SSC_MARKS
7789 if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
7790 thr->th.th_teams_size.nth = thr->th.th_team_nproc;
7813 ompt_data_t *task_data =
7814 &team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data;
7815 ompt_data_t *parallel_data = &team->
t.ompt_team_info.parallel_data;
7818 ompt_scope_begin, parallel_data, task_data, team->
t.t_nproc, tid,
7820 OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid;
7825 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_league;
7838 if (num_threads > 0)
7839 thr->th.th_set_nproc = num_threads;
7843 int *num_threads_list) {
7848 if (num_threads_list[0] > 0)
7849 thr->th.th_set_nproc = num_threads_list[0];
7850 thr->th.th_set_nested_nth =
7853 thr->th.th_set_nested_nth[
i] = num_threads_list[
i];
7854 thr->th.th_set_nested_nth_sz = list_length;
7860 thr->th.th_nt_strict =
true;
7861 thr->th.th_nt_loc =
loc;
7864 thr->th.th_nt_sev = sev;
7869 thr->th.th_nt_msg = msg;
7871 thr->th.th_nt_msg =
"Cannot form team with number of threads specified by "
7872 "strict num_threads clause.";
7885 if (num_threads == 0) {
7897 if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) {
7898 num_threads = thr->th.th_current_task->td_icvs.thread_limit;
7903 if (num_threads == 0) {
7907 if (num_threads < 0) {
7914 thr->th.th_current_task->td_icvs.thread_limit = num_threads;
7921 if (new_threads == 0) {
7924 if (new_threads != num_threads) {
7928 KMP_MSG(CantFormThrTeam, num_threads, new_threads),
7932 num_threads = new_threads;
7935 thr->th.th_teams_size.nth = num_threads;
7943 if (num_teams < 0) {
7950 if (num_teams == 0) {
7968 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
7976 int num_teams_ub,
int num_threads) {
7982 if (num_teams_lb > num_teams_ub) {
7989 if (num_teams_lb == 0 && num_teams_ub > 0)
7990 num_teams_lb = num_teams_ub;
7992 if (num_teams_lb == 0 && num_teams_ub == 0) {
8003 }
else if (num_teams_lb == num_teams_ub) {
8004 num_teams = num_teams_ub;
8006 if (num_threads <= 0) {
8008 num_teams = num_teams_lb;
8010 num_teams = num_teams_ub;
8016 if (num_teams < num_teams_lb) {
8017 num_teams = num_teams_lb;
8018 }
else if (num_teams > num_teams_ub) {
8019 num_teams = num_teams_ub;
8025 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
8033 thr->th.th_set_proc_bind = proc_bind;
8050 team->
t.t_construct = 0;
8051 team->
t.t_ordered.dt.t_value =
8056 if (team->
t.t_max_nproc > 1) {
8059 team->
t.t_disp_buffer[
i].buffer_index =
i;
8060 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
8063 team->
t.t_disp_buffer[0].buffer_index = 0;
8064 team->
t.t_disp_buffer[0].doacross_buf_idx = 0;
8071 for (
f = 0;
f < team->
t.t_nproc;
f++) {
8073 team->
t.t_threads[
f]->th.th_team_nproc == team->
t.t_nproc);
8094 __kmp_printf(
"GTID: %d, __kmp_threads[%d]=%p\n", gtid, gtid,
8096 __kmp_printf(
"__kmp_threads[%d]->th.th_team_nproc=%d, TEAM: %p, "
8097 "team->t.t_nproc=%d\n",
8108 ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
8110 (ompt_state == ompt_state_wait_barrier_teams ||
8111 ompt_state == ompt_state_wait_barrier_implicit_parallel)) {
8112 int ds_tid = this_thr->th.th_info.ds.ds_tid;
8113 ompt_data_t *task_data = OMPT_CUR_TASK_DATA(this_thr);
8114 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
8116 void *codeptr = NULL;
8120 codeptr = OMPT_CUR_TEAM_INFO(this_thr)->master_return_address;
8122 ompt_sync_region_t sync_kind = ompt_sync_region_barrier_implicit_parallel;
8123 if (this_thr->th.ompt_thread_info.parallel_flags & ompt_parallel_league)
8124 sync_kind = ompt_sync_region_barrier_teams;
8127 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8131 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8136 ompt_scope_end, NULL, task_data, 0, ds_tid,
8137 ompt_task_implicit);
8148#ifdef USE_LOAD_BALANCE
8152static int __kmp_active_hot_team_nproc(
kmp_root_t *root) {
8157 if (root->r.r_active) {
8160 hot_team = root->r.r_hot_team;
8162 return hot_team->
t.t_nproc - 1;
8167 for (
i = 1;
i < hot_team->
t.t_nproc;
i++) {
8168 if (hot_team->
t.t_threads[
i]->th.th_active) {
8177static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc) {
8180 int hot_team_active;
8181 int team_curr_active;
8184 KB_TRACE(20, (
"__kmp_load_balance_nproc: called root:%p set_nproc:%d\n", root,
8188 ->th.th_current_task->td_icvs.dynamic ==
TRUE);
8191 if (set_nproc == 1) {
8192 KB_TRACE(20, (
"__kmp_load_balance_nproc: serial execution.\n"));
8202 hot_team_active = __kmp_active_hot_team_nproc(root);
8203 team_curr_active = pool_active + hot_team_active + 1;
8207 KB_TRACE(30, (
"__kmp_load_balance_nproc: system active = %d pool active = %d "
8208 "hot team active = %d\n",
8209 system_active, pool_active, hot_team_active));
8211 if (system_active < 0) {
8216 KMP_WARNING(CantLoadBalUsing,
"KMP_DYNAMIC_MODE=thread limit");
8220 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
8221 if (retval > set_nproc) {
8228 KB_TRACE(20, (
"__kmp_load_balance_nproc: thread limit exit. retval:%d\n",
8236 if (system_active < team_curr_active) {
8237 system_active = team_curr_active;
8240 if (retval > set_nproc) {
8247 KB_TRACE(20, (
"__kmp_load_balance_nproc: exit. retval:%d\n", retval));
8259 KA_TRACE(10, (
"__kmp_cleanup: enter\n"));
8262#if KMP_HANDLE_SIGNALS
8263 __kmp_remove_signals();
8269#if KMP_AFFINITY_SUPPORTED
8270 __kmp_affinity_uninitialize();
8276 KA_TRACE(10, (
"__kmp_cleanup: go serial cleanup\n"));
8308#if KMP_USE_DYNAMIC_LOCK
8309 __kmp_cleanup_indirect_user_locks();
8314 if (ompd_env_block) {
8316 ompd_env_block = NULL;
8317 ompd_env_block_size = 0;
8321#if KMP_AFFINITY_SUPPORTED
8323 __kmp_cpuinfo_file = NULL;
8326#if KMP_USE_ADAPTIVE_LOCKS
8327#if KMP_DEBUG_ADAPTIVE_LOCKS
8328 __kmp_print_speculative_stats();
8352#if KMP_USE_HIER_SCHED
8356#if KMP_STATS_ENABLED
8363 KA_TRACE(10, (
"__kmp_cleanup: exit\n"));
8371 if ((env = getenv(
"KMP_IGNORE_MPPBEG")) != NULL) {
8382 if ((env = getenv(
"KMP_IGNORE_MPPEND")) != NULL) {
8400 if (root->r.r_begin)
8403 if (root->r.r_begin) {
8408 root->r.r_begin =
TRUE;
8425 root = thread->th.th_root;
8427 KA_TRACE(20, (
"__kmp_user_set_library: enter T#%d, arg: %d, %d\n", gtid, arg,
8429 if (root->r.r_in_parallel) {
8437 thread->th.th_set_nproc = 0;
8441 thread->th.th_set_nproc = 0;
8446 thread->th.th_set_nproc = 0;
8462 if (arg & (0x1000 - 1)) {
8463 arg &= ~(0x1000 - 1);
8513 teams_serialized = 0;
8514 if (thr->th.th_teams_microtask) {
8516 int tlevel = thr->th.th_teams_level;
8517 int ii = team->
t.t_level;
8518 teams_serialized = team->
t.t_serialized;
8519 int level = tlevel + 1;
8522 for (teams_serialized = team->
t.t_serialized;
8523 (teams_serialized > 0) && (
ii >
level); teams_serialized--,
ii--) {
8525 if (team->
t.t_serialized && (!teams_serialized)) {
8526 team = team->
t.t_parent;
8530 team = team->
t.t_parent;
8543 if (serialized > 1) {
8546 return team->
t.t_master_tid;
8556 if (serialized > 1) {
8559 return team->
t.t_parent->t.t_nproc;
8606#if KMP_AFFINITY_SUPPORTED
8607 {
'A',
"thread_affinity",
's'},
8609 {
't',
"team_num",
'd'},
8610 {
'T',
"num_teams",
'd'},
8611 {
'L',
"nesting_level",
'd'},
8612 {
'n',
"thread_num",
'd'},
8613 {
'N',
"num_threads",
'd'},
8614 {
'a',
"ancestor_tnum",
'd'},
8616 {
'P',
"process_id",
'd'},
8617 {
'i',
"native_thread_id",
'd'}};
8623 int rc, format_index, field_value;
8624 const char *width_left, *width_right;
8625 bool pad_zeros, right_justify, parse_long_name, found_valid_name;
8626 static const int FORMAT_SIZE = 20;
8627 char format[FORMAT_SIZE] = {0};
8628 char absolute_short_name = 0;
8653 right_justify =
false;
8655 right_justify =
true;
8659 width_left = width_right = NULL;
8660 if (**ptr >=
'0' && **ptr <=
'9') {
8668 format[format_index++] =
'%';
8670 format[format_index++] =
'-';
8672 format[format_index++] =
'0';
8673 if (width_left && width_right) {
8677 while (
i < 8 && width_left < width_right) {
8678 format[format_index++] = *width_left;
8686 found_valid_name =
false;
8687 parse_long_name = (**ptr ==
'{');
8688 if (parse_long_name)
8696 if (parse_long_name) {
8698 if (strncmp(*ptr, long_name,
length) == 0) {
8699 found_valid_name =
true;
8702 }
else if (**ptr == short_name) {
8703 found_valid_name =
true;
8706 if (found_valid_name) {
8707 format[format_index++] = field_format;
8708 format[format_index++] =
'\0';
8709 absolute_short_name = short_name;
8713 if (parse_long_name) {
8715 absolute_short_name = 0;
8723 switch (absolute_short_name) {
8756#if KMP_AFFINITY_SUPPORTED
8758 if (th->th.th_affin_mask) {
8761 __kmp_affinity_str_buf_mask(&
buf, th->th.th_affin_mask);
8774 if (parse_long_name) {
8795 const char *parse_ptr;
8812 if (parse_ptr == NULL || *parse_ptr ==
'\0') {
8817 while (*parse_ptr !=
'\0') {
8819 if (*parse_ptr ==
'%') {
8846 int blocktime = arg;
8865 bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(blocktime, __kmp_monitor_wakeups);
8867 set__bt_intervals_team(thread->th.th_team, tid, bt_intervals);
8868 set__bt_intervals_team(thread->th.th_serial_team, 0, bt_intervals);
8877 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
8878 "bt_intervals=%d, monitor_updates=%d\n",
8880 thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
8881 __kmp_monitor_wakeups));
8883 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d\n",
8885 thread->th.th_team->t.t_id, tid, blocktime));
8906 void *reduce_data,
void (*reduce_func)(
void *lhs_data,
void *rhs_data),
8924#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED \
8926 ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
8927#define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
8933 if (team_size == 1) {
8941#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
8942 KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
8943 KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_WASM32 || KMP_ARCH_WASM64 || \
8946#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8947 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HAIKU || \
8948 KMP_OS_HURD || KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8950 int teamsize_cutoff = 4;
8952#if KMP_MIC_SUPPORTED
8953 if (__kmp_mic_type != non_mic) {
8954 teamsize_cutoff = 8;
8958 if (tree_available) {
8959 if (team_size <= teamsize_cutoff) {
8960 if (atomic_available) {
8964 retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
8966 }
else if (atomic_available) {
8970#error "Unknown or unsupported OS"
8975#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8976 KMP_ARCH_PPC || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC
8978#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8979 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HAIKU || KMP_OS_HURD || \
8980 KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8984 if (atomic_available) {
8985 if (num_vars <= 2) {
8993 if (atomic_available && (num_vars <= 3)) {
8995 }
else if (tree_available) {
8996 if ((reduce_size > (9 *
sizeof(
kmp_real64))) &&
8997 (reduce_size < (2000 *
sizeof(
kmp_real64)))) {
8998 retval = TREE_REDUCE_BLOCK_WITH_PLAIN_BARRIER;
9003#error "Unknown or unsupported OS"
9007#error "Unknown or unsupported architecture"
9020 int atomic_available, tree_available;
9029 if (!atomic_available) {
9037 if (!tree_available) {
9041#if KMP_FAST_REDUCTION_BARRIER
9042 forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
9051 retval = forced_retval;
9054 KA_TRACE(10, (
"reduction method selected=%08x\n", retval));
9056#undef FAST_REDUCTION_TREE_METHOD_GENERATED
9057#undef FAST_REDUCTION_ATOMIC_METHOD_GENERATED
9160 for (
int f = 1;
f < old_nthreads; ++
f) {
9163 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 0) {
9169 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3) {
9170 while (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3)
9176 team->
t.t_threads[
f]->th.th_used_in_team.store(2);
9180 team->
t.b->go_release();
9186 int count = old_nthreads - 1;
9188 count = old_nthreads - 1;
9189 for (
int f = 1;
f < old_nthreads; ++
f) {
9190 if (other_threads[
f]->th.th_used_in_team.load() != 0) {
9193 void *, other_threads[
f]->th.th_sleep_loc);
9203 team->
t.b->update_num_threads(new_nthreads);
9204 team->
t.b->go_reset();
9215 for (
int f = 1;
f < new_nthreads; ++
f) {
9218 &(team->
t.t_threads[
f]->th.th_used_in_team), 0, 3);
9227 int count = new_nthreads - 1;
9229 count = new_nthreads - 1;
9230 for (
int f = 1;
f < new_nthreads; ++
f) {
9231 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 1) {
9251std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;
9253void __kmp_hidden_helper_wrapper_fn(
int *gtid,
int *, ...) {
9270 for (
int i = 1;
i < __kmp_hit_hidden_helper_threads_num; ++
i) {
9316 for (
int i = 0;
i < levels; ++
i)
9338 loc++, hw_level++) {
9347 int upper_levels = 1;
9381#if ENABLE_LIBOMPTARGET
9382void (*kmp_target_sync_cb)(
ident_t *loc_ref,
int gtid,
void *current_task,
9383 void *
event) = NULL;
9384void __kmp_target_init() {
9386 *(
void **)(&kmp_target_sync_cb) =
KMP_DLSYM(
"__tgt_target_sync");
9392#if !KMP_STATS_ENABLED
9399#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
A simple pure header implementation of VLA that aims to replace uses of actual VLA,...
static void deallocate(distributedBarrier *db)
static distributedBarrier * allocate(int nThreads)
bool is_sleeping()
Test whether there are threads sleeping on the flag.
@ KMP_IDENT_AUTOPAR
Entry point generated by auto-parallelization.
KMP_EXPORT void __kmpc_serialized_parallel(ident_t *, kmp_int32 global_tid)
KMP_EXPORT void __kmpc_fork_call(ident_t *, kmp_int32 nargs, kmpc_micro microtask,...)
KMP_EXPORT void __kmpc_end_serialized_parallel(ident_t *, kmp_int32 global_tid)
sched_type
Describes the loop schedule to be used for a parallel for loop.
KMP_EXPORT kmp_int32 __kmpc_master(ident_t *, kmp_int32 global_tid)
@ kmp_sch_static
static unspecialized
@ kmp_sch_guided_chunked
guided unspecialized
@ kmp_sch_dynamic_chunked
@ kmp_sch_guided_analytical_chunked
@ kmp_sch_static_balanced
@ kmp_sch_guided_iterative_chunked
__itt_string_handle * name
void const char const char int ITT_FORMAT __itt_group_sync s
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t new_size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t count
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t length
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event event
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id tail
void __kmp_free_task_team(kmp_info_t *thread, kmp_task_team_t *task_team)
struct kmp_disp kmp_disp_t
int __kmp_hot_teams_max_level
void __kmp_finish_implicit_task(kmp_info_t *this_thr)
volatile kmp_team_t * __kmp_team_pool
#define get__dynamic_2(xteam, xtid)
kmp_bar_pat_e __kmp_barrier_release_pat_dflt
kmp_info_t * __kmp_hidden_helper_main_thread
int __kmp_generate_warnings
kmp_proc_bind_t __kmp_teams_proc_bind
#define KMP_INTERNAL_MALLOC(sz)
#define KMP_DEFAULT_CHUNK
kmp_bootstrap_lock_t __kmp_initz_lock
#define KMP_MAX_STKPADDING
int __kmp_display_env_verbose
kmp_global_t __kmp_global
void __kmp_init_target_mem()
union kmp_task_team kmp_task_team_t
void __kmp_hidden_helper_worker_thread_signal()
void __kmp_teams_master(int gtid)
void __kmp_common_initialize(void)
void __kmp_release_64(kmp_flag_64<> *flag)
kmp_pause_status_t __kmp_pause_status
#define KMP_MAX_BLOCKTIME
void __kmp_read_system_time(double *delta)
kmp_bootstrap_lock_t __kmp_tp_cached_lock
void __kmp_reap_task_teams(void)
kmp_int32 __kmp_use_yield
int __kmp_dflt_team_nth_ub
void __kmp_hidden_helper_threads_initz_wait()
struct dispatch_shared_info dispatch_shared_info_t
void __kmp_fini_target_mem()
Finalize target memory support.
#define KMP_INTERNAL_REALLOC(p, sz)
#define get__nproc_2(xteam, xtid)
void __kmp_wait_to_unref_task_teams(void)
union kmp_team kmp_team_p
struct KMP_ALIGN_CACHE dispatch_private_info dispatch_private_info_t
#define __kmp_assign_root_init_mask()
int __kmp_dflt_max_active_levels
struct kmp_hot_team_ptr kmp_hot_team_ptr_t
#define KMP_NOT_SAFE_TO_REAP
void __kmp_unlock_suspend_mx(kmp_info_t *th)
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt
#define KMP_HIDDEN_HELPER_TEAM(team)
static kmp_team_t * __kmp_team_from_gtid(int gtid)
void __kmp_do_initialize_hidden_helper_threads()
struct kmp_local kmp_local_t
kmp_bar_pat_e __kmp_barrier_gather_pattern[bs_last_barrier]
kmp_tasking_mode_t __kmp_tasking_mode
char * __kmp_affinity_format
volatile kmp_info_t * __kmp_thread_pool
void __kmp_internal_end_atexit(void)
volatile int __kmp_init_gtid
omp_allocator_handle_t __kmp_def_allocator
static void __kmp_resume_if_hard_paused()
#define get__max_active_levels(xthread)
kmp_nested_proc_bind_t __kmp_nested_proc_bind
void __kmp_free_implicit_task(kmp_info_t *this_thr)
void __kmp_hidden_helper_main_thread_release()
fork_context_e
Tell the fork call which compiler generated the fork call, and therefore how to deal with the call.
@ fork_context_gnu
Called from GNU generated code, so must not invoke the microtask internally.
@ fork_context_intel
Called from Intel generated code.
void __kmp_suspend_initialize(void)
kmp_nested_nthreads_t __kmp_nested_nth
omp_allocator_handle_t const omp_default_mem_alloc
#define KMP_GTID_SHUTDOWN
void __kmp_internal_end_dtor(void)
volatile int __kmp_all_nth
#define set__nproc(xthread, xval)
int __kmp_is_address_mapped(void *addr)
kmp_lock_t __kmp_global_lock
void __kmpc_destroy_allocator(int gtid, omp_allocator_handle_t al)
union KMP_ALIGN_CACHE kmp_root kmp_root_t
int __kmp_adjust_gtid_mode
#define __kmp_entry_gtid()
kmp_old_threads_list_t * __kmp_old_threads_list
struct kmp_internal_control kmp_internal_control_t
volatile int __kmp_init_common
static int __kmp_tid_from_gtid(int gtid)
static bool KMP_UBER_GTID(int gtid)
kmp_int32 __kmp_use_yield_exp_set
volatile int __kmp_init_hidden_helper
#define KMP_DEBUG_ASSERT_TASKTEAM_INVARIANT(team, thr)
int __kmp_gtid_get_specific(void)
volatile int __kmp_init_middle
void __kmp_hidden_helper_threads_deinitz_wait()
void __kmpc_error(ident_t *loc, int severity, const char *message)
static kmp_sched_t __kmp_sched_without_mods(kmp_sched_t kind)
#define KMP_CHECK_UPDATE(a, b)
int __kmp_storage_map_verbose
int __kmp_allThreadsSpecified
enum sched_type __kmp_static
#define KMP_INITIAL_GTID(gtid)
int PACKED_REDUCTION_METHOD_T
std::atomic< int > __kmp_thread_pool_active_nth
#define KMP_MASTER_TID(tid)
int __kmp_duplicate_library_ok
volatile int __kmp_need_register_serial
kmp_bootstrap_lock_t __kmp_forkjoin_lock
struct kmp_cg_root kmp_cg_root_t
kmp_uint32 __kmp_barrier_release_branch_bits[bs_last_barrier]
static kmp_info_t * __kmp_entry_thread()
void __kmp_init_memkind()
void __kmp_hidden_helper_main_thread_wait()
#define KMP_GEN_TEAM_ID()
void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr, kmp_team_t *team, int tid, int set_curr_task)
kmp_int32 __kmp_default_device
#define get__sched_2(xteam, xtid)
void __kmp_cleanup_threadprivate_caches()
static void copy_icvs(kmp_internal_control_t *dst, kmp_internal_control_t *src)
kmp_bootstrap_lock_t __kmp_exit_lock
kmp_info_t ** __kmp_threads
void __kmp_hidden_helper_initz_release()
enum sched_type __kmp_sched
#define KMP_BARRIER_PARENT_FLAG
void __kmp_suspend_uninitialize_thread(kmp_info_t *th)
void __kmp_finalize_bget(kmp_info_t *th)
#define KMP_BARRIER_SWITCH_TO_OWN_FLAG
static void __kmp_reset_root_init_mask(int gtid)
kmp_uint32 __kmp_barrier_gather_bb_dflt
kmp_uint32 __kmp_barrier_release_bb_dflt
int __kmp_dispatch_num_buffers
#define SCHEDULE_WITHOUT_MODIFIERS(s)
union kmp_team kmp_team_t
#define set__max_active_levels(xthread, xval)
#define __kmp_get_team_num_threads(gtid)
#define KMP_MIN_MALLOC_ARGV_ENTRIES
#define KMP_MASTER_GTID(gtid)
void __kmp_lock_suspend_mx(kmp_info_t *th)
int __kmp_nesting_mode_nlevels
int(* launch_t)(int gtid)
void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size)
int * __kmp_nesting_nth_level
volatile int __kmp_init_parallel
union kmp_barrier_union kmp_balign_t
kmp_int32 __kmp_enable_hidden_helper
#define KMP_DEFAULT_BLOCKTIME
#define set__blocktime_team(xteam, xtid, xval)
#define __kmp_allocate(size)
enum kmp_sched kmp_sched_t
enum library_type __kmp_library
kmp_info_t * __kmp_thread_pool_insert_pt
int __kmp_env_consistency_check
#define bs_reduction_barrier
void __kmp_runtime_destroy(void)
union KMP_ALIGN_CACHE kmp_desc kmp_desc_t
static void __kmp_sched_apply_mods_intkind(kmp_sched_t kind, enum sched_type *internal_kind)
volatile int __kmp_hidden_helper_team_done
static void __kmp_sched_apply_mods_stdkind(kmp_sched_t *kind, enum sched_type internal_kind)
union kmp_barrier_team_union kmp_balign_team_t
std::atomic< kmp_int32 > __kmp_unexecuted_hidden_helper_tasks
#define KMP_INIT_BARRIER_STATE
size_t __kmp_sys_min_stksize
union kmp_info kmp_info_p
#define set__bt_set_team(xteam, xtid, xval)
int __kmp_invoke_task_func(int gtid)
kmp_uint32 __kmp_barrier_gather_branch_bits[bs_last_barrier]
#define KMP_BARRIER_NOT_WAITING
#define KMP_INTERNAL_FREE(p)
int __kmp_threads_capacity
kmp_info_t ** __kmp_hidden_helper_threads
void __kmp_push_current_task_to_thread(kmp_info_t *this_thr, kmp_team_t *team, int tid)
static int __kmp_gtid_from_tid(int tid, const kmp_team_t *team)
void __kmp_push_task_team_node(kmp_info_t *thread, kmp_team_t *team)
void __kmp_threadprivate_resize_cache(int newCapacity)
union kmp_r_sched kmp_r_sched_t
void __kmp_runtime_initialize(void)
volatile int __kmp_init_hidden_helper_threads
void __kmp_common_destroy_gtid(int gtid)
int __kmp_try_suspend_mx(kmp_info_t *th)
int __kmp_display_affinity
enum sched_type __kmp_guided
void __kmp_resume_32(int target_gtid, kmp_flag_32< C, S > *flag)
#define KMP_INLINE_ARGV_ENTRIES
#define SCHEDULE_GET_MODIFIERS(s)
PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method
#define __kmp_page_allocate(size)
void __kmp_initialize_bget(kmp_info_t *th)
int __kmp_teams_thread_limit
void __kmp_cleanup_hierarchy()
void __kmp_pop_current_task_from_thread(kmp_info_t *this_thr)
void __kmp_gtid_set_specific(int gtid)
void __kmp_atomic_resume_64(int target_gtid, kmp_atomic_flag_64< C, S > *flag)
static int __kmp_gtid_from_thread(const kmp_info_t *thr)
#define KMP_MIN_BLOCKTIME
#define SCHEDULE_SET_MODIFIERS(s, m)
void __kmp_suspend_initialize_thread(kmp_info_t *th)
volatile int __kmp_init_serial
@ reduction_method_not_defined
#define KMP_CHECK_UPDATE_SYNC(a, b)
int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int npr, int argc, void *argv[])
kmp_int32 __kmp_hidden_helper_threads_num
#define KMP_MAX_ACTIVE_LEVELS_LIMIT
static void __kmp_type_convert(T1 src, T2 *dest)
void __kmp_fini_memkind()
struct kmp_taskdata kmp_taskdata_t
kmp_bar_pat_e __kmp_barrier_release_pattern[bs_last_barrier]
void __kmp_reap_worker(kmp_info_t *th)
void __kmp_hidden_helper_threads_deinitz_release()
void __kmp_expand_host_name(char *buffer, size_t size)
union KMP_ALIGN_CACHE kmp_info kmp_info_t
enum sched_type __kmp_sch_map[]
void __kmp_task_team_wait(kmp_info_t *this_thr, kmp_team_t *team, int wait=1)
#define __kmp_thread_free(th, ptr)
kmp_topology_t * __kmp_topology
kmp_atomic_lock_t __kmp_atomic_lock_8c
kmp_atomic_lock_t __kmp_atomic_lock_8r
kmp_atomic_lock_t __kmp_atomic_lock_4i
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 kmp_int16
kmp_atomic_lock_t __kmp_atomic_lock_20c
kmp_atomic_lock_t __kmp_atomic_lock_16c
kmp_atomic_lock_t __kmp_atomic_lock_2i
kmp_atomic_lock_t __kmp_atomic_lock_32c
kmp_atomic_lock_t __kmp_atomic_lock_8i
kmp_atomic_lock_t __kmp_atomic_lock
kmp_atomic_lock_t __kmp_atomic_lock_10r
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 kmp_int8
kmp_atomic_lock_t __kmp_atomic_lock_1i
kmp_atomic_lock_t __kmp_atomic_lock_16r
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86<<, 2i, 1, KMP_ARCH_X86) ATOMIC_CMPXCHG(fixed2, shr, kmp_int16, 16, > KMP_ARCH_X86 KMP_ARCH_X86 kmp_uint32
kmp_atomic_lock_t __kmp_atomic_lock_4r
static void __kmp_init_atomic_lock(kmp_atomic_lock_t *lck)
void __kmp_print_structure(void)
void __kmp_dump_debug_buffer(void)
#define KMP_BUILD_ASSERT(expr)
#define KMP_DEBUG_ASSERT(cond)
#define KMP_ASSERT2(cond, msg)
unsigned long long kmp_uint64
kmp_hier_sched_env_t __kmp_hier_scheds
void __kmp_dispatch_free_hierarchies(kmp_team_t *team)
void __kmp_env_free(char const **value)
char * __kmp_env_get(char const *name)
void __kmp_env_set(char const *name, char const *value, int overwrite)
void __kmp_env_unset(char const *name)
void __kmp_push_sync(int gtid, enum cons_type ct, ident_t const *ident, kmp_user_lock_p lck)
void __kmp_push_parallel(int gtid, ident_t const *ident)
void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident)
enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident)
struct cons_header * __kmp_allocate_cons_stack(int gtid)
void __kmp_pop_parallel(int gtid, ident_t const *ident)
void __kmp_free_cons_stack(void *ptr)
static volatile kmp_i18n_cat_status_t status
static void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, va_list ap)
void __kmp_i18n_dump_catalog(kmp_str_buf_t *buffer)
void __kmp_fatal(kmp_msg_t message,...)
void __kmp_i18n_catclose()
kmp_bootstrap_lock_t __kmp_stdio_lock
void __kmp_fprintf(enum kmp_io stream, char const *format,...)
void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap)
void __kmp_printf(char const *format,...)
void __kmp_printf_no_lock(char const *format,...)
void __kmp_close_console(void)
#define USE_ITT_BUILD_ARG(x)
void __kmp_cleanup_user_locks(void)
void __kmp_validate_locks(void)
static void __kmp_release_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static int __kmp_acquire_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_lock(kmp_lock_t *lck)
static int __kmp_acquire_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static void __kmp_release_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_bootstrap_lock(kmp_bootstrap_lock_t *lck)
void(* microtask_t)(int *gtid, int *npr,...)
#define TCW_SYNC_PTR(a, b)
#define KMP_ATOMIC_ST_REL(p, v)
#define KMP_CACHE_PREFETCH(ADDR)
#define KMP_ATOMIC_LD_ACQ(p)
bool __kmp_atomic_compare_store_acq(std::atomic< T > *p, T expected, T desired)
#define KMP_FALLTHROUGH()
#define KMP_ATOMIC_DEC(p)
#define KMP_GET_PAGE_SIZE()
#define KMP_ATOMIC_LD_RLX(p)
#define KMP_COMPARE_AND_STORE_ACQ32(p, cv, sv)
#define KMP_WEAK_ATTRIBUTE_EXTERNAL
#define KMP_ATOMIC_INC(p)
int __kmp_pause_resource(kmp_pause_status_t level)
void __kmp_warn(char const *format,...)
void __kmp_set_schedule(int gtid, kmp_sched_t kind, int chunk)
static void __kmp_initialize_team(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc)
static void __kmp_fini_allocator()
static void __kmp_init_allocator()
void __kmp_aux_set_defaults(char const *str, size_t len)
static int __kmp_free_hot_teams(kmp_root_t *root, kmp_info_t *thr, int level, const int max_level)
static kmp_team_t * __kmp_aux_get_team_info(int &teams_serialized)
static int __kmp_expand_threads(int nNeed)
void __kmp_teams_master(int gtid)
static void __kmp_itthash_clean(kmp_info_t *th)
#define propagateFPControl(x)
void __kmp_itt_init_ittlib()
void __kmp_infinite_loop(void)
void __kmp_push_num_teams_51(ident_t *id, int gtid, int num_teams_lb, int num_teams_ub, int num_threads)
int __kmp_aux_get_num_teams()
kmp_team_t * __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc, kmp_proc_bind_t new_proc_bind, kmp_internal_control_t *new_icvs, int argc, kmp_info_t *master)
kmp_info_t * __kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team, int new_tid)
void __kmp_run_before_invoked_task(int gtid, int tid, kmp_info_t *this_thr, kmp_team_t *team)
static long __kmp_registration_flag
int __kmp_get_max_active_levels(int gtid)
void __kmp_aux_set_library(enum library_type arg)
void __kmp_print_storage_map_gtid(int gtid, void *p1, void *p2, size_t size, char const *format,...)
void __kmp_free_team(kmp_root_t *root, kmp_team_t *team, kmp_info_t *master)
unsigned short __kmp_get_random(kmp_info_t *thread)
int __kmp_register_root(int initial_thread)
static void __kmp_internal_end(void)
void __kmp_set_max_active_levels(int gtid, int max_active_levels)
void __kmp_abort_thread(void)
void __kmp_setup_icv_copy(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc)
void __kmp_internal_end_atexit(void)
static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team, kmp_info_t *master_th, int master_gtid, int fork_teams_workers)
void __kmp_push_proc_bind(ident_t *id, int gtid, kmp_proc_bind_t proc_bind)
kmp_team_t * __kmp_reap_team(kmp_team_t *team)
void __kmp_exit_single(int gtid)
void __kmp_check_stack_overlap(kmp_info_t *th)
void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams, int num_threads)
int __kmp_get_team_size(int gtid, int level)
static void __kmp_allocate_team_arrays(kmp_team_t *team, int max_nth)
static void __kmp_do_middle_initialize(void)
int __kmp_get_max_teams(void)
static void __kmp_free_team_arrays(kmp_team_t *team)
static void __kmp_initialize_root(kmp_root_t *root)
static void __kmp_reinitialize_team(kmp_team_t *team, kmp_internal_control_t *new_icvs, ident_t *loc)
int __kmp_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, kmp_int32 argc, microtask_t microtask, launch_t invoker, kmp_va_list ap)
void __kmp_parallel_dxo(int *gtid_ref, int *cid_ref, ident_t *loc_ref)
void * __kmp_launch_thread(kmp_info_t *this_thr)
void __kmp_set_teams_thread_limit(int limit)
static int __kmp_serial_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, kmp_int32 argc, microtask_t microtask, launch_t invoker, kmp_info_t *master_th, kmp_team_t *parent_team, kmp_va_list ap)
void __kmp_join_barrier(int gtid)
static kmp_internal_control_t __kmp_get_x_global_icvs(const kmp_team_t *team)
void __kmp_init_random(kmp_info_t *thread)
static void __kmp_push_thread_limit(kmp_info_t *thr, int num_teams, int num_threads)
void __kmp_push_num_threads(ident_t *id, int gtid, int num_threads)
void __kmp_user_set_library(enum library_type arg)
#define updateHWFPControl(x)
#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED
void __kmp_internal_end_dest(void *specific_gtid)
int __kmp_aux_get_team_num()
void __kmp_set_num_threads(int new_nth, int gtid)
void __kmp_internal_end_thread(int gtid_req)
static bool __kmp_is_fork_in_teams(kmp_info_t *master_th, microtask_t microtask, int level, int teams_level, kmp_va_list ap)
PACKED_REDUCTION_METHOD_T __kmp_determine_reduction_method(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars, size_t reduce_size, void *reduce_data, void(*reduce_func)(void *lhs_data, void *rhs_data), kmp_critical_name *lck)
void __kmp_hidden_helper_threads_initz_routine()
int __kmp_enter_single(int gtid, ident_t *id_ref, int push_ws)
static void __kmp_initialize_info(kmp_info_t *, kmp_team_t *, int tid, int gtid)
void __kmp_internal_join(ident_t *id, int gtid, kmp_team_t *team)
void __kmp_join_call(ident_t *loc, int gtid, int exit_teams)
static int __kmp_reset_root(int gtid, kmp_root_t *root)
int __kmp_get_ancestor_thread_num(int gtid, int level)
void __kmp_itt_fini_ittlib()
void __kmp_omp_display_env(int verbose)
void __kmp_middle_initialize(void)
void __kmp_unregister_root_current_thread(int gtid)
static void __kmp_reap_thread(kmp_info_t *thread, int is_root)
static const unsigned __kmp_primes[]
int __kmp_get_teams_thread_limit(void)
#define FAST_REDUCTION_TREE_METHOD_GENERATED
void __kmp_parallel_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref)
kmp_r_sched_t __kmp_get_schedule_global()
void __kmp_run_after_invoked_task(int gtid, int tid, kmp_info_t *this_thr, kmp_team_t *team)
static kmp_internal_control_t __kmp_get_global_icvs(void)
void __kmp_parallel_initialize(void)
void __kmp_set_nesting_mode_threads()
void __kmp_unregister_library(void)
char const __kmp_version_omp_api[]
static char * __kmp_registration_str
int __kmp_ignore_mppbeg(void)
void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team)
void __kmp_aux_set_stacksize(size_t arg)
void __kmp_internal_end_library(int gtid_req)
size_t __kmp_aux_capture_affinity(int gtid, const char *format, kmp_str_buf_t *buffer)
void __kmp_resize_dist_barrier(kmp_team_t *team, int old_nthreads, int new_nthreads)
int __kmp_omp_debug_struct_info
static void __kmp_print_thread_storage_map(kmp_info_t *thr, int gtid)
void __kmp_aux_display_affinity(int gtid, const char *format)
void __kmp_init_nesting_mode()
void __kmp_register_library_startup(void)
void __kmp_free_thread(kmp_info_t *this_th)
int __kmp_invoke_task_func(int gtid)
void __kmp_get_schedule(int gtid, kmp_sched_t *kind, int *chunk)
void __kmp_set_strict_num_threads(ident_t *loc, int gtid, int sev, const char *msg)
void __kmp_abort_process()
static const kmp_affinity_format_field_t __kmp_affinity_format_table[]
void __kmp_set_num_teams(int num_teams)
static void __kmp_alloc_argv_entries(int argc, kmp_team_t *team, int realloc)
void __kmp_save_internal_controls(kmp_info_t *thread)
int __kmp_invoke_teams_master(int gtid)
void __kmp_hidden_helper_initialize()
void __kmp_add_threads_to_team(kmp_team_t *team, int new_nthreads)
void __kmp_push_num_threads_list(ident_t *id, int gtid, kmp_uint32 list_length, int *num_threads_list)
static void __kmp_reallocate_team_arrays(kmp_team_t *team, int max_nth)
static int __kmp_reserve_threads(kmp_root_t *root, kmp_team_t *parent_team, int master_tid, int set_nthreads, int enter_teams)
void __kmp_serial_initialize(void)
static bool __kmp_is_entering_teams(int active_level, int level, int teams_level, kmp_va_list ap)
void __kmp_resume_if_soft_paused()
void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid)
int __kmp_get_global_thread_id()
void __kmp_internal_begin(void)
static char * __kmp_reg_status_name()
static void __kmp_print_team_storage_map(const char *header, kmp_team_t *team, int team_id, int num_thr)
static void __kmp_do_serial_initialize(void)
void __kmp_fork_barrier(int gtid, int tid)
int __kmp_get_global_thread_id_reg()
int __kmp_ignore_mppend(void)
static kmp_nested_nthreads_t * __kmp_override_nested_nth(kmp_info_t *thr, int level)
kmp_int32 __kmp_get_reduce_method(void)
static int __kmp_aux_capture_affinity_field(int gtid, const kmp_info_t *th, const char **ptr, kmp_str_buf_t *field_buffer)
static int __kmp_fork_in_teams(ident_t *loc, int gtid, kmp_team_t *parent_team, kmp_int32 argc, kmp_info_t *master_th, kmp_root_t *root, enum fork_context_e call_context, microtask_t microtask, launch_t invoker, int master_set_numthreads, int level, kmp_va_list ap)
void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid)
#define KMP_STRCPY_S(dst, bsz, src)
int __kmp_default_tp_capacity(int req_nproc, int max_nth, int all_threads_specified)
int __kmp_initial_threads_capacity(int req_nproc)
void __kmp_env_initialize(char const *string)
void __kmp_display_env_impl(int display_env, int display_env_verbose)
void __kmp_stats_init(void)
void __kmp_stats_fini(void)
Functions for collecting statistics.
#define KMP_COUNT_VALUE(n, v)
#define KMP_PUSH_PARTITIONED_TIMER(name)
#define KMP_GET_THREAD_STATE()
#define KMP_POP_PARTITIONED_TIMER()
#define KMP_INIT_PARTITIONED_TIMERS(name)
#define KMP_SET_THREAD_STATE_BLOCK(state_name)
#define KMP_TIME_PARTITIONED_BLOCK(name)
#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n)
#define KMP_SET_THREAD_STATE(state_name)
void __kmp_str_split(char *str, char delim, char **head, char **tail)
void __kmp_str_buf_clear(kmp_str_buf_t *buffer)
void __kmp_str_buf_free(kmp_str_buf_t *buffer)
char * __kmp_str_format(char const *format,...)
int __kmp_str_match_true(char const *data)
void __kmp_str_buf_cat(kmp_str_buf_t *buffer, char const *str, size_t len)
void __kmp_str_buf_catbuf(kmp_str_buf_t *dest, const kmp_str_buf_t *src)
int __kmp_str_buf_print(kmp_str_buf_t *buffer, char const *format,...)
int __kmp_str_match_false(char const *data)
struct kmp_str_buf kmp_str_buf_t
#define __kmp_str_buf_init(b)
void __kmp_print_version_1(void)
void __kmp_print_version_2(void)
#define KMP_VERSION_PREFIX
char const __kmp_version_alt_comp[]
char const __kmp_version_lock[]
static void __kmp_null_resume_wrapper(kmp_info_t *thr)
void microtask(int *global_tid, int *bound_tid)
ompt_callbacks_active_t ompt_enabled
ompt_callbacks_internal_t ompt_callbacks
struct ompt_lw_taskteam_s ompt_lw_taskteam_t
#define OMPT_GET_FRAME_ADDRESS(level)
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid, ompt_data_t *ompt_pid, void *codeptr)
int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame, ompt_data_t **parallel_data, int *thread_num)
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int on_heap, bool always)
ompt_task_info_t * __ompt_get_task_info_object(int depth)
void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid)
void __ompt_lw_taskteam_unlink(kmp_info_t *thr)
ompt_data_t * __ompt_get_thread_data_internal()
__attribute__((noinline))
kmp_int32 tt_found_proxy_tasks
kmp_int32 tt_hidden_helper_task_encountered
kmp_int32 cg_thread_limit
void(* th_dxo_fcn)(int *gtid, int *cid, ident_t *)
kmp_int32 th_doacross_buf_idx
dispatch_private_info_t * th_dispatch_pr_current
dispatch_private_info_t * th_disp_buffer
void(* th_deo_fcn)(int *gtid, int *cid, ident_t *)
dispatch_shared_info_t * th_dispatch_sh_current
kmp_proc_bind_t proc_bind
struct kmp_internal_control * next
struct kmp_old_threads_list_t * next
ompt_task_info_t ompt_task_info
enum sched_type r_sched_type
void __kmp_reap_monitor(kmp_info_t *th)
void __kmp_register_atfork(void)
void __kmp_free_handle(kmp_thread_t tHandle)
int __kmp_get_load_balance(int max)
int __kmp_still_running(kmp_info_t *th)
void __kmp_initialize_system_tick(void)
int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val)