39#if OMP_PROFILING_SUPPORT
40#include "llvm/Support/TimeProfiler.h"
41static char *ProfileTraceFile =
nullptr;
45#define KMP_USE_PRCTL 0
61#if defined(KMP_GOMP_COMPAT)
74#define KMP_MIN(x, y) ((x) < (y) ? (x) : (y))
91#if KMP_AFFINITY_SUPPORTED
92static void __kmp_partition_places(
kmp_team_t *team,
93 int update_master_only = 0);
101#ifdef USE_LOAD_BALANCE
102static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc);
107static int __kmp_unregister_root_other_thread(
int gtid);
124 new_nested_nth->
nth[
i] = 0;
126 new_nested_nth->
nth[
i] = thr->th.th_set_nested_nth[
j];
128 return new_nested_nth;
144 (
"*** __kmp_get_global_thread_id: entering, nproc=%d all_nproc=%d\n",
157 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using TDATA\n"));
162 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using keyed TLS\n"));
165 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using internal alg.\n"));
167 stack_addr = (
char *)&stack_data;
187 stack_size = (size_t)
TCR_PTR(thr->th.th_info.ds.ds_stacksize);
188 stack_base = (
char *)
TCR_PTR(thr->th.th_info.ds.ds_stackbase);
192 if (stack_addr <= stack_base) {
193 size_t stack_diff = stack_base - stack_addr;
195 if (stack_diff <= stack_size) {
211 (
"*** __kmp_get_global_thread_id: internal alg. failed to find "
212 "thread, using TLS\n"));
229 if (!
TCR_4(other_threads[
i]->th.th_info.ds.ds_stackgrow)) {
233 stack_base = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
234 if (stack_addr > stack_base) {
235 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stackbase, stack_addr);
236 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
237 other_threads[
i]->th.th_info.ds.ds_stacksize + stack_addr -
240 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
241 stack_base - stack_addr);
246 char *stack_end = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
247 char *stack_beg = stack_end - other_threads[
i]->th.th_info.ds.ds_stacksize;
249 other_threads[
i]->th.th_info.ds.ds_stacksize,
250 "th_%d stack (refinement)",
i);
263 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using TDATA\n"));
268 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using keyed TLS\n"));
272 (
"*** __kmp_get_global_thread_id_reg: using internal alg.\n"));
279 (
"__kmp_get_global_thread_id_reg: Encountered new root thread. "
280 "Registering a new gtid.\n"));
300 char *stack_beg = NULL;
301 char *stack_end = NULL;
304 KA_TRACE(10, (
"__kmp_check_stack_overlap: called\n"));
306 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
307 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
313 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
314 "th_%s stack (%s)",
"mon",
315 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
318 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
319 "th_%d stack (%s)", gtid,
320 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
329 (
"__kmp_check_stack_overlap: performing extensive checking\n"));
330 if (stack_beg == NULL) {
331 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
332 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
338 if (f_th && f_th != th) {
339 char *other_stack_end =
340 (
char *)
TCR_PTR(f_th->th.th_info.ds.ds_stackbase);
341 char *other_stack_beg =
342 other_stack_end - (size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize);
343 if ((stack_beg > other_stack_beg && stack_beg < other_stack_end) ||
344 (stack_end > other_stack_beg && stack_end < other_stack_end)) {
349 -1, other_stack_beg, other_stack_end,
350 (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize),
359 KA_TRACE(10, (
"__kmp_check_stack_overlap: returning\n"));
365 static int done =
FALSE;
372#define MAX_MESSAGE 512
375 char const *format, ...) {
379 va_start(ap, format);
380 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP storage map: %p %p%8lu %s\n", p1,
381 p2, (
unsigned long)
size, format);
384#if KMP_PRINT_DATA_PLACEMENT
387 if (p1 <= p2 && (
char *)p2 - (
char *)p1 ==
size) {
389 node = __kmp_get_host_node(p1);
395 int localProc = __kmp_get_cpu_from_gtid(gtid);
399 p1 = (
void *)((
size_t)p1 & ~((size_t)page_size - 1));
400 p2 = (
void *)(((
size_t)p2 - 1) & ~((
size_t)page_size - 1));
414 (
char *)p1 += page_size;
415 }
while (p1 <= p2 && (node = __kmp_get_host_node(p1)) == lastNode);
421 (
char *)p1 + (page_size - 1),
422 __kmp_get_host_node(p1));
425 (
char *)p2 + (page_size - 1),
426 __kmp_get_host_node(p2));
448 va_start(ap, format);
450 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP warning: %s\n", format);
525#if KMP_FAST_REDUCTION_BARRIER
537 int team_id,
int num_thr) {
545 "%s_%d.t_bar", header, team_id);
555 "%s_%d.t_bar[forkjoin]", header, team_id);
557#if KMP_FAST_REDUCTION_BARRIER
561 "%s_%d.t_bar[reduction]", header, team_id);
565 -1, &team->
t.t_dispatch[0], &team->
t.t_dispatch[num_thr],
566 sizeof(
kmp_disp_t) * num_thr,
"%s_%d.t_dispatch", header, team_id);
569 -1, &team->
t.t_threads[0], &team->
t.t_threads[num_thr],
570 sizeof(
kmp_info_t *) * num_thr,
"%s_%d.t_threads", header, team_id);
573 &team->
t.t_disp_buffer[num_disp_buff],
575 "%s_%d.t_disp_buffer", header, team_id);
586#if ENABLE_LIBOMPTARGET
587static void __kmp_init_omptarget() {
588 __kmp_init_target_task();
597BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
602 case DLL_PROCESS_ATTACH:
603 KA_TRACE(10, (
"DllMain: PROCESS_ATTACH\n"));
607 case DLL_PROCESS_DETACH:
621 if (lpReserved == NULL)
626 case DLL_THREAD_ATTACH:
627 KA_TRACE(10, (
"DllMain: THREAD_ATTACH\n"));
633 case DLL_THREAD_DETACH:
648 int gtid = *gtid_ref;
649#ifdef BUILD_PARALLEL_ORDERED
655#if KMP_USE_DYNAMIC_LOCK
661#ifdef BUILD_PARALLEL_ORDERED
662 if (!team->
t.t_serialized) {
673 int gtid = *gtid_ref;
674#ifdef BUILD_PARALLEL_ORDERED
683#ifdef BUILD_PARALLEL_ORDERED
684 if (!team->
t.t_serialized) {
689 team->
t.t_ordered.dt.t_value = ((tid + 1) % team->
t.t_nproc);
709 team = th->th.th_team;
712 th->th.th_ident = id_ref;
714 if (team->
t.t_serialized) {
717 kmp_int32 old_this = th->th.th_local.this_construct;
719 ++th->th.th_local.this_construct;
723 if (team->
t.t_construct == old_this) {
725 th->th.th_local.this_construct);
728 if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
730 team->
t.t_active_level == 1) {
732 __kmp_itt_metadata_single(id_ref);
746 __kmp_itt_single_start(gtid);
754 __kmp_itt_single_end(gtid);
767 int master_tid,
int set_nthreads,
773 kmp_info_t *this_thr = parent_team->
t.t_threads[master_tid];
777 new_nthreads = set_nthreads;
781#ifdef USE_LOAD_BALANCE
782 else if (
__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
783 new_nthreads = __kmp_load_balance_nproc(root, set_nthreads);
784 if (new_nthreads == 1) {
785 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
786 "reservation to 1 thread\n",
790 if (new_nthreads < set_nthreads) {
791 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
792 "reservation to %d threads\n",
793 master_tid, new_nthreads));
799 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
800 if (new_nthreads <= 1) {
801 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
802 "reservation to 1 thread\n",
806 if (new_nthreads < set_nthreads) {
807 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
808 "reservation to %d threads\n",
809 master_tid, new_nthreads));
811 new_nthreads = set_nthreads;
814 if (set_nthreads > 2) {
816 new_nthreads = (new_nthreads % set_nthreads) + 1;
817 if (new_nthreads == 1) {
818 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
819 "reservation to 1 thread\n",
823 if (new_nthreads < set_nthreads) {
824 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
825 "reservation to %d threads\n",
826 master_tid, new_nthreads));
835 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
838 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
839 if (tl_nthreads <= 0) {
847 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
850 if (tl_nthreads == 1) {
851 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT "
852 "reduced reservation to 1 thread\n",
856 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT reduced "
857 "reservation to %d threads\n",
858 master_tid, tl_nthreads));
859 new_nthreads = tl_nthreads;
863 int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
864 int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
865 if (cg_nthreads + new_nthreads -
866 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
868 int tl_nthreads = max_cg_threads - cg_nthreads +
869 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
870 if (tl_nthreads <= 0) {
878 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
881 if (tl_nthreads == 1) {
882 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT "
883 "reduced reservation to 1 thread\n",
887 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT reduced "
888 "reservation to %d threads\n",
889 master_tid, tl_nthreads));
890 new_nthreads = tl_nthreads;
907 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
910 int slotsRequired =
__kmp_nth + new_nthreads -
911 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) -
914 if (slotsAdded < slotsRequired) {
916 new_nthreads -= (slotsRequired - slotsAdded);
924 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
929 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
937 if (new_nthreads == 1) {
939 (
"__kmp_reserve_threads: T#%d serializing team after reclaiming "
940 "dead roots and rechecking; requested %d threads\n",
943 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d allocating %d threads; requested"
949 if (this_thr->th.th_nt_strict && new_nthreads < set_nthreads) {
950 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
951 this_thr->th.th_nt_msg);
961 int fork_teams_workers) {
965 KA_TRACE(10, (
"__kmp_fork_team_threads: new_nprocs = %d\n", team->
t.t_nproc));
970 master_th->th.th_info.ds.ds_tid = 0;
971 master_th->th.th_team = team;
972 master_th->th.th_team_nproc = team->
t.t_nproc;
973 master_th->th.th_team_master = master_th;
974 master_th->th.th_team_serialized =
FALSE;
975 master_th->th.th_dispatch = &team->
t.t_dispatch[0];
978#if KMP_NESTED_HOT_TEAMS
980 kmp_hot_team_ptr_t *hot_teams = master_th->th.th_hot_teams;
983 int level = team->
t.t_active_level - 1;
984 if (master_th->th.th_teams_microtask) {
985 if (master_th->th.th_teams_size.nteams > 1) {
990 master_th->th.th_teams_level == team->
t.t_level) {
995 if (
level < __kmp_hot_teams_max_level) {
996 if (hot_teams[
level].hot_team) {
1002 hot_teams[
level].hot_team = team;
1003 hot_teams[
level].hot_team_nth = team->
t.t_nproc;
1010 use_hot_team = team == root->r.r_hot_team;
1012 if (!use_hot_team) {
1015 team->
t.t_threads[0] = master_th;
1019 for (
i = 1;
i < team->
t.t_nproc;
i++) {
1023 team->
t.t_threads[
i] = thr;
1027 KA_TRACE(20, (
"__kmp_fork_team_threads: T#%d(%d:%d) init arrived "
1028 "T#%d(%d:%d) join =%llu, plain=%llu\n",
1033 thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
1034 thr->th.th_teams_level = master_th->th.th_teams_level;
1035 thr->th.th_teams_size = master_th->th.th_teams_size;
1040 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
1043 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
1049#if KMP_AFFINITY_SUPPORTED
1053 if (!fork_teams_workers) {
1054 __kmp_partition_places(team);
1058 if (team->
t.t_nproc > 1 &&
1060 team->
t.b->update_num_threads(team->
t.t_nproc);
1071 (
"__kmp_fork_team_threads: Primary T#%d pushing task_team %p / team "
1072 "%p, new task_team %p / team %p\n",
1074 team->
t.t_parent, team->
t.t_task_team[master_th->th.th_task_state],
1079 master_th->th.th_task_state);
1083 if (team->
t.t_nproc > 1) {
1085 team->
t.t_threads[1]->th.th_task_state == 1);
1087 team->
t.t_threads[1]->th.th_task_state);
1089 master_th->th.th_task_state = 0;
1094 master_th->th.th_task_state);
1096 master_th->th.th_task_state = 0;
1101 for (
i = 0;
i < team->
t.t_nproc;
i++) {
1103 if (thr->th.th_prev_num_threads != team->
t.t_nproc ||
1104 thr->th.th_prev_level != team->
t.t_level) {
1105 team->
t.t_display_affinity = 1;
1114#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1119 if (__kmp_inherit_fp_control) {
1124 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1125 __kmp_store_mxcsr(&mxcsr);
1126 mxcsr &= KMP_X86_MXCSR_MASK;
1152 if (__kmp_inherit_fp_control && team->
t.t_fp_control_saved) {
1157 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1158 __kmp_store_mxcsr(&mxcsr);
1159 mxcsr &= KMP_X86_MXCSR_MASK;
1161 if (team->
t.t_x87_fpu_control_word != x87_fpu_control_word) {
1162 __kmp_clear_x87_fpu_status_word();
1163 __kmp_load_x87_fpu_control_word(&team->
t.t_x87_fpu_control_word);
1166 if (team->
t.t_mxcsr != mxcsr) {
1167 __kmp_load_mxcsr(&team->
t.t_mxcsr);
1172#define propagateFPControl(x) ((void)0)
1173#define updateHWFPControl(x) ((void)0)
1185 KC_TRACE(10, (
"__kmpc_serialized_parallel: called by T#%d\n", global_tid));
1197 serial_team = this_thr->th.th_serial_team;
1204 if (this_thr->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1209 proc_bind = this_thr->th.th_current_task->td_icvs.proc_bind;
1215 this_thr->th.th_set_nproc = 0;
1218 ompt_data_t ompt_parallel_data = ompt_data_none;
1219 void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
1221 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1224 parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
1232 &ompt_parallel_data, team_size,
1233 ompt_parallel_invoker_program | ompt_parallel_team, codeptr);
1238 if (this_thr->th.th_team != serial_team) {
1240 int level = this_thr->th.th_team->t.t_level;
1242 if (serial_team->
t.t_serialized) {
1254 proc_bind, &this_thr->th.th_current_task->td_icvs,
1260 new_team->
t.t_threads[0] = this_thr;
1261 new_team->
t.t_parent = this_thr->th.th_team;
1262 serial_team = new_team;
1263 this_thr->th.th_serial_team = serial_team;
1267 (
"__kmpc_serialized_parallel: T#%d allocated new serial team %p\n",
1268 global_tid, serial_team));
1276 (
"__kmpc_serialized_parallel: T#%d reusing cached serial team %p\n",
1277 global_tid, serial_team));
1284 serial_team->
t.t_ident =
loc;
1285 serial_team->
t.t_serialized = 1;
1286 serial_team->
t.t_nproc = 1;
1287 serial_team->
t.t_parent = this_thr->th.th_team;
1288 if (this_thr->th.th_team->t.t_nested_nth)
1289 serial_team->
t.t_nested_nth = this_thr->th.th_team->t.t_nested_nth;
1293 serial_team->
t.t_primary_task_state = this_thr->th.th_task_state;
1294 serial_team->
t.t_sched.sched = this_thr->th.th_team->t.t_sched.sched;
1295 this_thr->th.th_team = serial_team;
1296 serial_team->
t.t_master_tid = this_thr->th.th_info.ds.ds_tid;
1298 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d curtask=%p\n", global_tid,
1299 this_thr->th.th_current_task));
1300 KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 1);
1301 this_thr->th.th_current_task->td_flags.executing = 0;
1308 copy_icvs(&this_thr->th.th_current_task->td_icvs,
1309 &this_thr->th.th_current_task->td_parent->td_icvs);
1314 if (this_thr->th.th_team->t.t_nested_nth)
1315 nested_nth = this_thr->th.th_team->t.t_nested_nth;
1317 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1322 this_thr->th.th_current_task->td_icvs.proc_bind =
1329 this_thr->th.th_info.ds.ds_tid = 0;
1332 this_thr->th.th_team_nproc = 1;
1333 this_thr->th.th_team_master = this_thr;
1334 this_thr->th.th_team_serialized = 1;
1335 this_thr->th.th_task_team = NULL;
1336 this_thr->th.th_task_state = 0;
1338 serial_team->
t.t_level = serial_team->
t.t_parent->t.t_level + 1;
1339 serial_team->
t.t_active_level = serial_team->
t.t_parent->t.t_active_level;
1340 serial_team->
t.t_def_allocator = this_thr->th.th_def_allocator;
1346 if (!serial_team->
t.t_dispatch->th_disp_buffer) {
1347 serial_team->
t.t_dispatch->th_disp_buffer =
1351 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1361 ++serial_team->
t.t_serialized;
1362 this_thr->th.th_team_serialized = serial_team->
t.t_serialized;
1365 int level = this_thr->th.th_team->t.t_level;
1370 if (serial_team->
t.t_nested_nth)
1371 nested_nth = serial_team->
t.t_nested_nth;
1373 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1376 serial_team->
t.t_level++;
1377 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d increasing nesting level "
1378 "of serial team %p to %d\n",
1379 global_tid, serial_team, serial_team->
t.t_level));
1387 disp_buffer->next = serial_team->
t.t_dispatch->th_disp_buffer;
1388 serial_team->
t.t_dispatch->th_disp_buffer = disp_buffer;
1390 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1402 if (this_thr->th.th_prev_level != serial_team->
t.t_level ||
1403 this_thr->th.th_prev_num_threads != 1) {
1406 this_thr->th.th_prev_level = serial_team->
t.t_level;
1407 this_thr->th.th_prev_num_threads = 1;
1414 serial_team->
t.ompt_team_info.master_return_address = codeptr;
1416 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1417 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1422 &ompt_parallel_data, codeptr);
1430 ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
1432 ompt_task_implicit);
1433 OMPT_CUR_TASK_INFO(this_thr)->thread_num =
1438 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
1439 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1449 return (master_th->th.th_teams_microtask && ap &&
1457 return ((ap == NULL && active_level == 0) ||
1458 (ap && teams_level > 0 && teams_level ==
level));
1470 ompt_data_t ompt_parallel_data,
void *return_address,
1476 parent_team->
t.t_ident =
loc;
1478 parent_team->
t.t_argc = argc;
1479 argv = (
void **)parent_team->
t.t_argv;
1480 for (
i = argc - 1;
i >= 0; --
i) {
1484 if (parent_team == master_th->th.th_serial_team) {
1492 parent_team->
t.t_serialized--;
1502 void **exit_frame_p;
1503 ompt_data_t *implicit_task_data;
1508 &ompt_parallel_data, return_address);
1515 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1519 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), implicit_task_data,
1520 1, OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1524 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1526 exit_frame_p = &dummy;
1532 parent_team->
t.t_serialized--;
1547 *exit_frame_p = NULL;
1548 OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
1551 ompt_scope_end, NULL, implicit_task_data, 1,
1552 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1554 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1558 &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th),
1559 OMPT_INVOKER(call_context) | ompt_parallel_team, return_address);
1561 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1568 parent_team->
t.t_invoke = invoker;
1570 parent_team->
t.t_active_level++;
1571 parent_team->
t.t_level++;
1572 parent_team->
t.t_def_allocator = master_th->th.th_def_allocator;
1579 master_th->th.th_teams_size.nth = parent_team->
t.t_nproc;
1591 if (master_set_numthreads) {
1592 if (master_set_numthreads <= master_th->th.th_teams_size.nth) {
1594 kmp_info_t **other_threads = parent_team->
t.t_threads;
1597 int old_proc = master_th->th.th_teams_size.nth;
1602 parent_team->
t.t_nproc = master_set_numthreads;
1603 for (
i = 0;
i < master_set_numthreads; ++
i) {
1604 other_threads[
i]->th.th_team_nproc = master_set_numthreads;
1608 master_th->th.th_set_nproc = 0;
1613 int nth = __kmp_omp_num_threads(
loc);
1615 master_set_numthreads = nth;
1624 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1629 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
1637 master_th->th.th_current_task->td_icvs.proc_bind)) {
1644 master_th->th.th_current_task->td_icvs.proc_bind != proc_bind_icv) {
1645 kmp_info_t **other_threads = parent_team->
t.t_threads;
1646 for (
i = 0;
i < master_th->th.th_team_nproc; ++
i) {
1647 other_threads[
i]->th.th_current_task->td_icvs.proc_bind = proc_bind_icv;
1653#if USE_ITT_BUILD && USE_ITT_NOTIFY
1654 if (((__itt_frame_submit_v3_ptr && __itt_get_timestamp_ptr) ||
1656 __kmp_forkjoin_frames_mode == 3 &&
1657 parent_team->
t.t_active_level == 1
1658 && master_th->th.th_teams_size.nteams == 1) {
1660 master_th->th.th_frame_time = tmp_time;
1661 parent_team->
t.t_region_time = tmp_time;
1663 if (__itt_stack_caller_create_ptr) {
1666 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
1669#if KMP_AFFINITY_SUPPORTED
1670 __kmp_partition_places(parent_team);
1673 KF_TRACE(10, (
"__kmp_fork_in_teams: before internal fork: root=%p, team=%p, "
1674 "master_th=%p, gtid=%d\n",
1675 root, parent_team, master_th, gtid));
1677 KF_TRACE(10, (
"__kmp_fork_in_teams: after internal fork: root=%p, team=%p, "
1678 "master_th=%p, gtid=%d\n",
1679 root, parent_team, master_th, gtid));
1685 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) invoke microtask = %p\n", gtid,
1686 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1688 if (!parent_team->
t.t_invoke(gtid)) {
1689 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
1691 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) done microtask = %p\n", gtid,
1692 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1695 KA_TRACE(20, (
"__kmp_fork_in_teams: parallel exit T#%d\n", gtid));
1706 ompt_data_t *ompt_parallel_data,
void **return_address,
1707 ompt_data_t **parent_task_data,
1715#if KMP_OS_LINUX && \
1716 (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
1724 20, (
"__kmp_serial_fork_call: T#%d serializing parallel region\n", gtid));
1729 master_th->th.th_serial_team->t.t_pkfn =
microtask;
1734 master_th->th.th_serial_team->t.t_ident =
loc;
1737 master_th->th.th_serial_team->t.t_level--;
1742 void **exit_frame_p;
1748 ompt_parallel_data, *return_address);
1752 task_info = OMPT_CUR_TASK_INFO(master_th);
1753 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1757 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1759 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1763 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1765 exit_frame_p = &dummy;
1782 *exit_frame_p = NULL;
1785 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1786 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1788 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1792 ompt_parallel_data, *parent_task_data,
1793 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1795 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1800 team = master_th->th.th_team;
1802 team->
t.t_invoke = invoker;
1804 team->
t.t_argc = argc;
1805 argv = (
void **)team->
t.t_argv;
1806 for (
i = argc - 1;
i >= 0; --
i)
1818 ompt_scope_end, NULL, &(task_info->
task_data), 0,
1819 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial);
1823 ompt_parallel_data, *parent_task_data,
1827 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1832 for (
i = argc - 1;
i >= 0; --
i)
1838 void **exit_frame_p;
1841 ompt_data_t *implicit_task_data;
1845 ompt_parallel_data, *return_address);
1848 task_info = OMPT_CUR_TASK_INFO(master_th);
1849 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1852 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1855 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1857 ompt_task_implicit);
1862 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1864 exit_frame_p = &dummy;
1881 *exit_frame_p = NULL;
1884 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1885 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1888 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1892 ompt_parallel_data, *parent_task_data,
1893 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1895 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1913 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1917 "__kmp_serial_fork_call: unknown fork_context parameter");
1920 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1934 int master_this_cons;
1941 int master_set_numthreads;
1942 int task_thread_limit = 0;
1946#if KMP_NESTED_HOT_TEAMS
1947 kmp_hot_team_ptr_t **p_hot_teams;
1953 KA_TRACE(20, (
"__kmp_fork_call: enter T#%d\n", gtid));
1975 parent_team = master_th->th.th_team;
1976 master_tid = master_th->th.th_info.ds.ds_tid;
1977 master_this_cons = master_th->th.th_local.this_construct;
1978 root = master_th->th.th_root;
1979 master_active = root->r.r_active;
1980 master_set_numthreads = master_th->th.th_set_nproc;
1982 master_th->th.th_current_task->td_icvs.task_thread_limit;
1985 ompt_data_t ompt_parallel_data = ompt_data_none;
1986 ompt_data_t *parent_task_data = NULL;
1987 ompt_frame_t *ompt_frame = NULL;
1988 void *return_address = NULL;
1993 return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
2001 level = parent_team->
t.t_level;
2003 active_level = parent_team->
t.t_active_level;
2005 teams_level = master_th->th.th_teams_level;
2006#if KMP_NESTED_HOT_TEAMS
2007 p_hot_teams = &master_th->th.th_hot_teams;
2008 if (*p_hot_teams == NULL && __kmp_hot_teams_max_level > 0) {
2010 sizeof(kmp_hot_team_ptr_t) * __kmp_hot_teams_max_level);
2011 (*p_hot_teams)[0].hot_team = root->r.r_hot_team;
2013 (*p_hot_teams)[0].hot_team_nth = 1;
2020 int team_size = master_set_numthreads
2021 ? master_set_numthreads
2025 ? ompt_parallel_league
2026 : ompt_parallel_team);
2028 parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags,
2031 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2035 master_th->th.th_ident =
loc;
2041 master_set_numthreads,
level,
2043 ompt_parallel_data, return_address,
2057 if ((!enter_teams &&
2058 (parent_team->
t.t_active_level >=
2059 master_th->th.th_current_task->td_icvs.max_active_levels)) ||
2061 KC_TRACE(10, (
"__kmp_fork_call: T#%d serializing team\n", gtid));
2064 nthreads = master_set_numthreads
2065 ? master_set_numthreads
2070 nthreads = task_thread_limit > 0 && task_thread_limit < nthreads
2083 nthreads, enter_teams);
2084 if (nthreads == 1) {
2095 master_th->th.th_set_nproc = 0;
2097 if (nthreads == 1) {
2099 invoker, master_th, parent_team,
2101 &ompt_parallel_data, &return_address,
2109 KF_TRACE(10, (
"__kmp_fork_call: parent_team_aclevel=%d, master_th=%p, "
2110 "curtask=%p, curtask_max_aclevel=%d\n",
2111 parent_team->
t.t_active_level, master_th,
2112 master_th->th.th_current_task,
2113 master_th->th.th_current_task->td_icvs.max_active_levels));
2117 master_th->th.th_current_task->td_flags.executing = 0;
2119 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2125 int nthreads_icv = master_th->th.th_current_task->td_icvs.nproc;
2127 if (!master_th->th.th_set_nested_nth &&
2128 (
level + 1 < parent_team->
t.t_nested_nth->used) &&
2129 (parent_team->
t.t_nested_nth->nth[
level + 1] != nthreads_icv)) {
2130 nthreads_icv = parent_team->
t.t_nested_nth->nth[
level + 1];
2131 }
else if (master_th->th.th_set_nested_nth) {
2134 (nested_nth->
nth[
level + 1] != nthreads_icv))
2135 nthreads_icv = nested_nth->
nth[
level + 1];
2146 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
2152 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
2155 if (master_th->th.th_teams_microtask &&
2165 master_th->th.th_current_task->td_icvs.proc_bind)) {
2168 if (!master_th->th.th_teams_microtask ||
2179 copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
2180 new_icvs.
next = NULL;
2181 if (nthreads_icv > 0) {
2182 new_icvs.
nproc = nthreads_icv;
2189 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2194 proc_bind, &new_icvs,
2200 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2206 &master_th->th.th_current_task->td_icvs,
2210 &master_th->th.th_current_task->td_icvs);
2213 10, (
"__kmp_fork_call: after __kmp_allocate_team - team = %p\n", team));
2227 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2228 int new_level = parent_team->
t.t_level + 1;
2230 new_level = parent_team->
t.t_active_level + 1;
2234 int new_level = parent_team->
t.t_level;
2236 new_level = parent_team->
t.t_active_level;
2247 if (team->
t.t_nested_nth &&
2248 team->
t.t_nested_nth != parent_team->
t.t_nested_nth) {
2251 team->
t.t_nested_nth = NULL;
2253 team->
t.t_nested_nth = parent_team->
t.t_nested_nth;
2254 if (master_th->th.th_set_nested_nth) {
2257 team->
t.t_nested_nth = nested_nth;
2259 master_th->th.th_set_nested_nth = NULL;
2260 master_th->th.th_set_nested_nth_sz = 0;
2261 master_th->th.th_nt_strict =
false;
2267 if (ompd_state & OMPD_ENABLE_BP)
2268 ompd_bp_parallel_begin();
2273 (
"__kmp_fork_call: T#%d(%d:%d)->(%d:0) created a team of %d threads\n",
2274 gtid, parent_team->
t.t_id, team->
t.t_master_tid, team->
t.t_id,
2277 (team->
t.t_master_tid == 0 &&
2278 (team->
t.t_parent == root->r.r_root_team ||
2279 team->
t.t_parent->t.t_serialized)));
2283 argv = (
void **)team->
t.t_argv;
2285 for (
i = argc - 1;
i >= 0; --
i) {
2291 for (
i = 0;
i < argc; ++
i) {
2299 if (!root->r.r_active)
2300 root->r.r_active =
TRUE;
2304 &master_th->th.th_current_task->td_icvs,
loc);
2307 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
2313 if (team->
t.t_active_level == 1
2314 && !master_th->th.th_teams_microtask) {
2316 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2317 (__kmp_forkjoin_frames_mode == 3 ||
2318 __kmp_forkjoin_frames_mode == 1)) {
2320 if (__itt_get_timestamp_ptr)
2321 tmp_time = __itt_get_timestamp();
2323 master_th->th.th_frame_time = tmp_time;
2324 if (__kmp_forkjoin_frames_mode == 3)
2325 team->
t.t_region_time = tmp_time;
2329 if ((__itt_frame_begin_v3_ptr || KMP_ITT_DEBUG) &&
2330 __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) {
2332 __kmp_itt_region_forking(gtid, team->
t.t_nproc, 0);
2341 (
"__kmp_internal_fork : root=%p, team=%p, master_th=%p, gtid=%d\n",
2342 root, team, master_th, gtid));
2345 if (__itt_stack_caller_create_ptr) {
2349 team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2350 }
else if (parent_team->
t.t_serialized) {
2356 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2365 KF_TRACE(10, (
"__kmp_internal_fork : after : root=%p, team=%p, "
2366 "master_th=%p, gtid=%d\n",
2367 root, team, master_th, gtid));
2371 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2376 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) invoke microtask = %p\n", gtid,
2377 team->
t.t_id, team->
t.t_pkfn));
2380#if KMP_STATS_ENABLED
2388 if (!team->
t.t_invoke(gtid)) {
2389 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
2392#if KMP_STATS_ENABLED
2399 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
2400 team->
t.t_id, team->
t.t_pkfn));
2403 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2406 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2414static inline void __kmp_join_restore_state(
kmp_info_t *thread,
2417 thread->th.ompt_thread_info.state =
2418 ((team->
t.t_serialized) ? ompt_state_work_serial
2419 : ompt_state_work_parallel);
2422static inline void __kmp_join_ompt(
int gtid,
kmp_info_t *thread,
2423 kmp_team_t *team, ompt_data_t *parallel_data,
2424 int flags,
void *codeptr) {
2428 parallel_data, &(task_info->
task_data), flags, codeptr);
2431 task_info->
frame.enter_frame = ompt_data_none;
2432 __kmp_join_restore_state(thread, team);
2450 KA_TRACE(20, (
"__kmp_join_call: enter T#%d\n", gtid));
2454 root = master_th->th.th_root;
2455 team = master_th->th.th_team;
2456 parent_team = team->
t.t_parent;
2458 master_th->th.th_ident =
loc;
2461 void *team_microtask = (
void *)team->
t.t_pkfn;
2467 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2473 KA_TRACE(20, (
"__kmp_join_call: T#%d, old team = %p old task_team = %p, "
2474 "th_task_team = %p\n",
2476 team->
t.t_task_team[master_th->th.th_task_state],
2477 master_th->th.th_task_team));
2482 if (team->
t.t_serialized) {
2483 if (master_th->th.th_teams_microtask) {
2485 int level = team->
t.t_level;
2486 int tlevel = master_th->th.th_teams_level;
2487 if (
level == tlevel) {
2491 }
else if (
level == tlevel + 1) {
2495 team->
t.t_serialized++;
2505 __kmp_join_restore_state(master_th, parent_team);
2512 master_active = team->
t.t_master_active;
2519 if (__itt_stack_caller_create_ptr) {
2522 __kmp_itt_stack_caller_destroy((__itt_caller)team->
t.t_stack_id);
2523 team->
t.t_stack_id = NULL;
2527 master_th->th.th_task_state =
2530 if (__itt_stack_caller_create_ptr && parent_team->
t.t_serialized) {
2535 __kmp_itt_stack_caller_destroy((__itt_caller)parent_team->
t.t_stack_id);
2536 parent_team->
t.t_stack_id = NULL;
2544 ompt_data_t *parallel_data = &(team->
t.ompt_team_info.parallel_data);
2545 void *codeptr = team->
t.ompt_team_info.master_return_address;
2550 if (team->
t.t_active_level == 1 &&
2551 (!master_th->th.th_teams_microtask ||
2552 master_th->th.th_teams_size.nteams == 1)) {
2553 master_th->th.th_ident =
loc;
2556 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2557 __kmp_forkjoin_frames_mode == 3)
2558 __kmp_itt_frame_submit(gtid, team->
t.t_region_time,
2559 master_th->th.th_frame_time, 0,
loc,
2560 master_th->th.th_team_nproc, 1);
2561 else if ((__itt_frame_end_v3_ptr || KMP_ITT_DEBUG) &&
2562 !__kmp_forkjoin_frames_mode && __kmp_forkjoin_frames)
2563 __kmp_itt_region_joined(gtid);
2567#if KMP_AFFINITY_SUPPORTED
2570 master_th->th.th_first_place = team->
t.t_first_place;
2571 master_th->th.th_last_place = team->
t.t_last_place;
2575 if (master_th->th.th_teams_microtask && !exit_teams &&
2577 team->
t.t_level == master_th->th.th_teams_level + 1) {
2582 ompt_data_t ompt_parallel_data = ompt_data_none;
2586 int ompt_team_size = team->
t.t_nproc;
2588 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2589 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
2591 task_info->
frame.exit_frame = ompt_data_none;
2593 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
2599 team->
t.t_active_level--;
2606 if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
2607 int old_num = master_th->th.th_team_nproc;
2608 int new_num = master_th->th.th_teams_size.nth;
2610 team->
t.t_nproc = new_num;
2611 for (
int i = 0;
i < old_num; ++
i) {
2612 other_threads[
i]->th.th_team_nproc = new_num;
2615 for (
int i = old_num;
i < new_num; ++
i) {
2620 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
2623 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
2628 other_threads[
i]->th.th_task_state = master_th->th.th_task_state;
2635 __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data,
2636 OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr);
2644 master_th->th.th_info.ds.ds_tid = team->
t.t_master_tid;
2645 master_th->th.th_local.this_construct = team->
t.t_master_this_cons;
2647 master_th->th.th_dispatch = &parent_team->
t.t_dispatch[team->
t.t_master_tid];
2654 if (!master_th->th.th_teams_microtask ||
2655 team->
t.t_level > master_th->th.th_teams_level) {
2667 : ompt_task_implicit;
2668 int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->
t.t_nproc;
2670 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2671 OMPT_CUR_TASK_INFO(master_th)->thread_num, flags);
2673 task_info->
frame.exit_frame = ompt_data_none;
2678 KF_TRACE(10, (
"__kmp_join_call1: T#%d, this_thread=%p team=%p\n", 0,
2682 master_th->th.th_def_allocator = team->
t.t_def_allocator;
2685 if (ompd_state & OMPD_ENABLE_BP)
2686 ompd_bp_parallel_end();
2690 if (root->r.r_active != master_active)
2691 root->r.r_active = master_active;
2701 master_th->th.th_team = parent_team;
2702 master_th->th.th_team_nproc = parent_team->
t.t_nproc;
2703 master_th->th.th_team_master = parent_team->
t.t_threads[0];
2704 master_th->th.th_team_serialized = parent_team->
t.t_serialized;
2707 if (parent_team->
t.t_serialized &&
2708 parent_team != master_th->th.th_serial_team &&
2709 parent_team != root->r.r_root_team) {
2712 master_th->th.th_serial_team = parent_team;
2718 team->
t.t_primary_task_state == 1);
2719 master_th->th.th_task_state = (
kmp_uint8)team->
t.t_primary_task_state;
2722 master_th->th.th_task_team =
2723 parent_team->
t.t_task_team[master_th->th.th_task_state];
2725 (
"__kmp_join_call: Primary T#%d restoring task_team %p, team %p\n",
2733 master_th->th.th_current_task->td_flags.executing = 1;
2737#if KMP_AFFINITY_SUPPORTED
2738 if (master_th->th.th_team->t.t_level == 0 && __kmp_affinity.flags.reset) {
2746 : ompt_parallel_team);
2748 __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags,
2754 KA_TRACE(20, (
"__kmp_join_call: exit T#%d\n", gtid));
2761 if (thread->th.th_team != thread->th.th_serial_team) {
2764 if (thread->th.th_team->t.t_serialized > 1) {
2767 if (thread->th.th_team->t.t_control_stack_top == NULL) {
2770 if (thread->th.th_team->t.t_control_stack_top->serial_nesting_level !=
2771 thread->th.th_team->t.t_serialized) {
2780 copy_icvs(control, &thread->th.th_current_task->td_icvs);
2784 control->
next = thread->th.th_team->t.t_control_stack_top;
2785 thread->th.th_team->t.t_control_stack_top = control;
2795 KF_TRACE(10, (
"__kmp_set_num_threads: new __kmp_nth = %d\n", new_nth));
2805 if (thread->th.th_current_task->td_icvs.nproc == new_nth)
2815 root = thread->th.th_root;
2817 (root->r.r_hot_team->t.t_nproc > new_nth)
2819 && __kmp_hot_teams_max_level && !__kmp_hot_teams_mode
2831 for (
f = new_nth;
f < hot_team->
t.t_nproc;
f++) {
2836 hot_team->
t.t_threads[
f]->th.th_task_team = NULL;
2839 hot_team->
t.t_threads[
f] = NULL;
2841 hot_team->
t.t_nproc = new_nth;
2842#if KMP_NESTED_HOT_TEAMS
2843 if (thread->th.th_hot_teams) {
2845 thread->th.th_hot_teams[0].hot_team_nth = new_nth;
2850 hot_team->
t.b->update_num_threads(new_nth);
2857 for (
f = 0;
f < new_nth;
f++) {
2859 hot_team->
t.t_threads[
f]->th.th_team_nproc = new_nth;
2862 hot_team->
t.t_size_changed = -1;
2870 KF_TRACE(10, (
"__kmp_set_max_active_levels: new max_active_levels for thread "
2872 gtid, max_active_levels));
2876 if (max_active_levels < 0) {
2877 KMP_WARNING(ActiveLevelsNegative, max_active_levels);
2882 KF_TRACE(10, (
"__kmp_set_max_active_levels: the call is ignored: new "
2883 "max_active_levels for thread %d = (%d)\n",
2884 gtid, max_active_levels));
2892 KMP_WARNING(ActiveLevelsExceedLimit, max_active_levels,
2900 KF_TRACE(10, (
"__kmp_set_max_active_levels: after validation: new "
2901 "max_active_levels for thread %d = (%d)\n",
2902 gtid, max_active_levels));
2915 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d\n", gtid));
2920 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d, curtask=%p, "
2921 "curtask_maxaclevel=%d\n",
2922 gtid, thread->th.th_current_task,
2923 thread->th.th_current_task->td_icvs.max_active_levels));
2924 return thread->th.th_current_task->td_icvs.max_active_levels;
2949 KF_TRACE(10, (
"__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
2950 gtid, (
int)kind, chunk));
2964 KMP_HNT(DefaultScheduleKindUsed,
"static, no chunk"),
2978 thread->th.th_current_task->td_icvs.sched.r_sched_type =
kmp_sch_static;
2980 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2986 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2991 orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
2996 thread->th.th_current_task->td_icvs.sched.chunk = chunk;
3005 KF_TRACE(10, (
"__kmp_get_schedule: thread %d\n", gtid));
3010 th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
3036#if KMP_STATIC_STEAL_ENABLED
3038 *kind = kmp_sched_static_steal;
3042 KMP_FATAL(UnknownSchedulingType, th_type);
3046 *chunk = thread->th.th_current_task->td_icvs.sched.chunk;
3055 KF_TRACE(10, (
"__kmp_get_ancestor_thread_num: thread %d %d\n", gtid,
level));
3064 team = thr->th.th_team;
3065 ii = team->
t.t_level;
3069 if (thr->th.th_teams_microtask) {
3071 int tlevel = thr->th.th_teams_level;
3088 dd = team->
t.t_serialized;
3091 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3093 if ((team->
t.t_serialized) && (!dd)) {
3094 team = team->
t.t_parent;
3098 team = team->
t.t_parent;
3099 dd = team->
t.t_serialized;
3104 return (dd > 1) ? (0) : (team->
t.t_master_tid);
3113 KF_TRACE(10, (
"__kmp_get_team_size: thread %d %d\n", gtid,
level));
3122 team = thr->th.th_team;
3123 ii = team->
t.t_level;
3127 if (thr->th.th_teams_microtask) {
3129 int tlevel = thr->th.th_teams_level;
3144 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3146 if (team->
t.t_serialized && (!dd)) {
3147 team = team->
t.t_parent;
3151 team = team->
t.t_parent;
3156 return team->
t.t_nproc;
3198 if (!realloc || argc > team->
t.t_max_argc) {
3200 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: needed entries=%d, "
3201 "current entries=%d\n",
3202 team->
t.t_id, argc, (realloc) ? team->
t.t_max_argc : 0));
3204 if (realloc && team->
t.t_argv != &team->
t.t_inline_argv[0])
3210 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: inline allocate %d "
3212 team->
t.t_id, team->
t.t_max_argc));
3213 team->
t.t_argv = &team->
t.t_inline_argv[0];
3216 -1, &team->
t.t_inline_argv[0],
3226 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: dynamic allocate %d "
3228 team->
t.t_id, team->
t.t_max_argc));
3233 &team->
t.t_argv[team->
t.t_max_argc],
3234 sizeof(
void *) * team->
t.t_max_argc,
3235 "team_%d.t_argv", team->
t.t_id);
3248 team->
t.t_dispatch =
3250 team->
t.t_implicit_task_taskdata =
3252 team->
t.t_max_nproc = max_nth;
3255 for (
i = 0;
i < num_disp_buff; ++
i) {
3256 team->
t.t_disp_buffer[
i].buffer_index =
i;
3257 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
3264 for (
i = 0;
i < team->
t.t_max_nproc; ++
i) {
3265 if (team->
t.t_dispatch[
i].th_disp_buffer != NULL) {
3267 team->
t.t_dispatch[
i].th_disp_buffer = NULL;
3270#if KMP_USE_HIER_SCHED
3277 team->
t.t_threads = NULL;
3278 team->
t.t_disp_buffer = NULL;
3279 team->
t.t_dispatch = NULL;
3280 team->
t.t_implicit_task_taskdata = 0;
3338 copy_icvs(&gx_icvs, &team->
t.t_threads[0]->th.th_current_task->td_icvs);
3339 gx_icvs.
next = NULL;
3348 int hot_team_max_nth;
3357 root->r.r_begin =
FALSE;
3358 root->r.r_active =
FALSE;
3359 root->r.r_in_parallel = 0;
3361#if KMP_AFFINITY_SUPPORTED
3362 root->r.r_affinity_assigned =
FALSE;
3367 KF_TRACE(10, (
"__kmp_initialize_root: before root_team\n"));
3386 KF_TRACE(10, (
"__kmp_initialize_root: after root_team = %p\n", root_team));
3388 root->r.r_root_team = root_team;
3389 root_team->
t.t_control_stack_top = NULL;
3392 root_team->
t.t_threads[0] = NULL;
3393 root_team->
t.t_nproc = 1;
3394 root_team->
t.t_serialized = 1;
3396 root_team->
t.t_sched.sched = r_sched.
sched;
3400 (
"__kmp_initialize_root: init root team %d arrived: join=%u, plain=%u\n",
3405 KF_TRACE(10, (
"__kmp_initialize_root: before hot_team\n"));
3418 KF_TRACE(10, (
"__kmp_initialize_root: after hot_team = %p\n", hot_team));
3420 root->r.r_hot_team = hot_team;
3421 root_team->
t.t_control_stack_top = NULL;
3424 hot_team->
t.t_parent = root_team;
3427 hot_team_max_nth = hot_team->
t.t_max_nproc;
3428 for (
f = 0;
f < hot_team_max_nth; ++
f) {
3429 hot_team->
t.t_threads[
f] = NULL;
3431 hot_team->
t.t_nproc = 1;
3433 hot_team->
t.t_sched.sched = r_sched.
sched;
3434 hot_team->
t.t_size_changed = 0;
3440typedef struct kmp_team_list_item {
3442 struct kmp_team_list_item *next;
3443} kmp_team_list_item_t;
3444typedef kmp_team_list_item_t *kmp_team_list_t;
3446static void __kmp_print_structure_team_accum(
3447 kmp_team_list_t list,
3463 __kmp_print_structure_team_accum(list, team->
t.t_parent);
3464 __kmp_print_structure_team_accum(list, team->
t.t_next_pool);
3468 while (l->next != NULL && l->entry != team) {
3471 if (l->next != NULL) {
3477 while (l->next != NULL && l->entry->t.t_id <= team->
t.t_id) {
3484 sizeof(kmp_team_list_item_t));
3491static void __kmp_print_structure_team(
char const *title,
kmp_team_p const *team
3502static void __kmp_print_structure_thread(
char const *title,
3505 if (thread != NULL) {
3514 kmp_team_list_t list;
3522 __kmp_printf(
"\n------------------------------\nGlobal Thread "
3523 "Table\n------------------------------\n");
3539 __kmp_printf(
"\n------------------------------\nThreads\n--------------------"
3545 if (thread != NULL) {
3548 __kmp_print_structure_team(
" Our Team: ", thread->th.th_team);
3549 __kmp_print_structure_team(
" Serial Team: ",
3550 thread->th.th_serial_team);
3551 __kmp_printf(
" Threads: %2d\n", thread->th.th_team_nproc);
3552 __kmp_print_structure_thread(
" Primary: ",
3553 thread->th.th_team_master);
3554 __kmp_printf(
" Serialized?: %2d\n", thread->th.th_team_serialized);
3555 __kmp_printf(
" Set NProc: %2d\n", thread->th.th_set_nproc);
3556 __kmp_printf(
" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
3557 __kmp_print_structure_thread(
" Next in pool: ",
3558 thread->th.th_next_pool);
3560 __kmp_print_structure_team_accum(list, thread->th.th_team);
3561 __kmp_print_structure_team_accum(list, thread->th.th_serial_team);
3569 __kmp_printf(
"\n------------------------------\nUbers\n----------------------"
3577 __kmp_print_structure_team(
" Root Team: ", root->r.r_root_team);
3578 __kmp_print_structure_team(
" Hot Team: ", root->r.r_hot_team);
3579 __kmp_print_structure_thread(
" Uber Thread: ",
3580 root->r.r_uber_thread);
3585 __kmp_print_structure_team_accum(list, root->r.r_root_team);
3586 __kmp_print_structure_team_accum(list, root->r.r_hot_team);
3593 __kmp_printf(
"\n------------------------------\nTeams\n----------------------"
3595 while (list->next != NULL) {
3599 __kmp_print_structure_team(
" Parent Team: ", team->
t.t_parent);
3602 __kmp_printf(
" Levels of serial: %2d\n", team->
t.t_serialized);
3604 for (
i = 0;
i < team->
t.t_nproc; ++
i) {
3606 __kmp_print_structure_thread(
"", team->
t.t_threads[
i]);
3608 __kmp_print_structure_team(
" Next in pool: ", team->
t.t_next_pool);
3614 __kmp_printf(
"\n------------------------------\nPools\n----------------------"
3616 __kmp_print_structure_thread(
"Thread pool: ",
3618 __kmp_print_structure_team(
"Team pool: ",
3623 while (list != NULL) {
3624 kmp_team_list_item_t *item = list;
3636 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, 0xba5703f5, 0xb495a877,
3637 0xe1626741, 0x79695e6b, 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231,
3638 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, 0xbe4d6fe9, 0x5f15e201,
3639 0x99afc3fd, 0xf3f16801, 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3,
3640 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, 0x085a3d61, 0x46eb5ea7,
3641 0x3d9910ed, 0x2e687b5b, 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9,
3642 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, 0x54581edb, 0xf2480f45,
3643 0x0bb9288f, 0xef1affc7, 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7,
3644 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, 0xfc411073, 0xc3749363,
3645 0xb892d829, 0x3549366b, 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3,
3646 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f};
3651 unsigned x = thread->th.th_x;
3652 unsigned short r = (
unsigned short)(x >> 16);
3654 thread->th.th_x = x * thread->th.th_a + 1;
3656 KA_TRACE(30, (
"__kmp_get_random: THREAD: %d, RETURN: %u\n",
3657 thread->th.th_info.ds.ds_tid,
r));
3664 unsigned seed = thread->th.th_info.ds.ds_tid;
3668 thread->th.th_x = (seed + 1) * thread->th.th_a + 1;
3670 (
"__kmp_init_random: THREAD: %u; A: %u\n", seed, thread->th.th_a));
3676static int __kmp_reclaim_dead_roots(
void) {
3684 r += __kmp_unregister_root_other_thread(
i);
3711 int minimumRequiredCapacity;
3720#if KMP_OS_WINDOWS && !KMP_DYNAMIC_LIB
3723 added = __kmp_reclaim_dead_roots();
3765 }
while (newCapacity < minimumRequiredCapacity);
3809 KA_TRACE(20, (
"__kmp_register_root: entered\n"));
3863 KA_TRACE(1, (
"__kmp_register_root: found slot in threads array for "
3864 "hidden helper thread: T#%d\n",
3878 1, (
"__kmp_register_root: found slot in threads array: T#%d\n", gtid));
3900#ifdef KMP_ADJUST_BLOCKTIME
3905 __kmp_zero_bt =
TRUE;
3916#if KMP_STATS_ENABLED
3918 __kmp_stats_thread_ptr = __kmp_stats_list->push_back(gtid);
3919 __kmp_stats_thread_ptr->startLife();
3926 if (root->r.r_uber_thread) {
3927 root_thread = root->r.r_uber_thread;
3933 root_thread->th.th_info.ds.ds_gtid = gtid;
3935 root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
3937 root_thread->th.th_root = root;
3942 __kmp_initialize_fast_memory(root_thread);
3953 if (!root_thread->th.th_serial_team) {
3955 KF_TRACE(10, (
"__kmp_register_root: before serial_team\n"));
3964 KF_TRACE(10, (
"__kmp_register_root: after serial_team = %p\n",
3965 root_thread->th.th_serial_team));
3970 root->r.r_root_team->t.t_threads[0] = root_thread;
3971 root->r.r_hot_team->t.t_threads[0] = root_thread;
3972 root_thread->th.th_serial_team->t.t_threads[0] = root_thread;
3974 root_thread->th.th_serial_team->t.t_serialized = 0;
3975 root->r.r_uber_thread = root_thread;
3985 __kmp_itt_thread_name(gtid);
3988#ifdef KMP_TDATA_GTID
3994 KA_TRACE(20, (
"__kmp_register_root: T#%d init T#%d(%d:%d) arrived: join=%u, "
4004 root_thread->th.th_bar[
b].bb.b_worker_arrived = 0;
4011#if KMP_AFFINITY_SUPPORTED
4012 root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
4013 root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
4014 root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
4015 root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
4018 root_thread->th.th_prev_level = 0;
4019 root_thread->th.th_prev_num_threads = 1;
4025 KA_TRACE(100, (
"__kmp_register_root: Thread %p created node %p with"
4026 " cg_nthreads init to 1\n",
4029 root_thread->th.th_cg_roots = tmp;
4038 ompt_set_thread_state(root_thread, ompt_state_overhead);
4044 ompt_data_t *task_data;
4045 ompt_data_t *parallel_data;
4050 ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
4053 ompt_set_thread_state(root_thread, ompt_state_work_serial);
4057 if (ompd_state & OMPD_ENABLE_BP)
4058 ompd_bp_thread_begin();
4067#if KMP_NESTED_HOT_TEAMS
4069 const int max_level) {
4071 kmp_hot_team_ptr_t *hot_teams = thr->th.th_hot_teams;
4072 if (!hot_teams || !hot_teams[
level].hot_team) {
4077 nth = hot_teams[
level].hot_team_nth;
4079 if (
level < max_level - 1) {
4080 for (
i = 0;
i < nth; ++
i) {
4082 n += __kmp_free_hot_teams(root, th,
level + 1, max_level);
4083 if (
i > 0 && th->th.th_hot_teams) {
4085 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;
4109#if KMP_NESTED_HOT_TEAMS
4110 if (__kmp_hot_teams_max_level >
4112 for (
i = 0;
i < hot_team->
t.t_nproc; ++
i) {
4114 if (__kmp_hot_teams_max_level > 1) {
4115 n += __kmp_free_hot_teams(root, th, 1, __kmp_hot_teams_max_level);
4117 if (th->th.th_hot_teams) {
4119 th->th.th_hot_teams = NULL;
4138 (LPVOID) & (root->r.r_uber_thread->th),
4139 root->r.r_uber_thread->th.th_info.ds.ds_thread));
4144 if (ompd_state & OMPD_ENABLE_BP)
4145 ompd_bp_thread_end();
4149 ompt_data_t *task_data;
4150 ompt_data_t *parallel_data;
4155 ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
4159 &(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
4165 i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
4166 KA_TRACE(100, (
"__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
4168 root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
4169 root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
4173 root->r.r_uber_thread->th.th_cg_roots->cg_root);
4175 __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
4176 root->r.r_uber_thread->th.th_cg_roots = NULL;
4182 root->r.r_uber_thread = NULL;
4184 root->r.r_begin =
FALSE;
4190 KA_TRACE(1, (
"__kmp_unregister_root_current_thread: enter T#%d\n", gtid));
4196 KC_TRACE(10, (
"__kmp_unregister_root_current_thread: already finished, "
4220 thread->th.ompt_thread_info.state = ompt_state_undefined;
4229 (
"__kmp_unregister_root_current_thread: T#%d unregistered\n", gtid));
4238static int __kmp_unregister_root_other_thread(
int gtid) {
4242 KA_TRACE(1, (
"__kmp_unregister_root_other_thread: enter T#%d\n", gtid));
4250 (
"__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid));
4256void __kmp_task_info() {
4261 kmp_team_t *steam = this_thr->th.th_serial_team;
4265 "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
4267 gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
4268 team->
t.t_implicit_task_taskdata[tid].td_parent);
4276 int tid,
int gtid) {
4293 this_thr->th.th_info.ds.ds_tid = tid;
4294 this_thr->th.th_set_nproc = 0;
4303#if KMP_AFFINITY_SUPPORTED
4304 this_thr->th.th_new_place = this_thr->th.th_current_place;
4306 this_thr->th.th_root = master->th.th_root;
4309 this_thr->th.th_team_nproc = team->
t.t_nproc;
4310 this_thr->th.th_team_master = master;
4311 this_thr->th.th_team_serialized = team->
t.t_serialized;
4315 KF_TRACE(10, (
"__kmp_initialize_info1: T#%d:%d this_thread=%p curtask=%p\n",
4316 tid, gtid, this_thr, this_thr->th.th_current_task));
4321 KF_TRACE(10, (
"__kmp_initialize_info2: T#%d:%d this_thread=%p curtask=%p\n",
4322 tid, gtid, this_thr, this_thr->th.th_current_task));
4327 this_thr->th.th_dispatch = &team->
t.t_dispatch[tid];
4329 this_thr->th.th_local.this_construct = 0;
4331 if (!this_thr->th.th_pri_common) {
4332 this_thr->th.th_pri_common =
4336 gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1,
4337 sizeof(
struct common_table),
"th_%d.th_pri_common\n", gtid);
4339 this_thr->th.th_pri_head = NULL;
4342 if (this_thr != master &&
4343 this_thr->th.th_cg_roots != master->th.th_cg_roots) {
4350 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p decrement cg_nthreads"
4351 " on node %p of thread %p to %d\n",
4357 this_thr->th.th_cg_roots = master->th.th_cg_roots;
4359 this_thr->th.th_cg_roots->cg_nthreads++;
4360 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p increment cg_nthreads on"
4361 " node %p of thread %p to %d\n",
4362 this_thr, this_thr->th.th_cg_roots,
4363 this_thr->th.th_cg_roots->cg_root,
4364 this_thr->th.th_cg_roots->cg_nthreads));
4365 this_thr->th.th_current_task->td_icvs.thread_limit =
4366 this_thr->th.th_cg_roots->cg_thread_limit;
4371 volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
4376 KD_TRACE(10, (
"__kmp_initialize_info: T#%d max_nproc: %d\n", gtid,
4377 team->
t.t_max_nproc));
4395 "th_%d.th_dispatch.th_disp_buffer "
4396 "(team_%d.t_dispatch[%d].th_disp_buffer)",
4397 gtid, team->
t.t_id, gtid);
4410 this_thr->th.th_next_pool = NULL;
4431#if !KMP_NESTED_HOT_TEAMS
4448 if (new_thr->th.th_active_in_pool ==
TRUE) {
4451 new_thr->th.th_active_in_pool =
FALSE;
4455 KA_TRACE(20, (
"__kmp_allocate_thread: T#%d using thread T#%d\n",
4462 new_thr->th.th_info.ds.ds_gtid);
4467 new_thr->th.th_task_state = 0;
4475#ifdef KMP_ADJUST_BLOCKTIME
4480 __kmp_zero_bt =
TRUE;
4494 KF_TRACE(10, (
"__kmp_allocate_thread: T#%d using thread %p T#%d\n",
4508 if (!
TCR_4(__kmp_init_monitor)) {
4510 if (!
TCR_4(__kmp_init_monitor)) {
4511 KF_TRACE(10, (
"before __kmp_create_monitor\n"));
4512 TCW_4(__kmp_init_monitor, 1);
4514 KF_TRACE(10, (
"after __kmp_create_monitor\n"));
4525 while (
TCR_4(__kmp_init_monitor) < 2) {
4528 KF_TRACE(10, (
"after monitor thread has started\n"));
4555 new_thr->th.th_nt_strict =
false;
4556 new_thr->th.th_nt_loc = NULL;
4558 new_thr->th.th_nt_msg = NULL;
4562#if USE_ITT_BUILD && USE_ITT_NOTIFY && KMP_DEBUG
4565 __itt_suppress_mark_range(
4566 __itt_suppress_range, __itt_suppress_threading_errors,
4567 &new_thr->th.th_sleep_loc,
sizeof(new_thr->th.th_sleep_loc));
4568 __itt_suppress_mark_range(
4569 __itt_suppress_range, __itt_suppress_threading_errors,
4570 &new_thr->th.th_reap_state,
sizeof(new_thr->th.th_reap_state));
4572 __itt_suppress_mark_range(
4573 __itt_suppress_range, __itt_suppress_threading_errors,
4574 &new_thr->th.th_suspend_init,
sizeof(new_thr->th.th_suspend_init));
4576 __itt_suppress_mark_range(__itt_suppress_range,
4577 __itt_suppress_threading_errors,
4578 &new_thr->th.th_suspend_init_count,
4579 sizeof(new_thr->th.th_suspend_init_count));
4582 __itt_suppress_mark_range(__itt_suppress_range,
4583 __itt_suppress_threading_errors,
4585 sizeof(new_thr->th.th_bar[0].bb.b_go));
4586 __itt_suppress_mark_range(__itt_suppress_range,
4587 __itt_suppress_threading_errors,
4589 sizeof(new_thr->th.th_bar[1].bb.b_go));
4590 __itt_suppress_mark_range(__itt_suppress_range,
4591 __itt_suppress_threading_errors,
4593 sizeof(new_thr->th.th_bar[2].bb.b_go));
4602 KF_TRACE(10, (
"__kmp_allocate_thread: before th_serial/serial_team\n"));
4603 new_thr->th.th_serial_team = serial_team =
4612 serial_team->
t.t_serialized = 0;
4614 serial_team->
t.t_threads[0] = new_thr;
4616 (
"__kmp_allocate_thread: after th_serial/serial_team : new_thr=%p\n",
4623 __kmp_initialize_fast_memory(new_thr);
4635 (
"__kmp_allocate_thread: T#%d init go fork=%u, plain=%u\n",
4642 balign[
b].
bb.team = NULL;
4644 balign[
b].
bb.use_oncore_barrier = 0;
4647 TCW_PTR(new_thr->th.th_sleep_loc, NULL);
4650 new_thr->th.th_spin_here =
FALSE;
4651 new_thr->th.th_next_waiting = 0;
4653 new_thr->th.th_blocking =
false;
4656#if KMP_AFFINITY_SUPPORTED
4657 new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
4658 new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
4659 new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
4660 new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
4663 new_thr->th.th_prev_level = 0;
4664 new_thr->th.th_prev_num_threads = 1;
4667 new_thr->th.th_active_in_pool =
FALSE;
4670 new_thr->th.th_set_nested_nth = NULL;
4671 new_thr->th.th_set_nested_nth_sz = 0;
4691#ifdef KMP_ADJUST_BLOCKTIME
4696 __kmp_zero_bt =
TRUE;
4701#if KMP_AFFINITY_SUPPORTED
4703 __kmp_affinity_set_init_mask(new_gtid,
FALSE);
4708 10, (
"__kmp_allocate_thread: before __kmp_create_worker: %p\n", new_thr));
4711 (
"__kmp_allocate_thread: after __kmp_create_worker: %p\n", new_thr));
4727 KF_TRACE(10, (
"__kmp_reinitialize_team: enter this_thread=%p team=%p\n",
4728 team->
t.t_threads[0], team));
4736 copy_icvs(&team->
t.t_implicit_task_taskdata[0].td_icvs, new_icvs);
4738 KF_TRACE(10, (
"__kmp_reinitialize_team: exit this_thread=%p team=%p\n",
4739 team->
t.t_threads[0], team));
4748 KF_TRACE(10, (
"__kmp_initialize_team: enter: team=%p\n", team));
4756 team->
t.t_master_tid = 0;
4758 team->
t.t_serialized = new_nproc > 1 ? 0 : 1;
4759 team->
t.t_nproc = new_nproc;
4762 team->
t.t_next_pool = NULL;
4767 team->
t.t_invoke = NULL;
4772#if KMP_ARCH_X86 || KMP_ARCH_X86_64
4773 team->
t.t_fp_control_saved =
FALSE;
4774 team->
t.t_x87_fpu_control_word = 0;
4775 team->
t.t_mxcsr = 0;
4778 team->
t.t_construct = 0;
4780 team->
t.t_ordered.dt.t_value = 0;
4781 team->
t.t_master_active =
FALSE;
4784 team->
t.t_copypriv_data = NULL;
4787 team->
t.t_copyin_counter = 0;
4790 team->
t.t_control_stack_top = NULL;
4795 KF_TRACE(10, (
"__kmp_initialize_team: exit: team=%p\n", team));
4798#if KMP_AFFINITY_SUPPORTED
4800 int first,
int last,
int newp) {
4801 th->th.th_first_place = first;
4802 th->th.th_last_place = last;
4803 th->th.th_new_place = newp;
4804 if (newp != th->th.th_current_place) {
4806 team->
t.t_display_affinity = 1;
4808 th->th.th_topology_ids = __kmp_affinity.ids[th->th.th_new_place];
4809 th->th.th_topology_attrs = __kmp_affinity.attrs[th->th.th_new_place];
4817static void __kmp_partition_places(
kmp_team_t *team,
int update_master_only) {
4825 int first_place = master_th->th.th_first_place;
4826 int last_place = master_th->th.th_last_place;
4827 int masters_place = master_th->th.th_current_place;
4828 int num_masks = __kmp_affinity.num_masks;
4829 team->
t.t_first_place = first_place;
4830 team->
t.t_last_place = last_place;
4832 KA_TRACE(20, (
"__kmp_partition_places: enter: proc_bind = %d T#%d(%d:0) "
4833 "bound to place %d partition = [%d,%d]\n",
4835 team->
t.t_id, masters_place, first_place, last_place));
4837 switch (proc_bind) {
4847 int n_th = team->
t.t_nproc;
4848 for (
f = 1;
f < n_th;
f++) {
4851 __kmp_set_thread_place(team, th, first_place, last_place, masters_place);
4853 KA_TRACE(100, (
"__kmp_partition_places: primary: T#%d(%d:%d) place %d "
4854 "partition = [%d,%d]\n",
4856 f, masters_place, first_place, last_place));
4862 int n_th = team->
t.t_nproc;
4864 if (first_place <= last_place) {
4865 n_places = last_place - first_place + 1;
4867 n_places = num_masks - first_place + last_place + 1;
4869 if (n_th <= n_places) {
4870 int place = masters_place;
4871 for (
f = 1;
f < n_th;
f++) {
4875 if (place == last_place) {
4876 place = first_place;
4877 }
else if (place == (num_masks - 1)) {
4882 __kmp_set_thread_place(team, th, first_place, last_place, place);
4884 KA_TRACE(100, (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4885 "partition = [%d,%d]\n",
4887 team->
t.t_id,
f, place, first_place, last_place));
4890 int S, rem, gap, s_count;
4891 S = n_th / n_places;
4893 rem = n_th - (
S * n_places);
4894 gap = rem > 0 ? n_places / rem : n_places;
4895 int place = masters_place;
4897 for (
f = 0;
f < n_th;
f++) {
4901 __kmp_set_thread_place(team, th, first_place, last_place, place);
4904 if ((s_count ==
S) && rem && (gap_ct == gap)) {
4906 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
4908 if (place == last_place) {
4909 place = first_place;
4910 }
else if (place == (num_masks - 1)) {
4918 }
else if (s_count ==
S) {
4919 if (place == last_place) {
4920 place = first_place;
4921 }
else if (place == (num_masks - 1)) {
4931 (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4932 "partition = [%d,%d]\n",
4934 th->th.th_new_place, first_place, last_place));
4942 int n_th = team->
t.t_nproc;
4945 if (first_place <= last_place) {
4946 n_places = last_place - first_place + 1;
4948 n_places = num_masks - first_place + last_place + 1;
4950 if (n_th <= n_places) {
4953 if (n_places != num_masks) {
4954 int S = n_places / n_th;
4955 int s_count, rem, gap, gap_ct;
4957 place = masters_place;
4958 rem = n_places - n_th *
S;
4959 gap = rem ? n_th / rem : 1;
4962 if (update_master_only == 1)
4964 for (
f = 0;
f < thidx;
f++) {
4968 int fplace = place, nplace = place;
4970 while (s_count <
S) {
4971 if (place == last_place) {
4972 place = first_place;
4973 }
else if (place == (num_masks - 1)) {
4980 if (rem && (gap_ct == gap)) {
4981 if (place == last_place) {
4982 place = first_place;
4983 }
else if (place == (num_masks - 1)) {
4991 __kmp_set_thread_place(team, th, fplace, place, nplace);
4994 if (place == last_place) {
4995 place = first_place;
4996 }
else if (place == (num_masks - 1)) {
5003 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5004 "partition = [%d,%d], num_masks: %u\n",
5006 f, th->th.th_new_place, th->th.th_first_place,
5007 th->th.th_last_place, num_masks));
5013 double current =
static_cast<double>(masters_place);
5015 (
static_cast<double>(n_places + 1) /
static_cast<double>(n_th));
5020 if (update_master_only == 1)
5022 for (
f = 0;
f < thidx;
f++) {
5023 first =
static_cast<int>(current);
5024 last =
static_cast<int>(current + spacing) - 1;
5026 if (first >= n_places) {
5027 if (masters_place) {
5030 if (first == (masters_place + 1)) {
5034 if (last == masters_place) {
5044 if (last >= n_places) {
5045 last = (n_places - 1);
5055 th = team->
t.t_threads[
f];
5057 __kmp_set_thread_place(team, th, first, last, place);
5059 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5060 "partition = [%d,%d], spacing = %.4f\n",
5062 team->
t.t_id,
f, th->th.th_new_place,
5063 th->th.th_first_place, th->th.th_last_place, spacing));
5069 int S, rem, gap, s_count;
5070 S = n_th / n_places;
5072 rem = n_th - (
S * n_places);
5073 gap = rem > 0 ? n_places / rem : n_places;
5074 int place = masters_place;
5077 if (update_master_only == 1)
5079 for (
f = 0;
f < thidx;
f++) {
5083 __kmp_set_thread_place(team, th, place, place, place);
5086 if ((s_count ==
S) && rem && (gap_ct == gap)) {
5088 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
5090 if (place == last_place) {
5091 place = first_place;
5092 }
else if (place == (num_masks - 1)) {
5100 }
else if (s_count ==
S) {
5101 if (place == last_place) {
5102 place = first_place;
5103 }
else if (place == (num_masks - 1)) {
5112 KA_TRACE(100, (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5113 "partition = [%d,%d]\n",
5115 team->
t.t_id,
f, th->th.th_new_place,
5116 th->th.th_first_place, th->th.th_last_place));
5126 KA_TRACE(20, (
"__kmp_partition_places: exit T#%d\n", team->
t.t_id));
5136 ompt_data_t ompt_parallel_data,
5144 int use_hot_team = !root->r.r_active;
5146 int do_place_partition = 1;
5148 KA_TRACE(20, (
"__kmp_allocate_team: called\n"));
5153#if KMP_NESTED_HOT_TEAMS
5154 kmp_hot_team_ptr_t *hot_teams;
5156 team = master->th.th_team;
5157 level = team->
t.t_active_level;
5158 if (master->th.th_teams_microtask) {
5159 if (master->th.th_teams_size.nteams > 1 &&
5163 master->th.th_teams_level <
5170 if ((master->th.th_teams_size.nteams == 1 &&
5171 master->th.th_teams_level >= team->
t.t_level) ||
5173 do_place_partition = 0;
5175 hot_teams = master->th.th_hot_teams;
5176 if (
level < __kmp_hot_teams_max_level && hot_teams &&
5177 hot_teams[
level].hot_team) {
5189 if (use_hot_team && new_nproc > 1) {
5191#if KMP_NESTED_HOT_TEAMS
5192 team = hot_teams[
level].hot_team;
5194 team = root->r.r_hot_team;
5198 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5199 "task_team[1] = %p before reinit\n",
5200 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5204 if (team->
t.t_nproc != new_nproc &&
5207 int old_nthr = team->
t.t_nproc;
5213 if (do_place_partition == 0)
5218 if (team->
t.t_nproc == new_nproc) {
5219 KA_TRACE(20, (
"__kmp_allocate_team: reusing hot team\n"));
5222 if (team->
t.t_size_changed == -1) {
5223 team->
t.t_size_changed = 1;
5234 root->r.r_uber_thread->th.th_ident);
5236 KF_TRACE(10, (
"__kmp_allocate_team2: T#%d, this_thread=%p team=%p\n", 0,
5237 team->
t.t_threads[0], team));
5240#if KMP_AFFINITY_SUPPORTED
5241 if ((team->
t.t_size_changed == 0) &&
5242 (team->
t.t_proc_bind == new_proc_bind)) {
5244 if (do_place_partition) {
5246 __kmp_partition_places(team, 1);
5249 KA_TRACE(200, (
"__kmp_allocate_team: reusing hot team #%d bindings: "
5250 "proc_bind = %d, partition = [%d,%d]\n",
5251 team->
t.t_id, new_proc_bind, team->
t.t_first_place,
5252 team->
t.t_last_place));
5254 if (do_place_partition) {
5256 __kmp_partition_places(team);
5262 }
else if (team->
t.t_nproc > new_nproc) {
5264 (
"__kmp_allocate_team: decreasing hot team thread count to %d\n",
5267 team->
t.t_size_changed = 1;
5276 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5279 th->th.th_task_team = NULL;
5282#if KMP_NESTED_HOT_TEAMS
5283 if (__kmp_hot_teams_mode == 0) {
5287 hot_teams[
level].hot_team_nth = new_nproc;
5290 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5293 team->
t.t_threads[
f] = NULL;
5295#if KMP_NESTED_HOT_TEAMS
5300 for (
f = new_nproc;
f < team->
t.t_nproc; ++
f) {
5312 team->
t.t_nproc = new_nproc;
5316 root->r.r_uber_thread->th.th_ident);
5319 for (
f = 0;
f < new_nproc; ++
f) {
5320 team->
t.t_threads[
f]->th.th_team_nproc = new_nproc;
5325 KF_TRACE(10, (
"__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
5326 team->
t.t_threads[0], team));
5331 for (
f = 0;
f < team->
t.t_nproc;
f++) {
5333 team->
t.t_threads[
f]->th.th_team_nproc ==
5338 if (do_place_partition) {
5340#if KMP_AFFINITY_SUPPORTED
5341 __kmp_partition_places(team);
5347 (
"__kmp_allocate_team: increasing hot team thread count to %d\n",
5349 int old_nproc = team->
t.t_nproc;
5350 team->
t.t_size_changed = 1;
5352#if KMP_NESTED_HOT_TEAMS
5353 int avail_threads = hot_teams[
level].hot_team_nth;
5354 if (new_nproc < avail_threads)
5355 avail_threads = new_nproc;
5357 for (
f = team->
t.t_nproc;
f < avail_threads; ++
f) {
5363 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5366 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5370 if (hot_teams[
level].hot_team_nth >= new_nproc) {
5374 team->
t.t_nproc = new_nproc;
5378 team->
t.t_nproc = hot_teams[
level].hot_team_nth;
5379 hot_teams[
level].hot_team_nth = new_nproc;
5381 if (team->
t.t_max_nproc < new_nproc) {
5387#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5388 KMP_AFFINITY_SUPPORTED
5394 kmp_affinity_raii_t new_temp_affinity{__kmp_affin_fullMask};
5398 for (
f = team->
t.t_nproc;
f < new_nproc;
f++) {
5401 team->
t.t_threads[
f] = new_worker;
5404 (
"__kmp_allocate_team: team %d init T#%d arrived: "
5405 "join=%llu, plain=%llu\n",
5414 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5418 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5424#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5425 KMP_AFFINITY_SUPPORTED
5427 new_temp_affinity.restore();
5429#if KMP_NESTED_HOT_TEAMS
5440 root->r.r_uber_thread->th.th_ident);
5444 for (
f = 0;
f < team->
t.t_nproc; ++
f)
5449 kmp_uint8 old_state = team->
t.t_threads[old_nproc - 1]->th.th_task_state;
5450 for (
f = old_nproc;
f < team->
t.t_nproc; ++
f)
5451 team->
t.t_threads[
f]->th.th_task_state = old_state;
5454 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5456 team->
t.t_threads[
f]->th.th_team_nproc ==
5461 if (do_place_partition) {
5463#if KMP_AFFINITY_SUPPORTED
5464 __kmp_partition_places(team);
5469 if (master->th.th_teams_microtask) {
5470 for (
f = 1;
f < new_nproc; ++
f) {
5473 thr->th.th_teams_microtask = master->th.th_teams_microtask;
5474 thr->th.th_teams_level = master->th.th_teams_level;
5475 thr->th.th_teams_size = master->th.th_teams_size;
5478#if KMP_NESTED_HOT_TEAMS
5482 for (
f = 1;
f < new_nproc; ++
f) {
5487 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5490 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5503 KF_TRACE(10, (
" hot_team = %p\n", team));
5507 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5508 "task_team[1] = %p after reinit\n",
5509 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5527 if (team->
t.t_max_nproc >= max_nproc) {
5531 if (max_nproc > 1 &&
5541 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and "
5542 "task_team[1] %p to NULL\n",
5543 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5544 team->
t.t_task_team[0] = NULL;
5545 team->
t.t_task_team[1] = NULL;
5552 20, (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5559 team->
t.t_bar[
b].b_master_arrived = 0;
5560 team->
t.t_bar[
b].b_team_arrived = 0;
5565 team->
t.t_proc_bind = new_proc_bind;
5567 KA_TRACE(20, (
"__kmp_allocate_team: using team from pool %d.\n",
5574 team->
t.t_nested_nth = NULL;
5594 team->
t.t_max_nproc = max_nproc;
5595 if (max_nproc > 1 &&
5605 KA_TRACE(20, (
"__kmp_allocate_team: making a new team\n"));
5608 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and task_team[1] "
5610 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5611 team->
t.t_task_team[0] = NULL;
5613 team->
t.t_task_team[1] = NULL;
5622 team->
t.t_argc = argc;
5625 (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5632 team->
t.t_bar[
b].b_master_arrived = 0;
5633 team->
t.t_bar[
b].b_team_arrived = 0;
5638 team->
t.t_proc_bind = new_proc_bind;
5642 team->
t.ompt_serialized_team_info = NULL;
5647 team->
t.t_nested_nth = NULL;
5649 KA_TRACE(20, (
"__kmp_allocate_team: done creating a new team %d.\n",
5672 int use_hot_team = team == root->r.r_hot_team;
5673#if KMP_NESTED_HOT_TEAMS
5676 level = team->
t.t_active_level - 1;
5677 if (master->th.th_teams_microtask) {
5678 if (master->th.th_teams_size.nteams > 1) {
5683 master->th.th_teams_level == team->
t.t_level) {
5689 kmp_hot_team_ptr_t *hot_teams = master->th.th_hot_teams;
5691 if (
level < __kmp_hot_teams_max_level) {
5702 team->
t.t_copyin_counter = 0;
5707 if (!use_hot_team) {
5710 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5713 volatile kmp_uint32 *state = &th->th.th_reap_state;
5724 if (th->th.th_sleep_loc)
5732 for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
5734 if (task_team != NULL) {
5735 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5737 team->
t.t_threads[
f]->th.th_task_team = NULL;
5741 (
"__kmp_free_team: T#%d deactivating task_team %p on team %d\n",
5743#if KMP_NESTED_HOT_TEAMS
5746 team->
t.t_task_team[tt_idx] = NULL;
5753 team->
t.t_nested_nth != team->
t.t_parent->t.t_nested_nth) {
5757 team->
t.t_nested_nth = NULL;
5760 team->
t.t_parent = NULL;
5761 team->
t.t_level = 0;
5762 team->
t.t_active_level = 0;
5765 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5769 &(team->
t.t_threads[
f]->th.th_used_in_team), 1, 2);
5777 team->
t.b->go_release();
5779 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5780 if (team->
t.b->sleep[
f].sleep) {
5782 team->
t.t_threads[
f]->th.th_info.ds.ds_gtid,
5788 for (
int f = 1;
f < team->
t.t_nproc; ++
f) {
5789 while (team->
t.t_threads[
f]->th.th_used_in_team.load() != 0)
5795 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5796 team->
t.t_threads[
f] = NULL;
5799 if (team->
t.t_max_nproc > 1 &&
5811 team->
t.t_threads[1]->th.th_cg_roots);
5812 if (team->
t.t_threads[1]->th.th_cg_roots->cg_root == team->
t.t_threads[1]) {
5814 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5817 thr->th.th_cg_roots->cg_root == thr);
5820 thr->th.th_cg_roots = tmp->
up;
5821 KA_TRACE(100, (
"__kmp_free_team: Thread %p popping node %p and moving"
5822 " up to node %p. cg_nthreads was %d\n",
5823 thr, tmp, thr->th.th_cg_roots, tmp->
cg_nthreads));
5829 if (thr->th.th_cg_roots)
5830 thr->th.th_current_task->td_icvs.thread_limit =
5831 thr->th.th_cg_roots->cg_thread_limit;
5853 if (team->
t.t_argv != &team->
t.t_inline_argv[0])
5890 KA_TRACE(20, (
"__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
5902 balign[
b].
bb.team = NULL;
5903 balign[
b].
bb.leaf_kids = 0;
5905 this_th->th.th_task_state = 0;
5909 TCW_PTR(this_th->th.th_team, NULL);
5910 TCW_PTR(this_th->th.th_root, NULL);
5911 TCW_PTR(this_th->th.th_dispatch, NULL);
5913 while (this_th->th.th_cg_roots) {
5914 this_th->th.th_cg_roots->cg_nthreads--;
5915 KA_TRACE(100, (
"__kmp_free_thread: Thread %p decrement cg_nthreads on node"
5916 " %p of thread %p to %d\n",
5917 this_th, this_th->th.th_cg_roots,
5918 this_th->th.th_cg_roots->cg_root,
5919 this_th->th.th_cg_roots->cg_nthreads));
5921 if (tmp->
cg_root == this_th) {
5924 5, (
"__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
5925 this_th->th.th_cg_roots = tmp->
up;
5931 this_th->th.th_cg_roots = NULL;
5942 this_th->th.th_current_task = NULL;
5946 gtid = this_th->th.th_info.ds.ds_gtid;
5964 for (; (*scan != NULL) && ((*scan)->th.th_info.ds.ds_gtid < gtid);
5965 scan = &((*scan)->th.th_next_pool))
5970 TCW_PTR(this_th->th.th_next_pool, *scan);
5973 (this_th->th.th_info.ds.ds_gtid <
5974 this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
5978 if (this_th->th.th_active ==
TRUE) {
5980 this_th->th.th_active_in_pool =
TRUE;
5991#ifdef KMP_ADJUST_BLOCKTIME
5997 __kmp_zero_bt =
FALSE;
6008#if OMP_PROFILING_SUPPORT
6009 ProfileTraceFile = getenv(
"LIBOMPTARGET_PROFILE");
6011 if (ProfileTraceFile)
6012 llvm::timeTraceProfilerInitialize(500 ,
"libomptarget");
6015 int gtid = this_thr->th.th_info.ds.ds_gtid;
6020 KA_TRACE(10, (
"__kmp_launch_thread: T#%d start\n", gtid));
6027 if (ompd_state & OMPD_ENABLE_BP)
6028 ompd_bp_thread_begin();
6032 ompt_data_t *thread_data =
nullptr;
6034 thread_data = &(this_thr->th.ompt_thread_info.thread_data);
6035 *thread_data = ompt_data_none;
6037 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6038 this_thr->th.ompt_thread_info.wait_id = 0;
6040 this_thr->th.ompt_thread_info.parallel_flags = 0;
6043 ompt_thread_worker, thread_data);
6045 this_thr->th.ompt_thread_info.state = ompt_state_idle;
6055 KA_TRACE(20, (
"__kmp_launch_thread: T#%d waiting for work\n", gtid));
6062 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6066 pteam = &this_thr->th.th_team;
6074 (
"__kmp_launch_thread: T#%d(%d:%d) invoke microtask = %p\n",
6076 (*pteam)->t.t_pkfn));
6082 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
6086 rc = (*pteam)->t.t_invoke(gtid);
6090 KA_TRACE(20, (
"__kmp_launch_thread: T#%d(%d:%d) done microtask = %p\n",
6092 (*pteam)->t.t_pkfn));
6099 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6108 if (ompd_state & OMPD_ENABLE_BP)
6109 ompd_bp_thread_end();
6114 ompt_callbacks.ompt_callback(ompt_callback_thread_end)(thread_data);
6118 this_thr->th.th_task_team = NULL;
6122 KA_TRACE(10, (
"__kmp_launch_thread: T#%d done\n", gtid));
6125#if OMP_PROFILING_SUPPORT
6126 llvm::timeTraceProfilerFinishThread();
6138 KA_TRACE(30, (
"__kmp_internal_end_dest: T#%d\n", gtid));
6145#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
6156 KA_TRACE(30, (
"__kmp_internal_end_atexit\n"));
6193 gtid = thread->th.th_info.ds.ds_gtid;
6199 20, (
"__kmp_reap_thread: releasing T#%d from fork barrier for reap\n",
6228 if (thread->th.th_active_in_pool) {
6229 thread->th.th_active_in_pool =
FALSE;
6239 __kmp_free_fast_memory(thread);
6250#ifdef KMP_ADJUST_BLOCKTIME
6256 __kmp_zero_bt =
FALSE;
6263 if (thread->th.th_cons) {
6265 thread->th.th_cons = NULL;
6269 if (thread->th.th_pri_common != NULL) {
6271 thread->th.th_pri_common = NULL;
6275 if (thread->th.th_local.bget_data != NULL) {
6280#if KMP_AFFINITY_SUPPORTED
6281 if (thread->th.th_affin_mask != NULL) {
6282 KMP_CPU_FREE(thread->th.th_affin_mask);
6283 thread->th.th_affin_mask = NULL;
6287#if KMP_USE_HIER_SCHED
6288 if (thread->th.th_hier_bar_data != NULL) {
6290 thread->th.th_hier_bar_data = NULL;
6295 thread->th.th_serial_team = NULL;
6304 if (__kmp_itt_region_domains.count > 0) {
6305 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6306 kmp_itthash_entry_t *bucket = __kmp_itt_region_domains.buckets[
i];
6308 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6314 if (__kmp_itt_barrier_domains.count > 0) {
6315 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6316 kmp_itthash_entry_t *bucket = __kmp_itt_barrier_domains.buckets[
i];
6318 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6338 __kmp_reclaim_dead_roots();
6362 if (
TCR_4(__kmp_init_monitor)) {
6364 TCW_4(__kmp_init_monitor, 0);
6367 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6392 thread->th.th_next_pool = NULL;
6393 thread->th.th_in_pool =
FALSE;
6404 team->
t.t_next_pool = NULL;
6431 KA_TRACE(10, (
"__kmp_internal_end: all workers reaped\n"));
6440 if (
TCR_4(__kmp_init_monitor)) {
6442 TCW_4(__kmp_init_monitor, 0);
6445 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6465 KA_TRACE(11, (
"__kmp_internal_end_library: abort, exiting\n"));
6470 KA_TRACE(10, (
"__kmp_internal_end_library: already finished\n"));
6489 10, (
"__kmp_internal_end_library: enter T#%d (%d)\n", gtid, gtid_req));
6491 KA_TRACE(10, (
"__kmp_internal_end_library: !__kmp_init_runtime, system "
6492 "already shutdown\n"));
6495 KA_TRACE(10, (
"__kmp_internal_end_library: monitor thread, gtid not "
6496 "registered, or system shutdown\n"));
6499 KA_TRACE(10, (
"__kmp_internal_end_library: gtid not registered or system "
6509 (
"__kmp_internal_end_library: root still active, abort T#%d\n",
6516 (
"__kmp_internal_end_library: unregistering sibling T#%d\n", gtid));
6524#ifdef DUMP_DEBUG_ON_EXIT
6540 KA_TRACE(10, (
"__kmp_internal_end_library: abort, exiting\n"));
6563 KA_TRACE(10, (
"__kmp_internal_end_library: exit\n"));
6565#ifdef DUMP_DEBUG_ON_EXIT
6588 KA_TRACE(11, (
"__kmp_internal_end_thread: abort, exiting\n"));
6593 KA_TRACE(10, (
"__kmp_internal_end_thread: already finished\n"));
6613 (
"__kmp_internal_end_thread: enter T#%d (%d)\n", gtid, gtid_req));
6615 KA_TRACE(10, (
"__kmp_internal_end_thread: !__kmp_init_runtime, system "
6616 "already shutdown\n"));
6619 KA_TRACE(10, (
"__kmp_internal_end_thread: monitor thread, gtid not "
6620 "registered, or system shutdown\n"));
6623 KA_TRACE(10, (
"__kmp_internal_end_thread: gtid not registered or system "
6633 (
"__kmp_internal_end_thread: root still active, abort T#%d\n",
6637 KA_TRACE(10, (
"__kmp_internal_end_thread: unregistering sibling T#%d\n",
6643 KA_TRACE(10, (
"__kmp_internal_end_thread: worker thread T#%d\n", gtid));
6650 (
"__kmp_internal_end_thread: worker thread done, exiting T#%d\n",
6660 KA_TRACE(10, (
"__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
6669 KA_TRACE(10, (
"__kmp_internal_end_thread: abort, exiting\n"));
6692 (
"__kmp_internal_end_thread: remaining sibling task: gtid==%d\n",
i));
6706 KA_TRACE(10, (
"__kmp_internal_end_thread: exit T#%d\n", gtid_req));
6708#ifdef DUMP_DEBUG_ON_EXIT
6728#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
6736#if defined(KMP_USE_SHM)
6737bool __kmp_shm_available =
false;
6738bool __kmp_tmp_available =
false;
6740char *temp_reg_status_file_name =
nullptr;
6751#if KMP_ARCH_X86 || KMP_ARCH_X86_64
6760 KA_TRACE(50, (
"__kmp_register_library_startup: %s=\"%s\"\n",
name,
6767#if defined(KMP_USE_SHM)
6768 char *shm_name =
nullptr;
6769 char *data1 =
nullptr;
6771 if (__kmp_shm_available) {
6774 int shm_preexist = 0;
6775 fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6776 if ((fd1 == -1) && (errno == EEXIST)) {
6779 fd1 = shm_open(shm_name, O_RDWR, 0600);
6782 __kmp_shm_available =
false;
6787 if (__kmp_shm_available && shm_preexist == 0) {
6788 if (ftruncate(fd1, SHM_SIZE) == -1) {
6789 KMP_WARNING(FunctionError,
"Can't set size of SHM");
6790 __kmp_shm_available =
false;
6793 if (__kmp_shm_available) {
6794 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6796 if (data1 == MAP_FAILED) {
6798 __kmp_shm_available =
false;
6801 if (__kmp_shm_available) {
6802 if (shm_preexist == 0) {
6807 munmap(data1, SHM_SIZE);
6812 if (!__kmp_shm_available)
6814 if (!__kmp_shm_available && __kmp_tmp_available) {
6822 int tmp_preexist = 0;
6823 fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6824 if ((fd1 == -1) && (errno == EEXIST)) {
6827 fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
6830 __kmp_tmp_available =
false;
6835 if (__kmp_tmp_available && tmp_preexist == 0) {
6837 if (ftruncate(fd1, SHM_SIZE) == -1) {
6838 KMP_WARNING(FunctionError,
"Can't set size of /tmp file");
6839 __kmp_tmp_available =
false;
6842 if (__kmp_tmp_available) {
6843 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6845 if (data1 == MAP_FAILED) {
6847 __kmp_tmp_available =
false;
6850 if (__kmp_tmp_available) {
6851 if (tmp_preexist == 0) {
6856 munmap(data1, SHM_SIZE);
6861 if (!__kmp_shm_available && !__kmp_tmp_available) {
6882 char *flag_addr_str = NULL;
6883 char *flag_val_str = NULL;
6884 char const *file_name = NULL;
6889 unsigned long *flag_addr = 0;
6890 unsigned long flag_val = 0;
6893 if (flag_addr != 0 && flag_val != 0 && strcmp(file_name,
"") != 0) {
6911 file_name =
"unknown library";
6928#if defined(KMP_USE_SHM)
6929 if (__kmp_shm_available) {
6930 shm_unlink(shm_name);
6931 }
else if (__kmp_tmp_available) {
6932 unlink(temp_reg_status_file_name);
6948#if defined(KMP_USE_SHM)
6962#if defined(KMP_USE_SHM)
6963 char *shm_name =
nullptr;
6965 if (__kmp_shm_available) {
6967 fd1 = shm_open(shm_name, O_RDONLY, 0600);
6969 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6970 if (data1 != MAP_FAILED) {
6972 munmap(data1, SHM_SIZE);
6976 }
else if (__kmp_tmp_available) {
6977 fd1 = open(temp_reg_status_file_name, O_RDONLY);
6979 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6980 if (data1 != MAP_FAILED) {
6982 munmap(data1, SHM_SIZE);
6997#if defined(KMP_USE_SHM)
6998 if (__kmp_shm_available) {
6999 shm_unlink(shm_name);
7000 }
else if (__kmp_tmp_available) {
7001 unlink(temp_reg_status_file_name);
7010#if defined(KMP_USE_SHM)
7013 if (temp_reg_status_file_name)
7029#if KMP_MIC_SUPPORTED
7031static void __kmp_check_mic_type() {
7032 kmp_cpuid_t cpuid_state = {0};
7033 kmp_cpuid_t *cs_p = &cpuid_state;
7034 __kmp_x86_cpuid(1, 0, cs_p);
7036 if ((cs_p->eax & 0xff0) == 0xB10) {
7037 __kmp_mic_type = mic2;
7038 }
else if ((cs_p->eax & 0xf0ff0) == 0x50670) {
7039 __kmp_mic_type = mic3;
7041 __kmp_mic_type = non_mic;
7048static void __kmp_user_level_mwait_init() {
7049 struct kmp_cpuid
buf;
7050 __kmp_x86_cpuid(7, 0, &
buf);
7051 __kmp_waitpkg_enabled = ((
buf.ecx >> 5) & 1);
7052 __kmp_umwait_enabled = __kmp_waitpkg_enabled && __kmp_user_level_mwait;
7053 __kmp_tpause_enabled = __kmp_waitpkg_enabled && (__kmp_tpause_state > 0);
7054 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_umwait_enabled = %d\n",
7055 __kmp_umwait_enabled));
7058#ifndef AT_INTELPHIUSERMWAIT
7061#define AT_INTELPHIUSERMWAIT 10000
7067unsigned long getauxval(
unsigned long) {
return 0; }
7069static void __kmp_user_level_mwait_init() {
7074 if (__kmp_mic_type == mic3) {
7075 unsigned long res = getauxval(AT_INTELPHIUSERMWAIT);
7076 if ((
res & 0x1) || __kmp_user_level_mwait) {
7077 __kmp_mwait_enabled =
TRUE;
7078 if (__kmp_user_level_mwait) {
7082 __kmp_mwait_enabled =
FALSE;
7085 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_mic_type = %d, "
7086 "__kmp_mwait_enabled = %d\n",
7087 __kmp_mic_type, __kmp_mwait_enabled));
7095 KA_TRACE(10, (
"__kmp_do_serial_initialize: enter\n"));
7113#if ENABLE_LIBOMPTARGET
7115 __kmp_init_omptarget();
7130 KA_TRACE(10, (
"__kmp_do_serial_initialize: reinitialization of library\n"));
7137#if KMP_USE_ADAPTIVE_LOCKS
7138#if KMP_DEBUG_ADAPTIVE_LOCKS
7139 __kmp_init_speculative_stats();
7142#if KMP_STATS_ENABLED
7172#if KMP_MIC_SUPPORTED
7173 __kmp_check_mic_type();
7202 __kmp_monitor_wakeups =
7204 __kmp_bt_intervals =
7217#if KMP_FAST_REDUCTION_BARRIER
7218#define kmp_reduction_barrier_gather_bb ((int)1)
7219#define kmp_reduction_barrier_release_bb ((int)1)
7220#define kmp_reduction_barrier_gather_pat __kmp_barrier_gather_pat_dflt
7221#define kmp_reduction_barrier_release_pat __kmp_barrier_release_pat_dflt
7228#if KMP_FAST_REDUCTION_BARRIER
7238#if KMP_FAST_REDUCTION_BARRIER
7239#undef kmp_reduction_barrier_release_pat
7240#undef kmp_reduction_barrier_gather_pat
7241#undef kmp_reduction_barrier_release_bb
7242#undef kmp_reduction_barrier_gather_bb
7244#if KMP_MIC_SUPPORTED
7245 if (__kmp_mic_type == mic2) {
7253#if KMP_FAST_REDUCTION_BARRIER
7254 if (__kmp_mic_type == mic2) {
7278#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
7279 __kmp_user_level_mwait_init();
7330 KA_TRACE(10, (
"__kmp_do_serial_initialize T#%d\n", gtid));
7343#if !KMP_DYNAMIC_LIB || \
7344 ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
7357#if KMP_HANDLE_SIGNALS
7363 __kmp_install_signals(
FALSE);
7366 __kmp_install_signals(
TRUE);
7393 KA_TRACE(10, (
"__kmp_do_serial_initialize: exit\n"));
7411 int prev_dflt_team_nth;
7417 KA_TRACE(10, (
"__kmp_middle_initialize: enter\n"));
7429#if KMP_AFFINITY_SUPPORTED
7432 __kmp_affinity_initialize(__kmp_affinity);
7451#ifdef KMP_DFLT_NTH_CORES
7454 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7455 "__kmp_ncores (%d)\n",
7460 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7461 "__kmp_avail_proc(%d)\n",
7489 if (thread->th.th_current_task->td_icvs.nproc != 0)
7497 (
"__kmp_middle_initialize: final value for __kmp_dflt_team_nth = %d\n",
7500#ifdef KMP_ADJUST_BLOCKTIME
7505 __kmp_zero_bt =
TRUE;
7513 KA_TRACE(10, (
"__kmp_do_middle_initialize: exit\n"));
7545 (
"__kmp_parallel_initialize: attempt to init while shutting down\n"));
7559 KA_TRACE(10, (
"__kmp_parallel_initialize: enter\n"));
7562#if KMP_ARCH_X86 || KMP_ARCH_X86_64
7565 __kmp_store_x87_fpu_control_word(&__kmp_init_x87_fpu_control_word);
7566 __kmp_store_mxcsr(&__kmp_init_mxcsr);
7567 __kmp_init_mxcsr &= KMP_X86_MXCSR_MASK;
7571#if KMP_HANDLE_SIGNALS
7573 __kmp_install_signals(
TRUE);
7579#if defined(USE_LOAD_BALANCE)
7597 KA_TRACE(10, (
"__kmp_parallel_initialize: exit\n"));
7618#if KMP_AFFINITY_SUPPORTED
7622 if (!__kmp_hh_affinity.flags.initialized)
7623 __kmp_affinity_initialize(__kmp_hh_affinity);
7654 this_thr->th.th_local.this_construct = 0;
7688 if (__itt_stack_caller_create_ptr) {
7690 if (team->
t.t_stack_id != NULL) {
7691 __kmp_itt_stack_callee_enter((__itt_caller)team->
t.t_stack_id);
7694 __kmp_itt_stack_callee_enter(
7695 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7699#if INCLUDE_SSC_MARKS
7700 SSC_MARK_INVOKING();
7705 void **exit_frame_p;
7706 ompt_data_t *my_task_data;
7707 ompt_data_t *my_parallel_data;
7711 exit_frame_p = &(team->
t.t_implicit_task_taskdata[tid]
7712 .ompt_task_info.frame.exit_frame.ptr);
7714 exit_frame_p = &dummy;
7718 &(team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data);
7719 my_parallel_data = &(team->
t.ompt_team_info.parallel_data);
7721 ompt_team_size = team->
t.t_nproc;
7723 ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
7729#if KMP_STATS_ENABLED
7731 if (previous_state == stats_state_e::TEAMS_REGION) {
7740 tid, (
int)team->
t.t_argc, (
void **)team->
t.t_argv
7747 *exit_frame_p = NULL;
7748 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_team;
7751#if KMP_STATS_ENABLED
7752 if (previous_state == stats_state_e::TEAMS_REGION) {
7759 if (__itt_stack_caller_create_ptr) {
7761 if (team->
t.t_stack_id != NULL) {
7762 __kmp_itt_stack_callee_leave((__itt_caller)team->
t.t_stack_id);
7765 __kmp_itt_stack_callee_leave(
7766 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7780 thr->th.th_set_nproc = thr->th.th_teams_size.nth;
7783 KA_TRACE(20, (
"__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
7792 KA_TRACE(100, (
"__kmp_teams_master: Thread %p created node %p and init"
7793 " cg_nthreads to 1\n",
7795 tmp->
up = thr->th.th_cg_roots;
7796 thr->th.th_cg_roots = tmp;
7800#if INCLUDE_SSC_MARKS
7806#if INCLUDE_SSC_MARKS
7810 if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
7811 thr->th.th_teams_size.nth = thr->th.th_team_nproc;
7834 ompt_data_t *task_data =
7835 &team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data;
7836 ompt_data_t *parallel_data = &team->
t.ompt_team_info.parallel_data;
7839 ompt_scope_begin, parallel_data, task_data, team->
t.t_nproc, tid,
7841 OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid;
7846 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_league;
7859 if (num_threads > 0)
7860 thr->th.th_set_nproc = num_threads;
7864 int *num_threads_list) {
7869 if (num_threads_list[0] > 0)
7870 thr->th.th_set_nproc = num_threads_list[0];
7871 thr->th.th_set_nested_nth =
7874 thr->th.th_set_nested_nth[
i] = num_threads_list[
i];
7875 thr->th.th_set_nested_nth_sz = list_length;
7881 thr->th.th_nt_strict =
true;
7882 thr->th.th_nt_loc =
loc;
7885 thr->th.th_nt_sev = sev;
7890 thr->th.th_nt_msg = msg;
7892 thr->th.th_nt_msg =
"Cannot form team with number of threads specified by "
7893 "strict num_threads clause.";
7906 if (num_threads == 0) {
7918 if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) {
7919 num_threads = thr->th.th_current_task->td_icvs.thread_limit;
7924 if (num_threads == 0) {
7928 if (num_threads < 0) {
7935 thr->th.th_current_task->td_icvs.thread_limit = num_threads;
7942 if (new_threads == 0) {
7945 if (new_threads != num_threads) {
7949 KMP_MSG(CantFormThrTeam, num_threads, new_threads),
7953 num_threads = new_threads;
7956 thr->th.th_teams_size.nth = num_threads;
7964 if (num_teams < 0) {
7971 if (num_teams == 0) {
7989 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
7997 int num_teams_ub,
int num_threads) {
8003 if (num_teams_lb > num_teams_ub) {
8010 if (num_teams_lb == 0 && num_teams_ub > 0)
8011 num_teams_lb = num_teams_ub;
8013 if (num_teams_lb == 0 && num_teams_ub == 0) {
8024 }
else if (num_teams_lb == num_teams_ub) {
8025 num_teams = num_teams_ub;
8027 if (num_threads <= 0) {
8029 num_teams = num_teams_lb;
8031 num_teams = num_teams_ub;
8037 if (num_teams < num_teams_lb) {
8038 num_teams = num_teams_lb;
8039 }
else if (num_teams > num_teams_ub) {
8040 num_teams = num_teams_ub;
8046 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
8054 thr->th.th_set_proc_bind = proc_bind;
8071 team->
t.t_construct = 0;
8072 team->
t.t_ordered.dt.t_value =
8077 if (team->
t.t_max_nproc > 1) {
8080 team->
t.t_disp_buffer[
i].buffer_index =
i;
8081 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
8084 team->
t.t_disp_buffer[0].buffer_index = 0;
8085 team->
t.t_disp_buffer[0].doacross_buf_idx = 0;
8092 for (
f = 0;
f < team->
t.t_nproc;
f++) {
8094 team->
t.t_threads[
f]->th.th_team_nproc == team->
t.t_nproc);
8115 __kmp_printf(
"GTID: %d, __kmp_threads[%d]=%p\n", gtid, gtid,
8117 __kmp_printf(
"__kmp_threads[%d]->th.th_team_nproc=%d, TEAM: %p, "
8118 "team->t.t_nproc=%d\n",
8129 ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
8131 (ompt_state == ompt_state_wait_barrier_teams ||
8132 ompt_state == ompt_state_wait_barrier_implicit_parallel)) {
8133 int ds_tid = this_thr->th.th_info.ds.ds_tid;
8134 ompt_data_t *task_data = OMPT_CUR_TASK_DATA(this_thr);
8135 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
8137 void *codeptr = NULL;
8141 codeptr = OMPT_CUR_TEAM_INFO(this_thr)->master_return_address;
8143 ompt_sync_region_t sync_kind = ompt_sync_region_barrier_implicit_parallel;
8144 if (this_thr->th.ompt_thread_info.parallel_flags & ompt_parallel_league)
8145 sync_kind = ompt_sync_region_barrier_teams;
8148 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8152 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8157 ompt_scope_end, NULL, task_data, 0, ds_tid,
8158 ompt_task_implicit);
8169#ifdef USE_LOAD_BALANCE
8173static int __kmp_active_hot_team_nproc(
kmp_root_t *root) {
8178 if (root->r.r_active) {
8181 hot_team = root->r.r_hot_team;
8183 return hot_team->
t.t_nproc - 1;
8188 for (
i = 1;
i < hot_team->
t.t_nproc;
i++) {
8189 if (hot_team->
t.t_threads[
i]->th.th_active) {
8198static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc) {
8201 int hot_team_active;
8202 int team_curr_active;
8205 KB_TRACE(20, (
"__kmp_load_balance_nproc: called root:%p set_nproc:%d\n", root,
8209 ->th.th_current_task->td_icvs.dynamic ==
TRUE);
8212 if (set_nproc == 1) {
8213 KB_TRACE(20, (
"__kmp_load_balance_nproc: serial execution.\n"));
8223 hot_team_active = __kmp_active_hot_team_nproc(root);
8224 team_curr_active = pool_active + hot_team_active + 1;
8228 KB_TRACE(30, (
"__kmp_load_balance_nproc: system active = %d pool active = %d "
8229 "hot team active = %d\n",
8230 system_active, pool_active, hot_team_active));
8232 if (system_active < 0) {
8237 KMP_WARNING(CantLoadBalUsing,
"KMP_DYNAMIC_MODE=thread limit");
8241 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
8242 if (retval > set_nproc) {
8249 KB_TRACE(20, (
"__kmp_load_balance_nproc: thread limit exit. retval:%d\n",
8257 if (system_active < team_curr_active) {
8258 system_active = team_curr_active;
8261 if (retval > set_nproc) {
8268 KB_TRACE(20, (
"__kmp_load_balance_nproc: exit. retval:%d\n", retval));
8280 KA_TRACE(10, (
"__kmp_cleanup: enter\n"));
8283#if KMP_HANDLE_SIGNALS
8284 __kmp_remove_signals();
8290#if KMP_AFFINITY_SUPPORTED
8291 __kmp_affinity_uninitialize();
8297 KA_TRACE(10, (
"__kmp_cleanup: go serial cleanup\n"));
8328#if KMP_USE_DYNAMIC_LOCK
8329 __kmp_cleanup_indirect_user_locks();
8336 ompd_env_block = NULL;
8337 ompd_env_block_size = 0;
8341#if KMP_AFFINITY_SUPPORTED
8343 __kmp_cpuinfo_file = NULL;
8346#if KMP_USE_ADAPTIVE_LOCKS
8347#if KMP_DEBUG_ADAPTIVE_LOCKS
8348 __kmp_print_speculative_stats();
8367#if KMP_USE_HIER_SCHED
8371#if KMP_STATS_ENABLED
8375 KA_TRACE(10, (
"__kmp_cleanup: exit\n"));
8383 if ((env = getenv(
"KMP_IGNORE_MPPBEG")) != NULL) {
8394 if ((env = getenv(
"KMP_IGNORE_MPPEND")) != NULL) {
8412 if (root->r.r_begin)
8415 if (root->r.r_begin) {
8420 root->r.r_begin =
TRUE;
8437 root = thread->th.th_root;
8439 KA_TRACE(20, (
"__kmp_user_set_library: enter T#%d, arg: %d, %d\n", gtid, arg,
8441 if (root->r.r_in_parallel) {
8449 thread->th.th_set_nproc = 0;
8453 thread->th.th_set_nproc = 0;
8458 thread->th.th_set_nproc = 0;
8474 if (arg & (0x1000 - 1)) {
8475 arg &= ~(0x1000 - 1);
8525 teams_serialized = 0;
8526 if (thr->th.th_teams_microtask) {
8528 int tlevel = thr->th.th_teams_level;
8529 int ii = team->
t.t_level;
8530 teams_serialized = team->
t.t_serialized;
8531 int level = tlevel + 1;
8534 for (teams_serialized = team->
t.t_serialized;
8535 (teams_serialized > 0) && (
ii >
level); teams_serialized--,
ii--) {
8537 if (team->
t.t_serialized && (!teams_serialized)) {
8538 team = team->
t.t_parent;
8542 team = team->
t.t_parent;
8555 if (serialized > 1) {
8558 return team->
t.t_master_tid;
8568 if (serialized > 1) {
8571 return team->
t.t_parent->t.t_nproc;
8618#if KMP_AFFINITY_SUPPORTED
8619 {
'A',
"thread_affinity",
's'},
8621 {
't',
"team_num",
'd'},
8622 {
'T',
"num_teams",
'd'},
8623 {
'L',
"nesting_level",
'd'},
8624 {
'n',
"thread_num",
'd'},
8625 {
'N',
"num_threads",
'd'},
8626 {
'a',
"ancestor_tnum",
'd'},
8628 {
'P',
"process_id",
'd'},
8629 {
'i',
"native_thread_id",
'd'}};
8635 int rc, format_index, field_value;
8636 const char *width_left, *width_right;
8637 bool pad_zeros, right_justify, parse_long_name, found_valid_name;
8638 static const int FORMAT_SIZE = 20;
8639 char format[FORMAT_SIZE] = {0};
8640 char absolute_short_name = 0;
8665 right_justify =
false;
8667 right_justify =
true;
8671 width_left = width_right = NULL;
8672 if (**ptr >=
'0' && **ptr <=
'9') {
8680 format[format_index++] =
'%';
8682 format[format_index++] =
'-';
8684 format[format_index++] =
'0';
8685 if (width_left && width_right) {
8689 while (
i < 8 && width_left < width_right) {
8690 format[format_index++] = *width_left;
8698 found_valid_name =
false;
8699 parse_long_name = (**ptr ==
'{');
8700 if (parse_long_name)
8708 if (parse_long_name) {
8710 if (strncmp(*ptr, long_name,
length) == 0) {
8711 found_valid_name =
true;
8714 }
else if (**ptr == short_name) {
8715 found_valid_name =
true;
8718 if (found_valid_name) {
8719 format[format_index++] = field_format;
8720 format[format_index++] =
'\0';
8721 absolute_short_name = short_name;
8725 if (parse_long_name) {
8727 absolute_short_name = 0;
8735 switch (absolute_short_name) {
8768#if KMP_AFFINITY_SUPPORTED
8772 __kmp_affinity_str_buf_mask(&
buf, th->th.th_affin_mask);
8782 if (parse_long_name) {
8803 const char *parse_ptr;
8820 if (parse_ptr == NULL || *parse_ptr ==
'\0') {
8825 while (*parse_ptr !=
'\0') {
8827 if (*parse_ptr ==
'%') {
8854 int blocktime = arg;
8873 bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(blocktime, __kmp_monitor_wakeups);
8875 set__bt_intervals_team(thread->th.th_team, tid, bt_intervals);
8876 set__bt_intervals_team(thread->th.th_serial_team, 0, bt_intervals);
8885 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
8886 "bt_intervals=%d, monitor_updates=%d\n",
8888 thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
8889 __kmp_monitor_wakeups));
8891 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d\n",
8893 thread->th.th_team->t.t_id, tid, blocktime));
8914 void *reduce_data,
void (*reduce_func)(
void *lhs_data,
void *rhs_data),
8932#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED \
8934 ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
8935#define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
8941 if (team_size == 1) {
8949#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
8950 KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
8951 KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_WASM
8953#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8954 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD || \
8955 KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8957 int teamsize_cutoff = 4;
8959#if KMP_MIC_SUPPORTED
8960 if (__kmp_mic_type != non_mic) {
8961 teamsize_cutoff = 8;
8965 if (tree_available) {
8966 if (team_size <= teamsize_cutoff) {
8967 if (atomic_available) {
8971 retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
8973 }
else if (atomic_available) {
8977#error "Unknown or unsupported OS"
8982#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8983 KMP_ARCH_WASM || KMP_ARCH_PPC || KMP_ARCH_AARCH64_32
8985#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8986 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HURD || KMP_OS_SOLARIS || \
8987 KMP_OS_WASI || KMP_OS_AIX
8991 if (atomic_available) {
8992 if (num_vars <= 2) {
9000 if (atomic_available && (num_vars <= 3)) {
9002 }
else if (tree_available) {
9003 if ((reduce_size > (9 *
sizeof(
kmp_real64))) &&
9004 (reduce_size < (2000 *
sizeof(
kmp_real64)))) {
9005 retval = TREE_REDUCE_BLOCK_WITH_PLAIN_BARRIER;
9010#error "Unknown or unsupported OS"
9014#error "Unknown or unsupported architecture"
9027 int atomic_available, tree_available;
9036 if (!atomic_available) {
9044 if (!tree_available) {
9048#if KMP_FAST_REDUCTION_BARRIER
9049 forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
9058 retval = forced_retval;
9061 KA_TRACE(10, (
"reduction method selected=%08x\n", retval));
9063#undef FAST_REDUCTION_TREE_METHOD_GENERATED
9064#undef FAST_REDUCTION_ATOMIC_METHOD_GENERATED
9167 for (
int f = 1;
f < old_nthreads; ++
f) {
9170 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 0) {
9176 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3) {
9177 while (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3)
9183 team->
t.t_threads[
f]->th.th_used_in_team.store(2);
9187 team->
t.b->go_release();
9193 int count = old_nthreads - 1;
9195 count = old_nthreads - 1;
9196 for (
int f = 1;
f < old_nthreads; ++
f) {
9197 if (other_threads[
f]->th.th_used_in_team.load() != 0) {
9200 void *, other_threads[
f]->th.th_sleep_loc);
9210 team->
t.b->update_num_threads(new_nthreads);
9211 team->
t.b->go_reset();
9222 for (
int f = 1;
f < new_nthreads; ++
f) {
9225 &(team->
t.t_threads[
f]->th.th_used_in_team), 0, 3);
9234 int count = new_nthreads - 1;
9236 count = new_nthreads - 1;
9237 for (
int f = 1;
f < new_nthreads; ++
f) {
9238 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 1) {
9258std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;
9260void __kmp_hidden_helper_wrapper_fn(
int *gtid,
int *, ...) {
9277 for (
int i = 1;
i < __kmp_hit_hidden_helper_threads_num; ++
i) {
9323 for (
int i = 0;
i < levels; ++
i)
9345 loc++, hw_level++) {
9354 int upper_levels = 1;
9390#if !KMP_STATS_ENABLED
9397#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.
int get_level(kmp_hw_t type) const
int get_count(int level) const
int get_ratio(int level) const
@ 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 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)
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
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()
void __kmp_hidden_helper_worker_thread_signal()
void __kmp_common_initialize(void)
void __kmp_release_64(kmp_flag_64<> *flag)
kmp_pause_status_t __kmp_pause_status
#define KMP_MAX_BLOCKTIME
kmp_lock_t __kmp_debug_lock
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()
#define KMP_INTERNAL_REALLOC(p, sz)
#define get__nproc_2(xteam, xtid)
void __kmp_wait_to_unref_task_teams(void)
struct KMP_ALIGN_CACHE dispatch_private_info dispatch_private_info_t
#define __kmp_assign_root_init_mask()
int __kmp_dflt_max_active_levels
#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()
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
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
#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
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
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_NESTED_HOT_TEAMS
#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
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)
#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
kmp_queuing_lock_t __kmp_dispatch_lock
#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
#define USE_NESTED_HOT_ARG(x)
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)
#define KMP_INIT_BARRIER_STATE
size_t __kmp_sys_min_stksize
#define set__bt_set_team(xteam, xtid, xval)
kmp_uint32 __kmp_barrier_gather_branch_bits[bs_last_barrier]
#define KMP_BARRIER_NOT_WAITING
#define KMP_INTERNAL_FREE(p)
int __kmp_threads_capacity
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)
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[])
#define KMP_MAX_ACTIVE_LEVELS_LIMIT
static void __kmp_type_convert(T1 src, T2 *dest)
void __kmp_fini_memkind()
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_atomic_lock_t __kmp_atomic_lock_4r
static void __kmp_init_atomic_lock(kmp_atomic_lock_t *lck)
void __kmp_print_structure(void)
void __kmp_dump_debug_buffer(void)
#define KMP_BUILD_ASSERT(expr)
#define KMP_DEBUG_ASSERT(cond)
#define KMP_ASSERT2(cond, msg)
unsigned long long kmp_uint64
kmp_hier_sched_env_t __kmp_hier_scheds
void __kmp_dispatch_free_hierarchies(kmp_team_t *team)
void __kmp_env_free(char const **value)
char * __kmp_env_get(char const *name)
void __kmp_env_set(char const *name, char const *value, int overwrite)
void __kmp_env_unset(char const *name)
void __kmp_push_sync(int gtid, enum cons_type ct, ident_t const *ident, kmp_user_lock_p lck)
void __kmp_push_parallel(int gtid, ident_t const *ident)
void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident)
enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident)
struct cons_header * __kmp_allocate_cons_stack(int gtid)
void __kmp_pop_parallel(int gtid, ident_t const *ident)
void __kmp_free_cons_stack(void *ptr)
static volatile kmp_i18n_cat_status_t status
static void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, va_list ap)
void __kmp_i18n_dump_catalog(kmp_str_buf_t *buffer)
void __kmp_fatal(kmp_msg_t message,...)
void __kmp_i18n_catclose()
kmp_bootstrap_lock_t __kmp_stdio_lock
void __kmp_fprintf(enum kmp_io stream, char const *format,...)
void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap)
void __kmp_printf(char const *format,...)
void __kmp_printf_no_lock(char const *format,...)
void __kmp_close_console(void)
#define USE_ITT_BUILD_ARG(x)
void __kmp_init_queuing_lock(kmp_queuing_lock_t *lck)
void __kmp_cleanup_user_locks(void)
void __kmp_validate_locks(void)
static void __kmp_release_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static int __kmp_acquire_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_lock(kmp_lock_t *lck)
static int __kmp_acquire_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static void __kmp_release_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_bootstrap_lock(kmp_bootstrap_lock_t *lck)
void(* microtask_t)(int *gtid, int *npr,...)
#define TCW_SYNC_PTR(a, b)
#define KMP_ATOMIC_ST_REL(p, v)
#define KMP_CACHE_PREFETCH(ADDR)
#define KMP_ATOMIC_LD_ACQ(p)
bool __kmp_atomic_compare_store_acq(std::atomic< T > *p, T expected, T desired)
#define KMP_FALLTHROUGH()
#define KMP_ATOMIC_DEC(p)
#define KMP_GET_PAGE_SIZE()
#define KMP_ATOMIC_LD_RLX(p)
#define KMP_COMPARE_AND_STORE_ACQ32(p, cv, sv)
#define KMP_WEAK_ATTRIBUTE_EXTERNAL
#define KMP_ATOMIC_INC(p)
int __kmp_pause_resource(kmp_pause_status_t level)
void __kmp_warn(char const *format,...)
kmp_info_t * __kmp_hidden_helper_main_thread
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 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_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,...)
unsigned short __kmp_get_random(kmp_info_t *thread)
int __kmp_register_root(int initial_thread)
static void __kmp_internal_end(void)
void __kmp_free_team(kmp_root_t *root, kmp_team_t *team USE_NESTED_HOT_ARG(kmp_info_t *master))
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)
kmp_int32 __kmp_enable_hidden_helper
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)
kmp_info_t * __kmp_thread_pool_insert_pt
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()
std::atomic< kmp_int32 > __kmp_unexecuted_hidden_helper_tasks
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)
kmp_info_t ** __kmp_hidden_helper_threads
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()
kmp_int32 __kmp_hidden_helper_threads_num
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 USE_NESTED_HOT_ARG(kmp_info_t *master))
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)
#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)
__attribute__((noinline))
void microtask(int *global_tid, int *bound_tid)
ompt_callbacks_active_t ompt_enabled
ompt_callbacks_internal_t ompt_callbacks
#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()
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
kmp_proc_bind_t * bind_types
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)