40#if OMP_PROFILING_SUPPORT
41#include "llvm/Support/TimeProfiler.h"
42static char *ProfileTraceFile =
nullptr;
46#define KMP_USE_PRCTL 0
62#if defined(KMP_GOMP_COMPAT)
75#define KMP_MIN(x, y) ((x) < (y) ? (x) : (y))
92#if KMP_AFFINITY_SUPPORTED
93static void __kmp_partition_places(
kmp_team_t *team,
94 int update_master_only = 0);
97#if ENABLE_LIBOMPTARGET
98static void __kmp_target_init(
void);
105#ifdef USE_LOAD_BALANCE
106static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc);
111static int __kmp_unregister_root_other_thread(
int gtid);
128 new_nested_nth->
nth[
i] = 0;
130 new_nested_nth->
nth[
i] = thr->th.th_set_nested_nth[
j];
132 return new_nested_nth;
148 (
"*** __kmp_get_global_thread_id: entering, nproc=%d all_nproc=%d\n",
161 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using TDATA\n"));
166 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using keyed TLS\n"));
169 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using internal alg.\n"));
171 stack_addr = (
char *)&stack_data;
191 stack_size = (size_t)
TCR_PTR(thr->th.th_info.ds.ds_stacksize);
192 stack_base = (
char *)
TCR_PTR(thr->th.th_info.ds.ds_stackbase);
196 if (stack_addr <= stack_base) {
197 size_t stack_diff = stack_base - stack_addr;
199 if (stack_diff <= stack_size) {
215 (
"*** __kmp_get_global_thread_id: internal alg. failed to find "
216 "thread, using TLS\n"));
233 if (!
TCR_4(other_threads[
i]->th.th_info.ds.ds_stackgrow)) {
237 stack_base = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
238 if (stack_addr > stack_base) {
239 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stackbase, stack_addr);
240 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
241 other_threads[
i]->th.th_info.ds.ds_stacksize + stack_addr -
244 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
245 stack_base - stack_addr);
250 char *stack_end = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
251 char *stack_beg = stack_end - other_threads[
i]->th.th_info.ds.ds_stacksize;
253 other_threads[
i]->th.th_info.ds.ds_stacksize,
254 "th_%d stack (refinement)",
i);
267 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using TDATA\n"));
272 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using keyed TLS\n"));
276 (
"*** __kmp_get_global_thread_id_reg: using internal alg.\n"));
283 (
"__kmp_get_global_thread_id_reg: Encountered new root thread. "
284 "Registering a new gtid.\n"));
304 char *stack_beg = NULL;
305 char *stack_end = NULL;
308 KA_TRACE(10, (
"__kmp_check_stack_overlap: called\n"));
310 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
311 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
317 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
318 "th_%s stack (%s)",
"mon",
319 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
322 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
323 "th_%d stack (%s)", gtid,
324 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
333 (
"__kmp_check_stack_overlap: performing extensive checking\n"));
334 if (stack_beg == NULL) {
335 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
336 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
342 if (f_th && f_th != th) {
343 char *other_stack_end =
344 (
char *)
TCR_PTR(f_th->th.th_info.ds.ds_stackbase);
345 char *other_stack_beg =
346 other_stack_end - (size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize);
347 if ((stack_beg > other_stack_beg && stack_beg < other_stack_end) ||
348 (stack_end > other_stack_beg && stack_end < other_stack_end)) {
353 -1, other_stack_beg, other_stack_end,
354 (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize),
363 KA_TRACE(10, (
"__kmp_check_stack_overlap: returning\n"));
369 static int done =
FALSE;
376#define MAX_MESSAGE 512
379 char const *format, ...) {
383 va_start(ap, format);
384 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP storage map: %p %p%8lu %s\n", p1,
385 p2, (
unsigned long)
size, format);
388#if KMP_PRINT_DATA_PLACEMENT
391 if (p1 <= p2 && (
char *)p2 - (
char *)p1 ==
size) {
393 node = __kmp_get_host_node(p1);
399 int localProc = __kmp_get_cpu_from_gtid(gtid);
403 p1 = (
void *)((
size_t)p1 & ~((
size_t)page_size - 1));
404 p2 = (
void *)(((
size_t)p2 - 1) & ~((
size_t)page_size - 1));
418 (
char *)p1 += page_size;
419 }
while (p1 <= p2 && (node = __kmp_get_host_node(p1)) == lastNode);
425 (
char *)p1 + (page_size - 1),
426 __kmp_get_host_node(p1));
429 (
char *)p2 + (page_size - 1),
430 __kmp_get_host_node(p2));
452 va_start(ap, format);
454 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP warning: %s\n", format);
538#if KMP_FAST_REDUCTION_BARRIER
550 int team_id,
int num_thr) {
558 "%s_%d.t_bar", header, team_id);
568 "%s_%d.t_bar[forkjoin]", header, team_id);
570#if KMP_FAST_REDUCTION_BARRIER
574 "%s_%d.t_bar[reduction]", header, team_id);
578 -1, &team->
t.t_dispatch[0], &team->
t.t_dispatch[num_thr],
579 sizeof(
kmp_disp_t) * num_thr,
"%s_%d.t_dispatch", header, team_id);
582 -1, &team->
t.t_threads[0], &team->
t.t_threads[num_thr],
583 sizeof(
kmp_info_t *) * num_thr,
"%s_%d.t_threads", header, team_id);
586 &team->
t.t_disp_buffer[num_disp_buff],
588 "%s_%d.t_disp_buffer", header, team_id);
602#if ENABLE_LIBOMPTARGET
603static void __kmp_init_omptarget() {
604 __kmp_init_target_task();
613BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
618 case DLL_PROCESS_ATTACH:
619 KA_TRACE(10, (
"DllMain: PROCESS_ATTACH\n"));
623 case DLL_PROCESS_DETACH:
637 if (lpReserved == NULL)
642 case DLL_THREAD_ATTACH:
643 KA_TRACE(10, (
"DllMain: THREAD_ATTACH\n"));
649 case DLL_THREAD_DETACH:
664 int gtid = *gtid_ref;
665#ifdef BUILD_PARALLEL_ORDERED
671#if KMP_USE_DYNAMIC_LOCK
677#ifdef BUILD_PARALLEL_ORDERED
678 if (!team->
t.t_serialized) {
689 int gtid = *gtid_ref;
690#ifdef BUILD_PARALLEL_ORDERED
699#ifdef BUILD_PARALLEL_ORDERED
700 if (!team->
t.t_serialized) {
705 team->
t.t_ordered.dt.t_value = ((tid + 1) % team->
t.t_nproc);
725 team = th->th.th_team;
728 th->th.th_ident = id_ref;
730 if (team->
t.t_serialized) {
733 kmp_int32 old_this = th->th.th_local.this_construct;
735 ++th->th.th_local.this_construct;
739 if (team->
t.t_construct == old_this) {
741 th->th.th_local.this_construct);
744 if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
746 team->
t.t_active_level == 1) {
748 __kmp_itt_metadata_single(id_ref);
762 __kmp_itt_single_start(gtid);
770 __kmp_itt_single_end(gtid);
783 int master_tid,
int set_nthreads,
789 kmp_info_t *this_thr = parent_team->
t.t_threads[master_tid];
793 new_nthreads = set_nthreads;
797#ifdef USE_LOAD_BALANCE
798 else if (
__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
799 new_nthreads = __kmp_load_balance_nproc(root, set_nthreads);
800 if (new_nthreads == 1) {
801 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
802 "reservation to 1 thread\n",
806 if (new_nthreads < set_nthreads) {
807 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
808 "reservation to %d threads\n",
809 master_tid, new_nthreads));
815 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
816 if (new_nthreads <= 1) {
817 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
818 "reservation to 1 thread\n",
822 if (new_nthreads < set_nthreads) {
823 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
824 "reservation to %d threads\n",
825 master_tid, new_nthreads));
827 new_nthreads = set_nthreads;
830 if (set_nthreads > 2) {
832 new_nthreads = (new_nthreads % set_nthreads) + 1;
833 if (new_nthreads == 1) {
834 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
835 "reservation to 1 thread\n",
839 if (new_nthreads < set_nthreads) {
840 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
841 "reservation to %d threads\n",
842 master_tid, new_nthreads));
851 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
854 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
855 if (tl_nthreads <= 0) {
863 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
866 if (tl_nthreads == 1) {
867 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT "
868 "reduced reservation to 1 thread\n",
872 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT reduced "
873 "reservation to %d threads\n",
874 master_tid, tl_nthreads));
875 new_nthreads = tl_nthreads;
879 int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
880 int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
881 if (cg_nthreads + new_nthreads -
882 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
884 int tl_nthreads = max_cg_threads - cg_nthreads +
885 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
886 if (tl_nthreads <= 0) {
894 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
897 if (tl_nthreads == 1) {
898 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT "
899 "reduced reservation to 1 thread\n",
903 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT reduced "
904 "reservation to %d threads\n",
905 master_tid, tl_nthreads));
906 new_nthreads = tl_nthreads;
923 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
926 int slotsRequired =
__kmp_nth + new_nthreads -
927 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) -
930 if (slotsAdded < slotsRequired) {
932 new_nthreads -= (slotsRequired - slotsAdded);
940 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
945 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
953 if (new_nthreads == 1) {
955 (
"__kmp_reserve_threads: T#%d serializing team after reclaiming "
956 "dead roots and rechecking; requested %d threads\n",
959 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d allocating %d threads; requested"
965 if (this_thr->th.th_nt_strict && new_nthreads < set_nthreads) {
966 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
967 this_thr->th.th_nt_msg);
977 int fork_teams_workers) {
981 KA_TRACE(10, (
"__kmp_fork_team_threads: new_nprocs = %d\n", team->
t.t_nproc));
986 master_th->th.th_info.ds.ds_tid = 0;
987 master_th->th.th_team = team;
988 master_th->th.th_team_nproc = team->
t.t_nproc;
989 master_th->th.th_team_master = master_th;
990 master_th->th.th_team_serialized =
FALSE;
991 master_th->th.th_dispatch = &team->
t.t_dispatch[0];
998 int level = team->
t.t_active_level - 1;
999 if (master_th->th.th_teams_microtask) {
1000 if (master_th->th.th_teams_size.nteams > 1) {
1005 master_th->th.th_teams_level == team->
t.t_level) {
1011 if (hot_teams[
level].hot_team) {
1024 if (!use_hot_team) {
1027 team->
t.t_threads[0] = master_th;
1031 for (
i = 1;
i < team->
t.t_nproc;
i++) {
1035 team->
t.t_threads[
i] = thr;
1039 KA_TRACE(20, (
"__kmp_fork_team_threads: T#%d(%d:%d) init arrived "
1040 "T#%d(%d:%d) join =%llu, plain=%llu\n",
1045 thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
1046 thr->th.th_teams_level = master_th->th.th_teams_level;
1047 thr->th.th_teams_size = master_th->th.th_teams_size;
1052 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
1055 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
1061#if KMP_AFFINITY_SUPPORTED
1065 if (!fork_teams_workers) {
1066 __kmp_partition_places(team);
1070 if (team->
t.t_nproc > 1 &&
1072 team->
t.b->update_num_threads(team->
t.t_nproc);
1083 (
"__kmp_fork_team_threads: Primary T#%d pushing task_team %p / team "
1084 "%p, new task_team %p / team %p\n",
1086 team->
t.t_parent, team->
t.t_task_team[master_th->th.th_task_state],
1091 master_th->th.th_task_state);
1095 if (team->
t.t_nproc > 1) {
1097 team->
t.t_threads[1]->th.th_task_state == 1);
1099 team->
t.t_threads[1]->th.th_task_state);
1101 master_th->th.th_task_state = 0;
1106 master_th->th.th_task_state);
1108 master_th->th.th_task_state = 0;
1113 for (
i = 0;
i < team->
t.t_nproc;
i++) {
1115 if (thr->th.th_prev_num_threads != team->
t.t_nproc ||
1116 thr->th.th_prev_level != team->
t.t_level) {
1117 team->
t.t_display_affinity = 1;
1126#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1131 if (__kmp_inherit_fp_control) {
1136 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1137 __kmp_store_mxcsr(&mxcsr);
1138 mxcsr &= KMP_X86_MXCSR_MASK;
1164 if (__kmp_inherit_fp_control && team->
t.t_fp_control_saved) {
1169 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1170 __kmp_store_mxcsr(&mxcsr);
1171 mxcsr &= KMP_X86_MXCSR_MASK;
1173 if (team->
t.t_x87_fpu_control_word != x87_fpu_control_word) {
1174 __kmp_clear_x87_fpu_status_word();
1175 __kmp_load_x87_fpu_control_word(&team->
t.t_x87_fpu_control_word);
1178 if (team->
t.t_mxcsr != mxcsr) {
1179 __kmp_load_mxcsr(&team->
t.t_mxcsr);
1184#define propagateFPControl(x) ((void)0)
1185#define updateHWFPControl(x) ((void)0)
1197 KC_TRACE(10, (
"__kmpc_serialized_parallel: called by T#%d\n", global_tid));
1209 serial_team = this_thr->th.th_serial_team;
1216 if (this_thr->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1221 proc_bind = this_thr->th.th_current_task->td_icvs.proc_bind;
1229 if (this_thr->th.th_nt_strict && this_thr->th.th_set_nproc > 1)
1230 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
1231 this_thr->th.th_nt_msg);
1233 this_thr->th.th_set_nproc = 0;
1236 ompt_data_t ompt_parallel_data = ompt_data_none;
1237 void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
1239 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1242 parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
1250 &ompt_parallel_data, team_size,
1251 ompt_parallel_invoker_program | ompt_parallel_team, codeptr);
1256 if (this_thr->th.th_team != serial_team) {
1258 int level = this_thr->th.th_team->t.t_level;
1260 if (serial_team->
t.t_serialized) {
1268 this_thr->th.th_root, 1, 1,
1272 proc_bind, &this_thr->th.th_current_task->td_icvs, 0, NULL);
1277 new_team->
t.t_threads[0] = this_thr;
1278 new_team->
t.t_parent = this_thr->th.th_team;
1279 serial_team = new_team;
1280 this_thr->th.th_serial_team = serial_team;
1284 (
"__kmpc_serialized_parallel: T#%d allocated new serial team %p\n",
1285 global_tid, serial_team));
1293 (
"__kmpc_serialized_parallel: T#%d reusing cached serial team %p\n",
1294 global_tid, serial_team));
1301 serial_team->
t.t_ident =
loc;
1302 serial_team->
t.t_serialized = 1;
1303 serial_team->
t.t_nproc = 1;
1304 serial_team->
t.t_parent = this_thr->th.th_team;
1305 if (this_thr->th.th_team->t.t_nested_nth)
1306 serial_team->
t.t_nested_nth = this_thr->th.th_team->t.t_nested_nth;
1310 serial_team->
t.t_primary_task_state = this_thr->th.th_task_state;
1311 serial_team->
t.t_sched.sched = this_thr->th.th_team->t.t_sched.sched;
1312 this_thr->th.th_team = serial_team;
1313 serial_team->
t.t_master_tid = this_thr->th.th_info.ds.ds_tid;
1315 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d curtask=%p\n", global_tid,
1316 this_thr->th.th_current_task));
1317 KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 1);
1318 this_thr->th.th_current_task->td_flags.executing = 0;
1325 copy_icvs(&this_thr->th.th_current_task->td_icvs,
1326 &this_thr->th.th_current_task->td_parent->td_icvs);
1331 if (this_thr->th.th_team->t.t_nested_nth)
1332 nested_nth = this_thr->th.th_team->t.t_nested_nth;
1334 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1339 this_thr->th.th_current_task->td_icvs.proc_bind =
1346 this_thr->th.th_info.ds.ds_tid = 0;
1349 this_thr->th.th_team_nproc = 1;
1350 this_thr->th.th_team_master = this_thr;
1351 this_thr->th.th_team_serialized = 1;
1352 this_thr->th.th_task_team = NULL;
1353 this_thr->th.th_task_state = 0;
1355 serial_team->
t.t_level = serial_team->
t.t_parent->t.t_level + 1;
1356 serial_team->
t.t_active_level = serial_team->
t.t_parent->t.t_active_level;
1357 serial_team->
t.t_def_allocator = this_thr->th.th_def_allocator;
1363 if (!serial_team->
t.t_dispatch->th_disp_buffer) {
1364 serial_team->
t.t_dispatch->th_disp_buffer =
1368 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1378 ++serial_team->
t.t_serialized;
1379 this_thr->th.th_team_serialized = serial_team->
t.t_serialized;
1382 int level = this_thr->th.th_team->t.t_level;
1387 if (serial_team->
t.t_nested_nth)
1388 nested_nth = serial_team->
t.t_nested_nth;
1390 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1393 serial_team->
t.t_level++;
1394 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d increasing nesting level "
1395 "of serial team %p to %d\n",
1396 global_tid, serial_team, serial_team->
t.t_level));
1404 disp_buffer->next = serial_team->
t.t_dispatch->th_disp_buffer;
1405 serial_team->
t.t_dispatch->th_disp_buffer = disp_buffer;
1407 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1419 if (this_thr->th.th_prev_level != serial_team->
t.t_level ||
1420 this_thr->th.th_prev_num_threads != 1) {
1423 this_thr->th.th_prev_level = serial_team->
t.t_level;
1424 this_thr->th.th_prev_num_threads = 1;
1431 serial_team->
t.ompt_team_info.master_return_address = codeptr;
1433 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1434 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1439 &ompt_parallel_data, codeptr);
1447 ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
1449 ompt_task_implicit);
1450 OMPT_CUR_TASK_INFO(this_thr)->thread_num =
1455 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
1456 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1466 return (master_th->th.th_teams_microtask && ap &&
1474 return ((ap == NULL && active_level == 0) ||
1475 (ap && teams_level > 0 && teams_level ==
level));
1487 ompt_data_t ompt_parallel_data,
void *return_address,
1493 parent_team->
t.t_ident =
loc;
1495 parent_team->
t.t_argc = argc;
1496 argv = (
void **)parent_team->
t.t_argv;
1497 for (
i = argc - 1;
i >= 0; --
i) {
1501 if (parent_team == master_th->th.th_serial_team) {
1509 parent_team->
t.t_serialized--;
1519 void **exit_frame_p;
1520 ompt_data_t *implicit_task_data;
1525 &ompt_parallel_data, return_address);
1532 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1536 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), implicit_task_data,
1537 1, OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1541 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1543 exit_frame_p = &dummy;
1549 parent_team->
t.t_serialized--;
1564 *exit_frame_p = NULL;
1565 OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
1568 ompt_scope_end, NULL, implicit_task_data, 1,
1569 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1571 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1575 &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th),
1576 OMPT_INVOKER(call_context) | ompt_parallel_team, return_address);
1578 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1585 parent_team->
t.t_invoke = invoker;
1587 parent_team->
t.t_active_level++;
1588 parent_team->
t.t_level++;
1589 parent_team->
t.t_def_allocator = master_th->th.th_def_allocator;
1596 master_th->th.th_teams_size.nth = parent_team->
t.t_nproc;
1608 if (master_set_numthreads) {
1609 if (master_set_numthreads <= master_th->th.th_teams_size.nth) {
1611 kmp_info_t **other_threads = parent_team->
t.t_threads;
1614 int old_proc = master_th->th.th_teams_size.nth;
1619 parent_team->
t.t_nproc = master_set_numthreads;
1620 for (
i = 0;
i < master_set_numthreads; ++
i) {
1621 other_threads[
i]->th.th_team_nproc = master_set_numthreads;
1625 master_th->th.th_set_nproc = 0;
1630 int nth = __kmp_omp_num_threads(
loc);
1632 master_set_numthreads = nth;
1641 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1646 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
1654 master_th->th.th_current_task->td_icvs.proc_bind)) {
1661 master_th->th.th_current_task->td_icvs.proc_bind != proc_bind_icv) {
1662 kmp_info_t **other_threads = parent_team->
t.t_threads;
1663 for (
i = 0;
i < master_th->th.th_team_nproc; ++
i) {
1664 other_threads[
i]->th.th_current_task->td_icvs.proc_bind = proc_bind_icv;
1670#if USE_ITT_BUILD && USE_ITT_NOTIFY
1671 if (((__itt_frame_submit_v3_ptr && __itt_get_timestamp_ptr) ||
1673 __kmp_forkjoin_frames_mode == 3 &&
1674 parent_team->
t.t_active_level == 1
1675 && master_th->th.th_teams_size.nteams == 1) {
1677 master_th->th.th_frame_time = tmp_time;
1678 parent_team->
t.t_region_time = tmp_time;
1680 if (__itt_stack_caller_create_ptr) {
1683 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
1686#if KMP_AFFINITY_SUPPORTED
1687 __kmp_partition_places(parent_team);
1690 KF_TRACE(10, (
"__kmp_fork_in_teams: before internal fork: root=%p, team=%p, "
1691 "master_th=%p, gtid=%d\n",
1692 root, parent_team, master_th, gtid));
1694 KF_TRACE(10, (
"__kmp_fork_in_teams: after internal fork: root=%p, team=%p, "
1695 "master_th=%p, gtid=%d\n",
1696 root, parent_team, master_th, gtid));
1702 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) invoke microtask = %p\n", gtid,
1703 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1705 if (!parent_team->
t.t_invoke(gtid)) {
1706 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
1708 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) done microtask = %p\n", gtid,
1709 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1712 KA_TRACE(20, (
"__kmp_fork_in_teams: parallel exit T#%d\n", gtid));
1723 ompt_data_t *ompt_parallel_data,
void **return_address,
1724 ompt_data_t **parent_task_data,
1732#if KMP_OS_LINUX && \
1733 (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
1741 20, (
"__kmp_serial_fork_call: T#%d serializing parallel region\n", gtid));
1746 master_th->th.th_serial_team->t.t_pkfn =
microtask;
1751 master_th->th.th_serial_team->t.t_ident =
loc;
1754 master_th->th.th_serial_team->t.t_level--;
1759 void **exit_frame_p;
1765 ompt_parallel_data, *return_address);
1769 task_info = OMPT_CUR_TASK_INFO(master_th);
1770 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1774 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1776 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1780 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1782 exit_frame_p = &dummy;
1799 *exit_frame_p = NULL;
1802 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1803 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1805 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1809 ompt_parallel_data, *parent_task_data,
1810 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1812 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1817 team = master_th->th.th_team;
1819 team->
t.t_invoke = invoker;
1821 team->
t.t_argc = argc;
1822 argv = (
void **)team->
t.t_argv;
1823 for (
i = argc - 1;
i >= 0; --
i)
1835 ompt_scope_end, NULL, &(task_info->
task_data), 0,
1836 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial);
1840 ompt_parallel_data, *parent_task_data,
1844 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1849 for (
i = argc - 1;
i >= 0; --
i)
1855 void **exit_frame_p;
1858 ompt_data_t *implicit_task_data;
1862 ompt_parallel_data, *return_address);
1865 task_info = OMPT_CUR_TASK_INFO(master_th);
1866 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1869 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1872 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1874 ompt_task_implicit);
1879 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1881 exit_frame_p = &dummy;
1898 *exit_frame_p = NULL;
1901 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1902 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1905 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1909 ompt_parallel_data, *parent_task_data,
1910 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1912 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1930 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1934 "__kmp_serial_fork_call: unknown fork_context parameter");
1937 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1951 int master_this_cons;
1958 int master_set_numthreads;
1959 int task_thread_limit = 0;
1968 KA_TRACE(20, (
"__kmp_fork_call: enter T#%d\n", gtid));
1990 parent_team = master_th->th.th_team;
1991 master_tid = master_th->th.th_info.ds.ds_tid;
1992 master_this_cons = master_th->th.th_local.this_construct;
1993 root = master_th->th.th_root;
1994 master_active = root->r.r_active;
1995 master_set_numthreads = master_th->th.th_set_nproc;
1997 master_th->th.th_current_task->td_icvs.task_thread_limit;
2000 ompt_data_t ompt_parallel_data = ompt_data_none;
2001 ompt_data_t *parent_task_data = NULL;
2002 ompt_frame_t *ompt_frame = NULL;
2003 void *return_address = NULL;
2008 return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
2016 level = parent_team->
t.t_level;
2018 active_level = parent_team->
t.t_active_level;
2020 teams_level = master_th->th.th_teams_level;
2021 p_hot_teams = &master_th->th.th_hot_teams;
2025 (*p_hot_teams)[0].
hot_team = root->r.r_hot_team;
2027 (*p_hot_teams)[0].hot_team_nth = 1;
2033 int team_size = master_set_numthreads
2034 ? master_set_numthreads
2038 ? ompt_parallel_league
2039 : ompt_parallel_team);
2041 parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags,
2044 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2048 master_th->th.th_ident =
loc;
2054 master_set_numthreads,
level,
2056 ompt_parallel_data, return_address,
2070 if ((!enter_teams &&
2071 (parent_team->
t.t_active_level >=
2072 master_th->th.th_current_task->td_icvs.max_active_levels)) ||
2074 KC_TRACE(10, (
"__kmp_fork_call: T#%d serializing team\n", gtid));
2077 nthreads = master_set_numthreads
2078 ? master_set_numthreads
2083 nthreads = task_thread_limit > 0 && task_thread_limit < nthreads
2096 nthreads, enter_teams);
2097 if (nthreads == 1) {
2108 master_th->th.th_set_nproc = 0;
2110 if (nthreads == 1) {
2112 invoker, master_th, parent_team,
2114 &ompt_parallel_data, &return_address,
2122 KF_TRACE(10, (
"__kmp_fork_call: parent_team_aclevel=%d, master_th=%p, "
2123 "curtask=%p, curtask_max_aclevel=%d\n",
2124 parent_team->
t.t_active_level, master_th,
2125 master_th->th.th_current_task,
2126 master_th->th.th_current_task->td_icvs.max_active_levels));
2130 master_th->th.th_current_task->td_flags.executing = 0;
2132 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2138 int nthreads_icv = master_th->th.th_current_task->td_icvs.nproc;
2140 if (!master_th->th.th_set_nested_nth &&
2141 (
level + 1 < parent_team->
t.t_nested_nth->used) &&
2142 (parent_team->
t.t_nested_nth->nth[
level + 1] != nthreads_icv)) {
2143 nthreads_icv = parent_team->
t.t_nested_nth->nth[
level + 1];
2144 }
else if (master_th->th.th_set_nested_nth) {
2147 (nested_nth->
nth[
level + 1] != nthreads_icv))
2148 nthreads_icv = nested_nth->
nth[
level + 1];
2159 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
2165 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
2168 if (master_th->th.th_teams_microtask &&
2178 master_th->th.th_current_task->td_icvs.proc_bind)) {
2181 if (!master_th->th.th_teams_microtask ||
2192 copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
2193 new_icvs.
next = NULL;
2194 if (nthreads_icv > 0) {
2195 new_icvs.
nproc = nthreads_icv;
2202 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2207 proc_bind, &new_icvs, argc, master_th);
2212 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2214 root, nthreads, nthreads,
2218 proc_bind, &master_th->th.th_current_task->td_icvs, argc, master_th);
2221 &master_th->th.th_current_task->td_icvs);
2224 10, (
"__kmp_fork_call: after __kmp_allocate_team - team = %p\n", team));
2238 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2239 int new_level = parent_team->
t.t_level + 1;
2241 new_level = parent_team->
t.t_active_level + 1;
2245 int new_level = parent_team->
t.t_level;
2247 new_level = parent_team->
t.t_active_level;
2258 if (team->
t.t_nested_nth &&
2259 team->
t.t_nested_nth != parent_team->
t.t_nested_nth) {
2262 team->
t.t_nested_nth = NULL;
2264 team->
t.t_nested_nth = parent_team->
t.t_nested_nth;
2265 if (master_th->th.th_set_nested_nth) {
2268 team->
t.t_nested_nth = nested_nth;
2270 master_th->th.th_set_nested_nth = NULL;
2271 master_th->th.th_set_nested_nth_sz = 0;
2272 master_th->th.th_nt_strict =
false;
2278 if (ompd_state & OMPD_ENABLE_BP)
2279 ompd_bp_parallel_begin();
2284 (
"__kmp_fork_call: T#%d(%d:%d)->(%d:0) created a team of %d threads\n",
2285 gtid, parent_team->
t.t_id, team->
t.t_master_tid, team->
t.t_id,
2288 (team->
t.t_master_tid == 0 &&
2289 (team->
t.t_parent == root->r.r_root_team ||
2290 team->
t.t_parent->t.t_serialized)));
2294 argv = (
void **)team->
t.t_argv;
2296 for (
i = argc - 1;
i >= 0; --
i) {
2302 for (
i = 0;
i < argc; ++
i) {
2310 if (!root->r.r_active)
2311 root->r.r_active =
TRUE;
2315 &master_th->th.th_current_task->td_icvs,
loc);
2318 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
2324 if (team->
t.t_active_level == 1
2325 && !master_th->th.th_teams_microtask) {
2327 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2328 (__kmp_forkjoin_frames_mode == 3 ||
2329 __kmp_forkjoin_frames_mode == 1)) {
2331 if (__itt_get_timestamp_ptr)
2332 tmp_time = __itt_get_timestamp();
2334 master_th->th.th_frame_time = tmp_time;
2335 if (__kmp_forkjoin_frames_mode == 3)
2336 team->
t.t_region_time = tmp_time;
2340 if ((__itt_frame_begin_v3_ptr || KMP_ITT_DEBUG) &&
2341 __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) {
2343 __kmp_itt_region_forking(gtid, team->
t.t_nproc, 0);
2352 (
"__kmp_internal_fork : root=%p, team=%p, master_th=%p, gtid=%d\n",
2353 root, team, master_th, gtid));
2356 if (__itt_stack_caller_create_ptr) {
2360 team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2361 }
else if (parent_team->
t.t_serialized) {
2367 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2376 KF_TRACE(10, (
"__kmp_internal_fork : after : root=%p, team=%p, "
2377 "master_th=%p, gtid=%d\n",
2378 root, team, master_th, gtid));
2382 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2387 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) invoke microtask = %p\n", gtid,
2388 team->
t.t_id, team->
t.t_pkfn));
2391#if KMP_STATS_ENABLED
2399 if (!team->
t.t_invoke(gtid)) {
2400 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
2403#if KMP_STATS_ENABLED
2410 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
2411 team->
t.t_id, team->
t.t_pkfn));
2414 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2417 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2425static inline void __kmp_join_restore_state(
kmp_info_t *thread,
2428 thread->th.ompt_thread_info.state =
2429 ((team->
t.t_serialized) ? ompt_state_work_serial
2430 : ompt_state_work_parallel);
2433static inline void __kmp_join_ompt(
int gtid,
kmp_info_t *thread,
2434 kmp_team_t *team, ompt_data_t *parallel_data,
2435 int flags,
void *codeptr) {
2439 parallel_data, &(task_info->
task_data), flags, codeptr);
2442 task_info->
frame.enter_frame = ompt_data_none;
2443 __kmp_join_restore_state(thread, team);
2461 KA_TRACE(20, (
"__kmp_join_call: enter T#%d\n", gtid));
2465 root = master_th->th.th_root;
2466 team = master_th->th.th_team;
2467 parent_team = team->
t.t_parent;
2469 master_th->th.th_ident =
loc;
2472 void *team_microtask = (
void *)team->
t.t_pkfn;
2478 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2484 KA_TRACE(20, (
"__kmp_join_call: T#%d, old team = %p old task_team = %p, "
2485 "th_task_team = %p\n",
2487 team->
t.t_task_team[master_th->th.th_task_state],
2488 master_th->th.th_task_team));
2493 if (team->
t.t_serialized) {
2494 if (master_th->th.th_teams_microtask) {
2496 int level = team->
t.t_level;
2497 int tlevel = master_th->th.th_teams_level;
2498 if (
level == tlevel) {
2502 }
else if (
level == tlevel + 1) {
2506 team->
t.t_serialized++;
2516 __kmp_join_restore_state(master_th, parent_team);
2523 master_active = team->
t.t_master_active;
2530 if (__itt_stack_caller_create_ptr) {
2533 __kmp_itt_stack_caller_destroy((__itt_caller)team->
t.t_stack_id);
2534 team->
t.t_stack_id = NULL;
2538 master_th->th.th_task_state =
2541 if (__itt_stack_caller_create_ptr && parent_team->
t.t_serialized) {
2546 __kmp_itt_stack_caller_destroy((__itt_caller)parent_team->
t.t_stack_id);
2547 parent_team->
t.t_stack_id = NULL;
2555 ompt_data_t *parallel_data = &(team->
t.ompt_team_info.parallel_data);
2556 void *codeptr = team->
t.ompt_team_info.master_return_address;
2561 if (team->
t.t_active_level == 1 &&
2562 (!master_th->th.th_teams_microtask ||
2563 master_th->th.th_teams_size.nteams == 1)) {
2564 master_th->th.th_ident =
loc;
2567 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2568 __kmp_forkjoin_frames_mode == 3)
2569 __kmp_itt_frame_submit(gtid, team->
t.t_region_time,
2570 master_th->th.th_frame_time, 0,
loc,
2571 master_th->th.th_team_nproc, 1);
2572 else if ((__itt_frame_end_v3_ptr || KMP_ITT_DEBUG) &&
2573 !__kmp_forkjoin_frames_mode && __kmp_forkjoin_frames)
2574 __kmp_itt_region_joined(gtid);
2578#if KMP_AFFINITY_SUPPORTED
2581 master_th->th.th_first_place = team->
t.t_first_place;
2582 master_th->th.th_last_place = team->
t.t_last_place;
2586 if (master_th->th.th_teams_microtask && !exit_teams &&
2588 team->
t.t_level == master_th->th.th_teams_level + 1) {
2593 ompt_data_t ompt_parallel_data = ompt_data_none;
2597 int ompt_team_size = team->
t.t_nproc;
2599 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2600 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
2602 task_info->
frame.exit_frame = ompt_data_none;
2604 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
2610 team->
t.t_active_level--;
2617 if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
2618 int old_num = master_th->th.th_team_nproc;
2619 int new_num = master_th->th.th_teams_size.nth;
2621 team->
t.t_nproc = new_num;
2622 for (
int i = 0;
i < old_num; ++
i) {
2623 other_threads[
i]->th.th_team_nproc = new_num;
2626 for (
int i = old_num;
i < new_num; ++
i) {
2631 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
2634 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
2639 other_threads[
i]->th.th_task_state = master_th->th.th_task_state;
2646 __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data,
2647 OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr);
2655 master_th->th.th_info.ds.ds_tid = team->
t.t_master_tid;
2656 master_th->th.th_local.this_construct = team->
t.t_master_this_cons;
2658 master_th->th.th_dispatch = &parent_team->
t.t_dispatch[team->
t.t_master_tid];
2665 if (!master_th->th.th_teams_microtask ||
2666 team->
t.t_level > master_th->th.th_teams_level) {
2678 : ompt_task_implicit;
2679 int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->
t.t_nproc;
2681 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2682 OMPT_CUR_TASK_INFO(master_th)->thread_num, flags);
2684 task_info->
frame.exit_frame = ompt_data_none;
2689 KF_TRACE(10, (
"__kmp_join_call1: T#%d, this_thread=%p team=%p\n", 0,
2693 master_th->th.th_def_allocator = team->
t.t_def_allocator;
2696 if (ompd_state & OMPD_ENABLE_BP)
2697 ompd_bp_parallel_end();
2701 if (root->r.r_active != master_active)
2702 root->r.r_active = master_active;
2711 master_th->th.th_team = parent_team;
2712 master_th->th.th_team_nproc = parent_team->
t.t_nproc;
2713 master_th->th.th_team_master = parent_team->
t.t_threads[0];
2714 master_th->th.th_team_serialized = parent_team->
t.t_serialized;
2717 if (parent_team->
t.t_serialized &&
2718 parent_team != master_th->th.th_serial_team &&
2719 parent_team != root->r.r_root_team) {
2721 master_th->th.th_serial_team = parent_team;
2727 team->
t.t_primary_task_state == 1);
2728 master_th->th.th_task_state = (
kmp_uint8)team->
t.t_primary_task_state;
2731 master_th->th.th_task_team =
2732 parent_team->
t.t_task_team[master_th->th.th_task_state];
2734 (
"__kmp_join_call: Primary T#%d restoring task_team %p, team %p\n",
2742 master_th->th.th_current_task->td_flags.executing = 1;
2746#if KMP_AFFINITY_SUPPORTED
2747 if (master_th->th.th_team->t.t_level == 0 && __kmp_affinity.flags.reset) {
2755 : ompt_parallel_team);
2757 __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags,
2763 KA_TRACE(20, (
"__kmp_join_call: exit T#%d\n", gtid));
2770 if (thread->th.th_team != thread->th.th_serial_team) {
2773 if (thread->th.th_team->t.t_serialized > 1) {
2776 if (thread->th.th_team->t.t_control_stack_top == NULL) {
2779 if (thread->th.th_team->t.t_control_stack_top->serial_nesting_level !=
2780 thread->th.th_team->t.t_serialized) {
2789 copy_icvs(control, &thread->th.th_current_task->td_icvs);
2793 control->
next = thread->th.th_team->t.t_control_stack_top;
2794 thread->th.th_team->t.t_control_stack_top = control;
2804 KF_TRACE(10, (
"__kmp_set_num_threads: new __kmp_nth = %d\n", new_nth));
2814 if (thread->th.th_current_task->td_icvs.nproc == new_nth)
2824 root = thread->th.th_root;
2837 for (
f = new_nth;
f < hot_team->
t.t_nproc;
f++) {
2842 hot_team->
t.t_threads[
f]->th.th_task_team = NULL;
2845 hot_team->
t.t_threads[
f] = NULL;
2847 hot_team->
t.t_nproc = new_nth;
2848 if (thread->th.th_hot_teams) {
2850 thread->th.th_hot_teams[0].hot_team_nth = new_nth;
2854 hot_team->
t.b->update_num_threads(new_nth);
2861 for (
f = 0;
f < new_nth;
f++) {
2863 hot_team->
t.t_threads[
f]->th.th_team_nproc = new_nth;
2866 hot_team->
t.t_size_changed = -1;
2874 KF_TRACE(10, (
"__kmp_set_max_active_levels: new max_active_levels for thread "
2876 gtid, max_active_levels));
2880 if (max_active_levels < 0) {
2881 KMP_WARNING(ActiveLevelsNegative, max_active_levels);
2886 KF_TRACE(10, (
"__kmp_set_max_active_levels: the call is ignored: new "
2887 "max_active_levels for thread %d = (%d)\n",
2888 gtid, max_active_levels));
2896 KMP_WARNING(ActiveLevelsExceedLimit, max_active_levels,
2904 KF_TRACE(10, (
"__kmp_set_max_active_levels: after validation: new "
2905 "max_active_levels for thread %d = (%d)\n",
2906 gtid, max_active_levels));
2919 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d\n", gtid));
2924 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d, curtask=%p, "
2925 "curtask_maxaclevel=%d\n",
2926 gtid, thread->th.th_current_task,
2927 thread->th.th_current_task->td_icvs.max_active_levels));
2928 return thread->th.th_current_task->td_icvs.max_active_levels;
2953 KF_TRACE(10, (
"__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
2954 gtid, (
int)kind, chunk));
2968 KMP_HNT(DefaultScheduleKindUsed,
"static, no chunk"),
2982 thread->th.th_current_task->td_icvs.sched.r_sched_type =
kmp_sch_static;
2984 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2990 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2995 orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
3000 thread->th.th_current_task->td_icvs.sched.chunk = chunk;
3009 KF_TRACE(10, (
"__kmp_get_schedule: thread %d\n", gtid));
3014 th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
3040#if KMP_STATIC_STEAL_ENABLED
3042 *kind = kmp_sched_static_steal;
3046 KMP_FATAL(UnknownSchedulingType, th_type);
3050 *chunk = thread->th.th_current_task->td_icvs.sched.chunk;
3059 KF_TRACE(10, (
"__kmp_get_ancestor_thread_num: thread %d %d\n", gtid,
level));
3068 team = thr->th.th_team;
3069 ii = team->
t.t_level;
3073 if (thr->th.th_teams_microtask) {
3075 int tlevel = thr->th.th_teams_level;
3092 dd = team->
t.t_serialized;
3095 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3097 if ((team->
t.t_serialized) && (!dd)) {
3098 team = team->
t.t_parent;
3102 team = team->
t.t_parent;
3103 dd = team->
t.t_serialized;
3108 return (dd > 1) ? (0) : (team->
t.t_master_tid);
3117 KF_TRACE(10, (
"__kmp_get_team_size: thread %d %d\n", gtid,
level));
3126 team = thr->th.th_team;
3127 ii = team->
t.t_level;
3131 if (thr->th.th_teams_microtask) {
3133 int tlevel = thr->th.th_teams_level;
3148 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3150 if (team->
t.t_serialized && (!dd)) {
3151 team = team->
t.t_parent;
3155 team = team->
t.t_parent;
3160 return team->
t.t_nproc;
3202 if (!realloc || argc > team->
t.t_max_argc) {
3204 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: needed entries=%d, "
3205 "current entries=%d\n",
3206 team->
t.t_id, argc, (realloc) ? team->
t.t_max_argc : 0));
3208 if (realloc && team->
t.t_argv != &team->
t.t_inline_argv[0])
3214 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: inline allocate %d "
3216 team->
t.t_id, team->
t.t_max_argc));
3217 team->
t.t_argv = &team->
t.t_inline_argv[0];
3220 -1, &team->
t.t_inline_argv[0],
3230 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: dynamic allocate %d "
3232 team->
t.t_id, team->
t.t_max_argc));
3237 &team->
t.t_argv[team->
t.t_max_argc],
3238 sizeof(
void *) * team->
t.t_max_argc,
3239 "team_%d.t_argv", team->
t.t_id);
3252 team->
t.t_dispatch =
3254 team->
t.t_implicit_task_taskdata =
3256 team->
t.t_max_nproc = max_nth;
3259 for (
i = 0;
i < num_disp_buff; ++
i) {
3260 team->
t.t_disp_buffer[
i].buffer_index =
i;
3261 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
3268 for (
i = 0;
i < team->
t.t_max_nproc; ++
i) {
3269 if (team->
t.t_dispatch[
i].th_disp_buffer != NULL) {
3271 team->
t.t_dispatch[
i].th_disp_buffer = NULL;
3274#if KMP_USE_HIER_SCHED
3281 team->
t.t_threads = NULL;
3282 team->
t.t_disp_buffer = NULL;
3283 team->
t.t_dispatch = NULL;
3284 team->
t.t_implicit_task_taskdata = 0;
3342 copy_icvs(&gx_icvs, &team->
t.t_threads[0]->th.th_current_task->td_icvs);
3343 gx_icvs.
next = NULL;
3352 int hot_team_max_nth;
3361 root->r.r_begin =
FALSE;
3362 root->r.r_active =
FALSE;
3363 root->r.r_in_parallel = 0;
3365#if KMP_AFFINITY_SUPPORTED
3366 root->r.r_affinity_assigned =
FALSE;
3371 KF_TRACE(10, (
"__kmp_initialize_root: before root_team\n"));
3389 KF_TRACE(10, (
"__kmp_initialize_root: after root_team = %p\n", root_team));
3391 root->r.r_root_team = root_team;
3392 root_team->
t.t_control_stack_top = NULL;
3395 root_team->
t.t_threads[0] = NULL;
3396 root_team->
t.t_nproc = 1;
3397 root_team->
t.t_serialized = 1;
3399 root_team->
t.t_sched.sched = r_sched.
sched;
3403 (
"__kmp_initialize_root: init root team %d arrived: join=%u, plain=%u\n",
3408 KF_TRACE(10, (
"__kmp_initialize_root: before hot_team\n"));
3420 KF_TRACE(10, (
"__kmp_initialize_root: after hot_team = %p\n", hot_team));
3422 root->r.r_hot_team = hot_team;
3423 root_team->
t.t_control_stack_top = NULL;
3426 hot_team->
t.t_parent = root_team;
3429 hot_team_max_nth = hot_team->
t.t_max_nproc;
3430 for (
f = 0;
f < hot_team_max_nth; ++
f) {
3431 hot_team->
t.t_threads[
f] = NULL;
3433 hot_team->
t.t_nproc = 1;
3435 hot_team->
t.t_sched.sched = r_sched.
sched;
3436 hot_team->
t.t_size_changed = 0;
3442typedef struct kmp_team_list_item {
3444 struct kmp_team_list_item *next;
3445} kmp_team_list_item_t;
3446typedef kmp_team_list_item_t *kmp_team_list_t;
3448static void __kmp_print_structure_team_accum(
3449 kmp_team_list_t list,
3465 __kmp_print_structure_team_accum(list, team->
t.t_parent);
3466 __kmp_print_structure_team_accum(list, team->
t.t_next_pool);
3470 while (l->next != NULL && l->entry != team) {
3473 if (l->next != NULL) {
3479 while (l->next != NULL && l->entry->t.t_id <= team->
t.t_id) {
3486 sizeof(kmp_team_list_item_t));
3493static void __kmp_print_structure_team(
char const *title,
kmp_team_p const *team
3504static void __kmp_print_structure_thread(
char const *title,
3507 if (thread != NULL) {
3516 kmp_team_list_t list;
3524 __kmp_printf(
"\n------------------------------\nGlobal Thread "
3525 "Table\n------------------------------\n");
3541 __kmp_printf(
"\n------------------------------\nThreads\n--------------------"
3547 if (thread != NULL) {
3550 __kmp_print_structure_team(
" Our Team: ", thread->th.th_team);
3551 __kmp_print_structure_team(
" Serial Team: ",
3552 thread->th.th_serial_team);
3553 __kmp_printf(
" Threads: %2d\n", thread->th.th_team_nproc);
3554 __kmp_print_structure_thread(
" Primary: ",
3555 thread->th.th_team_master);
3556 __kmp_printf(
" Serialized?: %2d\n", thread->th.th_team_serialized);
3557 __kmp_printf(
" Set NProc: %2d\n", thread->th.th_set_nproc);
3558 __kmp_printf(
" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
3559 __kmp_print_structure_thread(
" Next in pool: ",
3560 thread->th.th_next_pool);
3562 __kmp_print_structure_team_accum(list, thread->th.th_team);
3563 __kmp_print_structure_team_accum(list, thread->th.th_serial_team);
3571 __kmp_printf(
"\n------------------------------\nUbers\n----------------------"
3579 __kmp_print_structure_team(
" Root Team: ", root->r.r_root_team);
3580 __kmp_print_structure_team(
" Hot Team: ", root->r.r_hot_team);
3581 __kmp_print_structure_thread(
" Uber Thread: ",
3582 root->r.r_uber_thread);
3587 __kmp_print_structure_team_accum(list, root->r.r_root_team);
3588 __kmp_print_structure_team_accum(list, root->r.r_hot_team);
3595 __kmp_printf(
"\n------------------------------\nTeams\n----------------------"
3597 while (list->next != NULL) {
3601 __kmp_print_structure_team(
" Parent Team: ", team->
t.t_parent);
3604 __kmp_printf(
" Levels of serial: %2d\n", team->
t.t_serialized);
3606 for (
i = 0;
i < team->
t.t_nproc; ++
i) {
3608 __kmp_print_structure_thread(
"", team->
t.t_threads[
i]);
3610 __kmp_print_structure_team(
" Next in pool: ", team->
t.t_next_pool);
3616 __kmp_printf(
"\n------------------------------\nPools\n----------------------"
3618 __kmp_print_structure_thread(
"Thread pool: ",
3620 __kmp_print_structure_team(
"Team pool: ",
3625 while (list != NULL) {
3626 kmp_team_list_item_t *item = list;
3638 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, 0xba5703f5, 0xb495a877,
3639 0xe1626741, 0x79695e6b, 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231,
3640 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, 0xbe4d6fe9, 0x5f15e201,
3641 0x99afc3fd, 0xf3f16801, 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3,
3642 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, 0x085a3d61, 0x46eb5ea7,
3643 0x3d9910ed, 0x2e687b5b, 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9,
3644 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, 0x54581edb, 0xf2480f45,
3645 0x0bb9288f, 0xef1affc7, 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7,
3646 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, 0xfc411073, 0xc3749363,
3647 0xb892d829, 0x3549366b, 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3,
3648 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f};
3653 unsigned x = thread->th.th_x;
3654 unsigned short r = (
unsigned short)(x >> 16);
3656 thread->th.th_x = x * thread->th.th_a + 1;
3658 KA_TRACE(30, (
"__kmp_get_random: THREAD: %d, RETURN: %u\n",
3659 thread->th.th_info.ds.ds_tid,
r));
3666 unsigned seed = thread->th.th_info.ds.ds_tid;
3670 thread->th.th_x = (seed + 1) * thread->th.th_a + 1;
3672 (
"__kmp_init_random: THREAD: %u; A: %u\n", seed, thread->th.th_a));
3678static int __kmp_reclaim_dead_roots(
void) {
3686 r += __kmp_unregister_root_other_thread(
i);
3713 int minimumRequiredCapacity;
3722#if KMP_OS_WINDOWS && !KMP_DYNAMIC_LIB
3725 added = __kmp_reclaim_dead_roots();
3767 }
while (newCapacity < minimumRequiredCapacity);
3811 KA_TRACE(20, (
"__kmp_register_root: entered\n"));
3865 KA_TRACE(1, (
"__kmp_register_root: found slot in threads array for "
3866 "hidden helper thread: T#%d\n",
3880 1, (
"__kmp_register_root: found slot in threads array: T#%d\n", gtid));
3902#ifdef KMP_ADJUST_BLOCKTIME
3907 __kmp_zero_bt =
TRUE;
3918#if KMP_STATS_ENABLED
3920 __kmp_stats_thread_ptr = __kmp_stats_list->push_back(gtid);
3921 __kmp_stats_thread_ptr->startLife();
3928 if (root->r.r_uber_thread) {
3929 root_thread = root->r.r_uber_thread;
3935 root_thread->th.th_info.ds.ds_gtid = gtid;
3937 root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
3939 root_thread->th.th_root = root;
3944 __kmp_initialize_fast_memory(root_thread);
3955 if (!root_thread->th.th_serial_team) {
3957 KF_TRACE(10, (
"__kmp_register_root: before serial_team\n"));
3958 root_thread->th.th_serial_team =
3966 KF_TRACE(10, (
"__kmp_register_root: after serial_team = %p\n",
3967 root_thread->th.th_serial_team));
3972 root->r.r_root_team->t.t_threads[0] = root_thread;
3973 root->r.r_hot_team->t.t_threads[0] = root_thread;
3974 root_thread->th.th_serial_team->t.t_threads[0] = root_thread;
3976 root_thread->th.th_serial_team->t.t_serialized = 0;
3977 root->r.r_uber_thread = root_thread;
3987 __kmp_itt_thread_name(gtid);
3990#ifdef KMP_TDATA_GTID
3996 KA_TRACE(20, (
"__kmp_register_root: T#%d init T#%d(%d:%d) arrived: join=%u, "
4006 root_thread->th.th_bar[
b].bb.b_worker_arrived = 0;
4013#if KMP_AFFINITY_SUPPORTED
4014 root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
4015 root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
4016 root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
4017 root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
4020 root_thread->th.th_prev_level = 0;
4021 root_thread->th.th_prev_num_threads = 1;
4027 KA_TRACE(100, (
"__kmp_register_root: Thread %p created node %p with"
4028 " cg_nthreads init to 1\n",
4031 root_thread->th.th_cg_roots = tmp;
4040 ompt_set_thread_state(root_thread, ompt_state_overhead);
4046 ompt_data_t *task_data;
4047 ompt_data_t *parallel_data;
4052 ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
4055 ompt_set_thread_state(root_thread, ompt_state_work_serial);
4059 if (ompd_state & OMPD_ENABLE_BP)
4060 ompd_bp_thread_begin();
4070 const int max_level) {
4073 if (!hot_teams || !hot_teams[
level].hot_team) {
4080 if (
level < max_level - 1) {
4081 for (
i = 0;
i < nth; ++
i) {
4084 if (
i > 0 && th->th.th_hot_teams) {
4086 th->th.th_hot_teams = NULL;
4099 int n = hot_team->
t.t_nproc;
4104 root->r.r_root_team = NULL;
4105 root->r.r_hot_team = NULL;
4111 for (
i = 0;
i < hot_team->
t.t_nproc; ++
i) {
4116 if (th->th.th_hot_teams) {
4118 th->th.th_hot_teams = NULL;
4136 (LPVOID) & (root->r.r_uber_thread->th),
4137 root->r.r_uber_thread->th.th_info.ds.ds_thread));
4142 if (ompd_state & OMPD_ENABLE_BP)
4143 ompd_bp_thread_end();
4147 ompt_data_t *task_data;
4148 ompt_data_t *parallel_data;
4153 ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
4157 &(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
4163 i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
4164 KA_TRACE(100, (
"__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
4166 root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
4167 root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
4171 root->r.r_uber_thread->th.th_cg_roots->cg_root);
4173 __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
4174 root->r.r_uber_thread->th.th_cg_roots = NULL;
4180 root->r.r_uber_thread = NULL;
4182 root->r.r_begin =
FALSE;
4188 KA_TRACE(1, (
"__kmp_unregister_root_current_thread: enter T#%d\n", gtid));
4194 KC_TRACE(10, (
"__kmp_unregister_root_current_thread: already finished, "
4218 thread->th.ompt_thread_info.state = ompt_state_undefined;
4227 (
"__kmp_unregister_root_current_thread: T#%d unregistered\n", gtid));
4236static int __kmp_unregister_root_other_thread(
int gtid) {
4240 KA_TRACE(1, (
"__kmp_unregister_root_other_thread: enter T#%d\n", gtid));
4248 (
"__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid));
4254void __kmp_task_info() {
4259 kmp_team_t *steam = this_thr->th.th_serial_team;
4263 "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
4265 gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
4266 team->
t.t_implicit_task_taskdata[tid].td_parent);
4274 int tid,
int gtid) {
4291 this_thr->th.th_info.ds.ds_tid = tid;
4292 this_thr->th.th_set_nproc = 0;
4301#if KMP_AFFINITY_SUPPORTED
4302 this_thr->th.th_new_place = this_thr->th.th_current_place;
4304 this_thr->th.th_root = master->th.th_root;
4307 this_thr->th.th_team_nproc = team->
t.t_nproc;
4308 this_thr->th.th_team_master = master;
4309 this_thr->th.th_team_serialized = team->
t.t_serialized;
4313 KF_TRACE(10, (
"__kmp_initialize_info1: T#%d:%d this_thread=%p curtask=%p\n",
4314 tid, gtid, this_thr, this_thr->th.th_current_task));
4319 KF_TRACE(10, (
"__kmp_initialize_info2: T#%d:%d this_thread=%p curtask=%p\n",
4320 tid, gtid, this_thr, this_thr->th.th_current_task));
4325 this_thr->th.th_dispatch = &team->
t.t_dispatch[tid];
4327 this_thr->th.th_local.this_construct = 0;
4329 if (!this_thr->th.th_pri_common) {
4330 this_thr->th.th_pri_common =
4334 gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1,
4335 sizeof(
struct common_table),
"th_%d.th_pri_common\n", gtid);
4337 this_thr->th.th_pri_head = NULL;
4340 if (this_thr != master &&
4341 this_thr->th.th_cg_roots != master->th.th_cg_roots) {
4348 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p decrement cg_nthreads"
4349 " on node %p of thread %p to %d\n",
4355 this_thr->th.th_cg_roots = master->th.th_cg_roots;
4357 this_thr->th.th_cg_roots->cg_nthreads++;
4358 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p increment cg_nthreads on"
4359 " node %p of thread %p to %d\n",
4360 this_thr, this_thr->th.th_cg_roots,
4361 this_thr->th.th_cg_roots->cg_root,
4362 this_thr->th.th_cg_roots->cg_nthreads));
4363 this_thr->th.th_current_task->td_icvs.thread_limit =
4364 this_thr->th.th_cg_roots->cg_thread_limit;
4369 volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
4374 KD_TRACE(10, (
"__kmp_initialize_info: T#%d max_nproc: %d\n", gtid,
4375 team->
t.t_max_nproc));
4393 "th_%d.th_dispatch.th_disp_buffer "
4394 "(team_%d.t_dispatch[%d].th_disp_buffer)",
4395 gtid, team->
t.t_id, gtid);
4408 this_thr->th.th_next_pool = NULL;
4443 if (new_thr->th.th_active_in_pool ==
TRUE) {
4446 new_thr->th.th_active_in_pool =
FALSE;
4450 KA_TRACE(20, (
"__kmp_allocate_thread: T#%d using thread T#%d\n",
4457 new_thr->th.th_info.ds.ds_gtid);
4462 new_thr->th.th_task_state = 0;
4470#ifdef KMP_ADJUST_BLOCKTIME
4475 __kmp_zero_bt =
TRUE;
4489 KF_TRACE(10, (
"__kmp_allocate_thread: T#%d using thread %p T#%d\n",
4503 if (!
TCR_4(__kmp_init_monitor)) {
4505 if (!
TCR_4(__kmp_init_monitor)) {
4506 KF_TRACE(10, (
"before __kmp_create_monitor\n"));
4507 TCW_4(__kmp_init_monitor, 1);
4509 KF_TRACE(10, (
"after __kmp_create_monitor\n"));
4520 while (
TCR_4(__kmp_init_monitor) < 2) {
4523 KF_TRACE(10, (
"after monitor thread has started\n"));
4550 new_thr->th.th_nt_strict =
false;
4551 new_thr->th.th_nt_loc = NULL;
4553 new_thr->th.th_nt_msg = NULL;
4557#if USE_ITT_BUILD && USE_ITT_NOTIFY && KMP_DEBUG
4560 __itt_suppress_mark_range(
4561 __itt_suppress_range, __itt_suppress_threading_errors,
4562 &new_thr->th.th_sleep_loc,
sizeof(new_thr->th.th_sleep_loc));
4563 __itt_suppress_mark_range(
4564 __itt_suppress_range, __itt_suppress_threading_errors,
4565 &new_thr->th.th_reap_state,
sizeof(new_thr->th.th_reap_state));
4567 __itt_suppress_mark_range(
4568 __itt_suppress_range, __itt_suppress_threading_errors,
4569 &new_thr->th.th_suspend_init,
sizeof(new_thr->th.th_suspend_init));
4571 __itt_suppress_mark_range(__itt_suppress_range,
4572 __itt_suppress_threading_errors,
4573 &new_thr->th.th_suspend_init_count,
4574 sizeof(new_thr->th.th_suspend_init_count));
4577 __itt_suppress_mark_range(__itt_suppress_range,
4578 __itt_suppress_threading_errors,
4580 sizeof(new_thr->th.th_bar[0].bb.b_go));
4581 __itt_suppress_mark_range(__itt_suppress_range,
4582 __itt_suppress_threading_errors,
4584 sizeof(new_thr->th.th_bar[1].bb.b_go));
4585 __itt_suppress_mark_range(__itt_suppress_range,
4586 __itt_suppress_threading_errors,
4588 sizeof(new_thr->th.th_bar[2].bb.b_go));
4597 KF_TRACE(10, (
"__kmp_allocate_thread: before th_serial/serial_team\n"));
4598 new_thr->th.th_serial_team = serial_team =
4606 serial_team->
t.t_serialized = 0;
4608 serial_team->
t.t_threads[0] = new_thr;
4610 (
"__kmp_allocate_thread: after th_serial/serial_team : new_thr=%p\n",
4617 __kmp_initialize_fast_memory(new_thr);
4629 (
"__kmp_allocate_thread: T#%d init go fork=%u, plain=%u\n",
4636 balign[
b].
bb.team = NULL;
4638 balign[
b].
bb.use_oncore_barrier = 0;
4641 TCW_PTR(new_thr->th.th_sleep_loc, NULL);
4644 new_thr->th.th_spin_here =
FALSE;
4645 new_thr->th.th_next_waiting = 0;
4647 new_thr->th.th_blocking =
false;
4650#if KMP_AFFINITY_SUPPORTED
4651 new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
4652 new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
4653 new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
4654 new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
4657 new_thr->th.th_prev_level = 0;
4658 new_thr->th.th_prev_num_threads = 1;
4661 new_thr->th.th_active_in_pool =
FALSE;
4664 new_thr->th.th_set_nested_nth = NULL;
4665 new_thr->th.th_set_nested_nth_sz = 0;
4685#ifdef KMP_ADJUST_BLOCKTIME
4690 __kmp_zero_bt =
TRUE;
4695#if KMP_AFFINITY_SUPPORTED
4697 __kmp_affinity_set_init_mask(new_gtid,
FALSE);
4702 10, (
"__kmp_allocate_thread: before __kmp_create_worker: %p\n", new_thr));
4705 (
"__kmp_allocate_thread: after __kmp_create_worker: %p\n", new_thr));
4721 KF_TRACE(10, (
"__kmp_reinitialize_team: enter this_thread=%p team=%p\n",
4722 team->
t.t_threads[0], team));
4730 copy_icvs(&team->
t.t_implicit_task_taskdata[0].td_icvs, new_icvs);
4732 KF_TRACE(10, (
"__kmp_reinitialize_team: exit this_thread=%p team=%p\n",
4733 team->
t.t_threads[0], team));
4742 KF_TRACE(10, (
"__kmp_initialize_team: enter: team=%p\n", team));
4750 team->
t.t_master_tid = 0;
4752 team->
t.t_serialized = new_nproc > 1 ? 0 : 1;
4753 team->
t.t_nproc = new_nproc;
4756 team->
t.t_next_pool = NULL;
4761 team->
t.t_invoke = NULL;
4766#if KMP_ARCH_X86 || KMP_ARCH_X86_64
4767 team->
t.t_fp_control_saved =
FALSE;
4768 team->
t.t_x87_fpu_control_word = 0;
4769 team->
t.t_mxcsr = 0;
4772 team->
t.t_construct = 0;
4774 team->
t.t_ordered.dt.t_value = 0;
4775 team->
t.t_master_active =
FALSE;
4778 team->
t.t_copypriv_data = NULL;
4781 team->
t.t_copyin_counter = 0;
4784 team->
t.t_control_stack_top = NULL;
4789 KF_TRACE(10, (
"__kmp_initialize_team: exit: team=%p\n", team));
4792#if KMP_AFFINITY_SUPPORTED
4794 int first,
int last,
int newp) {
4795 th->th.th_first_place = first;
4796 th->th.th_last_place = last;
4797 th->th.th_new_place = newp;
4798 if (newp != th->th.th_current_place) {
4800 team->
t.t_display_affinity = 1;
4802 th->th.th_topology_ids = __kmp_affinity.ids[th->th.th_new_place];
4803 th->th.th_topology_attrs = __kmp_affinity.attrs[th->th.th_new_place];
4811static void __kmp_partition_places(
kmp_team_t *team,
int update_master_only) {
4819 int first_place = master_th->th.th_first_place;
4820 int last_place = master_th->th.th_last_place;
4821 int masters_place = master_th->th.th_current_place;
4822 int num_masks = __kmp_affinity.num_masks;
4823 team->
t.t_first_place = first_place;
4824 team->
t.t_last_place = last_place;
4826 KA_TRACE(20, (
"__kmp_partition_places: enter: proc_bind = %d T#%d(%d:0) "
4827 "bound to place %d partition = [%d,%d]\n",
4829 team->
t.t_id, masters_place, first_place, last_place));
4831 switch (proc_bind) {
4841 int n_th = team->
t.t_nproc;
4842 for (
f = 1;
f < n_th;
f++) {
4845 __kmp_set_thread_place(team, th, first_place, last_place, masters_place);
4847 KA_TRACE(100, (
"__kmp_partition_places: primary: T#%d(%d:%d) place %d "
4848 "partition = [%d,%d]\n",
4850 f, masters_place, first_place, last_place));
4856 int n_th = team->
t.t_nproc;
4858 if (first_place <= last_place) {
4859 n_places = last_place - first_place + 1;
4861 n_places = num_masks - first_place + last_place + 1;
4863 if (n_th <= n_places) {
4864 int place = masters_place;
4865 for (
f = 1;
f < n_th;
f++) {
4869 if (place == last_place) {
4870 place = first_place;
4871 }
else if (place == (num_masks - 1)) {
4876 __kmp_set_thread_place(team, th, first_place, last_place, place);
4878 KA_TRACE(100, (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4879 "partition = [%d,%d]\n",
4881 team->
t.t_id,
f, place, first_place, last_place));
4884 int S, rem, gap, s_count;
4885 S = n_th / n_places;
4887 rem = n_th - (
S * n_places);
4888 gap = rem > 0 ? n_places / rem : n_places;
4889 int place = masters_place;
4891 for (
f = 0;
f < n_th;
f++) {
4895 __kmp_set_thread_place(team, th, first_place, last_place, place);
4898 if ((s_count ==
S) && rem && (gap_ct == gap)) {
4900 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
4902 if (place == last_place) {
4903 place = first_place;
4904 }
else if (place == (num_masks - 1)) {
4912 }
else if (s_count ==
S) {
4913 if (place == last_place) {
4914 place = first_place;
4915 }
else if (place == (num_masks - 1)) {
4925 (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4926 "partition = [%d,%d]\n",
4928 th->th.th_new_place, first_place, last_place));
4936 int n_th = team->
t.t_nproc;
4939 if (first_place <= last_place) {
4940 n_places = last_place - first_place + 1;
4942 n_places = num_masks - first_place + last_place + 1;
4944 if (n_th <= n_places) {
4947 if (n_places != num_masks) {
4948 int S = n_places / n_th;
4949 int s_count, rem, gap, gap_ct;
4951 place = masters_place;
4952 rem = n_places - n_th *
S;
4953 gap = rem ? n_th / rem : 1;
4956 if (update_master_only == 1)
4958 for (
f = 0;
f < thidx;
f++) {
4962 int fplace = place, nplace = place;
4964 while (s_count <
S) {
4965 if (place == last_place) {
4966 place = first_place;
4967 }
else if (place == (num_masks - 1)) {
4974 if (rem && (gap_ct == gap)) {
4975 if (place == last_place) {
4976 place = first_place;
4977 }
else if (place == (num_masks - 1)) {
4985 __kmp_set_thread_place(team, th, fplace, place, nplace);
4988 if (place == last_place) {
4989 place = first_place;
4990 }
else if (place == (num_masks - 1)) {
4997 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
4998 "partition = [%d,%d], num_masks: %u\n",
5000 f, th->th.th_new_place, th->th.th_first_place,
5001 th->th.th_last_place, num_masks));
5007 double current =
static_cast<double>(masters_place);
5009 (
static_cast<double>(n_places + 1) /
static_cast<double>(n_th));
5014 if (update_master_only == 1)
5016 for (
f = 0;
f < thidx;
f++) {
5017 first =
static_cast<int>(current);
5018 last =
static_cast<int>(current + spacing) - 1;
5020 if (first >= n_places) {
5021 if (masters_place) {
5024 if (first == (masters_place + 1)) {
5028 if (last == masters_place) {
5038 if (last >= n_places) {
5039 last = (n_places - 1);
5049 th = team->
t.t_threads[
f];
5051 __kmp_set_thread_place(team, th, first, last, place);
5053 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5054 "partition = [%d,%d], spacing = %.4f\n",
5056 team->
t.t_id,
f, th->th.th_new_place,
5057 th->th.th_first_place, th->th.th_last_place, spacing));
5063 int S, rem, gap, s_count;
5064 S = n_th / n_places;
5066 rem = n_th - (
S * n_places);
5067 gap = rem > 0 ? n_places / rem : n_places;
5068 int place = masters_place;
5071 if (update_master_only == 1)
5073 for (
f = 0;
f < thidx;
f++) {
5077 __kmp_set_thread_place(team, th, place, place, place);
5080 if ((s_count ==
S) && rem && (gap_ct == gap)) {
5082 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
5084 if (place == last_place) {
5085 place = first_place;
5086 }
else if (place == (num_masks - 1)) {
5094 }
else if (s_count ==
S) {
5095 if (place == last_place) {
5096 place = first_place;
5097 }
else if (place == (num_masks - 1)) {
5106 KA_TRACE(100, (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5107 "partition = [%d,%d]\n",
5109 team->
t.t_id,
f, th->th.th_new_place,
5110 th->th.th_first_place, th->th.th_last_place));
5120 KA_TRACE(20, (
"__kmp_partition_places: exit T#%d\n", team->
t.t_id));
5129 ompt_data_t ompt_parallel_data,
5137 int use_hot_team = !root->r.r_active;
5139 int do_place_partition = 1;
5141 KA_TRACE(20, (
"__kmp_allocate_team: called\n"));
5148 team = master->th.th_team;
5149 level = team->
t.t_active_level;
5150 if (master->th.th_teams_microtask) {
5151 if (master->th.th_teams_size.nteams > 1 &&
5155 master->th.th_teams_level <
5162 if ((master->th.th_teams_size.nteams == 1 &&
5163 master->th.th_teams_level >= team->
t.t_level) ||
5165 do_place_partition = 0;
5167 hot_teams = master->th.th_hot_teams;
5169 hot_teams[
level].hot_team) {
5180 if (use_hot_team && new_nproc > 1) {
5185 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5186 "task_team[1] = %p before reinit\n",
5187 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5191 if (team->
t.t_nproc != new_nproc &&
5194 int old_nthr = team->
t.t_nproc;
5200 if (do_place_partition == 0)
5205 if (team->
t.t_nproc == new_nproc) {
5206 KA_TRACE(20, (
"__kmp_allocate_team: reusing hot team\n"));
5209 if (team->
t.t_size_changed == -1) {
5210 team->
t.t_size_changed = 1;
5221 root->r.r_uber_thread->th.th_ident);
5223 KF_TRACE(10, (
"__kmp_allocate_team2: T#%d, this_thread=%p team=%p\n", 0,
5224 team->
t.t_threads[0], team));
5227#if KMP_AFFINITY_SUPPORTED
5228 if ((team->
t.t_size_changed == 0) &&
5229 (team->
t.t_proc_bind == new_proc_bind)) {
5231 if (do_place_partition) {
5233 __kmp_partition_places(team, 1);
5236 KA_TRACE(200, (
"__kmp_allocate_team: reusing hot team #%d bindings: "
5237 "proc_bind = %d, partition = [%d,%d]\n",
5238 team->
t.t_id, new_proc_bind, team->
t.t_first_place,
5239 team->
t.t_last_place));
5241 if (do_place_partition) {
5243 __kmp_partition_places(team);
5249 }
else if (team->
t.t_nproc > new_nproc) {
5251 (
"__kmp_allocate_team: decreasing hot team thread count to %d\n",
5254 team->
t.t_size_changed = 1;
5263 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5266 th->th.th_task_team = NULL;
5275 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5278 team->
t.t_threads[
f] = NULL;
5284 for (
f = new_nproc;
f < team->
t.t_nproc; ++
f) {
5295 team->
t.t_nproc = new_nproc;
5299 root->r.r_uber_thread->th.th_ident);
5302 for (
f = 0;
f < new_nproc; ++
f) {
5303 team->
t.t_threads[
f]->th.th_team_nproc = new_nproc;
5308 KF_TRACE(10, (
"__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
5309 team->
t.t_threads[0], team));
5314 for (
f = 0;
f < team->
t.t_nproc;
f++) {
5316 team->
t.t_threads[
f]->th.th_team_nproc ==
5321 if (do_place_partition) {
5323#if KMP_AFFINITY_SUPPORTED
5324 __kmp_partition_places(team);
5330 (
"__kmp_allocate_team: increasing hot team thread count to %d\n",
5332 int old_nproc = team->
t.t_nproc;
5333 team->
t.t_size_changed = 1;
5336 if (new_nproc < avail_threads)
5337 avail_threads = new_nproc;
5339 for (
f = team->
t.t_nproc;
f < avail_threads; ++
f) {
5345 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5348 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5352 if (hot_teams[
level].hot_team_nth >= new_nproc) {
5356 team->
t.t_nproc = new_nproc;
5362 if (team->
t.t_max_nproc < new_nproc) {
5368#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5369 KMP_AFFINITY_SUPPORTED
5375 kmp_affinity_raii_t new_temp_affinity{__kmp_affin_fullMask};
5379 for (
f = team->
t.t_nproc;
f < new_nproc;
f++) {
5382 team->
t.t_threads[
f] = new_worker;
5385 (
"__kmp_allocate_team: team %d init T#%d arrived: "
5386 "join=%llu, plain=%llu\n",
5395 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5399 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5405#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5406 KMP_AFFINITY_SUPPORTED
5408 new_temp_affinity.restore();
5419 root->r.r_uber_thread->th.th_ident);
5423 for (
f = 0;
f < team->
t.t_nproc; ++
f)
5428 kmp_uint8 old_state = team->
t.t_threads[old_nproc - 1]->th.th_task_state;
5429 for (
f = old_nproc;
f < team->
t.t_nproc; ++
f)
5430 team->
t.t_threads[
f]->th.th_task_state = old_state;
5433 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5435 team->
t.t_threads[
f]->th.th_team_nproc ==
5440 if (do_place_partition) {
5442#if KMP_AFFINITY_SUPPORTED
5443 __kmp_partition_places(team);
5448 if (master->th.th_teams_microtask) {
5449 for (
f = 1;
f < new_nproc; ++
f) {
5452 thr->th.th_teams_microtask = master->th.th_teams_microtask;
5453 thr->th.th_teams_level = master->th.th_teams_level;
5454 thr->th.th_teams_size = master->th.th_teams_size;
5460 for (
f = 1;
f < new_nproc; ++
f) {
5465 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5468 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5480 KF_TRACE(10, (
" hot_team = %p\n", team));
5484 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5485 "task_team[1] = %p after reinit\n",
5486 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5504 if (team->
t.t_max_nproc >= max_nproc) {
5508 if (max_nproc > 1 &&
5518 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and "
5519 "task_team[1] %p to NULL\n",
5520 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5521 team->
t.t_task_team[0] = NULL;
5522 team->
t.t_task_team[1] = NULL;
5529 20, (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5536 team->
t.t_bar[
b].b_master_arrived = 0;
5537 team->
t.t_bar[
b].b_team_arrived = 0;
5542 team->
t.t_proc_bind = new_proc_bind;
5544 KA_TRACE(20, (
"__kmp_allocate_team: using team from pool %d.\n",
5551 team->
t.t_nested_nth = NULL;
5571 team->
t.t_max_nproc = max_nproc;
5572 if (max_nproc > 1 &&
5582 KA_TRACE(20, (
"__kmp_allocate_team: making a new team\n"));
5585 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and task_team[1] "
5587 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5588 team->
t.t_task_team[0] = NULL;
5590 team->
t.t_task_team[1] = NULL;
5599 team->
t.t_argc = argc;
5602 (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5609 team->
t.t_bar[
b].b_master_arrived = 0;
5610 team->
t.t_bar[
b].b_team_arrived = 0;
5615 team->
t.t_proc_bind = new_proc_bind;
5619 team->
t.ompt_serialized_team_info = NULL;
5624 team->
t.t_nested_nth = NULL;
5626 KA_TRACE(20, (
"__kmp_allocate_team: done creating a new team %d.\n",
5648 int use_hot_team = team == root->r.r_hot_team;
5651 level = team->
t.t_active_level - 1;
5652 if (master->th.th_teams_microtask) {
5653 if (master->th.th_teams_size.nteams > 1) {
5658 master->th.th_teams_level == team->
t.t_level) {
5676 team->
t.t_copyin_counter = 0;
5681 if (!use_hot_team) {
5684 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5687 volatile kmp_uint32 *state = &th->th.th_reap_state;
5698 if (th->th.th_sleep_loc)
5706 for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
5708 if (task_team != NULL) {
5709 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5711 team->
t.t_threads[
f]->th.th_task_team = NULL;
5715 (
"__kmp_free_team: T#%d deactivating task_team %p on team %d\n",
5718 team->
t.t_task_team[tt_idx] = NULL;
5725 team->
t.t_nested_nth != team->
t.t_parent->t.t_nested_nth) {
5729 team->
t.t_nested_nth = NULL;
5732 team->
t.t_parent = NULL;
5733 team->
t.t_level = 0;
5734 team->
t.t_active_level = 0;
5737 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5741 &(team->
t.t_threads[
f]->th.th_used_in_team), 1, 2);
5749 team->
t.b->go_release();
5751 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5752 if (team->
t.b->sleep[
f].sleep) {
5754 team->
t.t_threads[
f]->th.th_info.ds.ds_gtid,
5760 for (
int f = 1;
f < team->
t.t_nproc; ++
f) {
5761 while (team->
t.t_threads[
f]->th.th_used_in_team.load() != 0)
5767 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5768 team->
t.t_threads[
f] = NULL;
5771 if (team->
t.t_max_nproc > 1 &&
5783 team->
t.t_threads[1]->th.th_cg_roots);
5784 if (team->
t.t_threads[1]->th.th_cg_roots->cg_root == team->
t.t_threads[1]) {
5786 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5789 thr->th.th_cg_roots->cg_root == thr);
5792 thr->th.th_cg_roots = tmp->
up;
5793 KA_TRACE(100, (
"__kmp_free_team: Thread %p popping node %p and moving"
5794 " up to node %p. cg_nthreads was %d\n",
5795 thr, tmp, thr->th.th_cg_roots, tmp->
cg_nthreads));
5801 if (thr->th.th_cg_roots)
5802 thr->th.th_current_task->td_icvs.thread_limit =
5803 thr->th.th_cg_roots->cg_thread_limit;
5825 if (team->
t.t_argv != &team->
t.t_inline_argv[0])
5862 KA_TRACE(20, (
"__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
5874 balign[
b].
bb.team = NULL;
5875 balign[
b].
bb.leaf_kids = 0;
5877 this_th->th.th_task_state = 0;
5881 TCW_PTR(this_th->th.th_team, NULL);
5882 TCW_PTR(this_th->th.th_root, NULL);
5883 TCW_PTR(this_th->th.th_dispatch, NULL);
5885 while (this_th->th.th_cg_roots) {
5886 this_th->th.th_cg_roots->cg_nthreads--;
5887 KA_TRACE(100, (
"__kmp_free_thread: Thread %p decrement cg_nthreads on node"
5888 " %p of thread %p to %d\n",
5889 this_th, this_th->th.th_cg_roots,
5890 this_th->th.th_cg_roots->cg_root,
5891 this_th->th.th_cg_roots->cg_nthreads));
5893 if (tmp->
cg_root == this_th) {
5896 5, (
"__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
5897 this_th->th.th_cg_roots = tmp->
up;
5903 this_th->th.th_cg_roots = NULL;
5914 this_th->th.th_current_task = NULL;
5918 gtid = this_th->th.th_info.ds.ds_gtid;
5936 for (; (*scan != NULL) && ((*scan)->th.th_info.ds.ds_gtid < gtid);
5937 scan = &((*scan)->th.th_next_pool))
5942 TCW_PTR(this_th->th.th_next_pool, *scan);
5945 (this_th->th.th_info.ds.ds_gtid <
5946 this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
5950 if (this_th->th.th_active ==
TRUE) {
5952 this_th->th.th_active_in_pool =
TRUE;
5963#ifdef KMP_ADJUST_BLOCKTIME
5969 __kmp_zero_bt =
FALSE;
5980#if OMP_PROFILING_SUPPORT
5981 ProfileTraceFile = getenv(
"LIBOMPTARGET_PROFILE");
5983 if (ProfileTraceFile)
5984 llvm::timeTraceProfilerInitialize(500 ,
"libomptarget");
5987 int gtid = this_thr->th.th_info.ds.ds_gtid;
5992 KA_TRACE(10, (
"__kmp_launch_thread: T#%d start\n", gtid));
5999 if (ompd_state & OMPD_ENABLE_BP)
6000 ompd_bp_thread_begin();
6004 ompt_data_t *thread_data =
nullptr;
6006 thread_data = &(this_thr->th.ompt_thread_info.thread_data);
6007 *thread_data = ompt_data_none;
6009 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6010 this_thr->th.ompt_thread_info.wait_id = 0;
6012 this_thr->th.ompt_thread_info.parallel_flags = 0;
6015 ompt_thread_worker, thread_data);
6017 this_thr->th.ompt_thread_info.state = ompt_state_idle;
6027 KA_TRACE(20, (
"__kmp_launch_thread: T#%d waiting for work\n", gtid));
6034 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6038 pteam = &this_thr->th.th_team;
6046 (
"__kmp_launch_thread: T#%d(%d:%d) invoke microtask = %p\n",
6048 (*pteam)->t.t_pkfn));
6054 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
6058 rc = (*pteam)->t.t_invoke(gtid);
6062 KA_TRACE(20, (
"__kmp_launch_thread: T#%d(%d:%d) done microtask = %p\n",
6064 (*pteam)->t.t_pkfn));
6071 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6080 if (ompd_state & OMPD_ENABLE_BP)
6081 ompd_bp_thread_end();
6086 ompt_callbacks.ompt_callback(ompt_callback_thread_end)(thread_data);
6090 this_thr->th.th_task_team = NULL;
6094 KA_TRACE(10, (
"__kmp_launch_thread: T#%d done\n", gtid));
6097#if OMP_PROFILING_SUPPORT
6098 llvm::timeTraceProfilerFinishThread();
6110 KA_TRACE(30, (
"__kmp_internal_end_dest: T#%d\n", gtid));
6117#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
6128 KA_TRACE(30, (
"__kmp_internal_end_atexit\n"));
6165 gtid = thread->th.th_info.ds.ds_gtid;
6171 20, (
"__kmp_reap_thread: releasing T#%d from fork barrier for reap\n",
6200 if (thread->th.th_active_in_pool) {
6201 thread->th.th_active_in_pool =
FALSE;
6211 __kmp_free_fast_memory(thread);
6222#ifdef KMP_ADJUST_BLOCKTIME
6228 __kmp_zero_bt =
FALSE;
6235 if (thread->th.th_cons) {
6237 thread->th.th_cons = NULL;
6241 if (thread->th.th_pri_common != NULL) {
6243 thread->th.th_pri_common = NULL;
6247 if (thread->th.th_local.bget_data != NULL) {
6252#if KMP_AFFINITY_SUPPORTED
6253 if (thread->th.th_affin_mask != NULL) {
6254 KMP_CPU_FREE(thread->th.th_affin_mask);
6255 thread->th.th_affin_mask = NULL;
6259#if KMP_USE_HIER_SCHED
6260 if (thread->th.th_hier_bar_data != NULL) {
6262 thread->th.th_hier_bar_data = NULL;
6267 thread->th.th_serial_team = NULL;
6276 if (__kmp_itt_region_domains.count > 0) {
6277 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6278 kmp_itthash_entry_t *bucket = __kmp_itt_region_domains.buckets[
i];
6280 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6286 if (__kmp_itt_barrier_domains.count > 0) {
6287 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6288 kmp_itthash_entry_t *bucket = __kmp_itt_barrier_domains.buckets[
i];
6290 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6310 __kmp_reclaim_dead_roots();
6334 if (
TCR_4(__kmp_init_monitor)) {
6336 TCW_4(__kmp_init_monitor, 0);
6339 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6364 thread->th.th_next_pool = NULL;
6365 thread->th.th_in_pool =
FALSE;
6376 team->
t.t_next_pool = NULL;
6403 KA_TRACE(10, (
"__kmp_internal_end: all workers reaped\n"));
6412 if (
TCR_4(__kmp_init_monitor)) {
6414 TCW_4(__kmp_init_monitor, 0);
6417 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6437 KA_TRACE(11, (
"__kmp_internal_end_library: abort, exiting\n"));
6442 KA_TRACE(10, (
"__kmp_internal_end_library: already finished\n"));
6461 10, (
"__kmp_internal_end_library: enter T#%d (%d)\n", gtid, gtid_req));
6463 KA_TRACE(10, (
"__kmp_internal_end_library: !__kmp_init_runtime, system "
6464 "already shutdown\n"));
6467 KA_TRACE(10, (
"__kmp_internal_end_library: monitor thread, gtid not "
6468 "registered, or system shutdown\n"));
6471 KA_TRACE(10, (
"__kmp_internal_end_library: gtid not registered or system "
6481 (
"__kmp_internal_end_library: root still active, abort T#%d\n",
6488 (
"__kmp_internal_end_library: unregistering sibling T#%d\n", gtid));
6496#ifdef DUMP_DEBUG_ON_EXIT
6512 KA_TRACE(10, (
"__kmp_internal_end_library: abort, exiting\n"));
6535 KA_TRACE(10, (
"__kmp_internal_end_library: exit\n"));
6537#ifdef DUMP_DEBUG_ON_EXIT
6560 KA_TRACE(11, (
"__kmp_internal_end_thread: abort, exiting\n"));
6565 KA_TRACE(10, (
"__kmp_internal_end_thread: already finished\n"));
6585 (
"__kmp_internal_end_thread: enter T#%d (%d)\n", gtid, gtid_req));
6587 KA_TRACE(10, (
"__kmp_internal_end_thread: !__kmp_init_runtime, system "
6588 "already shutdown\n"));
6591 KA_TRACE(10, (
"__kmp_internal_end_thread: monitor thread, gtid not "
6592 "registered, or system shutdown\n"));
6595 KA_TRACE(10, (
"__kmp_internal_end_thread: gtid not registered or system "
6605 (
"__kmp_internal_end_thread: root still active, abort T#%d\n",
6609 KA_TRACE(10, (
"__kmp_internal_end_thread: unregistering sibling T#%d\n",
6615 KA_TRACE(10, (
"__kmp_internal_end_thread: worker thread T#%d\n", gtid));
6622 (
"__kmp_internal_end_thread: worker thread done, exiting T#%d\n",
6632 KA_TRACE(10, (
"__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
6641 KA_TRACE(10, (
"__kmp_internal_end_thread: abort, exiting\n"));
6664 (
"__kmp_internal_end_thread: remaining sibling task: gtid==%d\n",
i));
6678 KA_TRACE(10, (
"__kmp_internal_end_thread: exit T#%d\n", gtid_req));
6680#ifdef DUMP_DEBUG_ON_EXIT
6700#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
6708#if defined(KMP_USE_SHM)
6709bool __kmp_shm_available =
false;
6710bool __kmp_tmp_available =
false;
6712char *temp_reg_status_file_name =
nullptr;
6723#if KMP_ARCH_X86 || KMP_ARCH_X86_64
6732 KA_TRACE(50, (
"__kmp_register_library_startup: %s=\"%s\"\n",
name,
6739#if defined(KMP_USE_SHM)
6740 char *shm_name =
nullptr;
6741 char *data1 =
nullptr;
6743 if (__kmp_shm_available) {
6746 int shm_preexist = 0;
6747 fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6748 if ((fd1 == -1) && (errno == EEXIST)) {
6751 fd1 = shm_open(shm_name, O_RDWR, 0600);
6754 __kmp_shm_available =
false;
6759 if (__kmp_shm_available && shm_preexist == 0) {
6760 if (ftruncate(fd1, SHM_SIZE) == -1) {
6761 KMP_WARNING(FunctionError,
"Can't set size of SHM");
6762 __kmp_shm_available =
false;
6765 if (__kmp_shm_available) {
6766 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6768 if (data1 == MAP_FAILED) {
6770 __kmp_shm_available =
false;
6773 if (__kmp_shm_available) {
6774 if (shm_preexist == 0) {
6779 munmap(data1, SHM_SIZE);
6784 if (!__kmp_shm_available)
6786 if (!__kmp_shm_available && __kmp_tmp_available) {
6794 int tmp_preexist = 0;
6795 fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6796 if ((fd1 == -1) && (errno == EEXIST)) {
6799 fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
6802 __kmp_tmp_available =
false;
6807 if (__kmp_tmp_available && tmp_preexist == 0) {
6809 if (ftruncate(fd1, SHM_SIZE) == -1) {
6810 KMP_WARNING(FunctionError,
"Can't set size of /tmp file");
6811 __kmp_tmp_available =
false;
6814 if (__kmp_tmp_available) {
6815 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6817 if (data1 == MAP_FAILED) {
6819 __kmp_tmp_available =
false;
6822 if (__kmp_tmp_available) {
6823 if (tmp_preexist == 0) {
6828 munmap(data1, SHM_SIZE);
6833 if (!__kmp_shm_available && !__kmp_tmp_available) {
6854 char *flag_addr_str = NULL;
6855 char *flag_val_str = NULL;
6856 char const *file_name = NULL;
6861 unsigned long *flag_addr = 0;
6862 unsigned long flag_val = 0;
6865 if (flag_addr != 0 && flag_val != 0 && strcmp(file_name,
"") != 0) {
6883 file_name =
"unknown library";
6900#if defined(KMP_USE_SHM)
6901 if (__kmp_shm_available) {
6902 shm_unlink(shm_name);
6903 }
else if (__kmp_tmp_available) {
6904 unlink(temp_reg_status_file_name);
6920#if defined(KMP_USE_SHM)
6938 if (reg_str == NULL ||
6946#if defined(KMP_USE_SHM)
6947 char *shm_name =
nullptr;
6949 if (__kmp_shm_available) {
6951 fd1 = shm_open(shm_name, O_RDONLY, 0600);
6953 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6954 if (data1 != MAP_FAILED) {
6956 munmap(data1, SHM_SIZE);
6960 }
else if (__kmp_tmp_available) {
6961 fd1 = open(temp_reg_status_file_name, O_RDONLY);
6963 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6964 if (data1 != MAP_FAILED) {
6966 munmap(data1, SHM_SIZE);
6977 if (
value != NULL && strcmp(
value, reg_str) == 0) {
6979#if defined(KMP_USE_SHM)
6980 if (__kmp_shm_available) {
6981 shm_unlink(shm_name);
6982 }
else if (__kmp_tmp_available) {
6983 unlink(temp_reg_status_file_name);
6992#if defined(KMP_USE_SHM)
6995 if (temp_reg_status_file_name)
7008#if KMP_MIC_SUPPORTED
7010static void __kmp_check_mic_type() {
7011 kmp_cpuid_t cpuid_state = {0};
7012 kmp_cpuid_t *cs_p = &cpuid_state;
7013 __kmp_x86_cpuid(1, 0, cs_p);
7015 if ((cs_p->eax & 0xff0) == 0xB10) {
7016 __kmp_mic_type = mic2;
7017 }
else if ((cs_p->eax & 0xf0ff0) == 0x50670) {
7018 __kmp_mic_type = mic3;
7020 __kmp_mic_type = non_mic;
7027static void __kmp_user_level_mwait_init() {
7028 struct kmp_cpuid
buf;
7029 __kmp_x86_cpuid(7, 0, &
buf);
7030 __kmp_waitpkg_enabled = ((
buf.ecx >> 5) & 1);
7031 __kmp_umwait_enabled = __kmp_waitpkg_enabled && __kmp_user_level_mwait;
7032 __kmp_tpause_enabled = __kmp_waitpkg_enabled && (__kmp_tpause_state > 0);
7033 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_umwait_enabled = %d\n",
7034 __kmp_umwait_enabled));
7037#ifndef AT_INTELPHIUSERMWAIT
7040#define AT_INTELPHIUSERMWAIT 10000
7046unsigned long getauxval(
unsigned long) {
return 0; }
7048static void __kmp_user_level_mwait_init() {
7053 if (__kmp_mic_type == mic3) {
7054 unsigned long res = getauxval(AT_INTELPHIUSERMWAIT);
7055 if ((
res & 0x1) || __kmp_user_level_mwait) {
7056 __kmp_mwait_enabled =
TRUE;
7057 if (__kmp_user_level_mwait) {
7061 __kmp_mwait_enabled =
FALSE;
7064 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_mic_type = %d, "
7065 "__kmp_mwait_enabled = %d\n",
7066 __kmp_mic_type, __kmp_mwait_enabled));
7074 KA_TRACE(10, (
"__kmp_do_serial_initialize: enter\n"));
7092#if ENABLE_LIBOMPTARGET
7094 __kmp_init_omptarget();
7109 KA_TRACE(10, (
"__kmp_do_serial_initialize: reinitialization of library\n"));
7116#if KMP_USE_ADAPTIVE_LOCKS
7117#if KMP_DEBUG_ADAPTIVE_LOCKS
7118 __kmp_init_speculative_stats();
7121#if KMP_STATS_ENABLED
7149#if KMP_MIC_SUPPORTED
7150 __kmp_check_mic_type();
7152#if ENABLE_LIBOMPTARGET
7153 __kmp_target_init();
7182 __kmp_monitor_wakeups =
7184 __kmp_bt_intervals =
7197#if KMP_FAST_REDUCTION_BARRIER
7198#define kmp_reduction_barrier_gather_bb ((int)1)
7199#define kmp_reduction_barrier_release_bb ((int)1)
7200#define kmp_reduction_barrier_gather_pat __kmp_barrier_gather_pat_dflt
7201#define kmp_reduction_barrier_release_pat __kmp_barrier_release_pat_dflt
7208#if KMP_FAST_REDUCTION_BARRIER
7218#if KMP_FAST_REDUCTION_BARRIER
7219#undef kmp_reduction_barrier_release_pat
7220#undef kmp_reduction_barrier_gather_pat
7221#undef kmp_reduction_barrier_release_bb
7222#undef kmp_reduction_barrier_gather_bb
7224#if KMP_MIC_SUPPORTED
7225 if (__kmp_mic_type == mic2) {
7233#if KMP_FAST_REDUCTION_BARRIER
7234 if (__kmp_mic_type == mic2) {
7258#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
7259 __kmp_user_level_mwait_init();
7310 KA_TRACE(10, (
"__kmp_do_serial_initialize T#%d\n", gtid));
7323#if !KMP_DYNAMIC_LIB || \
7324 ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
7337#if KMP_HANDLE_SIGNALS
7343 __kmp_install_signals(
FALSE);
7346 __kmp_install_signals(
TRUE);
7373 KA_TRACE(10, (
"__kmp_do_serial_initialize: exit\n"));
7391 int prev_dflt_team_nth;
7397 KA_TRACE(10, (
"__kmp_middle_initialize: enter\n"));
7409#if KMP_AFFINITY_SUPPORTED
7412 __kmp_affinity_initialize(__kmp_affinity);
7431#ifdef KMP_DFLT_NTH_CORES
7434 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7435 "__kmp_ncores (%d)\n",
7440 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7441 "__kmp_avail_proc(%d)\n",
7469 if (thread->th.th_current_task->td_icvs.nproc != 0)
7477 (
"__kmp_middle_initialize: final value for __kmp_dflt_team_nth = %d\n",
7480#ifdef KMP_ADJUST_BLOCKTIME
7485 __kmp_zero_bt =
TRUE;
7493 KA_TRACE(10, (
"__kmp_do_middle_initialize: exit\n"));
7525 (
"__kmp_parallel_initialize: attempt to init while shutting down\n"));
7539 KA_TRACE(10, (
"__kmp_parallel_initialize: enter\n"));
7542#if KMP_ARCH_X86 || KMP_ARCH_X86_64
7545 __kmp_store_x87_fpu_control_word(&__kmp_init_x87_fpu_control_word);
7546 __kmp_store_mxcsr(&__kmp_init_mxcsr);
7547 __kmp_init_mxcsr &= KMP_X86_MXCSR_MASK;
7551#if KMP_HANDLE_SIGNALS
7553 __kmp_install_signals(
TRUE);
7559#if defined(USE_LOAD_BALANCE)
7577 KA_TRACE(10, (
"__kmp_parallel_initialize: exit\n"));
7598#if KMP_AFFINITY_SUPPORTED
7602 if (!__kmp_hh_affinity.flags.initialized)
7603 __kmp_affinity_initialize(__kmp_hh_affinity);
7634 this_thr->th.th_local.this_construct = 0;
7668 if (__itt_stack_caller_create_ptr) {
7670 if (team->
t.t_stack_id != NULL) {
7671 __kmp_itt_stack_callee_enter((__itt_caller)team->
t.t_stack_id);
7674 __kmp_itt_stack_callee_enter(
7675 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7679#if INCLUDE_SSC_MARKS
7680 SSC_MARK_INVOKING();
7685 void **exit_frame_p;
7686 ompt_data_t *my_task_data;
7687 ompt_data_t *my_parallel_data;
7691 exit_frame_p = &(team->
t.t_implicit_task_taskdata[tid]
7692 .ompt_task_info.frame.exit_frame.ptr);
7694 exit_frame_p = &dummy;
7698 &(team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data);
7699 my_parallel_data = &(team->
t.ompt_team_info.parallel_data);
7701 ompt_team_size = team->
t.t_nproc;
7703 ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
7709#if KMP_STATS_ENABLED
7711 if (previous_state == stats_state_e::TEAMS_REGION) {
7720 tid, (
int)team->
t.t_argc, (
void **)team->
t.t_argv
7727 *exit_frame_p = NULL;
7728 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_team;
7731#if KMP_STATS_ENABLED
7732 if (previous_state == stats_state_e::TEAMS_REGION) {
7739 if (__itt_stack_caller_create_ptr) {
7741 if (team->
t.t_stack_id != NULL) {
7742 __kmp_itt_stack_callee_leave((__itt_caller)team->
t.t_stack_id);
7745 __kmp_itt_stack_callee_leave(
7746 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7760 thr->th.th_set_nproc = thr->th.th_teams_size.nth;
7763 KA_TRACE(20, (
"__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
7772 KA_TRACE(100, (
"__kmp_teams_master: Thread %p created node %p and init"
7773 " cg_nthreads to 1\n",
7775 tmp->
up = thr->th.th_cg_roots;
7776 thr->th.th_cg_roots = tmp;
7780#if INCLUDE_SSC_MARKS
7786#if INCLUDE_SSC_MARKS
7790 if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
7791 thr->th.th_teams_size.nth = thr->th.th_team_nproc;
7814 ompt_data_t *task_data =
7815 &team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data;
7816 ompt_data_t *parallel_data = &team->
t.ompt_team_info.parallel_data;
7819 ompt_scope_begin, parallel_data, task_data, team->
t.t_nproc, tid,
7821 OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid;
7826 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_league;
7839 if (num_threads > 0)
7840 thr->th.th_set_nproc = num_threads;
7844 int *num_threads_list) {
7849 if (num_threads_list[0] > 0)
7850 thr->th.th_set_nproc = num_threads_list[0];
7851 thr->th.th_set_nested_nth =
7854 thr->th.th_set_nested_nth[
i] = num_threads_list[
i];
7855 thr->th.th_set_nested_nth_sz = list_length;
7861 thr->th.th_nt_strict =
true;
7862 thr->th.th_nt_loc =
loc;
7865 thr->th.th_nt_sev = sev;
7870 thr->th.th_nt_msg = msg;
7872 thr->th.th_nt_msg =
"Cannot form team with number of threads specified by "
7873 "strict num_threads clause.";
7886 if (num_threads == 0) {
7898 if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) {
7899 num_threads = thr->th.th_current_task->td_icvs.thread_limit;
7904 if (num_threads == 0) {
7908 if (num_threads < 0) {
7915 thr->th.th_current_task->td_icvs.thread_limit = num_threads;
7922 if (new_threads == 0) {
7925 if (new_threads != num_threads) {
7929 KMP_MSG(CantFormThrTeam, num_threads, new_threads),
7933 num_threads = new_threads;
7936 thr->th.th_teams_size.nth = num_threads;
7944 if (num_teams < 0) {
7951 if (num_teams == 0) {
7969 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
7977 int num_teams_ub,
int num_threads) {
7983 if (num_teams_lb > num_teams_ub) {
7990 if (num_teams_lb == 0 && num_teams_ub > 0)
7991 num_teams_lb = num_teams_ub;
7993 if (num_teams_lb == 0 && num_teams_ub == 0) {
8004 }
else if (num_teams_lb == num_teams_ub) {
8005 num_teams = num_teams_ub;
8007 if (num_threads <= 0) {
8009 num_teams = num_teams_lb;
8011 num_teams = num_teams_ub;
8017 if (num_teams < num_teams_lb) {
8018 num_teams = num_teams_lb;
8019 }
else if (num_teams > num_teams_ub) {
8020 num_teams = num_teams_ub;
8026 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
8034 thr->th.th_set_proc_bind = proc_bind;
8051 team->
t.t_construct = 0;
8052 team->
t.t_ordered.dt.t_value =
8057 if (team->
t.t_max_nproc > 1) {
8060 team->
t.t_disp_buffer[
i].buffer_index =
i;
8061 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
8064 team->
t.t_disp_buffer[0].buffer_index = 0;
8065 team->
t.t_disp_buffer[0].doacross_buf_idx = 0;
8072 for (
f = 0;
f < team->
t.t_nproc;
f++) {
8074 team->
t.t_threads[
f]->th.th_team_nproc == team->
t.t_nproc);
8095 __kmp_printf(
"GTID: %d, __kmp_threads[%d]=%p\n", gtid, gtid,
8097 __kmp_printf(
"__kmp_threads[%d]->th.th_team_nproc=%d, TEAM: %p, "
8098 "team->t.t_nproc=%d\n",
8109 ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
8111 (ompt_state == ompt_state_wait_barrier_teams ||
8112 ompt_state == ompt_state_wait_barrier_implicit_parallel)) {
8113 int ds_tid = this_thr->th.th_info.ds.ds_tid;
8114 ompt_data_t *task_data = OMPT_CUR_TASK_DATA(this_thr);
8115 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
8117 void *codeptr = NULL;
8121 codeptr = OMPT_CUR_TEAM_INFO(this_thr)->master_return_address;
8123 ompt_sync_region_t sync_kind = ompt_sync_region_barrier_implicit_parallel;
8124 if (this_thr->th.ompt_thread_info.parallel_flags & ompt_parallel_league)
8125 sync_kind = ompt_sync_region_barrier_teams;
8128 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8132 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8137 ompt_scope_end, NULL, task_data, 0, ds_tid,
8138 ompt_task_implicit);
8149#ifdef USE_LOAD_BALANCE
8153static int __kmp_active_hot_team_nproc(
kmp_root_t *root) {
8158 if (root->r.r_active) {
8161 hot_team = root->r.r_hot_team;
8163 return hot_team->
t.t_nproc - 1;
8168 for (
i = 1;
i < hot_team->
t.t_nproc;
i++) {
8169 if (hot_team->
t.t_threads[
i]->th.th_active) {
8178static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc) {
8181 int hot_team_active;
8182 int team_curr_active;
8185 KB_TRACE(20, (
"__kmp_load_balance_nproc: called root:%p set_nproc:%d\n", root,
8189 ->th.th_current_task->td_icvs.dynamic ==
TRUE);
8192 if (set_nproc == 1) {
8193 KB_TRACE(20, (
"__kmp_load_balance_nproc: serial execution.\n"));
8203 hot_team_active = __kmp_active_hot_team_nproc(root);
8204 team_curr_active = pool_active + hot_team_active + 1;
8208 KB_TRACE(30, (
"__kmp_load_balance_nproc: system active = %d pool active = %d "
8209 "hot team active = %d\n",
8210 system_active, pool_active, hot_team_active));
8212 if (system_active < 0) {
8217 KMP_WARNING(CantLoadBalUsing,
"KMP_DYNAMIC_MODE=thread limit");
8221 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
8222 if (retval > set_nproc) {
8229 KB_TRACE(20, (
"__kmp_load_balance_nproc: thread limit exit. retval:%d\n",
8237 if (system_active < team_curr_active) {
8238 system_active = team_curr_active;
8241 if (retval > set_nproc) {
8248 KB_TRACE(20, (
"__kmp_load_balance_nproc: exit. retval:%d\n", retval));
8260 KA_TRACE(10, (
"__kmp_cleanup: enter\n"));
8263#if KMP_HANDLE_SIGNALS
8264 __kmp_remove_signals();
8270#if KMP_AFFINITY_SUPPORTED
8271 __kmp_affinity_uninitialize();
8277 KA_TRACE(10, (
"__kmp_cleanup: go serial cleanup\n"));
8309#if KMP_USE_DYNAMIC_LOCK
8310 __kmp_cleanup_indirect_user_locks();
8315 if (ompd_env_block) {
8317 ompd_env_block = NULL;
8318 ompd_env_block_size = 0;
8322#if KMP_AFFINITY_SUPPORTED
8324 __kmp_cpuinfo_file = NULL;
8327#if KMP_USE_ADAPTIVE_LOCKS
8328#if KMP_DEBUG_ADAPTIVE_LOCKS
8329 __kmp_print_speculative_stats();
8355#if KMP_USE_HIER_SCHED
8359#if KMP_STATS_ENABLED
8366 KA_TRACE(10, (
"__kmp_cleanup: exit\n"));
8374 if ((env = getenv(
"KMP_IGNORE_MPPBEG")) != NULL) {
8385 if ((env = getenv(
"KMP_IGNORE_MPPEND")) != NULL) {
8403 if (root->r.r_begin)
8406 if (root->r.r_begin) {
8411 root->r.r_begin =
TRUE;
8428 root = thread->th.th_root;
8430 KA_TRACE(20, (
"__kmp_user_set_library: enter T#%d, arg: %d, %d\n", gtid, arg,
8432 if (root->r.r_in_parallel) {
8440 thread->th.th_set_nproc = 0;
8444 thread->th.th_set_nproc = 0;
8449 thread->th.th_set_nproc = 0;
8465 if (arg & (0x1000 - 1)) {
8466 arg &= ~(0x1000 - 1);
8516 teams_serialized = 0;
8517 if (thr->th.th_teams_microtask) {
8519 int tlevel = thr->th.th_teams_level;
8520 int ii = team->
t.t_level;
8521 teams_serialized = team->
t.t_serialized;
8522 int level = tlevel + 1;
8525 for (teams_serialized = team->
t.t_serialized;
8526 (teams_serialized > 0) && (
ii >
level); teams_serialized--,
ii--) {
8528 if (team->
t.t_serialized && (!teams_serialized)) {
8529 team = team->
t.t_parent;
8533 team = team->
t.t_parent;
8546 if (serialized > 1) {
8549 return team->
t.t_master_tid;
8559 if (serialized > 1) {
8562 return team->
t.t_parent->t.t_nproc;
8609#if KMP_AFFINITY_SUPPORTED
8610 {
'A',
"thread_affinity",
's'},
8612 {
't',
"team_num",
'd'},
8613 {
'T',
"num_teams",
'd'},
8614 {
'L',
"nesting_level",
'd'},
8615 {
'n',
"thread_num",
'd'},
8616 {
'N',
"num_threads",
'd'},
8617 {
'a',
"ancestor_tnum",
'd'},
8619 {
'P',
"process_id",
'd'},
8620 {
'i',
"native_thread_id",
'd'}};
8626 int rc, format_index, field_value;
8627 const char *width_left, *width_right;
8628 bool pad_zeros, right_justify, parse_long_name, found_valid_name;
8629 static const int FORMAT_SIZE = 20;
8630 char format[FORMAT_SIZE] = {0};
8631 char absolute_short_name = 0;
8656 right_justify =
false;
8658 right_justify =
true;
8662 width_left = width_right = NULL;
8663 if (**ptr >=
'0' && **ptr <=
'9') {
8671 format[format_index++] =
'%';
8673 format[format_index++] =
'-';
8675 format[format_index++] =
'0';
8676 if (width_left && width_right) {
8680 while (
i < 8 && width_left < width_right) {
8681 format[format_index++] = *width_left;
8689 found_valid_name =
false;
8690 parse_long_name = (**ptr ==
'{');
8691 if (parse_long_name)
8699 if (parse_long_name) {
8701 if (strncmp(*ptr, long_name,
length) == 0) {
8702 found_valid_name =
true;
8705 }
else if (**ptr == short_name) {
8706 found_valid_name =
true;
8709 if (found_valid_name) {
8710 format[format_index++] = field_format;
8711 format[format_index++] =
'\0';
8712 absolute_short_name = short_name;
8716 if (parse_long_name) {
8718 absolute_short_name = 0;
8726 switch (absolute_short_name) {
8759#if KMP_AFFINITY_SUPPORTED
8761 if (th->th.th_affin_mask) {
8764 __kmp_affinity_str_buf_mask(&
buf, th->th.th_affin_mask);
8777 if (parse_long_name) {
8798 const char *parse_ptr;
8815 if (parse_ptr == NULL || *parse_ptr ==
'\0') {
8820 while (*parse_ptr !=
'\0') {
8822 if (*parse_ptr ==
'%') {
8849 int blocktime = arg;
8868 bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(blocktime, __kmp_monitor_wakeups);
8870 set__bt_intervals_team(thread->th.th_team, tid, bt_intervals);
8871 set__bt_intervals_team(thread->th.th_serial_team, 0, bt_intervals);
8880 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
8881 "bt_intervals=%d, monitor_updates=%d\n",
8883 thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
8884 __kmp_monitor_wakeups));
8886 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d\n",
8888 thread->th.th_team->t.t_id, tid, blocktime));
8909 void *reduce_data,
void (*reduce_func)(
void *lhs_data,
void *rhs_data),
8927#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED \
8929 ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
8930#define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
8936 if (team_size == 1) {
8944#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
8945 KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
8946 KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_WASM32 || KMP_ARCH_WASM64 || \
8949#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8950 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HAIKU || \
8951 KMP_OS_HURD || KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8953 int teamsize_cutoff = 4;
8955#if KMP_MIC_SUPPORTED
8956 if (__kmp_mic_type != non_mic) {
8957 teamsize_cutoff = 8;
8961 if (tree_available) {
8962 if (team_size <= teamsize_cutoff) {
8963 if (atomic_available) {
8967 retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
8969 }
else if (atomic_available) {
8973#error "Unknown or unsupported OS"
8978#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8979 KMP_ARCH_PPC || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC
8981#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8982 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HAIKU || KMP_OS_HURD || \
8983 KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8987 if (atomic_available) {
8988 if (num_vars <= 2) {
8996 if (atomic_available && (num_vars <= 3)) {
8998 }
else if (tree_available) {
8999 if ((reduce_size > (9 *
sizeof(
kmp_real64))) &&
9000 (reduce_size < (2000 *
sizeof(
kmp_real64)))) {
9001 retval = TREE_REDUCE_BLOCK_WITH_PLAIN_BARRIER;
9006#error "Unknown or unsupported OS"
9010#error "Unknown or unsupported architecture"
9023 int atomic_available, tree_available;
9032 if (!atomic_available) {
9040 if (!tree_available) {
9044#if KMP_FAST_REDUCTION_BARRIER
9045 forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
9054 retval = forced_retval;
9057 KA_TRACE(10, (
"reduction method selected=%08x\n", retval));
9059#undef FAST_REDUCTION_TREE_METHOD_GENERATED
9060#undef FAST_REDUCTION_ATOMIC_METHOD_GENERATED
9163 for (
int f = 1;
f < old_nthreads; ++
f) {
9166 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 0) {
9172 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3) {
9173 while (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3)
9179 team->
t.t_threads[
f]->th.th_used_in_team.store(2);
9183 team->
t.b->go_release();
9189 int count = old_nthreads - 1;
9191 count = old_nthreads - 1;
9192 for (
int f = 1;
f < old_nthreads; ++
f) {
9193 if (other_threads[
f]->th.th_used_in_team.load() != 0) {
9196 void *, other_threads[
f]->th.th_sleep_loc);
9206 team->
t.b->update_num_threads(new_nthreads);
9207 team->
t.b->go_reset();
9218 for (
int f = 1;
f < new_nthreads; ++
f) {
9221 &(team->
t.t_threads[
f]->th.th_used_in_team), 0, 3);
9230 int count = new_nthreads - 1;
9232 count = new_nthreads - 1;
9233 for (
int f = 1;
f < new_nthreads; ++
f) {
9234 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 1) {
9254std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;
9256void __kmp_hidden_helper_wrapper_fn(
int *gtid,
int *, ...) {
9273 for (
int i = 1;
i < __kmp_hit_hidden_helper_threads_num; ++
i) {
9319 for (
int i = 0;
i < levels; ++
i)
9341 loc++, hw_level++) {
9350 int upper_levels = 1;
9384#if ENABLE_LIBOMPTARGET
9385void (*kmp_target_sync_cb)(
ident_t *loc_ref,
int gtid,
void *current_task,
9386 void *
event) = NULL;
9387void __kmp_target_init() {
9389 *(
void **)(&kmp_target_sync_cb) =
KMP_DLSYM(
"__tgt_target_sync");
9395#if !KMP_STATS_ENABLED
9402#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)
char const __kmp_version_omp_api[]
static char * __kmp_registration_str
int __kmp_ignore_mppbeg(void)
void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team)
void __kmp_aux_set_stacksize(size_t arg)
void __kmp_internal_end_library(int gtid_req)
size_t __kmp_aux_capture_affinity(int gtid, const char *format, kmp_str_buf_t *buffer)
void __kmp_resize_dist_barrier(kmp_team_t *team, int old_nthreads, int new_nthreads)
int __kmp_omp_debug_struct_info
static void __kmp_print_thread_storage_map(kmp_info_t *thr, int gtid)
void __kmp_aux_display_affinity(int gtid, const char *format)
void __kmp_init_nesting_mode()
void __kmp_register_library_startup(void)
void __kmp_free_thread(kmp_info_t *this_th)
int __kmp_invoke_task_func(int gtid)
void __kmp_get_schedule(int gtid, kmp_sched_t *kind, int *chunk)
void __kmp_set_strict_num_threads(ident_t *loc, int gtid, int sev, const char *msg)
void __kmp_abort_process()
static const kmp_affinity_format_field_t __kmp_affinity_format_table[]
void __kmp_set_num_teams(int num_teams)
static void __kmp_alloc_argv_entries(int argc, kmp_team_t *team, int realloc)
void __kmp_save_internal_controls(kmp_info_t *thread)
int __kmp_invoke_teams_master(int gtid)
void __kmp_hidden_helper_initialize()
void __kmp_add_threads_to_team(kmp_team_t *team, int new_nthreads)
void __kmp_push_num_threads_list(ident_t *id, int gtid, kmp_uint32 list_length, int *num_threads_list)
static void __kmp_reallocate_team_arrays(kmp_team_t *team, int max_nth)
static int __kmp_reserve_threads(kmp_root_t *root, kmp_team_t *parent_team, int master_tid, int set_nthreads, int enter_teams)
void __kmp_serial_initialize(void)
static bool __kmp_is_entering_teams(int active_level, int level, int teams_level, kmp_va_list ap)
void __kmp_resume_if_soft_paused()
void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid)
int __kmp_get_global_thread_id()
void __kmp_internal_begin(void)
static char * __kmp_reg_status_name()
static void __kmp_print_team_storage_map(const char *header, kmp_team_t *team, int team_id, int num_thr)
static void __kmp_do_serial_initialize(void)
void __kmp_fork_barrier(int gtid, int tid)
int __kmp_get_global_thread_id_reg()
int __kmp_ignore_mppend(void)
static kmp_nested_nthreads_t * __kmp_override_nested_nth(kmp_info_t *thr, int level)
kmp_int32 __kmp_get_reduce_method(void)
static int __kmp_aux_capture_affinity_field(int gtid, const kmp_info_t *th, const char **ptr, kmp_str_buf_t *field_buffer)
static int __kmp_fork_in_teams(ident_t *loc, int gtid, kmp_team_t *parent_team, kmp_int32 argc, kmp_info_t *master_th, kmp_root_t *root, enum fork_context_e call_context, microtask_t microtask, launch_t invoker, int master_set_numthreads, int level, kmp_va_list ap)
void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid)
#define KMP_STRCPY_S(dst, bsz, src)
int __kmp_default_tp_capacity(int req_nproc, int max_nth, int all_threads_specified)
int __kmp_initial_threads_capacity(int req_nproc)
void __kmp_env_initialize(char const *string)
void __kmp_display_env_impl(int display_env, int display_env_verbose)
void __kmp_stats_init(void)
void __kmp_stats_fini(void)
Functions for collecting statistics.
#define KMP_COUNT_VALUE(n, v)
#define KMP_PUSH_PARTITIONED_TIMER(name)
#define KMP_GET_THREAD_STATE()
#define KMP_POP_PARTITIONED_TIMER()
#define KMP_INIT_PARTITIONED_TIMERS(name)
#define KMP_SET_THREAD_STATE_BLOCK(state_name)
#define KMP_TIME_PARTITIONED_BLOCK(name)
#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n)
#define KMP_SET_THREAD_STATE(state_name)
void __kmp_str_split(char *str, char delim, char **head, char **tail)
void __kmp_str_buf_clear(kmp_str_buf_t *buffer)
void __kmp_str_buf_free(kmp_str_buf_t *buffer)
char * __kmp_str_format(char const *format,...)
int __kmp_str_match_true(char const *data)
void __kmp_str_buf_cat(kmp_str_buf_t *buffer, char const *str, size_t len)
void __kmp_str_buf_catbuf(kmp_str_buf_t *dest, const kmp_str_buf_t *src)
int __kmp_str_buf_print(kmp_str_buf_t *buffer, char const *format,...)
int __kmp_str_match_false(char const *data)
struct kmp_str_buf kmp_str_buf_t
#define __kmp_str_buf_init(b)
void __kmp_print_version_1(void)
void __kmp_print_version_2(void)
#define KMP_VERSION_PREFIX
char const __kmp_version_alt_comp[]
char const __kmp_version_lock[]
static void __kmp_null_resume_wrapper(kmp_info_t *thr)
void microtask(int *global_tid, int *bound_tid)
ompt_callbacks_active_t ompt_enabled
ompt_callbacks_internal_t ompt_callbacks
struct ompt_lw_taskteam_s ompt_lw_taskteam_t
#define OMPT_GET_FRAME_ADDRESS(level)
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid, ompt_data_t *ompt_pid, void *codeptr)
int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame, ompt_data_t **parallel_data, int *thread_num)
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int on_heap, bool always)
ompt_task_info_t * __ompt_get_task_info_object(int depth)
void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid)
void __ompt_lw_taskteam_unlink(kmp_info_t *thr)
ompt_data_t * __ompt_get_thread_data_internal()
__attribute__((noinline))
kmp_int32 tt_found_proxy_tasks
kmp_int32 tt_hidden_helper_task_encountered
kmp_int32 cg_thread_limit
void(* th_dxo_fcn)(int *gtid, int *cid, ident_t *)
kmp_int32 th_doacross_buf_idx
dispatch_private_info_t * th_dispatch_pr_current
dispatch_private_info_t * th_disp_buffer
void(* th_deo_fcn)(int *gtid, int *cid, ident_t *)
dispatch_shared_info_t * th_dispatch_sh_current
kmp_proc_bind_t proc_bind
struct kmp_internal_control * next
struct kmp_old_threads_list_t * next
ompt_task_info_t ompt_task_info
enum sched_type r_sched_type
void __kmp_reap_monitor(kmp_info_t *th)
void __kmp_register_atfork(void)
void __kmp_free_handle(kmp_thread_t tHandle)
int __kmp_get_load_balance(int max)
int __kmp_still_running(kmp_info_t *th)
void __kmp_initialize_system_tick(void)
int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val)