40#if OMP_PROFILING_SUPPORT
41#include "llvm/Support/TimeProfiler.h"
42static char *ProfileTraceFile =
nullptr;
46#define KMP_USE_PRCTL 0
62#define KMP_MIN(x, y) ((x) < (y) ? (x) : (y))
79#if KMP_AFFINITY_SUPPORTED
80static void __kmp_partition_places(
kmp_team_t *team,
81 int update_master_only = 0);
84#if ENABLE_LIBOMPTARGET
85static void __kmp_target_init(
void);
92#ifdef USE_LOAD_BALANCE
93static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc);
98static int __kmp_unregister_root_other_thread(
int gtid);
115 new_nested_nth->
nth[
i] = 0;
117 new_nested_nth->
nth[
i] = thr->th.th_set_nested_nth[
j];
119 return new_nested_nth;
135 (
"*** __kmp_get_global_thread_id: entering, nproc=%d all_nproc=%d\n",
148 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using TDATA\n"));
153 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using keyed TLS\n"));
156 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using internal alg.\n"));
158 stack_addr = (
char *)&stack_data;
178 stack_size = (
size_t)
TCR_PTR(thr->th.th_info.ds.ds_stacksize);
179 stack_base = (
char *)
TCR_PTR(thr->th.th_info.ds.ds_stackbase);
183 if (stack_addr <= stack_base) {
184 size_t stack_diff = stack_base - stack_addr;
186 if (stack_diff <= stack_size) {
202 (
"*** __kmp_get_global_thread_id: internal alg. failed to find "
203 "thread, using TLS\n"));
220 if (!
TCR_4(other_threads[
i]->th.th_info.ds.ds_stackgrow)) {
224 stack_base = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
225 if (stack_addr > stack_base) {
226 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stackbase, stack_addr);
227 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
228 other_threads[
i]->th.th_info.ds.ds_stacksize + stack_addr -
231 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
232 stack_base - stack_addr);
237 char *stack_end = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
238 char *stack_beg = stack_end - other_threads[
i]->th.th_info.ds.ds_stacksize;
240 other_threads[
i]->th.th_info.ds.ds_stacksize,
241 "th_%d stack (refinement)",
i);
254 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using TDATA\n"));
259 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using keyed TLS\n"));
263 (
"*** __kmp_get_global_thread_id_reg: using internal alg.\n"));
270 (
"__kmp_get_global_thread_id_reg: Encountered new root thread. "
271 "Registering a new gtid.\n"));
291 char *stack_beg = NULL;
292 char *stack_end = NULL;
295 KA_TRACE(10, (
"__kmp_check_stack_overlap: called\n"));
297 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
298 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
304 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
305 "th_%s stack (%s)",
"mon",
306 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
309 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
310 "th_%d stack (%s)", gtid,
311 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
320 (
"__kmp_check_stack_overlap: performing extensive checking\n"));
321 if (stack_beg == NULL) {
322 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
323 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
329 if (f_th && f_th != th) {
330 char *other_stack_end =
331 (
char *)
TCR_PTR(f_th->th.th_info.ds.ds_stackbase);
332 char *other_stack_beg =
333 other_stack_end - (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize);
334 if ((stack_beg > other_stack_beg && stack_beg < other_stack_end) ||
335 (stack_end > other_stack_beg && stack_end < other_stack_end)) {
340 -1, other_stack_beg, other_stack_end,
341 (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize),
350 KA_TRACE(10, (
"__kmp_check_stack_overlap: returning\n"));
356 static int done =
FALSE;
363#define MAX_MESSAGE 512
366 char const *format, ...) {
370 va_start(ap, format);
371 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP storage map: %p %p%8lu %s\n", p1,
372 p2, (
unsigned long)
size, format);
375#if KMP_PRINT_DATA_PLACEMENT
378 if (p1 <= p2 && (
char *)p2 - (
char *)p1 ==
size) {
380 node = __kmp_get_host_node(p1);
386 int localProc = __kmp_get_cpu_from_gtid(gtid);
390 p1 = (
void *)((
size_t)p1 & ~((
size_t)page_size - 1));
391 p2 = (
void *)(((
size_t)p2 - 1) & ~((
size_t)page_size - 1));
405 (
char *)p1 += page_size;
406 }
while (p1 <= p2 && (node = __kmp_get_host_node(p1)) == lastNode);
412 (
char *)p1 + (page_size - 1),
413 __kmp_get_host_node(p1));
416 (
char *)p2 + (page_size - 1),
417 __kmp_get_host_node(p2));
439 va_start(ap, format);
441 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP warning: %s\n", format);
525#if KMP_FAST_REDUCTION_BARRIER
537 int team_id,
int num_thr) {
545 "%s_%d.t_bar", header, team_id);
555 "%s_%d.t_bar[forkjoin]", header, team_id);
557#if KMP_FAST_REDUCTION_BARRIER
561 "%s_%d.t_bar[reduction]", header, team_id);
565 -1, &team->
t.t_dispatch[0], &team->
t.t_dispatch[num_thr],
566 sizeof(
kmp_disp_t) * num_thr,
"%s_%d.t_dispatch", header, team_id);
569 -1, &team->
t.t_threads[0], &team->
t.t_threads[num_thr],
570 sizeof(
kmp_info_t *) * num_thr,
"%s_%d.t_threads", header, team_id);
573 &team->
t.t_disp_buffer[num_disp_buff],
575 "%s_%d.t_disp_buffer", header, team_id);
589#if ENABLE_LIBOMPTARGET
590static void __kmp_init_omptarget() {
591 __kmp_init_target_task();
600BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
605 case DLL_PROCESS_ATTACH:
606 KA_TRACE(10, (
"DllMain: PROCESS_ATTACH\n"));
610 case DLL_PROCESS_DETACH:
624 if (lpReserved == NULL)
629 case DLL_THREAD_ATTACH:
630 KA_TRACE(10, (
"DllMain: THREAD_ATTACH\n"));
636 case DLL_THREAD_DETACH:
651 int gtid = *gtid_ref;
652#ifdef BUILD_PARALLEL_ORDERED
658#if KMP_USE_DYNAMIC_LOCK
664#ifdef BUILD_PARALLEL_ORDERED
665 if (!team->
t.t_serialized) {
676 int gtid = *gtid_ref;
677#ifdef BUILD_PARALLEL_ORDERED
686#ifdef BUILD_PARALLEL_ORDERED
687 if (!team->
t.t_serialized) {
692 team->
t.t_ordered.dt.t_value = ((tid + 1) % team->
t.t_nproc);
712 team = th->th.th_team;
715 th->th.th_ident = id_ref;
717 if (team->
t.t_serialized) {
720 kmp_int32 old_this = th->th.th_local.this_construct;
722 ++th->th.th_local.this_construct;
726 if (team->
t.t_construct == old_this) {
728 th->th.th_local.this_construct);
731 if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
733 team->
t.t_active_level == 1) {
735 __kmp_itt_metadata_single(id_ref);
749 __kmp_itt_single_start(gtid);
757 __kmp_itt_single_end(gtid);
770 int master_tid,
int set_nthreads,
776 kmp_info_t *this_thr = parent_team->
t.t_threads[master_tid];
780 new_nthreads = set_nthreads;
784#ifdef USE_LOAD_BALANCE
785 else if (
__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
786 new_nthreads = __kmp_load_balance_nproc(root, set_nthreads);
787 if (new_nthreads == 1) {
788 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
789 "reservation to 1 thread\n",
793 if (new_nthreads < set_nthreads) {
794 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
795 "reservation to %d threads\n",
796 master_tid, new_nthreads));
802 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
803 if (new_nthreads <= 1) {
804 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
805 "reservation to 1 thread\n",
809 if (new_nthreads < set_nthreads) {
810 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
811 "reservation to %d threads\n",
812 master_tid, new_nthreads));
814 new_nthreads = set_nthreads;
817 if (set_nthreads > 2) {
819 new_nthreads = (new_nthreads % set_nthreads) + 1;
820 if (new_nthreads == 1) {
821 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
822 "reservation to 1 thread\n",
826 if (new_nthreads < set_nthreads) {
827 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
828 "reservation to %d threads\n",
829 master_tid, new_nthreads));
838 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
841 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
842 if (tl_nthreads <= 0) {
850 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
853 if (tl_nthreads == 1) {
854 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT "
855 "reduced reservation to 1 thread\n",
859 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT reduced "
860 "reservation to %d threads\n",
861 master_tid, tl_nthreads));
862 new_nthreads = tl_nthreads;
866 int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
867 int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
868 if (cg_nthreads + new_nthreads -
869 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
871 int tl_nthreads = max_cg_threads - cg_nthreads +
872 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
873 if (tl_nthreads <= 0) {
881 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
884 if (tl_nthreads == 1) {
885 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT "
886 "reduced reservation to 1 thread\n",
890 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT reduced "
891 "reservation to %d threads\n",
892 master_tid, tl_nthreads));
893 new_nthreads = tl_nthreads;
910 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
913 int slotsRequired =
__kmp_nth + new_nthreads -
914 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) -
917 if (slotsAdded < slotsRequired) {
919 new_nthreads -= (slotsRequired - slotsAdded);
927 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
932 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
940 if (new_nthreads == 1) {
942 (
"__kmp_reserve_threads: T#%d serializing team after reclaiming "
943 "dead roots and rechecking; requested %d threads\n",
946 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d allocating %d threads; requested"
952 if (this_thr->th.th_nt_strict && new_nthreads < set_nthreads) {
953 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
954 this_thr->th.th_nt_msg);
964 int fork_teams_workers) {
968 KA_TRACE(10, (
"__kmp_fork_team_threads: new_nprocs = %d\n", team->
t.t_nproc));
973 master_th->th.th_info.ds.ds_tid = 0;
974 master_th->th.th_team = team;
975 master_th->th.th_team_nproc = team->
t.t_nproc;
976 master_th->th.th_team_master = master_th;
977 master_th->th.th_team_serialized =
FALSE;
978 master_th->th.th_dispatch = &team->
t.t_dispatch[0];
985 int level = team->
t.t_active_level - 1;
986 if (master_th->th.th_teams_microtask) {
987 if (master_th->th.th_teams_size.nteams > 1) {
992 master_th->th.th_teams_level == team->
t.t_level) {
998 if (hot_teams[
level].hot_team) {
1011 if (!use_hot_team) {
1014 team->
t.t_threads[0] = master_th;
1018 for (
i = 1;
i < team->
t.t_nproc;
i++) {
1022 team->
t.t_threads[
i] = thr;
1026 KA_TRACE(20, (
"__kmp_fork_team_threads: T#%d(%d:%d) init arrived "
1027 "T#%d(%d:%d) join =%llu, plain=%llu\n",
1032 thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
1033 thr->th.th_teams_level = master_th->th.th_teams_level;
1034 thr->th.th_teams_size = master_th->th.th_teams_size;
1039 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
1042 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
1048#if KMP_AFFINITY_SUPPORTED
1052 if (!fork_teams_workers) {
1053 __kmp_partition_places(team);
1057 if (team->
t.t_nproc > 1 &&
1059 team->
t.b->update_num_threads(team->
t.t_nproc);
1070 (
"__kmp_fork_team_threads: Primary T#%d pushing task_team %p / team "
1071 "%p, new task_team %p / team %p\n",
1073 team->
t.t_parent, team->
t.t_task_team[master_th->th.th_task_state],
1078 master_th->th.th_task_state);
1082 if (team->
t.t_nproc > 1) {
1084 team->
t.t_threads[1]->th.th_task_state == 1);
1086 team->
t.t_threads[1]->th.th_task_state);
1088 master_th->th.th_task_state = 0;
1093 master_th->th.th_task_state);
1095 master_th->th.th_task_state = 0;
1100 for (
i = 0;
i < team->
t.t_nproc;
i++) {
1102 if (thr->th.th_prev_num_threads != team->
t.t_nproc ||
1103 thr->th.th_prev_level != team->
t.t_level) {
1104 team->
t.t_display_affinity = 1;
1113#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1118 if (__kmp_inherit_fp_control) {
1123 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1124 __kmp_store_mxcsr(&mxcsr);
1125 mxcsr &= KMP_X86_MXCSR_MASK;
1151 if (__kmp_inherit_fp_control && team->
t.t_fp_control_saved) {
1156 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1157 __kmp_store_mxcsr(&mxcsr);
1158 mxcsr &= KMP_X86_MXCSR_MASK;
1160 if (team->
t.t_x87_fpu_control_word != x87_fpu_control_word) {
1161 __kmp_clear_x87_fpu_status_word();
1162 __kmp_load_x87_fpu_control_word(&team->
t.t_x87_fpu_control_word);
1165 if (team->
t.t_mxcsr != mxcsr) {
1166 __kmp_load_mxcsr(&team->
t.t_mxcsr);
1171#define propagateFPControl(x) ((void)0)
1172#define updateHWFPControl(x) ((void)0)
1184 KC_TRACE(10, (
"__kmpc_serialized_parallel: called by T#%d\n", global_tid));
1196 serial_team = this_thr->th.th_serial_team;
1203 if (this_thr->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1208 proc_bind = this_thr->th.th_current_task->td_icvs.proc_bind;
1216 if (this_thr->th.th_nt_strict && this_thr->th.th_set_nproc > 1)
1217 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
1218 this_thr->th.th_nt_msg);
1220 this_thr->th.th_set_nproc = 0;
1223 ompt_data_t ompt_parallel_data = ompt_data_none;
1224 void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
1226 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1229 parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
1237 &ompt_parallel_data, team_size,
1238 ompt_parallel_invoker_program | ompt_parallel_team, codeptr);
1243 if (this_thr->th.th_team != serial_team) {
1245 int level = this_thr->th.th_team->t.t_level;
1247 if (serial_team->
t.t_serialized) {
1255 this_thr->th.th_root, 1, 1,
1259 proc_bind, &this_thr->th.th_current_task->td_icvs, 0, NULL);
1264 new_team->
t.t_threads[0] = this_thr;
1265 new_team->
t.t_parent = this_thr->th.th_team;
1266 serial_team = new_team;
1267 this_thr->th.th_serial_team = serial_team;
1271 (
"__kmpc_serialized_parallel: T#%d allocated new serial team %p\n",
1272 global_tid, serial_team));
1280 (
"__kmpc_serialized_parallel: T#%d reusing cached serial team %p\n",
1281 global_tid, serial_team));
1288 serial_team->
t.t_ident =
loc;
1289 serial_team->
t.t_serialized = 1;
1290 serial_team->
t.t_nproc = 1;
1291 serial_team->
t.t_parent = this_thr->th.th_team;
1292 if (this_thr->th.th_team->t.t_nested_nth)
1293 serial_team->
t.t_nested_nth = this_thr->th.th_team->t.t_nested_nth;
1297 serial_team->
t.t_primary_task_state = this_thr->th.th_task_state;
1298 serial_team->
t.t_sched.sched = this_thr->th.th_team->t.t_sched.sched;
1299 this_thr->th.th_team = serial_team;
1300 serial_team->
t.t_master_tid = this_thr->th.th_info.ds.ds_tid;
1302 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d curtask=%p\n", global_tid,
1303 this_thr->th.th_current_task));
1304 KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 1);
1305 this_thr->th.th_current_task->td_flags.executing = 0;
1312 copy_icvs(&this_thr->th.th_current_task->td_icvs,
1313 &this_thr->th.th_current_task->td_parent->td_icvs);
1318 if (this_thr->th.th_team->t.t_nested_nth)
1319 nested_nth = this_thr->th.th_team->t.t_nested_nth;
1321 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1326 this_thr->th.th_current_task->td_icvs.proc_bind =
1333 this_thr->th.th_info.ds.ds_tid = 0;
1336 this_thr->th.th_team_nproc = 1;
1337 this_thr->th.th_team_master = this_thr;
1338 this_thr->th.th_team_serialized = 1;
1339 this_thr->th.th_task_team = NULL;
1340 this_thr->th.th_task_state = 0;
1342 serial_team->
t.t_level = serial_team->
t.t_parent->t.t_level + 1;
1343 serial_team->
t.t_active_level = serial_team->
t.t_parent->t.t_active_level;
1344 serial_team->
t.t_def_allocator = this_thr->th.th_def_allocator;
1350 if (!serial_team->
t.t_dispatch->th_disp_buffer) {
1351 serial_team->
t.t_dispatch->th_disp_buffer =
1355 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1365 ++serial_team->
t.t_serialized;
1366 this_thr->th.th_team_serialized = serial_team->
t.t_serialized;
1369 int level = this_thr->th.th_team->t.t_level;
1374 if (serial_team->
t.t_nested_nth)
1375 nested_nth = serial_team->
t.t_nested_nth;
1377 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1380 serial_team->
t.t_level++;
1381 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d increasing nesting level "
1382 "of serial team %p to %d\n",
1383 global_tid, serial_team, serial_team->
t.t_level));
1391 disp_buffer->next = serial_team->
t.t_dispatch->th_disp_buffer;
1392 serial_team->
t.t_dispatch->th_disp_buffer = disp_buffer;
1394 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1406 if (this_thr->th.th_prev_level != serial_team->
t.t_level ||
1407 this_thr->th.th_prev_num_threads != 1) {
1410 this_thr->th.th_prev_level = serial_team->
t.t_level;
1411 this_thr->th.th_prev_num_threads = 1;
1418 serial_team->
t.ompt_team_info.master_return_address = codeptr;
1420 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1421 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1426 &ompt_parallel_data, codeptr);
1434 ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
1436 ompt_task_implicit);
1437 OMPT_CUR_TASK_INFO(this_thr)->thread_num =
1442 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
1443 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1453 return (master_th->th.th_teams_microtask && ap &&
1461 return ((ap == NULL && active_level == 0) ||
1462 (ap && teams_level > 0 && teams_level ==
level));
1474 ompt_data_t ompt_parallel_data,
void *return_address,
1480 parent_team->
t.t_ident =
loc;
1482 parent_team->
t.t_argc = argc;
1483 argv = (
void **)parent_team->
t.t_argv;
1484 for (
i = argc - 1;
i >= 0; --
i) {
1488 if (parent_team == master_th->th.th_serial_team) {
1496 parent_team->
t.t_serialized--;
1506 void **exit_frame_p;
1507 ompt_data_t *implicit_task_data;
1512 &ompt_parallel_data, return_address);
1519 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1523 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), implicit_task_data,
1524 1, OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1528 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1530 exit_frame_p = &dummy;
1536 parent_team->
t.t_serialized--;
1551 *exit_frame_p = NULL;
1552 OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
1555 ompt_scope_end, NULL, implicit_task_data, 1,
1556 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1558 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1562 &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th),
1563 OMPT_INVOKER(call_context) | ompt_parallel_team, return_address);
1565 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1572 parent_team->
t.t_invoke = invoker;
1574 parent_team->
t.t_active_level++;
1575 parent_team->
t.t_level++;
1576 parent_team->
t.t_def_allocator = master_th->th.th_def_allocator;
1583 master_th->th.th_teams_size.nth = parent_team->
t.t_nproc;
1595 if (master_set_numthreads) {
1596 if (master_set_numthreads <= master_th->th.th_teams_size.nth) {
1598 kmp_info_t **other_threads = parent_team->
t.t_threads;
1601 int old_proc = master_th->th.th_teams_size.nth;
1606 parent_team->
t.t_nproc = master_set_numthreads;
1607 for (
i = 0;
i < master_set_numthreads; ++
i) {
1608 other_threads[
i]->th.th_team_nproc = master_set_numthreads;
1612 master_th->th.th_set_nproc = 0;
1617 int nth = __kmp_omp_num_threads(
loc);
1619 master_set_numthreads = nth;
1628 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1633 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
1641 master_th->th.th_current_task->td_icvs.proc_bind)) {
1648 master_th->th.th_current_task->td_icvs.proc_bind != proc_bind_icv) {
1649 kmp_info_t **other_threads = parent_team->
t.t_threads;
1650 for (
i = 0;
i < master_th->th.th_team_nproc; ++
i) {
1651 other_threads[
i]->th.th_current_task->td_icvs.proc_bind = proc_bind_icv;
1657#if USE_ITT_BUILD && USE_ITT_NOTIFY
1658 if (((__itt_frame_submit_v3_ptr && __itt_get_timestamp_ptr) ||
1660 __kmp_forkjoin_frames_mode == 3 &&
1661 parent_team->
t.t_active_level == 1
1662 && master_th->th.th_teams_size.nteams == 1) {
1664 master_th->th.th_frame_time = tmp_time;
1665 parent_team->
t.t_region_time = tmp_time;
1667 if (__itt_stack_caller_create_ptr) {
1670 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
1673#if KMP_AFFINITY_SUPPORTED
1674 __kmp_partition_places(parent_team);
1677 KF_TRACE(10, (
"__kmp_fork_in_teams: before internal fork: root=%p, team=%p, "
1678 "master_th=%p, gtid=%d\n",
1679 root, parent_team, master_th, gtid));
1681 KF_TRACE(10, (
"__kmp_fork_in_teams: after internal fork: root=%p, team=%p, "
1682 "master_th=%p, gtid=%d\n",
1683 root, parent_team, master_th, gtid));
1689 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) invoke microtask = %p\n", gtid,
1690 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1692 if (!parent_team->
t.t_invoke(gtid)) {
1693 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
1695 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) done microtask = %p\n", gtid,
1696 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1699 KA_TRACE(20, (
"__kmp_fork_in_teams: parallel exit T#%d\n", gtid));
1710 ompt_data_t *ompt_parallel_data,
void **return_address,
1711 ompt_data_t **parent_task_data,
1719#if KMP_OS_LINUX && \
1720 (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
1728 20, (
"__kmp_serial_fork_call: T#%d serializing parallel region\n", gtid));
1733 master_th->th.th_serial_team->t.t_pkfn =
microtask;
1738 master_th->th.th_serial_team->t.t_ident =
loc;
1741 master_th->th.th_serial_team->t.t_level--;
1746 void **exit_frame_p;
1752 ompt_parallel_data, *return_address);
1756 task_info = OMPT_CUR_TASK_INFO(master_th);
1757 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1761 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1763 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1767 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1769 exit_frame_p = &dummy;
1786 *exit_frame_p = NULL;
1789 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1790 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1792 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1796 ompt_parallel_data, *parent_task_data,
1797 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1799 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1804 team = master_th->th.th_team;
1806 team->
t.t_invoke = invoker;
1808 team->
t.t_argc = argc;
1809 argv = (
void **)team->
t.t_argv;
1810 for (
i = argc - 1;
i >= 0; --
i)
1822 ompt_scope_end, NULL, &(task_info->
task_data), 0,
1823 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial);
1827 ompt_parallel_data, *parent_task_data,
1831 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1836 for (
i = argc - 1;
i >= 0; --
i)
1842 void **exit_frame_p;
1845 ompt_data_t *implicit_task_data;
1849 ompt_parallel_data, *return_address);
1852 task_info = OMPT_CUR_TASK_INFO(master_th);
1853 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1856 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1859 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1861 ompt_task_implicit);
1866 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1868 exit_frame_p = &dummy;
1885 *exit_frame_p = NULL;
1888 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1889 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1892 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1896 ompt_parallel_data, *parent_task_data,
1897 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1899 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1917 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1921 "__kmp_serial_fork_call: unknown fork_context parameter");
1924 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1938 int master_this_cons;
1945 int master_set_numthreads;
1946 int task_thread_limit = 0;
1955 KA_TRACE(20, (
"__kmp_fork_call: enter T#%d\n", gtid));
1977 parent_team = master_th->th.th_team;
1978 master_tid = master_th->th.th_info.ds.ds_tid;
1979 master_this_cons = master_th->th.th_local.this_construct;
1980 root = master_th->th.th_root;
1981 master_active = root->r.r_active;
1982 master_set_numthreads = master_th->th.th_set_nproc;
1984 master_th->th.th_current_task->td_icvs.task_thread_limit;
1987 ompt_data_t ompt_parallel_data = ompt_data_none;
1988 ompt_data_t *parent_task_data = NULL;
1989 ompt_frame_t *ompt_frame = NULL;
1990 void *return_address = NULL;
1995 return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
2003 level = parent_team->
t.t_level;
2005 active_level = parent_team->
t.t_active_level;
2007 teams_level = master_th->th.th_teams_level;
2008 p_hot_teams = &master_th->th.th_hot_teams;
2012 (*p_hot_teams)[0].
hot_team = root->r.r_hot_team;
2014 (*p_hot_teams)[0].hot_team_nth = 1;
2020 int team_size = master_set_numthreads
2021 ? master_set_numthreads
2025 ? ompt_parallel_league
2026 : ompt_parallel_team);
2028 parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags,
2031 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2035 master_th->th.th_ident =
loc;
2041 master_set_numthreads,
level,
2043 ompt_parallel_data, return_address,
2057 if ((!enter_teams &&
2058 (parent_team->
t.t_active_level >=
2059 master_th->th.th_current_task->td_icvs.max_active_levels)) ||
2061 KC_TRACE(10, (
"__kmp_fork_call: T#%d serializing team\n", gtid));
2064 nthreads = master_set_numthreads
2065 ? master_set_numthreads
2070 nthreads = task_thread_limit > 0 && task_thread_limit < nthreads
2083 nthreads, enter_teams);
2084 if (nthreads == 1) {
2095 master_th->th.th_set_nproc = 0;
2097 if (nthreads == 1) {
2099 invoker, master_th, parent_team,
2101 &ompt_parallel_data, &return_address,
2109 KF_TRACE(10, (
"__kmp_fork_call: parent_team_aclevel=%d, master_th=%p, "
2110 "curtask=%p, curtask_max_aclevel=%d\n",
2111 parent_team->
t.t_active_level, master_th,
2112 master_th->th.th_current_task,
2113 master_th->th.th_current_task->td_icvs.max_active_levels));
2117 master_th->th.th_current_task->td_flags.executing = 0;
2119 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2125 int nthreads_icv = master_th->th.th_current_task->td_icvs.nproc;
2127 if (!master_th->th.th_set_nested_nth &&
2128 (
level + 1 < parent_team->
t.t_nested_nth->used) &&
2129 (parent_team->
t.t_nested_nth->nth[
level + 1] != nthreads_icv)) {
2130 nthreads_icv = parent_team->
t.t_nested_nth->nth[
level + 1];
2131 }
else if (master_th->th.th_set_nested_nth) {
2134 (nested_nth->
nth[
level + 1] != nthreads_icv))
2135 nthreads_icv = nested_nth->
nth[
level + 1];
2146 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
2152 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
2155 if (master_th->th.th_teams_microtask &&
2165 master_th->th.th_current_task->td_icvs.proc_bind)) {
2168 if (!master_th->th.th_teams_microtask ||
2179 copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
2180 new_icvs.
next = NULL;
2181 if (nthreads_icv > 0) {
2182 new_icvs.
nproc = nthreads_icv;
2189 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2194 proc_bind, &new_icvs, argc, master_th);
2199 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2201 root, nthreads, nthreads,
2205 proc_bind, &master_th->th.th_current_task->td_icvs, argc, master_th);
2208 &master_th->th.th_current_task->td_icvs);
2211 10, (
"__kmp_fork_call: after __kmp_allocate_team - team = %p\n", team));
2225 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2226 int new_level = parent_team->
t.t_level + 1;
2228 new_level = parent_team->
t.t_active_level + 1;
2232 int new_level = parent_team->
t.t_level;
2234 new_level = parent_team->
t.t_active_level;
2245 if (team->
t.t_nested_nth &&
2246 team->
t.t_nested_nth != parent_team->
t.t_nested_nth) {
2249 team->
t.t_nested_nth = NULL;
2251 team->
t.t_nested_nth = parent_team->
t.t_nested_nth;
2252 if (master_th->th.th_set_nested_nth) {
2255 team->
t.t_nested_nth = nested_nth;
2257 master_th->th.th_set_nested_nth = NULL;
2258 master_th->th.th_set_nested_nth_sz = 0;
2259 master_th->th.th_nt_strict =
false;
2265 if (ompd_state & OMPD_ENABLE_BP)
2266 ompd_bp_parallel_begin();
2271 (
"__kmp_fork_call: T#%d(%d:%d)->(%d:0) created a team of %d threads\n",
2272 gtid, parent_team->
t.t_id, team->
t.t_master_tid, team->
t.t_id,
2275 (team->
t.t_master_tid == 0 &&
2276 (team->
t.t_parent == root->r.r_root_team ||
2277 team->
t.t_parent->t.t_serialized)));
2281 argv = (
void **)team->
t.t_argv;
2283 for (
i = argc - 1;
i >= 0; --
i) {
2289 for (
i = 0;
i < argc; ++
i) {
2297 if (!root->r.r_active)
2298 root->r.r_active =
TRUE;
2302 &master_th->th.th_current_task->td_icvs,
loc);
2305 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
2311 if (team->
t.t_active_level == 1
2312 && !master_th->th.th_teams_microtask) {
2314 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2315 (__kmp_forkjoin_frames_mode == 3 ||
2316 __kmp_forkjoin_frames_mode == 1)) {
2318 if (__itt_get_timestamp_ptr)
2319 tmp_time = __itt_get_timestamp();
2321 master_th->th.th_frame_time = tmp_time;
2322 if (__kmp_forkjoin_frames_mode == 3)
2323 team->
t.t_region_time = tmp_time;
2327 if ((__itt_frame_begin_v3_ptr || KMP_ITT_DEBUG) &&
2328 __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) {
2330 __kmp_itt_region_forking(gtid, team->
t.t_nproc, 0);
2339 (
"__kmp_internal_fork : root=%p, team=%p, master_th=%p, gtid=%d\n",
2340 root, team, master_th, gtid));
2343 if (__itt_stack_caller_create_ptr) {
2347 team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2348 }
else if (parent_team->
t.t_serialized) {
2354 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2363 KF_TRACE(10, (
"__kmp_internal_fork : after : root=%p, team=%p, "
2364 "master_th=%p, gtid=%d\n",
2365 root, team, master_th, gtid));
2369 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2374 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) invoke microtask = %p\n", gtid,
2375 team->
t.t_id, team->
t.t_pkfn));
2378#if KMP_STATS_ENABLED
2386 if (!team->
t.t_invoke(gtid)) {
2387 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
2390#if KMP_STATS_ENABLED
2397 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
2398 team->
t.t_id, team->
t.t_pkfn));
2401 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2404 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2412static inline void __kmp_join_restore_state(
kmp_info_t *thread,
2415 thread->th.ompt_thread_info.state =
2416 ((team->
t.t_serialized) ? ompt_state_work_serial
2417 : ompt_state_work_parallel);
2420static inline void __kmp_join_ompt(
int gtid,
kmp_info_t *thread,
2421 kmp_team_t *team, ompt_data_t *parallel_data,
2422 int flags,
void *codeptr) {
2426 parallel_data, &(task_info->
task_data), flags, codeptr);
2429 task_info->
frame.enter_frame = ompt_data_none;
2430 __kmp_join_restore_state(thread, team);
2448 KA_TRACE(20, (
"__kmp_join_call: enter T#%d\n", gtid));
2452 root = master_th->th.th_root;
2453 team = master_th->th.th_team;
2454 parent_team = team->
t.t_parent;
2456 master_th->th.th_ident =
loc;
2459 void *team_microtask = (
void *)team->
t.t_pkfn;
2465 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2471 KA_TRACE(20, (
"__kmp_join_call: T#%d, old team = %p old task_team = %p, "
2472 "th_task_team = %p\n",
2474 team->
t.t_task_team[master_th->th.th_task_state],
2475 master_th->th.th_task_team));
2480 if (team->
t.t_serialized) {
2481 if (master_th->th.th_teams_microtask) {
2483 int level = team->
t.t_level;
2484 int tlevel = master_th->th.th_teams_level;
2485 if (
level == tlevel) {
2489 }
else if (
level == tlevel + 1) {
2493 team->
t.t_serialized++;
2503 __kmp_join_restore_state(master_th, parent_team);
2510 master_active = team->
t.t_master_active;
2517 if (__itt_stack_caller_create_ptr) {
2520 __kmp_itt_stack_caller_destroy((__itt_caller)team->
t.t_stack_id);
2521 team->
t.t_stack_id = NULL;
2525 master_th->th.th_task_state =
2528 if (__itt_stack_caller_create_ptr && parent_team->
t.t_serialized) {
2533 __kmp_itt_stack_caller_destroy((__itt_caller)parent_team->
t.t_stack_id);
2534 parent_team->
t.t_stack_id = NULL;
2542 ompt_data_t *parallel_data = &(team->
t.ompt_team_info.parallel_data);
2543 void *codeptr = team->
t.ompt_team_info.master_return_address;
2548 if (team->
t.t_active_level == 1 &&
2549 (!master_th->th.th_teams_microtask ||
2550 master_th->th.th_teams_size.nteams == 1)) {
2551 master_th->th.th_ident =
loc;
2554 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2555 __kmp_forkjoin_frames_mode == 3)
2556 __kmp_itt_frame_submit(gtid, team->
t.t_region_time,
2557 master_th->th.th_frame_time, 0,
loc,
2558 master_th->th.th_team_nproc, 1);
2559 else if ((__itt_frame_end_v3_ptr || KMP_ITT_DEBUG) &&
2560 !__kmp_forkjoin_frames_mode && __kmp_forkjoin_frames)
2561 __kmp_itt_region_joined(gtid);
2565#if KMP_AFFINITY_SUPPORTED
2568 master_th->th.th_first_place = team->
t.t_first_place;
2569 master_th->th.th_last_place = team->
t.t_last_place;
2573 if (master_th->th.th_teams_microtask && !exit_teams &&
2575 team->
t.t_level == master_th->th.th_teams_level + 1) {
2580 ompt_data_t ompt_parallel_data = ompt_data_none;
2584 int ompt_team_size = team->
t.t_nproc;
2586 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2587 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
2589 task_info->
frame.exit_frame = ompt_data_none;
2591 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
2597 team->
t.t_active_level--;
2604 if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
2605 int old_num = master_th->th.th_team_nproc;
2606 int new_num = master_th->th.th_teams_size.nth;
2608 team->
t.t_nproc = new_num;
2609 for (
int i = 0;
i < old_num; ++
i) {
2610 other_threads[
i]->th.th_team_nproc = new_num;
2613 for (
int i = old_num;
i < new_num; ++
i) {
2618 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
2621 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
2626 other_threads[
i]->th.th_task_state = master_th->th.th_task_state;
2633 __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data,
2634 OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr);
2642 master_th->th.th_info.ds.ds_tid = team->
t.t_master_tid;
2643 master_th->th.th_local.this_construct = team->
t.t_master_this_cons;
2645 master_th->th.th_dispatch = &parent_team->
t.t_dispatch[team->
t.t_master_tid];
2652 if (!master_th->th.th_teams_microtask ||
2653 team->
t.t_level > master_th->th.th_teams_level) {
2665 : ompt_task_implicit;
2666 int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->
t.t_nproc;
2668 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2669 OMPT_CUR_TASK_INFO(master_th)->thread_num, flags);
2671 task_info->
frame.exit_frame = ompt_data_none;
2676 KF_TRACE(10, (
"__kmp_join_call1: T#%d, this_thread=%p team=%p\n", 0,
2680 master_th->th.th_def_allocator = team->
t.t_def_allocator;
2683 if (ompd_state & OMPD_ENABLE_BP)
2684 ompd_bp_parallel_end();
2688 if (root->r.r_active != master_active)
2689 root->r.r_active = master_active;
2698 master_th->th.th_team = parent_team;
2699 master_th->th.th_team_nproc = parent_team->
t.t_nproc;
2700 master_th->th.th_team_master = parent_team->
t.t_threads[0];
2701 master_th->th.th_team_serialized = parent_team->
t.t_serialized;
2704 if (parent_team->
t.t_serialized &&
2705 parent_team != master_th->th.th_serial_team &&
2706 parent_team != root->r.r_root_team) {
2708 master_th->th.th_serial_team = parent_team;
2714 team->
t.t_primary_task_state == 1);
2715 master_th->th.th_task_state = (
kmp_uint8)team->
t.t_primary_task_state;
2718 master_th->th.th_task_team =
2719 parent_team->
t.t_task_team[master_th->th.th_task_state];
2721 (
"__kmp_join_call: Primary T#%d restoring task_team %p, team %p\n",
2729 master_th->th.th_current_task->td_flags.executing = 1;
2733#if KMP_AFFINITY_SUPPORTED
2734 if (master_th->th.th_team->t.t_level == 0 && __kmp_affinity.flags.reset) {
2742 : ompt_parallel_team);
2744 __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags,
2750 KA_TRACE(20, (
"__kmp_join_call: exit T#%d\n", gtid));
2757 if (thread->th.th_team != thread->th.th_serial_team) {
2760 if (thread->th.th_team->t.t_serialized > 1) {
2763 if (thread->th.th_team->t.t_control_stack_top == NULL) {
2766 if (thread->th.th_team->t.t_control_stack_top->serial_nesting_level !=
2767 thread->th.th_team->t.t_serialized) {
2776 copy_icvs(control, &thread->th.th_current_task->td_icvs);
2780 control->
next = thread->th.th_team->t.t_control_stack_top;
2781 thread->th.th_team->t.t_control_stack_top = control;
2791 KF_TRACE(10, (
"__kmp_set_num_threads: new __kmp_nth = %d\n", new_nth));
2801 if (thread->th.th_current_task->td_icvs.nproc == new_nth)
2811 root = thread->th.th_root;
2824 for (
f = new_nth;
f < hot_team->
t.t_nproc;
f++) {
2829 hot_team->
t.t_threads[
f]->th.th_task_team = NULL;
2832 hot_team->
t.t_threads[
f] = NULL;
2834 hot_team->
t.t_nproc = new_nth;
2835 if (thread->th.th_hot_teams) {
2837 thread->th.th_hot_teams[0].hot_team_nth = new_nth;
2841 hot_team->
t.b->update_num_threads(new_nth);
2848 for (
f = 0;
f < new_nth;
f++) {
2850 hot_team->
t.t_threads[
f]->th.th_team_nproc = new_nth;
2853 hot_team->
t.t_size_changed = -1;
2861 KF_TRACE(10, (
"__kmp_set_max_active_levels: new max_active_levels for thread "
2863 gtid, max_active_levels));
2867 if (max_active_levels < 0) {
2868 KMP_WARNING(ActiveLevelsNegative, max_active_levels);
2873 KF_TRACE(10, (
"__kmp_set_max_active_levels: the call is ignored: new "
2874 "max_active_levels for thread %d = (%d)\n",
2875 gtid, max_active_levels));
2883 KMP_WARNING(ActiveLevelsExceedLimit, max_active_levels,
2891 KF_TRACE(10, (
"__kmp_set_max_active_levels: after validation: new "
2892 "max_active_levels for thread %d = (%d)\n",
2893 gtid, max_active_levels));
2906 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d\n", gtid));
2911 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d, curtask=%p, "
2912 "curtask_maxaclevel=%d\n",
2913 gtid, thread->th.th_current_task,
2914 thread->th.th_current_task->td_icvs.max_active_levels));
2915 return thread->th.th_current_task->td_icvs.max_active_levels;
2940 KF_TRACE(10, (
"__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
2941 gtid, (
int)kind, chunk));
2955 KMP_HNT(DefaultScheduleKindUsed,
"static, no chunk"),
2969 thread->th.th_current_task->td_icvs.sched.r_sched_type =
kmp_sch_static;
2971 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2977 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2982 orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
2987 thread->th.th_current_task->td_icvs.sched.chunk = chunk;
2996 KF_TRACE(10, (
"__kmp_get_schedule: thread %d\n", gtid));
3001 th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
3027#if KMP_STATIC_STEAL_ENABLED
3033 KMP_FATAL(UnknownSchedulingType, th_type);
3037 *chunk = thread->th.th_current_task->td_icvs.sched.chunk;
3046 KF_TRACE(10, (
"__kmp_get_ancestor_thread_num: thread %d %d\n", gtid,
level));
3055 team = thr->th.th_team;
3056 ii = team->
t.t_level;
3060 if (thr->th.th_teams_microtask) {
3062 int tlevel = thr->th.th_teams_level;
3079 dd = team->
t.t_serialized;
3082 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3084 if ((team->
t.t_serialized) && (!dd)) {
3085 team = team->
t.t_parent;
3089 team = team->
t.t_parent;
3090 dd = team->
t.t_serialized;
3095 return (dd > 1) ? (0) : (team->
t.t_master_tid);
3104 KF_TRACE(10, (
"__kmp_get_team_size: thread %d %d\n", gtid,
level));
3113 team = thr->th.th_team;
3114 ii = team->
t.t_level;
3118 if (thr->th.th_teams_microtask) {
3120 int tlevel = thr->th.th_teams_level;
3135 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3137 if (team->
t.t_serialized && (!dd)) {
3138 team = team->
t.t_parent;
3142 team = team->
t.t_parent;
3147 return team->
t.t_nproc;
3189 if (!realloc || argc > team->
t.t_max_argc) {
3191 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: needed entries=%d, "
3192 "current entries=%d\n",
3193 team->
t.t_id, argc, (realloc) ? team->
t.t_max_argc : 0));
3195 if (realloc && team->
t.t_argv != &team->
t.t_inline_argv[0])
3201 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: inline allocate %d "
3203 team->
t.t_id, team->
t.t_max_argc));
3204 team->
t.t_argv = &team->
t.t_inline_argv[0];
3207 -1, &team->
t.t_inline_argv[0],
3217 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: dynamic allocate %d "
3219 team->
t.t_id, team->
t.t_max_argc));
3224 &team->
t.t_argv[team->
t.t_max_argc],
3225 sizeof(
void *) * team->
t.t_max_argc,
3226 "team_%d.t_argv", team->
t.t_id);
3239 team->
t.t_dispatch =
3241 team->
t.t_implicit_task_taskdata =
3243 team->
t.t_max_nproc = max_nth;
3246 for (
i = 0;
i < num_disp_buff; ++
i) {
3247 team->
t.t_disp_buffer[
i].buffer_index =
i;
3248 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
3255 for (
i = 0;
i < team->
t.t_max_nproc; ++
i) {
3256 if (team->
t.t_dispatch[
i].th_disp_buffer != NULL) {
3258 team->
t.t_dispatch[
i].th_disp_buffer = NULL;
3261#if KMP_USE_HIER_SCHED
3268 team->
t.t_threads = NULL;
3269 team->
t.t_disp_buffer = NULL;
3270 team->
t.t_dispatch = NULL;
3271 team->
t.t_implicit_task_taskdata = 0;
3329 copy_icvs(&gx_icvs, &team->
t.t_threads[0]->th.th_current_task->td_icvs);
3330 gx_icvs.
next = NULL;
3339 int hot_team_max_nth;
3348 root->r.r_begin =
FALSE;
3349 root->r.r_active =
FALSE;
3350 root->r.r_in_parallel = 0;
3352#if KMP_AFFINITY_SUPPORTED
3353 root->r.r_affinity_assigned =
FALSE;
3358 KF_TRACE(10, (
"__kmp_initialize_root: before root_team\n"));
3376 KF_TRACE(10, (
"__kmp_initialize_root: after root_team = %p\n", root_team));
3378 root->r.r_root_team = root_team;
3379 root_team->
t.t_control_stack_top = NULL;
3382 root_team->
t.t_threads[0] = NULL;
3383 root_team->
t.t_nproc = 1;
3384 root_team->
t.t_serialized = 1;
3386 root_team->
t.t_sched.sched = r_sched.
sched;
3390 (
"__kmp_initialize_root: init root team %d arrived: join=%u, plain=%u\n",
3395 KF_TRACE(10, (
"__kmp_initialize_root: before hot_team\n"));
3407 KF_TRACE(10, (
"__kmp_initialize_root: after hot_team = %p\n", hot_team));
3409 root->r.r_hot_team = hot_team;
3410 root_team->
t.t_control_stack_top = NULL;
3413 hot_team->
t.t_parent = root_team;
3416 hot_team_max_nth = hot_team->
t.t_max_nproc;
3417 for (
f = 0;
f < hot_team_max_nth; ++
f) {
3418 hot_team->
t.t_threads[
f] = NULL;
3420 hot_team->
t.t_nproc = 1;
3422 hot_team->
t.t_sched.sched = r_sched.
sched;
3423 hot_team->
t.t_size_changed = 0;
3429typedef struct kmp_team_list_item {
3431 struct kmp_team_list_item *next;
3432} kmp_team_list_item_t;
3433typedef kmp_team_list_item_t *kmp_team_list_t;
3435static void __kmp_print_structure_team_accum(
3436 kmp_team_list_t list,
3452 __kmp_print_structure_team_accum(list, team->
t.t_parent);
3453 __kmp_print_structure_team_accum(list, team->
t.t_next_pool);
3457 while (l->next != NULL && l->entry != team) {
3460 if (l->next != NULL) {
3466 while (l->next != NULL && l->entry->t.t_id <= team->
t.t_id) {
3473 sizeof(kmp_team_list_item_t));
3480static void __kmp_print_structure_team(
char const *title,
kmp_team_p const *team
3491static void __kmp_print_structure_thread(
char const *title,
3494 if (thread != NULL) {
3503 kmp_team_list_t list;
3511 __kmp_printf(
"\n------------------------------\nGlobal Thread "
3512 "Table\n------------------------------\n");
3528 __kmp_printf(
"\n------------------------------\nThreads\n--------------------"
3534 if (thread != NULL) {
3537 __kmp_print_structure_team(
" Our Team: ", thread->th.th_team);
3538 __kmp_print_structure_team(
" Serial Team: ",
3539 thread->th.th_serial_team);
3540 __kmp_printf(
" Threads: %2d\n", thread->th.th_team_nproc);
3541 __kmp_print_structure_thread(
" Primary: ",
3542 thread->th.th_team_master);
3543 __kmp_printf(
" Serialized?: %2d\n", thread->th.th_team_serialized);
3544 __kmp_printf(
" Set NProc: %2d\n", thread->th.th_set_nproc);
3545 __kmp_printf(
" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
3546 __kmp_print_structure_thread(
" Next in pool: ",
3547 thread->th.th_next_pool);
3549 __kmp_print_structure_team_accum(list, thread->th.th_team);
3550 __kmp_print_structure_team_accum(list, thread->th.th_serial_team);
3558 __kmp_printf(
"\n------------------------------\nUbers\n----------------------"
3566 __kmp_print_structure_team(
" Root Team: ", root->r.r_root_team);
3567 __kmp_print_structure_team(
" Hot Team: ", root->r.r_hot_team);
3568 __kmp_print_structure_thread(
" Uber Thread: ",
3569 root->r.r_uber_thread);
3574 __kmp_print_structure_team_accum(list, root->r.r_root_team);
3575 __kmp_print_structure_team_accum(list, root->r.r_hot_team);
3582 __kmp_printf(
"\n------------------------------\nTeams\n----------------------"
3584 while (list->next != NULL) {
3588 __kmp_print_structure_team(
" Parent Team: ", team->
t.t_parent);
3591 __kmp_printf(
" Levels of serial: %2d\n", team->
t.t_serialized);
3593 for (
i = 0;
i < team->
t.t_nproc; ++
i) {
3595 __kmp_print_structure_thread(
"", team->
t.t_threads[
i]);
3597 __kmp_print_structure_team(
" Next in pool: ", team->
t.t_next_pool);
3603 __kmp_printf(
"\n------------------------------\nPools\n----------------------"
3605 __kmp_print_structure_thread(
"Thread pool: ",
3607 __kmp_print_structure_team(
"Team pool: ",
3612 while (list != NULL) {
3613 kmp_team_list_item_t *item = list;
3625 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, 0xba5703f5, 0xb495a877,
3626 0xe1626741, 0x79695e6b, 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231,
3627 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, 0xbe4d6fe9, 0x5f15e201,
3628 0x99afc3fd, 0xf3f16801, 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3,
3629 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, 0x085a3d61, 0x46eb5ea7,
3630 0x3d9910ed, 0x2e687b5b, 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9,
3631 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, 0x54581edb, 0xf2480f45,
3632 0x0bb9288f, 0xef1affc7, 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7,
3633 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, 0xfc411073, 0xc3749363,
3634 0xb892d829, 0x3549366b, 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3,
3635 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f};
3640 unsigned x = thread->th.th_x;
3641 unsigned short r = (
unsigned short)(
x >> 16);
3643 thread->th.th_x =
x * thread->th.th_a + 1;
3645 KA_TRACE(30, (
"__kmp_get_random: THREAD: %d, RETURN: %u\n",
3646 thread->th.th_info.ds.ds_tid,
r));
3653 unsigned seed = thread->th.th_info.ds.ds_tid;
3657 thread->th.th_x = (seed + 1) * thread->th.th_a + 1;
3659 (
"__kmp_init_random: THREAD: %u; A: %u\n", seed, thread->th.th_a));
3665static int __kmp_reclaim_dead_roots(
void) {
3673 r += __kmp_unregister_root_other_thread(
i);
3700 int minimumRequiredCapacity;
3709#if KMP_OS_WINDOWS && !KMP_DYNAMIC_LIB
3712 added = __kmp_reclaim_dead_roots();
3754 }
while (newCapacity < minimumRequiredCapacity);
3798 KA_TRACE(20, (
"__kmp_register_root: entered\n"));
3852 KA_TRACE(1, (
"__kmp_register_root: found slot in threads array for "
3853 "hidden helper thread: T#%d\n",
3867 1, (
"__kmp_register_root: found slot in threads array: T#%d\n", gtid));
3889#ifdef KMP_ADJUST_BLOCKTIME
3894 __kmp_zero_bt =
TRUE;
3905#if KMP_STATS_ENABLED
3907 __kmp_stats_thread_ptr = __kmp_stats_list->push_back(gtid);
3908 __kmp_stats_thread_ptr->startLife();
3915 if (root->r.r_uber_thread) {
3916 root_thread = root->r.r_uber_thread;
3922 root_thread->th.th_info.ds.ds_gtid = gtid;
3924 root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
3926 root_thread->th.th_root = root;
3931 __kmp_initialize_fast_memory(root_thread);
3942 if (!root_thread->th.th_serial_team) {
3944 KF_TRACE(10, (
"__kmp_register_root: before serial_team\n"));
3945 root_thread->th.th_serial_team =
3953 KF_TRACE(10, (
"__kmp_register_root: after serial_team = %p\n",
3954 root_thread->th.th_serial_team));
3959 root->r.r_root_team->t.t_threads[0] = root_thread;
3960 root->r.r_hot_team->t.t_threads[0] = root_thread;
3961 root_thread->th.th_serial_team->t.t_threads[0] = root_thread;
3963 root_thread->th.th_serial_team->t.t_serialized = 0;
3964 root->r.r_uber_thread = root_thread;
3974 __kmp_itt_thread_name(gtid);
3977#ifdef KMP_TDATA_GTID
3983 KA_TRACE(20, (
"__kmp_register_root: T#%d init T#%d(%d:%d) arrived: join=%u, "
3993 root_thread->th.th_bar[
b].bb.b_worker_arrived = 0;
4000#if KMP_AFFINITY_SUPPORTED
4001 root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
4002 root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
4003 root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
4004 root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
4007 root_thread->th.th_prev_level = 0;
4008 root_thread->th.th_prev_num_threads = 1;
4014 KA_TRACE(100, (
"__kmp_register_root: Thread %p created node %p with"
4015 " cg_nthreads init to 1\n",
4018 root_thread->th.th_cg_roots = tmp;
4027 ompt_set_thread_state(root_thread, ompt_state_overhead);
4033 ompt_data_t *task_data;
4034 ompt_data_t *parallel_data;
4039 ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
4042 ompt_set_thread_state(root_thread, ompt_state_work_serial);
4046 if (ompd_state & OMPD_ENABLE_BP)
4047 ompd_bp_thread_begin();
4057 const int max_level) {
4060 if (!hot_teams || !hot_teams[
level].hot_team) {
4067 if (
level < max_level - 1) {
4068 for (
i = 0;
i < nth; ++
i) {
4071 if (
i > 0 && th->th.th_hot_teams) {
4073 th->th.th_hot_teams = NULL;
4086 int n = hot_team->
t.t_nproc;
4091 root->r.r_root_team = NULL;
4092 root->r.r_hot_team = NULL;
4098 for (
i = 0;
i < hot_team->
t.t_nproc; ++
i) {
4103 if (th->th.th_hot_teams) {
4105 th->th.th_hot_teams = NULL;
4123 (LPVOID) & (root->r.r_uber_thread->th),
4124 root->r.r_uber_thread->th.th_info.ds.ds_thread));
4129 if (ompd_state & OMPD_ENABLE_BP)
4130 ompd_bp_thread_end();
4134 ompt_data_t *task_data;
4135 ompt_data_t *parallel_data;
4140 ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
4144 &(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
4150 i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
4151 KA_TRACE(100, (
"__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
4153 root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
4154 root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
4158 root->r.r_uber_thread->th.th_cg_roots->cg_root);
4160 __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
4161 root->r.r_uber_thread->th.th_cg_roots = NULL;
4167 root->r.r_uber_thread = NULL;
4169 root->r.r_begin =
FALSE;
4175 KA_TRACE(1, (
"__kmp_unregister_root_current_thread: enter T#%d\n", gtid));
4181 KC_TRACE(10, (
"__kmp_unregister_root_current_thread: already finished, "
4205 thread->th.ompt_thread_info.state = ompt_state_undefined;
4214 (
"__kmp_unregister_root_current_thread: T#%d unregistered\n", gtid));
4223static int __kmp_unregister_root_other_thread(
int gtid) {
4227 KA_TRACE(1, (
"__kmp_unregister_root_other_thread: enter T#%d\n", gtid));
4235 (
"__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid));
4241void __kmp_task_info() {
4246 kmp_team_t *steam = this_thr->th.th_serial_team;
4250 "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
4252 gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
4253 team->
t.t_implicit_task_taskdata[tid].td_parent);
4261 int tid,
int gtid) {
4278 this_thr->th.th_info.ds.ds_tid = tid;
4279 this_thr->th.th_set_nproc = 0;
4288#if KMP_AFFINITY_SUPPORTED
4289 this_thr->th.th_new_place = this_thr->th.th_current_place;
4291 this_thr->th.th_root = master->th.th_root;
4294 this_thr->th.th_team_nproc = team->
t.t_nproc;
4295 this_thr->th.th_team_master = master;
4296 this_thr->th.th_team_serialized = team->
t.t_serialized;
4300 KF_TRACE(10, (
"__kmp_initialize_info1: T#%d:%d this_thread=%p curtask=%p\n",
4301 tid, gtid, this_thr, this_thr->th.th_current_task));
4306 KF_TRACE(10, (
"__kmp_initialize_info2: T#%d:%d this_thread=%p curtask=%p\n",
4307 tid, gtid, this_thr, this_thr->th.th_current_task));
4312 this_thr->th.th_dispatch = &team->
t.t_dispatch[tid];
4314 this_thr->th.th_local.this_construct = 0;
4316 if (!this_thr->th.th_pri_common) {
4317 this_thr->th.th_pri_common =
4321 gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1,
4322 sizeof(
struct common_table),
"th_%d.th_pri_common\n", gtid);
4324 this_thr->th.th_pri_head = NULL;
4327 if (this_thr != master &&
4328 this_thr->th.th_cg_roots != master->th.th_cg_roots) {
4335 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p decrement cg_nthreads"
4336 " on node %p of thread %p to %d\n",
4342 this_thr->th.th_cg_roots = master->th.th_cg_roots;
4344 this_thr->th.th_cg_roots->cg_nthreads++;
4345 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p increment cg_nthreads on"
4346 " node %p of thread %p to %d\n",
4347 this_thr, this_thr->th.th_cg_roots,
4348 this_thr->th.th_cg_roots->cg_root,
4349 this_thr->th.th_cg_roots->cg_nthreads));
4350 this_thr->th.th_current_task->td_icvs.thread_limit =
4351 this_thr->th.th_cg_roots->cg_thread_limit;
4356 volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
4361 KD_TRACE(10, (
"__kmp_initialize_info: T#%d max_nproc: %d\n", gtid,
4362 team->
t.t_max_nproc));
4380 "th_%d.th_dispatch.th_disp_buffer "
4381 "(team_%d.t_dispatch[%d].th_disp_buffer)",
4382 gtid, team->
t.t_id, gtid);
4395 this_thr->th.th_next_pool = NULL;
4430 if (new_thr->th.th_active_in_pool ==
TRUE) {
4433 new_thr->th.th_active_in_pool =
FALSE;
4437 KA_TRACE(20, (
"__kmp_allocate_thread: T#%d using thread T#%d\n",
4444 new_thr->th.th_info.ds.ds_gtid);
4449 new_thr->th.th_task_state = 0;
4457#ifdef KMP_ADJUST_BLOCKTIME
4462 __kmp_zero_bt =
TRUE;
4476 KF_TRACE(10, (
"__kmp_allocate_thread: T#%d using thread %p T#%d\n",
4490 if (!
TCR_4(__kmp_init_monitor)) {
4492 if (!
TCR_4(__kmp_init_monitor)) {
4493 KF_TRACE(10, (
"before __kmp_create_monitor\n"));
4494 TCW_4(__kmp_init_monitor, 1);
4496 KF_TRACE(10, (
"after __kmp_create_monitor\n"));
4507 while (
TCR_4(__kmp_init_monitor) < 2) {
4510 KF_TRACE(10, (
"after monitor thread has started\n"));
4537 new_thr->th.th_nt_strict =
false;
4538 new_thr->th.th_nt_loc = NULL;
4540 new_thr->th.th_nt_msg = NULL;
4544#if USE_ITT_BUILD && USE_ITT_NOTIFY && KMP_DEBUG
4547 __itt_suppress_mark_range(
4548 __itt_suppress_range, __itt_suppress_threading_errors,
4549 &new_thr->th.th_sleep_loc,
sizeof(new_thr->th.th_sleep_loc));
4550 __itt_suppress_mark_range(
4551 __itt_suppress_range, __itt_suppress_threading_errors,
4552 &new_thr->th.th_reap_state,
sizeof(new_thr->th.th_reap_state));
4554 __itt_suppress_mark_range(
4555 __itt_suppress_range, __itt_suppress_threading_errors,
4556 &new_thr->th.th_suspend_init,
sizeof(new_thr->th.th_suspend_init));
4558 __itt_suppress_mark_range(__itt_suppress_range,
4559 __itt_suppress_threading_errors,
4560 &new_thr->th.th_suspend_init_count,
4561 sizeof(new_thr->th.th_suspend_init_count));
4564 __itt_suppress_mark_range(__itt_suppress_range,
4565 __itt_suppress_threading_errors,
4567 sizeof(new_thr->th.th_bar[0].bb.b_go));
4568 __itt_suppress_mark_range(__itt_suppress_range,
4569 __itt_suppress_threading_errors,
4571 sizeof(new_thr->th.th_bar[1].bb.b_go));
4572 __itt_suppress_mark_range(__itt_suppress_range,
4573 __itt_suppress_threading_errors,
4575 sizeof(new_thr->th.th_bar[2].bb.b_go));
4584 KF_TRACE(10, (
"__kmp_allocate_thread: before th_serial/serial_team\n"));
4585 new_thr->th.th_serial_team = serial_team =
4593 serial_team->
t.t_serialized = 0;
4595 serial_team->
t.t_threads[0] = new_thr;
4597 (
"__kmp_allocate_thread: after th_serial/serial_team : new_thr=%p\n",
4604 __kmp_initialize_fast_memory(new_thr);
4616 (
"__kmp_allocate_thread: T#%d init go fork=%u, plain=%u\n",
4623 balign[
b].
bb.team = NULL;
4625 balign[
b].
bb.use_oncore_barrier = 0;
4628 TCW_PTR(new_thr->th.th_sleep_loc, NULL);
4631 new_thr->th.th_spin_here =
FALSE;
4632 new_thr->th.th_next_waiting = 0;
4634 new_thr->th.th_blocking =
false;
4637#if KMP_AFFINITY_SUPPORTED
4638 new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
4639 new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
4640 new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
4641 new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
4644 new_thr->th.th_prev_level = 0;
4645 new_thr->th.th_prev_num_threads = 1;
4648 new_thr->th.th_active_in_pool =
FALSE;
4651 new_thr->th.th_set_nested_nth = NULL;
4652 new_thr->th.th_set_nested_nth_sz = 0;
4672#ifdef KMP_ADJUST_BLOCKTIME
4677 __kmp_zero_bt =
TRUE;
4682#if KMP_AFFINITY_SUPPORTED
4684 __kmp_affinity_set_init_mask(new_gtid,
FALSE);
4689 10, (
"__kmp_allocate_thread: before __kmp_create_worker: %p\n", new_thr));
4692 (
"__kmp_allocate_thread: after __kmp_create_worker: %p\n", new_thr));
4708 KF_TRACE(10, (
"__kmp_reinitialize_team: enter this_thread=%p team=%p\n",
4709 team->
t.t_threads[0], team));
4717 copy_icvs(&team->
t.t_implicit_task_taskdata[0].td_icvs, new_icvs);
4719 KF_TRACE(10, (
"__kmp_reinitialize_team: exit this_thread=%p team=%p\n",
4720 team->
t.t_threads[0], team));
4729 KF_TRACE(10, (
"__kmp_initialize_team: enter: team=%p\n", team));
4737 team->
t.t_master_tid = 0;
4739 team->
t.t_serialized = new_nproc > 1 ? 0 : 1;
4740 team->
t.t_nproc = new_nproc;
4743 team->
t.t_next_pool = NULL;
4748 team->
t.t_invoke = NULL;
4753#if KMP_ARCH_X86 || KMP_ARCH_X86_64
4754 team->
t.t_fp_control_saved =
FALSE;
4755 team->
t.t_x87_fpu_control_word = 0;
4756 team->
t.t_mxcsr = 0;
4759 team->
t.t_construct = 0;
4761 team->
t.t_ordered.dt.t_value = 0;
4762 team->
t.t_master_active =
FALSE;
4765 team->
t.t_copypriv_data = NULL;
4768 team->
t.t_copyin_counter = 0;
4771 team->
t.t_control_stack_top = NULL;
4776 KF_TRACE(10, (
"__kmp_initialize_team: exit: team=%p\n", team));
4779#if KMP_AFFINITY_SUPPORTED
4781 int first,
int last,
int newp) {
4782 th->th.th_first_place = first;
4783 th->th.th_last_place = last;
4784 th->th.th_new_place = newp;
4785 if (newp != th->th.th_current_place) {
4787 team->
t.t_display_affinity = 1;
4789 th->th.th_topology_ids = __kmp_affinity.ids[th->th.th_new_place];
4790 th->th.th_topology_attrs = __kmp_affinity.attrs[th->th.th_new_place];
4798static void __kmp_partition_places(
kmp_team_t *team,
int update_master_only) {
4806 int first_place = master_th->th.th_first_place;
4807 int last_place = master_th->th.th_last_place;
4808 int masters_place = master_th->th.th_current_place;
4809 int num_masks = __kmp_affinity.num_masks;
4810 team->
t.t_first_place = first_place;
4811 team->
t.t_last_place = last_place;
4813 KA_TRACE(20, (
"__kmp_partition_places: enter: proc_bind = %d T#%d(%d:0) "
4814 "bound to place %d partition = [%d,%d]\n",
4816 team->
t.t_id, masters_place, first_place, last_place));
4818 switch (proc_bind) {
4828 int n_th = team->
t.t_nproc;
4829 for (
f = 1;
f < n_th;
f++) {
4832 __kmp_set_thread_place(team, th, first_place, last_place, masters_place);
4834 KA_TRACE(100, (
"__kmp_partition_places: primary: T#%d(%d:%d) place %d "
4835 "partition = [%d,%d]\n",
4837 f, masters_place, first_place, last_place));
4843 int n_th = team->
t.t_nproc;
4845 if (first_place <= last_place) {
4846 n_places = last_place - first_place + 1;
4848 n_places = num_masks - first_place + last_place + 1;
4850 if (n_th <= n_places) {
4851 int place = masters_place;
4852 for (
f = 1;
f < n_th;
f++) {
4856 if (place == last_place) {
4857 place = first_place;
4858 }
else if (place == (num_masks - 1)) {
4863 __kmp_set_thread_place(team, th, first_place, last_place, place);
4865 KA_TRACE(100, (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4866 "partition = [%d,%d]\n",
4868 team->
t.t_id,
f, place, first_place, last_place));
4871 int S, rem, gap, s_count;
4872 S = n_th / n_places;
4874 rem = n_th - (
S * n_places);
4875 gap = rem > 0 ? n_places / rem : n_places;
4876 int place = masters_place;
4878 for (
f = 0;
f < n_th;
f++) {
4882 __kmp_set_thread_place(team, th, first_place, last_place, place);
4885 if ((s_count ==
S) && rem && (gap_ct == gap)) {
4887 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
4889 if (place == last_place) {
4890 place = first_place;
4891 }
else if (place == (num_masks - 1)) {
4899 }
else if (s_count ==
S) {
4900 if (place == last_place) {
4901 place = first_place;
4902 }
else if (place == (num_masks - 1)) {
4912 (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4913 "partition = [%d,%d]\n",
4915 th->th.th_new_place, first_place, last_place));
4923 int n_th = team->
t.t_nproc;
4926 if (first_place <= last_place) {
4927 n_places = last_place - first_place + 1;
4929 n_places = num_masks - first_place + last_place + 1;
4931 if (n_th <= n_places) {
4934 if (n_places != num_masks) {
4935 int S = n_places / n_th;
4936 int s_count, rem, gap, gap_ct;
4938 place = masters_place;
4939 rem = n_places - n_th *
S;
4940 gap = rem ? n_th / rem : 1;
4943 if (update_master_only == 1)
4945 for (
f = 0;
f < thidx;
f++) {
4949 int fplace = place, nplace = place;
4951 while (s_count <
S) {
4952 if (place == last_place) {
4953 place = first_place;
4954 }
else if (place == (num_masks - 1)) {
4961 if (rem && (gap_ct == gap)) {
4962 if (place == last_place) {
4963 place = first_place;
4964 }
else if (place == (num_masks - 1)) {
4972 __kmp_set_thread_place(team, th, fplace, place, nplace);
4975 if (place == last_place) {
4976 place = first_place;
4977 }
else if (place == (num_masks - 1)) {
4984 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
4985 "partition = [%d,%d], num_masks: %u\n",
4987 f, th->th.th_new_place, th->th.th_first_place,
4988 th->th.th_last_place, num_masks));
4994 double current =
static_cast<double>(masters_place);
4996 (
static_cast<double>(n_places + 1) /
static_cast<double>(n_th));
5001 if (update_master_only == 1)
5003 for (
f = 0;
f < thidx;
f++) {
5004 first =
static_cast<int>(current);
5005 last =
static_cast<int>(current + spacing) - 1;
5007 if (first >= n_places) {
5008 if (masters_place) {
5011 if (first == (masters_place + 1)) {
5015 if (last == masters_place) {
5025 if (last >= n_places) {
5026 last = (n_places - 1);
5036 th = team->
t.t_threads[
f];
5038 __kmp_set_thread_place(team, th, first, last, place);
5040 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5041 "partition = [%d,%d], spacing = %.4f\n",
5043 team->
t.t_id,
f, th->th.th_new_place,
5044 th->th.th_first_place, th->th.th_last_place, spacing));
5050 int S, rem, gap, s_count;
5051 S = n_th / n_places;
5053 rem = n_th - (
S * n_places);
5054 gap = rem > 0 ? n_places / rem : n_places;
5055 int place = masters_place;
5058 if (update_master_only == 1)
5060 for (
f = 0;
f < thidx;
f++) {
5064 __kmp_set_thread_place(team, th, place, place, place);
5067 if ((s_count ==
S) && rem && (gap_ct == gap)) {
5069 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
5071 if (place == last_place) {
5072 place = first_place;
5073 }
else if (place == (num_masks - 1)) {
5081 }
else if (s_count ==
S) {
5082 if (place == last_place) {
5083 place = first_place;
5084 }
else if (place == (num_masks - 1)) {
5093 KA_TRACE(100, (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5094 "partition = [%d,%d]\n",
5096 team->
t.t_id,
f, th->th.th_new_place,
5097 th->th.th_first_place, th->th.th_last_place));
5107 KA_TRACE(20, (
"__kmp_partition_places: exit T#%d\n", team->
t.t_id));
5116 ompt_data_t ompt_parallel_data,
5124 int use_hot_team = !root->r.r_active;
5126 int do_place_partition = 1;
5128 KA_TRACE(20, (
"__kmp_allocate_team: called\n"));
5135 team = master->th.th_team;
5136 level = team->
t.t_active_level;
5137 if (master->th.th_teams_microtask) {
5138 if (master->th.th_teams_size.nteams > 1 &&
5142 master->th.th_teams_level <
5149 if ((master->th.th_teams_size.nteams == 1 &&
5150 master->th.th_teams_level >= team->
t.t_level) ||
5152 do_place_partition = 0;
5154 hot_teams = master->th.th_hot_teams;
5156 hot_teams[
level].hot_team) {
5167 if (use_hot_team && new_nproc > 1) {
5172 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5173 "task_team[1] = %p before reinit\n",
5174 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5178 if (team->
t.t_nproc != new_nproc &&
5181 int old_nthr = team->
t.t_nproc;
5187 if (do_place_partition == 0)
5192 if (team->
t.t_nproc == new_nproc) {
5193 KA_TRACE(20, (
"__kmp_allocate_team: reusing hot team\n"));
5196 if (team->
t.t_size_changed == -1) {
5197 team->
t.t_size_changed = 1;
5208 root->r.r_uber_thread->th.th_ident);
5210 KF_TRACE(10, (
"__kmp_allocate_team2: T#%d, this_thread=%p team=%p\n", 0,
5211 team->
t.t_threads[0], team));
5214#if KMP_AFFINITY_SUPPORTED
5215 if ((team->
t.t_size_changed == 0) &&
5216 (team->
t.t_proc_bind == new_proc_bind)) {
5218 if (do_place_partition) {
5220 __kmp_partition_places(team, 1);
5223 KA_TRACE(200, (
"__kmp_allocate_team: reusing hot team #%d bindings: "
5224 "proc_bind = %d, partition = [%d,%d]\n",
5225 team->
t.t_id, new_proc_bind, team->
t.t_first_place,
5226 team->
t.t_last_place));
5228 if (do_place_partition) {
5230 __kmp_partition_places(team);
5236 }
else if (team->
t.t_nproc > new_nproc) {
5238 (
"__kmp_allocate_team: decreasing hot team thread count to %d\n",
5241 team->
t.t_size_changed = 1;
5250 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5253 th->th.th_task_team = NULL;
5262 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5265 team->
t.t_threads[
f] = NULL;
5271 for (
f = new_nproc;
f < team->
t.t_nproc; ++
f) {
5282 team->
t.t_nproc = new_nproc;
5286 root->r.r_uber_thread->th.th_ident);
5289 for (
f = 0;
f < new_nproc; ++
f) {
5290 team->
t.t_threads[
f]->th.th_team_nproc = new_nproc;
5295 KF_TRACE(10, (
"__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
5296 team->
t.t_threads[0], team));
5301 for (
f = 0;
f < team->
t.t_nproc;
f++) {
5303 team->
t.t_threads[
f]->th.th_team_nproc ==
5308 if (do_place_partition) {
5310#if KMP_AFFINITY_SUPPORTED
5311 __kmp_partition_places(team);
5317 (
"__kmp_allocate_team: increasing hot team thread count to %d\n",
5319 int old_nproc = team->
t.t_nproc;
5320 team->
t.t_size_changed = 1;
5323 if (new_nproc < avail_threads)
5324 avail_threads = new_nproc;
5326 for (
f = team->
t.t_nproc;
f < avail_threads; ++
f) {
5332 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5335 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5339 if (hot_teams[
level].hot_team_nth >= new_nproc) {
5343 team->
t.t_nproc = new_nproc;
5349 if (team->
t.t_max_nproc < new_nproc) {
5355#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5356 KMP_AFFINITY_SUPPORTED
5362 kmp_affinity_raii_t new_temp_affinity{__kmp_affin_fullMask};
5366 for (
f = team->
t.t_nproc;
f < new_nproc;
f++) {
5369 team->
t.t_threads[
f] = new_worker;
5372 (
"__kmp_allocate_team: team %d init T#%d arrived: "
5373 "join=%llu, plain=%llu\n",
5382 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5386 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5392#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5393 KMP_AFFINITY_SUPPORTED
5395 new_temp_affinity.restore();
5406 root->r.r_uber_thread->th.th_ident);
5410 for (
f = 0;
f < team->
t.t_nproc; ++
f)
5415 kmp_uint8 old_state = team->
t.t_threads[old_nproc - 1]->th.th_task_state;
5416 for (
f = old_nproc;
f < team->
t.t_nproc; ++
f)
5417 team->
t.t_threads[
f]->th.th_task_state = old_state;
5420 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5422 team->
t.t_threads[
f]->th.th_team_nproc ==
5427 if (do_place_partition) {
5429#if KMP_AFFINITY_SUPPORTED
5430 __kmp_partition_places(team);
5435 if (master->th.th_teams_microtask) {
5436 for (
f = 1;
f < new_nproc; ++
f) {
5439 thr->th.th_teams_microtask = master->th.th_teams_microtask;
5440 thr->th.th_teams_level = master->th.th_teams_level;
5441 thr->th.th_teams_size = master->th.th_teams_size;
5447 for (
f = 1;
f < new_nproc; ++
f) {
5452 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5455 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5467 KF_TRACE(10, (
" hot_team = %p\n", team));
5471 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5472 "task_team[1] = %p after reinit\n",
5473 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5491 if (team->
t.t_max_nproc >= max_nproc) {
5495 if (max_nproc > 1 &&
5505 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and "
5506 "task_team[1] %p to NULL\n",
5507 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5508 team->
t.t_task_team[0] = NULL;
5509 team->
t.t_task_team[1] = NULL;
5516 20, (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5523 team->
t.t_bar[
b].b_master_arrived = 0;
5524 team->
t.t_bar[
b].b_team_arrived = 0;
5529 team->
t.t_proc_bind = new_proc_bind;
5531 KA_TRACE(20, (
"__kmp_allocate_team: using team from pool %d.\n",
5538 team->
t.t_nested_nth = NULL;
5558 team->
t.t_max_nproc = max_nproc;
5559 if (max_nproc > 1 &&
5569 KA_TRACE(20, (
"__kmp_allocate_team: making a new team\n"));
5572 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and task_team[1] "
5574 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5575 team->
t.t_task_team[0] = NULL;
5577 team->
t.t_task_team[1] = NULL;
5586 team->
t.t_argc = argc;
5589 (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5596 team->
t.t_bar[
b].b_master_arrived = 0;
5597 team->
t.t_bar[
b].b_team_arrived = 0;
5602 team->
t.t_proc_bind = new_proc_bind;
5606 team->
t.ompt_serialized_team_info = NULL;
5611 team->
t.t_nested_nth = NULL;
5613 KA_TRACE(20, (
"__kmp_allocate_team: done creating a new team %d.\n",
5635 int use_hot_team = team == root->r.r_hot_team;
5638 level = team->
t.t_active_level - 1;
5639 if (master->th.th_teams_microtask) {
5640 if (master->th.th_teams_size.nteams > 1) {
5645 master->th.th_teams_level == team->
t.t_level) {
5663 team->
t.t_copyin_counter = 0;
5668 if (!use_hot_team) {
5671 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5674 volatile kmp_uint32 *state = &th->th.th_reap_state;
5685 if (th->th.th_sleep_loc)
5693 for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
5695 if (task_team != NULL) {
5696 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5698 team->
t.t_threads[
f]->th.th_task_team = NULL;
5702 (
"__kmp_free_team: T#%d deactivating task_team %p on team %d\n",
5705 team->
t.t_task_team[tt_idx] = NULL;
5712 team->
t.t_nested_nth != team->
t.t_parent->t.t_nested_nth) {
5716 team->
t.t_nested_nth = NULL;
5719 team->
t.t_parent = NULL;
5720 team->
t.t_level = 0;
5721 team->
t.t_active_level = 0;
5724 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5728 &(team->
t.t_threads[
f]->th.th_used_in_team), 1, 2);
5736 team->
t.b->go_release();
5738 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5739 if (team->
t.b->sleep[
f].sleep) {
5741 team->
t.t_threads[
f]->th.th_info.ds.ds_gtid,
5747 for (
int f = 1;
f < team->
t.t_nproc; ++
f) {
5748 while (team->
t.t_threads[
f]->th.th_used_in_team.load() != 0)
5754 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5755 team->
t.t_threads[
f] = NULL;
5758 if (team->
t.t_max_nproc > 1 &&
5770 team->
t.t_threads[1]->th.th_cg_roots);
5771 if (team->
t.t_threads[1]->th.th_cg_roots->cg_root == team->
t.t_threads[1]) {
5773 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5776 thr->th.th_cg_roots->cg_root == thr);
5779 thr->th.th_cg_roots = tmp->
up;
5780 KA_TRACE(100, (
"__kmp_free_team: Thread %p popping node %p and moving"
5781 " up to node %p. cg_nthreads was %d\n",
5782 thr, tmp, thr->th.th_cg_roots, tmp->
cg_nthreads));
5788 if (thr->th.th_cg_roots)
5789 thr->th.th_current_task->td_icvs.thread_limit =
5790 thr->th.th_cg_roots->cg_thread_limit;
5812 if (team->
t.t_argv != &team->
t.t_inline_argv[0])
5849 KA_TRACE(20, (
"__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
5861 balign[
b].
bb.team = NULL;
5862 balign[
b].
bb.leaf_kids = 0;
5864 this_th->th.th_task_state = 0;
5868 TCW_PTR(this_th->th.th_team, NULL);
5869 TCW_PTR(this_th->th.th_root, NULL);
5870 TCW_PTR(this_th->th.th_dispatch, NULL);
5872 while (this_th->th.th_cg_roots) {
5873 this_th->th.th_cg_roots->cg_nthreads--;
5874 KA_TRACE(100, (
"__kmp_free_thread: Thread %p decrement cg_nthreads on node"
5875 " %p of thread %p to %d\n",
5876 this_th, this_th->th.th_cg_roots,
5877 this_th->th.th_cg_roots->cg_root,
5878 this_th->th.th_cg_roots->cg_nthreads));
5880 if (tmp->
cg_root == this_th) {
5883 5, (
"__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
5884 this_th->th.th_cg_roots = tmp->
up;
5890 this_th->th.th_cg_roots = NULL;
5901 this_th->th.th_current_task = NULL;
5905 gtid = this_th->th.th_info.ds.ds_gtid;
5923 for (; (*scan != NULL) && ((*scan)->th.th_info.ds.ds_gtid < gtid);
5924 scan = &((*scan)->th.th_next_pool))
5929 TCW_PTR(this_th->th.th_next_pool, *scan);
5932 (this_th->th.th_info.ds.ds_gtid <
5933 this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
5937 if (this_th->th.th_active ==
TRUE) {
5939 this_th->th.th_active_in_pool =
TRUE;
5950#ifdef KMP_ADJUST_BLOCKTIME
5956 __kmp_zero_bt =
FALSE;
5967#if OMP_PROFILING_SUPPORT
5968 ProfileTraceFile = getenv(
"LIBOMPTARGET_PROFILE");
5970 if (ProfileTraceFile)
5971 llvm::timeTraceProfilerInitialize(500 ,
"libomptarget");
5974 int gtid = this_thr->th.th_info.ds.ds_gtid;
5979 KA_TRACE(10, (
"__kmp_launch_thread: T#%d start\n", gtid));
5986 if (ompd_state & OMPD_ENABLE_BP)
5987 ompd_bp_thread_begin();
5991 ompt_data_t *thread_data =
nullptr;
5993 thread_data = &(this_thr->th.ompt_thread_info.thread_data);
5994 *thread_data = ompt_data_none;
5996 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
5997 this_thr->th.ompt_thread_info.wait_id = 0;
5999 this_thr->th.ompt_thread_info.parallel_flags = 0;
6002 ompt_thread_worker, thread_data);
6004 this_thr->th.ompt_thread_info.state = ompt_state_idle;
6014 KA_TRACE(20, (
"__kmp_launch_thread: T#%d waiting for work\n", gtid));
6021 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6025 pteam = &this_thr->th.th_team;
6033 (
"__kmp_launch_thread: T#%d(%d:%d) invoke microtask = %p\n",
6035 (*pteam)->t.t_pkfn));
6041 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
6045 rc = (*pteam)->t.t_invoke(gtid);
6049 KA_TRACE(20, (
"__kmp_launch_thread: T#%d(%d:%d) done microtask = %p\n",
6051 (*pteam)->t.t_pkfn));
6058 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6067 if (ompd_state & OMPD_ENABLE_BP)
6068 ompd_bp_thread_end();
6073 ompt_callbacks.ompt_callback(ompt_callback_thread_end)(thread_data);
6077 this_thr->th.th_task_team = NULL;
6081 KA_TRACE(10, (
"__kmp_launch_thread: T#%d done\n", gtid));
6084#if OMP_PROFILING_SUPPORT
6085 llvm::timeTraceProfilerFinishThread();
6097 KA_TRACE(30, (
"__kmp_internal_end_dest: T#%d\n", gtid));
6104#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
6115 KA_TRACE(30, (
"__kmp_internal_end_atexit\n"));
6152 gtid = thread->th.th_info.ds.ds_gtid;
6158 20, (
"__kmp_reap_thread: releasing T#%d from fork barrier for reap\n",
6187 if (thread->th.th_active_in_pool) {
6188 thread->th.th_active_in_pool =
FALSE;
6198 __kmp_free_fast_memory(thread);
6209#ifdef KMP_ADJUST_BLOCKTIME
6215 __kmp_zero_bt =
FALSE;
6222 if (thread->th.th_cons) {
6224 thread->th.th_cons = NULL;
6228 if (thread->th.th_pri_common != NULL) {
6230 thread->th.th_pri_common = NULL;
6234 if (thread->th.th_local.bget_data != NULL) {
6239#if KMP_AFFINITY_SUPPORTED
6240 if (thread->th.th_affin_mask != NULL) {
6241 KMP_CPU_FREE(thread->th.th_affin_mask);
6242 thread->th.th_affin_mask = NULL;
6246#if KMP_USE_HIER_SCHED
6247 if (thread->th.th_hier_bar_data != NULL) {
6249 thread->th.th_hier_bar_data = NULL;
6254 thread->th.th_serial_team = NULL;
6263 if (__kmp_itt_region_domains.count > 0) {
6264 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6265 kmp_itthash_entry_t *bucket = __kmp_itt_region_domains.buckets[
i];
6267 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6273 if (__kmp_itt_barrier_domains.count > 0) {
6274 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6275 kmp_itthash_entry_t *bucket = __kmp_itt_barrier_domains.buckets[
i];
6277 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6297 __kmp_reclaim_dead_roots();
6321 if (
TCR_4(__kmp_init_monitor)) {
6323 TCW_4(__kmp_init_monitor, 0);
6326 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6351 thread->th.th_next_pool = NULL;
6352 thread->th.th_in_pool =
FALSE;
6363 team->
t.t_next_pool = NULL;
6390 KA_TRACE(10, (
"__kmp_internal_end: all workers reaped\n"));
6399 if (
TCR_4(__kmp_init_monitor)) {
6401 TCW_4(__kmp_init_monitor, 0);
6404 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6424 KA_TRACE(11, (
"__kmp_internal_end_library: abort, exiting\n"));
6429 KA_TRACE(10, (
"__kmp_internal_end_library: already finished\n"));
6448 10, (
"__kmp_internal_end_library: enter T#%d (%d)\n", gtid, gtid_req));
6450 KA_TRACE(10, (
"__kmp_internal_end_library: !__kmp_init_runtime, system "
6451 "already shutdown\n"));
6454 KA_TRACE(10, (
"__kmp_internal_end_library: monitor thread, gtid not "
6455 "registered, or system shutdown\n"));
6458 KA_TRACE(10, (
"__kmp_internal_end_library: gtid not registered or system "
6468 (
"__kmp_internal_end_library: root still active, abort T#%d\n",
6475 (
"__kmp_internal_end_library: unregistering sibling T#%d\n", gtid));
6483#ifdef DUMP_DEBUG_ON_EXIT
6499 KA_TRACE(10, (
"__kmp_internal_end_library: abort, exiting\n"));
6522 KA_TRACE(10, (
"__kmp_internal_end_library: exit\n"));
6524#ifdef DUMP_DEBUG_ON_EXIT
6547 KA_TRACE(11, (
"__kmp_internal_end_thread: abort, exiting\n"));
6552 KA_TRACE(10, (
"__kmp_internal_end_thread: already finished\n"));
6572 (
"__kmp_internal_end_thread: enter T#%d (%d)\n", gtid, gtid_req));
6574 KA_TRACE(10, (
"__kmp_internal_end_thread: !__kmp_init_runtime, system "
6575 "already shutdown\n"));
6578 KA_TRACE(10, (
"__kmp_internal_end_thread: monitor thread, gtid not "
6579 "registered, or system shutdown\n"));
6582 KA_TRACE(10, (
"__kmp_internal_end_thread: gtid not registered or system "
6592 (
"__kmp_internal_end_thread: root still active, abort T#%d\n",
6596 KA_TRACE(10, (
"__kmp_internal_end_thread: unregistering sibling T#%d\n",
6602 KA_TRACE(10, (
"__kmp_internal_end_thread: worker thread T#%d\n", gtid));
6609 (
"__kmp_internal_end_thread: worker thread done, exiting T#%d\n",
6619 KA_TRACE(10, (
"__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
6628 KA_TRACE(10, (
"__kmp_internal_end_thread: abort, exiting\n"));
6651 (
"__kmp_internal_end_thread: remaining sibling task: gtid==%d\n",
i));
6665 KA_TRACE(10, (
"__kmp_internal_end_thread: exit T#%d\n", gtid_req));
6667#ifdef DUMP_DEBUG_ON_EXIT
6687#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
6695#if defined(KMP_USE_SHM)
6696bool __kmp_shm_available =
false;
6697bool __kmp_tmp_available =
false;
6699char *temp_reg_status_file_name =
nullptr;
6710#if KMP_ARCH_X86 || KMP_ARCH_X86_64
6719 KA_TRACE(50, (
"__kmp_register_library_startup: %s=\"%s\"\n",
name,
6726#if defined(KMP_USE_SHM)
6727 char *shm_name =
nullptr;
6728 char *data1 =
nullptr;
6730 if (__kmp_shm_available) {
6733 int shm_preexist = 0;
6734 fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6735 if ((fd1 == -1) && (errno == EEXIST)) {
6738 fd1 = shm_open(shm_name, O_RDWR, 0600);
6741 __kmp_shm_available =
false;
6746 if (__kmp_shm_available && shm_preexist == 0) {
6747 if (ftruncate(fd1, SHM_SIZE) == -1) {
6748 KMP_WARNING(FunctionError,
"Can't set size of SHM");
6749 __kmp_shm_available =
false;
6752 if (__kmp_shm_available) {
6753 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6755 if (data1 == MAP_FAILED) {
6757 __kmp_shm_available =
false;
6760 if (__kmp_shm_available) {
6761 if (shm_preexist == 0) {
6766 munmap(data1, SHM_SIZE);
6771 if (!__kmp_shm_available)
6773 if (!__kmp_shm_available && __kmp_tmp_available) {
6781 int tmp_preexist = 0;
6782 fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6783 if ((fd1 == -1) && (errno == EEXIST)) {
6786 fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
6789 __kmp_tmp_available =
false;
6794 if (__kmp_tmp_available && tmp_preexist == 0) {
6796 if (ftruncate(fd1, SHM_SIZE) == -1) {
6797 KMP_WARNING(FunctionError,
"Can't set size of /tmp file");
6798 __kmp_tmp_available =
false;
6801 if (__kmp_tmp_available) {
6802 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6804 if (data1 == MAP_FAILED) {
6806 __kmp_tmp_available =
false;
6809 if (__kmp_tmp_available) {
6810 if (tmp_preexist == 0) {
6815 munmap(data1, SHM_SIZE);
6820 if (!__kmp_shm_available && !__kmp_tmp_available) {
6841 char *flag_addr_str = NULL;
6842 char *flag_val_str = NULL;
6843 char const *file_name = NULL;
6848 unsigned long *flag_addr = 0;
6849 unsigned long flag_val = 0;
6852 if (flag_addr != 0 && flag_val != 0 && strcmp(file_name,
"") != 0) {
6870 file_name =
"unknown library";
6887#if defined(KMP_USE_SHM)
6888 if (__kmp_shm_available) {
6889 shm_unlink(shm_name);
6890 }
else if (__kmp_tmp_available) {
6891 unlink(temp_reg_status_file_name);
6907#if defined(KMP_USE_SHM)
6925 if (reg_str == NULL ||
6933#if defined(KMP_USE_SHM)
6934 char *shm_name =
nullptr;
6936 if (__kmp_shm_available) {
6938 fd1 = shm_open(shm_name, O_RDONLY, 0600);
6940 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6941 if (data1 != MAP_FAILED) {
6943 munmap(data1, SHM_SIZE);
6947 }
else if (__kmp_tmp_available) {
6948 fd1 = open(temp_reg_status_file_name, O_RDONLY);
6950 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6951 if (data1 != MAP_FAILED) {
6953 munmap(data1, SHM_SIZE);
6964 if (
value != NULL && strcmp(
value, reg_str) == 0) {
6966#if defined(KMP_USE_SHM)
6967 if (__kmp_shm_available) {
6968 shm_unlink(shm_name);
6969 }
else if (__kmp_tmp_available) {
6970 unlink(temp_reg_status_file_name);
6979#if defined(KMP_USE_SHM)
6982 if (temp_reg_status_file_name)
6995#if KMP_MIC_SUPPORTED
6997static void __kmp_check_mic_type() {
6998 kmp_cpuid_t cpuid_state = {0};
6999 kmp_cpuid_t *cs_p = &cpuid_state;
7000 __kmp_x86_cpuid(1, 0, cs_p);
7002 if ((cs_p->eax & 0xff0) == 0xB10) {
7003 __kmp_mic_type = mic2;
7004 }
else if ((cs_p->eax & 0xf0ff0) == 0x50670) {
7005 __kmp_mic_type = mic3;
7007 __kmp_mic_type = non_mic;
7014static void __kmp_user_level_mwait_init() {
7015 struct kmp_cpuid
buf;
7016 __kmp_x86_cpuid(7, 0, &
buf);
7017 __kmp_waitpkg_enabled = ((
buf.ecx >> 5) & 1);
7018 __kmp_umwait_enabled = __kmp_waitpkg_enabled && __kmp_user_level_mwait;
7019 __kmp_tpause_enabled = __kmp_waitpkg_enabled && (__kmp_tpause_state > 0);
7020 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_umwait_enabled = %d\n",
7021 __kmp_umwait_enabled));
7024#ifndef AT_INTELPHIUSERMWAIT
7027#define AT_INTELPHIUSERMWAIT 10000
7033unsigned long getauxval(
unsigned long) {
return 0; }
7035static void __kmp_user_level_mwait_init() {
7040 if (__kmp_mic_type == mic3) {
7041 unsigned long res = getauxval(AT_INTELPHIUSERMWAIT);
7042 if ((
res & 0x1) || __kmp_user_level_mwait) {
7043 __kmp_mwait_enabled =
TRUE;
7044 if (__kmp_user_level_mwait) {
7048 __kmp_mwait_enabled =
FALSE;
7051 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_mic_type = %d, "
7052 "__kmp_mwait_enabled = %d\n",
7053 __kmp_mic_type, __kmp_mwait_enabled));
7061 KA_TRACE(10, (
"__kmp_do_serial_initialize: enter\n"));
7079#if ENABLE_LIBOMPTARGET
7081 __kmp_init_omptarget();
7096 KA_TRACE(10, (
"__kmp_do_serial_initialize: reinitialization of library\n"));
7103#if KMP_USE_ADAPTIVE_LOCKS
7104#if KMP_DEBUG_ADAPTIVE_LOCKS
7105 __kmp_init_speculative_stats();
7108#if KMP_STATS_ENABLED
7136#if KMP_MIC_SUPPORTED
7137 __kmp_check_mic_type();
7139#if ENABLE_LIBOMPTARGET
7140 __kmp_target_init();
7169 __kmp_monitor_wakeups =
7171 __kmp_bt_intervals =
7184#if KMP_FAST_REDUCTION_BARRIER
7185#define kmp_reduction_barrier_gather_bb ((int)1)
7186#define kmp_reduction_barrier_release_bb ((int)1)
7187#define kmp_reduction_barrier_gather_pat __kmp_barrier_gather_pat_dflt
7188#define kmp_reduction_barrier_release_pat __kmp_barrier_release_pat_dflt
7195#if KMP_FAST_REDUCTION_BARRIER
7205#if KMP_FAST_REDUCTION_BARRIER
7206#undef kmp_reduction_barrier_release_pat
7207#undef kmp_reduction_barrier_gather_pat
7208#undef kmp_reduction_barrier_release_bb
7209#undef kmp_reduction_barrier_gather_bb
7211#if KMP_MIC_SUPPORTED
7212 if (__kmp_mic_type == mic2) {
7220#if KMP_FAST_REDUCTION_BARRIER
7221 if (__kmp_mic_type == mic2) {
7245#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
7246 __kmp_user_level_mwait_init();
7297 KA_TRACE(10, (
"__kmp_do_serial_initialize T#%d\n", gtid));
7310#if !KMP_DYNAMIC_LIB || \
7311 ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
7324#if KMP_HANDLE_SIGNALS
7330 __kmp_install_signals(
FALSE);
7333 __kmp_install_signals(
TRUE);
7360 KA_TRACE(10, (
"__kmp_do_serial_initialize: exit\n"));
7378 int prev_dflt_team_nth;
7384 KA_TRACE(10, (
"__kmp_middle_initialize: enter\n"));
7396#if KMP_AFFINITY_SUPPORTED
7399 __kmp_affinity_initialize(__kmp_affinity);
7418#ifdef KMP_DFLT_NTH_CORES
7421 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7422 "__kmp_ncores (%d)\n",
7427 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7428 "__kmp_avail_proc(%d)\n",
7456 if (thread->th.th_current_task->td_icvs.nproc != 0)
7464 (
"__kmp_middle_initialize: final value for __kmp_dflt_team_nth = %d\n",
7467#ifdef KMP_ADJUST_BLOCKTIME
7472 __kmp_zero_bt =
TRUE;
7480 KA_TRACE(10, (
"__kmp_do_middle_initialize: exit\n"));
7512 (
"__kmp_parallel_initialize: attempt to init while shutting down\n"));
7526 KA_TRACE(10, (
"__kmp_parallel_initialize: enter\n"));
7529#if KMP_ARCH_X86 || KMP_ARCH_X86_64
7532 __kmp_store_x87_fpu_control_word(&__kmp_init_x87_fpu_control_word);
7533 __kmp_store_mxcsr(&__kmp_init_mxcsr);
7534 __kmp_init_mxcsr &= KMP_X86_MXCSR_MASK;
7538#if KMP_HANDLE_SIGNALS
7540 __kmp_install_signals(
TRUE);
7546#if defined(USE_LOAD_BALANCE)
7564 KA_TRACE(10, (
"__kmp_parallel_initialize: exit\n"));
7585#if KMP_AFFINITY_SUPPORTED
7589 if (!__kmp_hh_affinity.flags.initialized)
7590 __kmp_affinity_initialize(__kmp_hh_affinity);
7621 this_thr->th.th_local.this_construct = 0;
7655 if (__itt_stack_caller_create_ptr) {
7657 if (team->
t.t_stack_id != NULL) {
7658 __kmp_itt_stack_callee_enter((__itt_caller)team->
t.t_stack_id);
7661 __kmp_itt_stack_callee_enter(
7662 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7666#if INCLUDE_SSC_MARKS
7667 SSC_MARK_INVOKING();
7672 void **exit_frame_p;
7673 ompt_data_t *my_task_data;
7674 ompt_data_t *my_parallel_data;
7678 exit_frame_p = &(team->
t.t_implicit_task_taskdata[tid]
7679 .ompt_task_info.frame.exit_frame.ptr);
7681 exit_frame_p = &dummy;
7685 &(team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data);
7686 my_parallel_data = &(team->
t.ompt_team_info.parallel_data);
7688 ompt_team_size = team->
t.t_nproc;
7690 ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
7696#if KMP_STATS_ENABLED
7698 if (previous_state == stats_state_e::TEAMS_REGION) {
7707 tid, (
int)team->
t.t_argc, (
void **)team->
t.t_argv
7714 *exit_frame_p = NULL;
7715 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_team;
7718#if KMP_STATS_ENABLED
7719 if (previous_state == stats_state_e::TEAMS_REGION) {
7726 if (__itt_stack_caller_create_ptr) {
7728 if (team->
t.t_stack_id != NULL) {
7729 __kmp_itt_stack_callee_leave((__itt_caller)team->
t.t_stack_id);
7732 __kmp_itt_stack_callee_leave(
7733 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7747 thr->th.th_set_nproc = thr->th.th_teams_size.nth;
7750 KA_TRACE(20, (
"__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
7759 KA_TRACE(100, (
"__kmp_teams_master: Thread %p created node %p and init"
7760 " cg_nthreads to 1\n",
7762 tmp->
up = thr->th.th_cg_roots;
7763 thr->th.th_cg_roots = tmp;
7767#if INCLUDE_SSC_MARKS
7773#if INCLUDE_SSC_MARKS
7777 if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
7778 thr->th.th_teams_size.nth = thr->th.th_team_nproc;
7801 ompt_data_t *task_data =
7802 &team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data;
7803 ompt_data_t *parallel_data = &team->
t.ompt_team_info.parallel_data;
7806 ompt_scope_begin, parallel_data, task_data, team->
t.t_nproc, tid,
7808 OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid;
7813 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_league;
7826 if (num_threads > 0)
7827 thr->th.th_set_nproc = num_threads;
7831 int *num_threads_list) {
7836 if (num_threads_list[0] > 0)
7837 thr->th.th_set_nproc = num_threads_list[0];
7838 thr->th.th_set_nested_nth =
7841 thr->th.th_set_nested_nth[
i] = num_threads_list[
i];
7842 thr->th.th_set_nested_nth_sz = list_length;
7848 thr->th.th_nt_strict =
true;
7849 thr->th.th_nt_loc =
loc;
7852 thr->th.th_nt_sev = sev;
7857 thr->th.th_nt_msg = msg;
7859 thr->th.th_nt_msg =
"Cannot form team with number of threads specified by "
7860 "strict num_threads clause.";
7873 if (num_threads == 0) {
7885 if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) {
7886 num_threads = thr->th.th_current_task->td_icvs.thread_limit;
7891 if (num_threads == 0) {
7895 if (num_threads < 0) {
7902 thr->th.th_current_task->td_icvs.thread_limit = num_threads;
7909 if (new_threads == 0) {
7912 if (new_threads != num_threads) {
7916 KMP_MSG(CantFormThrTeam, num_threads, new_threads),
7920 num_threads = new_threads;
7923 thr->th.th_teams_size.nth = num_threads;
7931 if (num_teams < 0) {
7938 if (num_teams == 0) {
7956 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
7964 int num_teams_ub,
int num_threads) {
7970 if (num_teams_lb > num_teams_ub) {
7977 if (num_teams_lb == 0 && num_teams_ub > 0)
7978 num_teams_lb = num_teams_ub;
7980 if (num_teams_lb == 0 && num_teams_ub == 0) {
7991 }
else if (num_teams_lb == num_teams_ub) {
7992 num_teams = num_teams_ub;
7994 if (num_threads <= 0) {
7996 num_teams = num_teams_lb;
7998 num_teams = num_teams_ub;
8004 if (num_teams < num_teams_lb) {
8005 num_teams = num_teams_lb;
8006 }
else if (num_teams > num_teams_ub) {
8007 num_teams = num_teams_ub;
8013 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
8021 thr->th.th_set_proc_bind = proc_bind;
8038 team->
t.t_construct = 0;
8039 team->
t.t_ordered.dt.t_value =
8044 if (team->
t.t_max_nproc > 1) {
8047 team->
t.t_disp_buffer[
i].buffer_index =
i;
8048 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
8051 team->
t.t_disp_buffer[0].buffer_index = 0;
8052 team->
t.t_disp_buffer[0].doacross_buf_idx = 0;
8059 for (
f = 0;
f < team->
t.t_nproc;
f++) {
8061 team->
t.t_threads[
f]->th.th_team_nproc == team->
t.t_nproc);
8082 __kmp_printf(
"GTID: %d, __kmp_threads[%d]=%p\n", gtid, gtid,
8084 __kmp_printf(
"__kmp_threads[%d]->th.th_team_nproc=%d, TEAM: %p, "
8085 "team->t.t_nproc=%d\n",
8096 ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
8098 (ompt_state == ompt_state_wait_barrier_teams ||
8099 ompt_state == ompt_state_wait_barrier_implicit_parallel)) {
8100 int ds_tid = this_thr->th.th_info.ds.ds_tid;
8101 ompt_data_t *task_data = OMPT_CUR_TASK_DATA(this_thr);
8102 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
8104 void *codeptr = NULL;
8108 codeptr = OMPT_CUR_TEAM_INFO(this_thr)->master_return_address;
8110 ompt_sync_region_t sync_kind = ompt_sync_region_barrier_implicit_parallel;
8111 if (this_thr->th.ompt_thread_info.parallel_flags & ompt_parallel_league)
8112 sync_kind = ompt_sync_region_barrier_teams;
8115 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8119 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8124 ompt_scope_end, NULL, task_data, 0, ds_tid,
8125 ompt_task_implicit);
8136#ifdef USE_LOAD_BALANCE
8140static int __kmp_active_hot_team_nproc(
kmp_root_t *root) {
8145 if (root->r.r_active) {
8148 hot_team = root->r.r_hot_team;
8150 return hot_team->
t.t_nproc - 1;
8155 for (
i = 1;
i < hot_team->
t.t_nproc;
i++) {
8156 if (hot_team->
t.t_threads[
i]->th.th_active) {
8165static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc) {
8168 int hot_team_active;
8169 int team_curr_active;
8172 KB_TRACE(20, (
"__kmp_load_balance_nproc: called root:%p set_nproc:%d\n", root,
8176 ->th.th_current_task->td_icvs.dynamic ==
TRUE);
8179 if (set_nproc == 1) {
8180 KB_TRACE(20, (
"__kmp_load_balance_nproc: serial execution.\n"));
8190 hot_team_active = __kmp_active_hot_team_nproc(root);
8191 team_curr_active = pool_active + hot_team_active + 1;
8195 KB_TRACE(30, (
"__kmp_load_balance_nproc: system active = %d pool active = %d "
8196 "hot team active = %d\n",
8197 system_active, pool_active, hot_team_active));
8199 if (system_active < 0) {
8204 KMP_WARNING(CantLoadBalUsing,
"KMP_DYNAMIC_MODE=thread limit");
8208 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
8209 if (retval > set_nproc) {
8216 KB_TRACE(20, (
"__kmp_load_balance_nproc: thread limit exit. retval:%d\n",
8224 if (system_active < team_curr_active) {
8225 system_active = team_curr_active;
8228 if (retval > set_nproc) {
8235 KB_TRACE(20, (
"__kmp_load_balance_nproc: exit. retval:%d\n", retval));
8247 KA_TRACE(10, (
"__kmp_cleanup: enter\n"));
8250#if KMP_HANDLE_SIGNALS
8251 __kmp_remove_signals();
8257#if KMP_AFFINITY_SUPPORTED
8258 __kmp_affinity_uninitialize();
8264 KA_TRACE(10, (
"__kmp_cleanup: go serial cleanup\n"));
8296#if KMP_USE_DYNAMIC_LOCK
8297 __kmp_cleanup_indirect_user_locks();
8302 if (ompd_env_block) {
8304 ompd_env_block = NULL;
8305 ompd_env_block_size = 0;
8309#if KMP_AFFINITY_SUPPORTED
8311 __kmp_cpuinfo_file = NULL;
8314#if KMP_USE_ADAPTIVE_LOCKS
8315#if KMP_DEBUG_ADAPTIVE_LOCKS
8316 __kmp_print_speculative_stats();
8342#if KMP_USE_HIER_SCHED
8346#if KMP_STATS_ENABLED
8353 KA_TRACE(10, (
"__kmp_cleanup: exit\n"));
8361 if ((env = getenv(
"KMP_IGNORE_MPPBEG")) != NULL) {
8372 if ((env = getenv(
"KMP_IGNORE_MPPEND")) != NULL) {
8390 if (root->r.r_begin)
8393 if (root->r.r_begin) {
8398 root->r.r_begin =
TRUE;
8415 root = thread->th.th_root;
8417 KA_TRACE(20, (
"__kmp_user_set_library: enter T#%d, arg: %d, %d\n", gtid, arg,
8419 if (root->r.r_in_parallel) {
8427 thread->th.th_set_nproc = 0;
8431 thread->th.th_set_nproc = 0;
8436 thread->th.th_set_nproc = 0;
8452 if (arg & (0x1000 - 1)) {
8453 arg &= ~(0x1000 - 1);
8503 teams_serialized = 0;
8504 if (thr->th.th_teams_microtask) {
8506 int tlevel = thr->th.th_teams_level;
8507 int ii = team->
t.t_level;
8508 teams_serialized = team->
t.t_serialized;
8509 int level = tlevel + 1;
8512 for (teams_serialized = team->
t.t_serialized;
8513 (teams_serialized > 0) && (
ii >
level); teams_serialized--,
ii--) {
8515 if (team->
t.t_serialized && (!teams_serialized)) {
8516 team = team->
t.t_parent;
8520 team = team->
t.t_parent;
8533 if (serialized > 1) {
8536 return team->
t.t_master_tid;
8546 if (serialized > 1) {
8549 return team->
t.t_parent->t.t_nproc;
8596#if KMP_AFFINITY_SUPPORTED
8597 {
'A',
"thread_affinity",
's'},
8599 {
't',
"team_num",
'd'},
8600 {
'T',
"num_teams",
'd'},
8601 {
'L',
"nesting_level",
'd'},
8602 {
'n',
"thread_num",
'd'},
8603 {
'N',
"num_threads",
'd'},
8604 {
'a',
"ancestor_tnum",
'd'},
8606 {
'P',
"process_id",
'd'},
8607 {
'i',
"native_thread_id",
'd'}};
8613 int rc, format_index, field_value;
8614 const char *width_left, *width_right;
8615 bool pad_zeros, right_justify, parse_long_name, found_valid_name;
8616 static const int FORMAT_SIZE = 20;
8617 char format[FORMAT_SIZE] = {0};
8618 char absolute_short_name = 0;
8643 right_justify =
false;
8645 right_justify =
true;
8649 width_left = width_right = NULL;
8650 if (**ptr >=
'0' && **ptr <=
'9') {
8658 format[format_index++] =
'%';
8660 format[format_index++] =
'-';
8662 format[format_index++] =
'0';
8663 if (width_left && width_right) {
8667 while (
i < 8 && width_left < width_right) {
8668 format[format_index++] = *width_left;
8676 found_valid_name =
false;
8677 parse_long_name = (**ptr ==
'{');
8678 if (parse_long_name)
8686 if (parse_long_name) {
8688 if (strncmp(*ptr, long_name,
length) == 0) {
8689 found_valid_name =
true;
8692 }
else if (**ptr == short_name) {
8693 found_valid_name =
true;
8696 if (found_valid_name) {
8697 format[format_index++] = field_format;
8698 format[format_index++] =
'\0';
8699 absolute_short_name = short_name;
8703 if (parse_long_name) {
8705 absolute_short_name = 0;
8713 switch (absolute_short_name) {
8746#if KMP_AFFINITY_SUPPORTED
8748 if (th->th.th_affin_mask) {
8751 __kmp_affinity_str_buf_mask(&
buf, th->th.th_affin_mask);
8764 if (parse_long_name) {
8785 const char *parse_ptr;
8802 if (parse_ptr == NULL || *parse_ptr ==
'\0') {
8807 while (*parse_ptr !=
'\0') {
8809 if (*parse_ptr ==
'%') {
8836 int blocktime = arg;
8855 bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(blocktime, __kmp_monitor_wakeups);
8857 set__bt_intervals_team(thread->th.th_team, tid, bt_intervals);
8858 set__bt_intervals_team(thread->th.th_serial_team, 0, bt_intervals);
8867 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
8868 "bt_intervals=%d, monitor_updates=%d\n",
8870 thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
8871 __kmp_monitor_wakeups));
8873 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d\n",
8875 thread->th.th_team->t.t_id, tid, blocktime));
8896 void *reduce_data,
void (*reduce_func)(
void *lhs_data,
void *rhs_data),
8914#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED \
8916 ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
8917#define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
8923 if (team_size == 1) {
8931#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
8932 KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
8933 KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_WASM32 || KMP_ARCH_WASM64 || \
8936#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8937 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HAIKU || \
8938 KMP_OS_HURD || KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8940 int teamsize_cutoff = 4;
8942#if KMP_MIC_SUPPORTED
8943 if (__kmp_mic_type != non_mic) {
8944 teamsize_cutoff = 8;
8948 if (tree_available) {
8949 if (team_size <= teamsize_cutoff) {
8950 if (atomic_available) {
8954 retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
8956 }
else if (atomic_available) {
8960#error "Unknown or unsupported OS"
8965#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8966 KMP_ARCH_PPC || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC
8968#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8969 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HAIKU || KMP_OS_HURD || \
8970 KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8974 if (atomic_available) {
8975 if (num_vars <= 2) {
8983 if (atomic_available && (num_vars <= 3)) {
8985 }
else if (tree_available) {
8986 if ((reduce_size > (9 *
sizeof(
kmp_real64))) &&
8987 (reduce_size < (2000 *
sizeof(
kmp_real64)))) {
8988 retval = TREE_REDUCE_BLOCK_WITH_PLAIN_BARRIER;
8993#error "Unknown or unsupported OS"
8997#error "Unknown or unsupported architecture"
9010 int atomic_available, tree_available;
9019 if (!atomic_available) {
9027 if (!tree_available) {
9031#if KMP_FAST_REDUCTION_BARRIER
9032 forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
9041 retval = forced_retval;
9044 KA_TRACE(10, (
"reduction method selected=%08x\n", retval));
9046#undef FAST_REDUCTION_TREE_METHOD_GENERATED
9047#undef FAST_REDUCTION_ATOMIC_METHOD_GENERATED
9150 for (
int f = 1;
f < old_nthreads; ++
f) {
9153 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 0) {
9159 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3) {
9160 while (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3)
9166 team->
t.t_threads[
f]->th.th_used_in_team.store(2);
9170 team->
t.b->go_release();
9176 int count = old_nthreads - 1;
9178 count = old_nthreads - 1;
9179 for (
int f = 1;
f < old_nthreads; ++
f) {
9180 if (other_threads[
f]->th.th_used_in_team.load() != 0) {
9183 void *, other_threads[
f]->th.th_sleep_loc);
9193 team->
t.b->update_num_threads(new_nthreads);
9194 team->
t.b->go_reset();
9205 for (
int f = 1;
f < new_nthreads; ++
f) {
9208 &(team->
t.t_threads[
f]->th.th_used_in_team), 0, 3);
9217 int count = new_nthreads - 1;
9219 count = new_nthreads - 1;
9220 for (
int f = 1;
f < new_nthreads; ++
f) {
9221 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 1) {
9241std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;
9243void __kmp_hidden_helper_wrapper_fn(
int *gtid,
int *, ...) {
9260 for (
int i = 1;
i < __kmp_hit_hidden_helper_threads_num; ++
i) {
9306 for (
int i = 0;
i < levels; ++
i)
9328 loc++, hw_level++) {
9337 int upper_levels = 1;
9371#if ENABLE_LIBOMPTARGET
9372void (*kmp_target_sync_cb)(
ident_t *loc_ref,
int gtid,
void *current_task,
9373 void *
event) = NULL;
9374void __kmp_target_init() {
9376 *(
void **)(&kmp_target_sync_cb) =
KMP_DLSYM(
"__tgt_target_sync");
9382#if !KMP_STATS_ENABLED
9389#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
void __kmp_device_env_reset(void)
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)
#define KMP_COMPARE_AND_STORE_PTR(p, cv, sv)
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)
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)
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)