39#if OMP_PROFILING_SUPPORT
40#include "llvm/Support/TimeProfiler.h"
41static char *ProfileTraceFile =
nullptr;
45#define KMP_USE_PRCTL 0
61#if defined(KMP_GOMP_COMPAT)
74#define KMP_MIN(x, y) ((x) < (y) ? (x) : (y))
91#if KMP_AFFINITY_SUPPORTED
92static void __kmp_partition_places(
kmp_team_t *team,
93 int update_master_only = 0);
96#if ENABLE_LIBOMPTARGET
97static void __kmp_target_init(
void);
104#ifdef USE_LOAD_BALANCE
105static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc);
110static int __kmp_unregister_root_other_thread(
int gtid);
127 new_nested_nth->
nth[
i] = 0;
129 new_nested_nth->
nth[
i] = thr->th.th_set_nested_nth[
j];
131 return new_nested_nth;
147 (
"*** __kmp_get_global_thread_id: entering, nproc=%d all_nproc=%d\n",
160 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using TDATA\n"));
165 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using keyed TLS\n"));
168 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id: using internal alg.\n"));
170 stack_addr = (
char *)&stack_data;
190 stack_size = (size_t)
TCR_PTR(thr->th.th_info.ds.ds_stacksize);
191 stack_base = (
char *)
TCR_PTR(thr->th.th_info.ds.ds_stackbase);
195 if (stack_addr <= stack_base) {
196 size_t stack_diff = stack_base - stack_addr;
198 if (stack_diff <= stack_size) {
214 (
"*** __kmp_get_global_thread_id: internal alg. failed to find "
215 "thread, using TLS\n"));
232 if (!
TCR_4(other_threads[
i]->th.th_info.ds.ds_stackgrow)) {
236 stack_base = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
237 if (stack_addr > stack_base) {
238 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stackbase, stack_addr);
239 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
240 other_threads[
i]->th.th_info.ds.ds_stacksize + stack_addr -
243 TCW_PTR(other_threads[
i]->th.th_info.ds.ds_stacksize,
244 stack_base - stack_addr);
249 char *stack_end = (
char *)other_threads[
i]->th.th_info.ds.ds_stackbase;
250 char *stack_beg = stack_end - other_threads[
i]->th.th_info.ds.ds_stacksize;
252 other_threads[
i]->th.th_info.ds.ds_stacksize,
253 "th_%d stack (refinement)",
i);
266 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using TDATA\n"));
271 KA_TRACE(1000, (
"*** __kmp_get_global_thread_id_reg: using keyed TLS\n"));
275 (
"*** __kmp_get_global_thread_id_reg: using internal alg.\n"));
282 (
"__kmp_get_global_thread_id_reg: Encountered new root thread. "
283 "Registering a new gtid.\n"));
303 char *stack_beg = NULL;
304 char *stack_end = NULL;
307 KA_TRACE(10, (
"__kmp_check_stack_overlap: called\n"));
309 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
310 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
316 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
317 "th_%s stack (%s)",
"mon",
318 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
321 gtid, stack_beg, stack_end, th->th.th_info.ds.ds_stacksize,
322 "th_%d stack (%s)", gtid,
323 (th->th.th_info.ds.ds_stackgrow) ?
"initial" :
"actual");
332 (
"__kmp_check_stack_overlap: performing extensive checking\n"));
333 if (stack_beg == NULL) {
334 stack_end = (
char *)th->th.th_info.ds.ds_stackbase;
335 stack_beg = stack_end - th->th.th_info.ds.ds_stacksize;
341 if (f_th && f_th != th) {
342 char *other_stack_end =
343 (
char *)
TCR_PTR(f_th->th.th_info.ds.ds_stackbase);
344 char *other_stack_beg =
345 other_stack_end - (size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize);
346 if ((stack_beg > other_stack_beg && stack_beg < other_stack_end) ||
347 (stack_end > other_stack_beg && stack_end < other_stack_end)) {
352 -1, other_stack_beg, other_stack_end,
353 (
size_t)
TCR_PTR(f_th->th.th_info.ds.ds_stacksize),
362 KA_TRACE(10, (
"__kmp_check_stack_overlap: returning\n"));
368 static int done =
FALSE;
375#define MAX_MESSAGE 512
378 char const *format, ...) {
382 va_start(ap, format);
383 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP storage map: %p %p%8lu %s\n", p1,
384 p2, (
unsigned long)
size, format);
387#if KMP_PRINT_DATA_PLACEMENT
390 if (p1 <= p2 && (
char *)p2 - (
char *)p1 ==
size) {
392 node = __kmp_get_host_node(p1);
398 int localProc = __kmp_get_cpu_from_gtid(gtid);
402 p1 = (
void *)((
size_t)p1 & ~((
size_t)page_size - 1));
403 p2 = (
void *)(((
size_t)p2 - 1) & ~((
size_t)page_size - 1));
417 (
char *)p1 += page_size;
418 }
while (p1 <= p2 && (node = __kmp_get_host_node(p1)) == lastNode);
424 (
char *)p1 + (page_size - 1),
425 __kmp_get_host_node(p1));
428 (
char *)p2 + (page_size - 1),
429 __kmp_get_host_node(p2));
451 va_start(ap, format);
453 KMP_SNPRINTF(buffer,
sizeof(buffer),
"OMP warning: %s\n", format);
528#if KMP_FAST_REDUCTION_BARRIER
540 int team_id,
int num_thr) {
548 "%s_%d.t_bar", header, team_id);
558 "%s_%d.t_bar[forkjoin]", header, team_id);
560#if KMP_FAST_REDUCTION_BARRIER
564 "%s_%d.t_bar[reduction]", header, team_id);
568 -1, &team->
t.t_dispatch[0], &team->
t.t_dispatch[num_thr],
569 sizeof(
kmp_disp_t) * num_thr,
"%s_%d.t_dispatch", header, team_id);
572 -1, &team->
t.t_threads[0], &team->
t.t_threads[num_thr],
573 sizeof(
kmp_info_t *) * num_thr,
"%s_%d.t_threads", header, team_id);
576 &team->
t.t_disp_buffer[num_disp_buff],
578 "%s_%d.t_disp_buffer", header, team_id);
592#if ENABLE_LIBOMPTARGET
593static void __kmp_init_omptarget() {
594 __kmp_init_target_task();
603BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
608 case DLL_PROCESS_ATTACH:
609 KA_TRACE(10, (
"DllMain: PROCESS_ATTACH\n"));
613 case DLL_PROCESS_DETACH:
627 if (lpReserved == NULL)
632 case DLL_THREAD_ATTACH:
633 KA_TRACE(10, (
"DllMain: THREAD_ATTACH\n"));
639 case DLL_THREAD_DETACH:
654 int gtid = *gtid_ref;
655#ifdef BUILD_PARALLEL_ORDERED
661#if KMP_USE_DYNAMIC_LOCK
667#ifdef BUILD_PARALLEL_ORDERED
668 if (!team->
t.t_serialized) {
679 int gtid = *gtid_ref;
680#ifdef BUILD_PARALLEL_ORDERED
689#ifdef BUILD_PARALLEL_ORDERED
690 if (!team->
t.t_serialized) {
695 team->
t.t_ordered.dt.t_value = ((tid + 1) % team->
t.t_nproc);
715 team = th->th.th_team;
718 th->th.th_ident = id_ref;
720 if (team->
t.t_serialized) {
723 kmp_int32 old_this = th->th.th_local.this_construct;
725 ++th->th.th_local.this_construct;
729 if (team->
t.t_construct == old_this) {
731 th->th.th_local.this_construct);
734 if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
736 team->
t.t_active_level == 1) {
738 __kmp_itt_metadata_single(id_ref);
752 __kmp_itt_single_start(gtid);
760 __kmp_itt_single_end(gtid);
773 int master_tid,
int set_nthreads,
779 kmp_info_t *this_thr = parent_team->
t.t_threads[master_tid];
783 new_nthreads = set_nthreads;
787#ifdef USE_LOAD_BALANCE
788 else if (
__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
789 new_nthreads = __kmp_load_balance_nproc(root, set_nthreads);
790 if (new_nthreads == 1) {
791 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
792 "reservation to 1 thread\n",
796 if (new_nthreads < set_nthreads) {
797 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d load balance reduced "
798 "reservation to %d threads\n",
799 master_tid, new_nthreads));
805 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
806 if (new_nthreads <= 1) {
807 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
808 "reservation to 1 thread\n",
812 if (new_nthreads < set_nthreads) {
813 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d thread limit reduced "
814 "reservation to %d threads\n",
815 master_tid, new_nthreads));
817 new_nthreads = set_nthreads;
820 if (set_nthreads > 2) {
822 new_nthreads = (new_nthreads % set_nthreads) + 1;
823 if (new_nthreads == 1) {
824 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
825 "reservation to 1 thread\n",
829 if (new_nthreads < set_nthreads) {
830 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d dynamic random reduced "
831 "reservation to %d threads\n",
832 master_tid, new_nthreads));
841 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
844 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
845 if (tl_nthreads <= 0) {
853 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
856 if (tl_nthreads == 1) {
857 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT "
858 "reduced reservation to 1 thread\n",
862 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d KMP_DEVICE_THREAD_LIMIT reduced "
863 "reservation to %d threads\n",
864 master_tid, tl_nthreads));
865 new_nthreads = tl_nthreads;
869 int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
870 int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
871 if (cg_nthreads + new_nthreads -
872 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
874 int tl_nthreads = max_cg_threads - cg_nthreads +
875 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
876 if (tl_nthreads <= 0) {
884 KMP_MSG(CantFormThrTeam, set_nthreads, tl_nthreads),
887 if (tl_nthreads == 1) {
888 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT "
889 "reduced reservation to 1 thread\n",
893 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d OMP_THREAD_LIMIT reduced "
894 "reservation to %d threads\n",
895 master_tid, tl_nthreads));
896 new_nthreads = tl_nthreads;
913 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
916 int slotsRequired =
__kmp_nth + new_nthreads -
917 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) -
920 if (slotsAdded < slotsRequired) {
922 new_nthreads -= (slotsRequired - slotsAdded);
930 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
935 KMP_MSG(CantFormThrTeam, set_nthreads, new_nthreads),
943 if (new_nthreads == 1) {
945 (
"__kmp_reserve_threads: T#%d serializing team after reclaiming "
946 "dead roots and rechecking; requested %d threads\n",
949 KC_TRACE(10, (
"__kmp_reserve_threads: T#%d allocating %d threads; requested"
955 if (this_thr->th.th_nt_strict && new_nthreads < set_nthreads) {
956 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
957 this_thr->th.th_nt_msg);
967 int fork_teams_workers) {
971 KA_TRACE(10, (
"__kmp_fork_team_threads: new_nprocs = %d\n", team->
t.t_nproc));
976 master_th->th.th_info.ds.ds_tid = 0;
977 master_th->th.th_team = team;
978 master_th->th.th_team_nproc = team->
t.t_nproc;
979 master_th->th.th_team_master = master_th;
980 master_th->th.th_team_serialized =
FALSE;
981 master_th->th.th_dispatch = &team->
t.t_dispatch[0];
988 int level = team->
t.t_active_level - 1;
989 if (master_th->th.th_teams_microtask) {
990 if (master_th->th.th_teams_size.nteams > 1) {
995 master_th->th.th_teams_level == team->
t.t_level) {
1001 if (hot_teams[
level].hot_team) {
1014 if (!use_hot_team) {
1017 team->
t.t_threads[0] = master_th;
1021 for (
i = 1;
i < team->
t.t_nproc;
i++) {
1025 team->
t.t_threads[
i] = thr;
1029 KA_TRACE(20, (
"__kmp_fork_team_threads: T#%d(%d:%d) init arrived "
1030 "T#%d(%d:%d) join =%llu, plain=%llu\n",
1035 thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
1036 thr->th.th_teams_level = master_th->th.th_teams_level;
1037 thr->th.th_teams_size = master_th->th.th_teams_size;
1042 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
1045 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
1051#if KMP_AFFINITY_SUPPORTED
1055 if (!fork_teams_workers) {
1056 __kmp_partition_places(team);
1060 if (team->
t.t_nproc > 1 &&
1062 team->
t.b->update_num_threads(team->
t.t_nproc);
1073 (
"__kmp_fork_team_threads: Primary T#%d pushing task_team %p / team "
1074 "%p, new task_team %p / team %p\n",
1076 team->
t.t_parent, team->
t.t_task_team[master_th->th.th_task_state],
1081 master_th->th.th_task_state);
1085 if (team->
t.t_nproc > 1) {
1087 team->
t.t_threads[1]->th.th_task_state == 1);
1089 team->
t.t_threads[1]->th.th_task_state);
1091 master_th->th.th_task_state = 0;
1096 master_th->th.th_task_state);
1098 master_th->th.th_task_state = 0;
1103 for (
i = 0;
i < team->
t.t_nproc;
i++) {
1105 if (thr->th.th_prev_num_threads != team->
t.t_nproc ||
1106 thr->th.th_prev_level != team->
t.t_level) {
1107 team->
t.t_display_affinity = 1;
1116#if KMP_ARCH_X86 || KMP_ARCH_X86_64
1121 if (__kmp_inherit_fp_control) {
1126 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1127 __kmp_store_mxcsr(&mxcsr);
1128 mxcsr &= KMP_X86_MXCSR_MASK;
1154 if (__kmp_inherit_fp_control && team->
t.t_fp_control_saved) {
1159 __kmp_store_x87_fpu_control_word(&x87_fpu_control_word);
1160 __kmp_store_mxcsr(&mxcsr);
1161 mxcsr &= KMP_X86_MXCSR_MASK;
1163 if (team->
t.t_x87_fpu_control_word != x87_fpu_control_word) {
1164 __kmp_clear_x87_fpu_status_word();
1165 __kmp_load_x87_fpu_control_word(&team->
t.t_x87_fpu_control_word);
1168 if (team->
t.t_mxcsr != mxcsr) {
1169 __kmp_load_mxcsr(&team->
t.t_mxcsr);
1174#define propagateFPControl(x) ((void)0)
1175#define updateHWFPControl(x) ((void)0)
1187 KC_TRACE(10, (
"__kmpc_serialized_parallel: called by T#%d\n", global_tid));
1199 serial_team = this_thr->th.th_serial_team;
1206 if (this_thr->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1211 proc_bind = this_thr->th.th_current_task->td_icvs.proc_bind;
1219 if (this_thr->th.th_nt_strict && this_thr->th.th_set_nproc > 1)
1220 __kmpc_error(this_thr->th.th_nt_loc, this_thr->th.th_nt_sev,
1221 this_thr->th.th_nt_msg);
1223 this_thr->th.th_set_nproc = 0;
1226 ompt_data_t ompt_parallel_data = ompt_data_none;
1227 void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
1229 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1232 parent_task_info = OMPT_CUR_TASK_INFO(this_thr);
1240 &ompt_parallel_data, team_size,
1241 ompt_parallel_invoker_program | ompt_parallel_team, codeptr);
1246 if (this_thr->th.th_team != serial_team) {
1248 int level = this_thr->th.th_team->t.t_level;
1250 if (serial_team->
t.t_serialized) {
1258 this_thr->th.th_root, 1, 1,
1262 proc_bind, &this_thr->th.th_current_task->td_icvs, 0, NULL);
1267 new_team->
t.t_threads[0] = this_thr;
1268 new_team->
t.t_parent = this_thr->th.th_team;
1269 serial_team = new_team;
1270 this_thr->th.th_serial_team = serial_team;
1274 (
"__kmpc_serialized_parallel: T#%d allocated new serial team %p\n",
1275 global_tid, serial_team));
1283 (
"__kmpc_serialized_parallel: T#%d reusing cached serial team %p\n",
1284 global_tid, serial_team));
1291 serial_team->
t.t_ident =
loc;
1292 serial_team->
t.t_serialized = 1;
1293 serial_team->
t.t_nproc = 1;
1294 serial_team->
t.t_parent = this_thr->th.th_team;
1295 if (this_thr->th.th_team->t.t_nested_nth)
1296 serial_team->
t.t_nested_nth = this_thr->th.th_team->t.t_nested_nth;
1300 serial_team->
t.t_primary_task_state = this_thr->th.th_task_state;
1301 serial_team->
t.t_sched.sched = this_thr->th.th_team->t.t_sched.sched;
1302 this_thr->th.th_team = serial_team;
1303 serial_team->
t.t_master_tid = this_thr->th.th_info.ds.ds_tid;
1305 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d curtask=%p\n", global_tid,
1306 this_thr->th.th_current_task));
1307 KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 1);
1308 this_thr->th.th_current_task->td_flags.executing = 0;
1315 copy_icvs(&this_thr->th.th_current_task->td_icvs,
1316 &this_thr->th.th_current_task->td_parent->td_icvs);
1321 if (this_thr->th.th_team->t.t_nested_nth)
1322 nested_nth = this_thr->th.th_team->t.t_nested_nth;
1324 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1329 this_thr->th.th_current_task->td_icvs.proc_bind =
1336 this_thr->th.th_info.ds.ds_tid = 0;
1339 this_thr->th.th_team_nproc = 1;
1340 this_thr->th.th_team_master = this_thr;
1341 this_thr->th.th_team_serialized = 1;
1342 this_thr->th.th_task_team = NULL;
1343 this_thr->th.th_task_state = 0;
1345 serial_team->
t.t_level = serial_team->
t.t_parent->t.t_level + 1;
1346 serial_team->
t.t_active_level = serial_team->
t.t_parent->t.t_active_level;
1347 serial_team->
t.t_def_allocator = this_thr->th.th_def_allocator;
1353 if (!serial_team->
t.t_dispatch->th_disp_buffer) {
1354 serial_team->
t.t_dispatch->th_disp_buffer =
1358 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1368 ++serial_team->
t.t_serialized;
1369 this_thr->th.th_team_serialized = serial_team->
t.t_serialized;
1372 int level = this_thr->th.th_team->t.t_level;
1377 if (serial_team->
t.t_nested_nth)
1378 nested_nth = serial_team->
t.t_nested_nth;
1380 this_thr->th.th_current_task->td_icvs.nproc = nested_nth->
nth[
level + 1];
1383 serial_team->
t.t_level++;
1384 KF_TRACE(10, (
"__kmpc_serialized_parallel: T#%d increasing nesting level "
1385 "of serial team %p to %d\n",
1386 global_tid, serial_team, serial_team->
t.t_level));
1394 disp_buffer->next = serial_team->
t.t_dispatch->th_disp_buffer;
1395 serial_team->
t.t_dispatch->th_disp_buffer = disp_buffer;
1397 this_thr->th.th_dispatch = serial_team->
t.t_dispatch;
1409 if (this_thr->th.th_prev_level != serial_team->
t.t_level ||
1410 this_thr->th.th_prev_num_threads != 1) {
1413 this_thr->th.th_prev_level = serial_team->
t.t_level;
1414 this_thr->th.th_prev_num_threads = 1;
1421 serial_team->
t.ompt_team_info.master_return_address = codeptr;
1423 this_thr->th.ompt_thread_info.state != ompt_state_overhead) {
1424 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1429 &ompt_parallel_data, codeptr);
1437 ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
1439 ompt_task_implicit);
1440 OMPT_CUR_TASK_INFO(this_thr)->thread_num =
1445 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
1446 OMPT_CUR_TASK_INFO(this_thr)->frame.exit_frame.ptr =
1456 return (master_th->th.th_teams_microtask && ap &&
1464 return ((ap == NULL && active_level == 0) ||
1465 (ap && teams_level > 0 && teams_level ==
level));
1477 ompt_data_t ompt_parallel_data,
void *return_address,
1483 parent_team->
t.t_ident =
loc;
1485 parent_team->
t.t_argc = argc;
1486 argv = (
void **)parent_team->
t.t_argv;
1487 for (
i = argc - 1;
i >= 0; --
i) {
1491 if (parent_team == master_th->th.th_serial_team) {
1499 parent_team->
t.t_serialized--;
1509 void **exit_frame_p;
1510 ompt_data_t *implicit_task_data;
1515 &ompt_parallel_data, return_address);
1522 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1526 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), implicit_task_data,
1527 1, OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1531 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1533 exit_frame_p = &dummy;
1539 parent_team->
t.t_serialized--;
1554 *exit_frame_p = NULL;
1555 OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
1558 ompt_scope_end, NULL, implicit_task_data, 1,
1559 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1561 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1565 &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th),
1566 OMPT_INVOKER(call_context) | ompt_parallel_team, return_address);
1568 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1575 parent_team->
t.t_invoke = invoker;
1577 parent_team->
t.t_active_level++;
1578 parent_team->
t.t_level++;
1579 parent_team->
t.t_def_allocator = master_th->th.th_def_allocator;
1586 master_th->th.th_teams_size.nth = parent_team->
t.t_nproc;
1598 if (master_set_numthreads) {
1599 if (master_set_numthreads <= master_th->th.th_teams_size.nth) {
1601 kmp_info_t **other_threads = parent_team->
t.t_threads;
1604 int old_proc = master_th->th.th_teams_size.nth;
1609 parent_team->
t.t_nproc = master_set_numthreads;
1610 for (
i = 0;
i < master_set_numthreads; ++
i) {
1611 other_threads[
i]->th.th_team_nproc = master_set_numthreads;
1615 master_th->th.th_set_nproc = 0;
1620 int nth = __kmp_omp_num_threads(
loc);
1622 master_set_numthreads = nth;
1631 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
1636 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
1644 master_th->th.th_current_task->td_icvs.proc_bind)) {
1651 master_th->th.th_current_task->td_icvs.proc_bind != proc_bind_icv) {
1652 kmp_info_t **other_threads = parent_team->
t.t_threads;
1653 for (
i = 0;
i < master_th->th.th_team_nproc; ++
i) {
1654 other_threads[
i]->th.th_current_task->td_icvs.proc_bind = proc_bind_icv;
1660#if USE_ITT_BUILD && USE_ITT_NOTIFY
1661 if (((__itt_frame_submit_v3_ptr && __itt_get_timestamp_ptr) ||
1663 __kmp_forkjoin_frames_mode == 3 &&
1664 parent_team->
t.t_active_level == 1
1665 && master_th->th.th_teams_size.nteams == 1) {
1667 master_th->th.th_frame_time = tmp_time;
1668 parent_team->
t.t_region_time = tmp_time;
1670 if (__itt_stack_caller_create_ptr) {
1673 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
1676#if KMP_AFFINITY_SUPPORTED
1677 __kmp_partition_places(parent_team);
1680 KF_TRACE(10, (
"__kmp_fork_in_teams: before internal fork: root=%p, team=%p, "
1681 "master_th=%p, gtid=%d\n",
1682 root, parent_team, master_th, gtid));
1684 KF_TRACE(10, (
"__kmp_fork_in_teams: after internal fork: root=%p, team=%p, "
1685 "master_th=%p, gtid=%d\n",
1686 root, parent_team, master_th, gtid));
1692 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) invoke microtask = %p\n", gtid,
1693 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1695 if (!parent_team->
t.t_invoke(gtid)) {
1696 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
1698 KA_TRACE(20, (
"__kmp_fork_in_teams: T#%d(%d:0) done microtask = %p\n", gtid,
1699 parent_team->
t.t_id, parent_team->
t.t_pkfn));
1702 KA_TRACE(20, (
"__kmp_fork_in_teams: parallel exit T#%d\n", gtid));
1713 ompt_data_t *ompt_parallel_data,
void **return_address,
1714 ompt_data_t **parent_task_data,
1722#if KMP_OS_LINUX && \
1723 (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64)
1731 20, (
"__kmp_serial_fork_call: T#%d serializing parallel region\n", gtid));
1736 master_th->th.th_serial_team->t.t_pkfn =
microtask;
1741 master_th->th.th_serial_team->t.t_ident =
loc;
1744 master_th->th.th_serial_team->t.t_level--;
1749 void **exit_frame_p;
1755 ompt_parallel_data, *return_address);
1759 task_info = OMPT_CUR_TASK_INFO(master_th);
1760 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1764 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1766 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1770 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1772 exit_frame_p = &dummy;
1789 *exit_frame_p = NULL;
1792 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1793 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1795 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1799 ompt_parallel_data, *parent_task_data,
1800 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1802 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1807 team = master_th->th.th_team;
1809 team->
t.t_invoke = invoker;
1811 team->
t.t_argc = argc;
1812 argv = (
void **)team->
t.t_argv;
1813 for (
i = argc - 1;
i >= 0; --
i)
1825 ompt_scope_end, NULL, &(task_info->
task_data), 0,
1826 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial);
1830 ompt_parallel_data, *parent_task_data,
1834 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1839 for (
i = argc - 1;
i >= 0; --
i)
1845 void **exit_frame_p;
1848 ompt_data_t *implicit_task_data;
1852 ompt_parallel_data, *return_address);
1855 task_info = OMPT_CUR_TASK_INFO(master_th);
1856 exit_frame_p = &(task_info->
frame.exit_frame.ptr);
1859 implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
1862 ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
1864 ompt_task_implicit);
1869 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
1871 exit_frame_p = &dummy;
1888 *exit_frame_p = NULL;
1891 ompt_scope_end, NULL, &(task_info->
task_data), 1,
1892 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
1895 *ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
1899 ompt_parallel_data, *parent_task_data,
1900 OMPT_INVOKER(call_context) | ompt_parallel_team, *return_address);
1902 master_th->th.ompt_thread_info.state = ompt_state_overhead;
1920 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1924 "__kmp_serial_fork_call: unknown fork_context parameter");
1927 KA_TRACE(20, (
"__kmp_serial_fork_call: T#%d serial exit\n", gtid));
1941 int master_this_cons;
1948 int master_set_numthreads;
1949 int task_thread_limit = 0;
1958 KA_TRACE(20, (
"__kmp_fork_call: enter T#%d\n", gtid));
1980 parent_team = master_th->th.th_team;
1981 master_tid = master_th->th.th_info.ds.ds_tid;
1982 master_this_cons = master_th->th.th_local.this_construct;
1983 root = master_th->th.th_root;
1984 master_active = root->r.r_active;
1985 master_set_numthreads = master_th->th.th_set_nproc;
1987 master_th->th.th_current_task->td_icvs.task_thread_limit;
1990 ompt_data_t ompt_parallel_data = ompt_data_none;
1991 ompt_data_t *parent_task_data = NULL;
1992 ompt_frame_t *ompt_frame = NULL;
1993 void *return_address = NULL;
1998 return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
2006 level = parent_team->
t.t_level;
2008 active_level = parent_team->
t.t_active_level;
2010 teams_level = master_th->th.th_teams_level;
2011 p_hot_teams = &master_th->th.th_hot_teams;
2015 (*p_hot_teams)[0].
hot_team = root->r.r_hot_team;
2017 (*p_hot_teams)[0].hot_team_nth = 1;
2023 int team_size = master_set_numthreads
2024 ? master_set_numthreads
2028 ? ompt_parallel_league
2029 : ompt_parallel_team);
2031 parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags,
2034 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2038 master_th->th.th_ident =
loc;
2044 master_set_numthreads,
level,
2046 ompt_parallel_data, return_address,
2060 if ((!enter_teams &&
2061 (parent_team->
t.t_active_level >=
2062 master_th->th.th_current_task->td_icvs.max_active_levels)) ||
2064 KC_TRACE(10, (
"__kmp_fork_call: T#%d serializing team\n", gtid));
2067 nthreads = master_set_numthreads
2068 ? master_set_numthreads
2073 nthreads = task_thread_limit > 0 && task_thread_limit < nthreads
2086 nthreads, enter_teams);
2087 if (nthreads == 1) {
2098 master_th->th.th_set_nproc = 0;
2100 if (nthreads == 1) {
2102 invoker, master_th, parent_team,
2104 &ompt_parallel_data, &return_address,
2112 KF_TRACE(10, (
"__kmp_fork_call: parent_team_aclevel=%d, master_th=%p, "
2113 "curtask=%p, curtask_max_aclevel=%d\n",
2114 parent_team->
t.t_active_level, master_th,
2115 master_th->th.th_current_task,
2116 master_th->th.th_current_task->td_icvs.max_active_levels));
2120 master_th->th.th_current_task->td_flags.executing = 0;
2122 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2128 int nthreads_icv = master_th->th.th_current_task->td_icvs.nproc;
2130 if (!master_th->th.th_set_nested_nth &&
2131 (
level + 1 < parent_team->
t.t_nested_nth->used) &&
2132 (parent_team->
t.t_nested_nth->nth[
level + 1] != nthreads_icv)) {
2133 nthreads_icv = parent_team->
t.t_nested_nth->nth[
level + 1];
2134 }
else if (master_th->th.th_set_nested_nth) {
2137 (nested_nth->
nth[
level + 1] != nthreads_icv))
2138 nthreads_icv = nested_nth->
nth[
level + 1];
2149 if (master_th->th.th_current_task->td_icvs.proc_bind ==
proc_bind_false) {
2155 proc_bind = master_th->th.th_current_task->td_icvs.proc_bind;
2158 if (master_th->th.th_teams_microtask &&
2168 master_th->th.th_current_task->td_icvs.proc_bind)) {
2171 if (!master_th->th.th_teams_microtask ||
2182 copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
2183 new_icvs.
next = NULL;
2184 if (nthreads_icv > 0) {
2185 new_icvs.
nproc = nthreads_icv;
2192 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2197 proc_bind, &new_icvs, argc, master_th);
2202 KF_TRACE(10, (
"__kmp_fork_call: before __kmp_allocate_team\n"));
2204 root, nthreads, nthreads,
2208 proc_bind, &master_th->th.th_current_task->td_icvs, argc, master_th);
2211 &master_th->th.th_current_task->td_icvs);
2214 10, (
"__kmp_fork_call: after __kmp_allocate_team - team = %p\n", team));
2228 if (!master_th->th.th_teams_microtask ||
level > teams_level) {
2229 int new_level = parent_team->
t.t_level + 1;
2231 new_level = parent_team->
t.t_active_level + 1;
2235 int new_level = parent_team->
t.t_level;
2237 new_level = parent_team->
t.t_active_level;
2248 if (team->
t.t_nested_nth &&
2249 team->
t.t_nested_nth != parent_team->
t.t_nested_nth) {
2252 team->
t.t_nested_nth = NULL;
2254 team->
t.t_nested_nth = parent_team->
t.t_nested_nth;
2255 if (master_th->th.th_set_nested_nth) {
2258 team->
t.t_nested_nth = nested_nth;
2260 master_th->th.th_set_nested_nth = NULL;
2261 master_th->th.th_set_nested_nth_sz = 0;
2262 master_th->th.th_nt_strict =
false;
2268 if (ompd_state & OMPD_ENABLE_BP)
2269 ompd_bp_parallel_begin();
2274 (
"__kmp_fork_call: T#%d(%d:%d)->(%d:0) created a team of %d threads\n",
2275 gtid, parent_team->
t.t_id, team->
t.t_master_tid, team->
t.t_id,
2278 (team->
t.t_master_tid == 0 &&
2279 (team->
t.t_parent == root->r.r_root_team ||
2280 team->
t.t_parent->t.t_serialized)));
2284 argv = (
void **)team->
t.t_argv;
2286 for (
i = argc - 1;
i >= 0; --
i) {
2292 for (
i = 0;
i < argc; ++
i) {
2300 if (!root->r.r_active)
2301 root->r.r_active =
TRUE;
2305 &master_th->th.th_current_task->td_icvs,
loc);
2308 master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
2314 if (team->
t.t_active_level == 1
2315 && !master_th->th.th_teams_microtask) {
2317 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2318 (__kmp_forkjoin_frames_mode == 3 ||
2319 __kmp_forkjoin_frames_mode == 1)) {
2321 if (__itt_get_timestamp_ptr)
2322 tmp_time = __itt_get_timestamp();
2324 master_th->th.th_frame_time = tmp_time;
2325 if (__kmp_forkjoin_frames_mode == 3)
2326 team->
t.t_region_time = tmp_time;
2330 if ((__itt_frame_begin_v3_ptr || KMP_ITT_DEBUG) &&
2331 __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) {
2333 __kmp_itt_region_forking(gtid, team->
t.t_nproc, 0);
2342 (
"__kmp_internal_fork : root=%p, team=%p, master_th=%p, gtid=%d\n",
2343 root, team, master_th, gtid));
2346 if (__itt_stack_caller_create_ptr) {
2350 team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2351 }
else if (parent_team->
t.t_serialized) {
2357 parent_team->
t.t_stack_id = __kmp_itt_stack_caller_create();
2366 KF_TRACE(10, (
"__kmp_internal_fork : after : root=%p, team=%p, "
2367 "master_th=%p, gtid=%d\n",
2368 root, team, master_th, gtid));
2372 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2377 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) invoke microtask = %p\n", gtid,
2378 team->
t.t_id, team->
t.t_pkfn));
2381#if KMP_STATS_ENABLED
2389 if (!team->
t.t_invoke(gtid)) {
2390 KMP_ASSERT2(0,
"cannot invoke microtask for PRIMARY thread");
2393#if KMP_STATS_ENABLED
2400 KA_TRACE(20, (
"__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
2401 team->
t.t_id, team->
t.t_pkfn));
2404 KA_TRACE(20, (
"__kmp_fork_call: parallel exit T#%d\n", gtid));
2407 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2415static inline void __kmp_join_restore_state(
kmp_info_t *thread,
2418 thread->th.ompt_thread_info.state =
2419 ((team->
t.t_serialized) ? ompt_state_work_serial
2420 : ompt_state_work_parallel);
2423static inline void __kmp_join_ompt(
int gtid,
kmp_info_t *thread,
2424 kmp_team_t *team, ompt_data_t *parallel_data,
2425 int flags,
void *codeptr) {
2429 parallel_data, &(task_info->
task_data), flags, codeptr);
2432 task_info->
frame.enter_frame = ompt_data_none;
2433 __kmp_join_restore_state(thread, team);
2451 KA_TRACE(20, (
"__kmp_join_call: enter T#%d\n", gtid));
2455 root = master_th->th.th_root;
2456 team = master_th->th.th_team;
2457 parent_team = team->
t.t_parent;
2459 master_th->th.th_ident =
loc;
2462 void *team_microtask = (
void *)team->
t.t_pkfn;
2468 master_th->th.ompt_thread_info.state = ompt_state_overhead;
2474 KA_TRACE(20, (
"__kmp_join_call: T#%d, old team = %p old task_team = %p, "
2475 "th_task_team = %p\n",
2477 team->
t.t_task_team[master_th->th.th_task_state],
2478 master_th->th.th_task_team));
2483 if (team->
t.t_serialized) {
2484 if (master_th->th.th_teams_microtask) {
2486 int level = team->
t.t_level;
2487 int tlevel = master_th->th.th_teams_level;
2488 if (
level == tlevel) {
2492 }
else if (
level == tlevel + 1) {
2496 team->
t.t_serialized++;
2506 __kmp_join_restore_state(master_th, parent_team);
2513 master_active = team->
t.t_master_active;
2520 if (__itt_stack_caller_create_ptr) {
2523 __kmp_itt_stack_caller_destroy((__itt_caller)team->
t.t_stack_id);
2524 team->
t.t_stack_id = NULL;
2528 master_th->th.th_task_state =
2531 if (__itt_stack_caller_create_ptr && parent_team->
t.t_serialized) {
2536 __kmp_itt_stack_caller_destroy((__itt_caller)parent_team->
t.t_stack_id);
2537 parent_team->
t.t_stack_id = NULL;
2545 ompt_data_t *parallel_data = &(team->
t.ompt_team_info.parallel_data);
2546 void *codeptr = team->
t.ompt_team_info.master_return_address;
2551 if (team->
t.t_active_level == 1 &&
2552 (!master_th->th.th_teams_microtask ||
2553 master_th->th.th_teams_size.nteams == 1)) {
2554 master_th->th.th_ident =
loc;
2557 if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
2558 __kmp_forkjoin_frames_mode == 3)
2559 __kmp_itt_frame_submit(gtid, team->
t.t_region_time,
2560 master_th->th.th_frame_time, 0,
loc,
2561 master_th->th.th_team_nproc, 1);
2562 else if ((__itt_frame_end_v3_ptr || KMP_ITT_DEBUG) &&
2563 !__kmp_forkjoin_frames_mode && __kmp_forkjoin_frames)
2564 __kmp_itt_region_joined(gtid);
2568#if KMP_AFFINITY_SUPPORTED
2571 master_th->th.th_first_place = team->
t.t_first_place;
2572 master_th->th.th_last_place = team->
t.t_last_place;
2576 if (master_th->th.th_teams_microtask && !exit_teams &&
2578 team->
t.t_level == master_th->th.th_teams_level + 1) {
2583 ompt_data_t ompt_parallel_data = ompt_data_none;
2587 int ompt_team_size = team->
t.t_nproc;
2589 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2590 OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit);
2592 task_info->
frame.exit_frame = ompt_data_none;
2594 ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
2600 team->
t.t_active_level--;
2607 if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
2608 int old_num = master_th->th.th_team_nproc;
2609 int new_num = master_th->th.th_teams_size.nth;
2611 team->
t.t_nproc = new_num;
2612 for (
int i = 0;
i < old_num; ++
i) {
2613 other_threads[
i]->th.th_team_nproc = new_num;
2616 for (
int i = old_num;
i < new_num; ++
i) {
2621 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
2624 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
2629 other_threads[
i]->th.th_task_state = master_th->th.th_task_state;
2636 __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data,
2637 OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr);
2645 master_th->th.th_info.ds.ds_tid = team->
t.t_master_tid;
2646 master_th->th.th_local.this_construct = team->
t.t_master_this_cons;
2648 master_th->th.th_dispatch = &parent_team->
t.t_dispatch[team->
t.t_master_tid];
2655 if (!master_th->th.th_teams_microtask ||
2656 team->
t.t_level > master_th->th.th_teams_level) {
2668 : ompt_task_implicit;
2669 int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->
t.t_nproc;
2671 ompt_scope_end, NULL, &(task_info->
task_data), ompt_team_size,
2672 OMPT_CUR_TASK_INFO(master_th)->thread_num, flags);
2674 task_info->
frame.exit_frame = ompt_data_none;
2679 KF_TRACE(10, (
"__kmp_join_call1: T#%d, this_thread=%p team=%p\n", 0,
2683 master_th->th.th_def_allocator = team->
t.t_def_allocator;
2686 if (ompd_state & OMPD_ENABLE_BP)
2687 ompd_bp_parallel_end();
2691 if (root->r.r_active != master_active)
2692 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) {
2711 master_th->th.th_serial_team = parent_team;
2717 team->
t.t_primary_task_state == 1);
2718 master_th->th.th_task_state = (
kmp_uint8)team->
t.t_primary_task_state;
2721 master_th->th.th_task_team =
2722 parent_team->
t.t_task_team[master_th->th.th_task_state];
2724 (
"__kmp_join_call: Primary T#%d restoring task_team %p, team %p\n",
2732 master_th->th.th_current_task->td_flags.executing = 1;
2736#if KMP_AFFINITY_SUPPORTED
2737 if (master_th->th.th_team->t.t_level == 0 && __kmp_affinity.flags.reset) {
2745 : ompt_parallel_team);
2747 __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags,
2753 KA_TRACE(20, (
"__kmp_join_call: exit T#%d\n", gtid));
2760 if (thread->th.th_team != thread->th.th_serial_team) {
2763 if (thread->th.th_team->t.t_serialized > 1) {
2766 if (thread->th.th_team->t.t_control_stack_top == NULL) {
2769 if (thread->th.th_team->t.t_control_stack_top->serial_nesting_level !=
2770 thread->th.th_team->t.t_serialized) {
2779 copy_icvs(control, &thread->th.th_current_task->td_icvs);
2783 control->
next = thread->th.th_team->t.t_control_stack_top;
2784 thread->th.th_team->t.t_control_stack_top = control;
2794 KF_TRACE(10, (
"__kmp_set_num_threads: new __kmp_nth = %d\n", new_nth));
2804 if (thread->th.th_current_task->td_icvs.nproc == new_nth)
2814 root = thread->th.th_root;
2827 for (
f = new_nth;
f < hot_team->
t.t_nproc;
f++) {
2832 hot_team->
t.t_threads[
f]->th.th_task_team = NULL;
2835 hot_team->
t.t_threads[
f] = NULL;
2837 hot_team->
t.t_nproc = new_nth;
2838 if (thread->th.th_hot_teams) {
2840 thread->th.th_hot_teams[0].hot_team_nth = new_nth;
2844 hot_team->
t.b->update_num_threads(new_nth);
2851 for (
f = 0;
f < new_nth;
f++) {
2853 hot_team->
t.t_threads[
f]->th.th_team_nproc = new_nth;
2856 hot_team->
t.t_size_changed = -1;
2864 KF_TRACE(10, (
"__kmp_set_max_active_levels: new max_active_levels for thread "
2866 gtid, max_active_levels));
2870 if (max_active_levels < 0) {
2871 KMP_WARNING(ActiveLevelsNegative, max_active_levels);
2876 KF_TRACE(10, (
"__kmp_set_max_active_levels: the call is ignored: new "
2877 "max_active_levels for thread %d = (%d)\n",
2878 gtid, max_active_levels));
2886 KMP_WARNING(ActiveLevelsExceedLimit, max_active_levels,
2894 KF_TRACE(10, (
"__kmp_set_max_active_levels: after validation: new "
2895 "max_active_levels for thread %d = (%d)\n",
2896 gtid, max_active_levels));
2909 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d\n", gtid));
2914 KF_TRACE(10, (
"__kmp_get_max_active_levels: thread %d, curtask=%p, "
2915 "curtask_maxaclevel=%d\n",
2916 gtid, thread->th.th_current_task,
2917 thread->th.th_current_task->td_icvs.max_active_levels));
2918 return thread->th.th_current_task->td_icvs.max_active_levels;
2943 KF_TRACE(10, (
"__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
2944 gtid, (
int)kind, chunk));
2958 KMP_HNT(DefaultScheduleKindUsed,
"static, no chunk"),
2972 thread->th.th_current_task->td_icvs.sched.r_sched_type =
kmp_sch_static;
2974 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2980 thread->th.th_current_task->td_icvs.sched.r_sched_type =
2985 orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
2990 thread->th.th_current_task->td_icvs.sched.chunk = chunk;
2999 KF_TRACE(10, (
"__kmp_get_schedule: thread %d\n", gtid));
3004 th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
3030#if KMP_STATIC_STEAL_ENABLED
3032 *kind = kmp_sched_static_steal;
3036 KMP_FATAL(UnknownSchedulingType, th_type);
3040 *chunk = thread->th.th_current_task->td_icvs.sched.chunk;
3049 KF_TRACE(10, (
"__kmp_get_ancestor_thread_num: thread %d %d\n", gtid,
level));
3058 team = thr->th.th_team;
3059 ii = team->
t.t_level;
3063 if (thr->th.th_teams_microtask) {
3065 int tlevel = thr->th.th_teams_level;
3082 dd = team->
t.t_serialized;
3085 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3087 if ((team->
t.t_serialized) && (!dd)) {
3088 team = team->
t.t_parent;
3092 team = team->
t.t_parent;
3093 dd = team->
t.t_serialized;
3098 return (dd > 1) ? (0) : (team->
t.t_master_tid);
3107 KF_TRACE(10, (
"__kmp_get_team_size: thread %d %d\n", gtid,
level));
3116 team = thr->th.th_team;
3117 ii = team->
t.t_level;
3121 if (thr->th.th_teams_microtask) {
3123 int tlevel = thr->th.th_teams_level;
3138 for (dd = team->
t.t_serialized; (dd > 0) && (
ii >
level); dd--,
ii--) {
3140 if (team->
t.t_serialized && (!dd)) {
3141 team = team->
t.t_parent;
3145 team = team->
t.t_parent;
3150 return team->
t.t_nproc;
3192 if (!realloc || argc > team->
t.t_max_argc) {
3194 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: needed entries=%d, "
3195 "current entries=%d\n",
3196 team->
t.t_id, argc, (realloc) ? team->
t.t_max_argc : 0));
3198 if (realloc && team->
t.t_argv != &team->
t.t_inline_argv[0])
3204 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: inline allocate %d "
3206 team->
t.t_id, team->
t.t_max_argc));
3207 team->
t.t_argv = &team->
t.t_inline_argv[0];
3210 -1, &team->
t.t_inline_argv[0],
3220 KA_TRACE(100, (
"__kmp_alloc_argv_entries: team %d: dynamic allocate %d "
3222 team->
t.t_id, team->
t.t_max_argc));
3227 &team->
t.t_argv[team->
t.t_max_argc],
3228 sizeof(
void *) * team->
t.t_max_argc,
3229 "team_%d.t_argv", team->
t.t_id);
3242 team->
t.t_dispatch =
3244 team->
t.t_implicit_task_taskdata =
3246 team->
t.t_max_nproc = max_nth;
3249 for (
i = 0;
i < num_disp_buff; ++
i) {
3250 team->
t.t_disp_buffer[
i].buffer_index =
i;
3251 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
3258 for (
i = 0;
i < team->
t.t_max_nproc; ++
i) {
3259 if (team->
t.t_dispatch[
i].th_disp_buffer != NULL) {
3261 team->
t.t_dispatch[
i].th_disp_buffer = NULL;
3264#if KMP_USE_HIER_SCHED
3271 team->
t.t_threads = NULL;
3272 team->
t.t_disp_buffer = NULL;
3273 team->
t.t_dispatch = NULL;
3274 team->
t.t_implicit_task_taskdata = 0;
3332 copy_icvs(&gx_icvs, &team->
t.t_threads[0]->th.th_current_task->td_icvs);
3333 gx_icvs.
next = NULL;
3342 int hot_team_max_nth;
3351 root->r.r_begin =
FALSE;
3352 root->r.r_active =
FALSE;
3353 root->r.r_in_parallel = 0;
3355#if KMP_AFFINITY_SUPPORTED
3356 root->r.r_affinity_assigned =
FALSE;
3361 KF_TRACE(10, (
"__kmp_initialize_root: before root_team\n"));
3379 KF_TRACE(10, (
"__kmp_initialize_root: after root_team = %p\n", root_team));
3381 root->r.r_root_team = root_team;
3382 root_team->
t.t_control_stack_top = NULL;
3385 root_team->
t.t_threads[0] = NULL;
3386 root_team->
t.t_nproc = 1;
3387 root_team->
t.t_serialized = 1;
3389 root_team->
t.t_sched.sched = r_sched.
sched;
3393 (
"__kmp_initialize_root: init root team %d arrived: join=%u, plain=%u\n",
3398 KF_TRACE(10, (
"__kmp_initialize_root: before hot_team\n"));
3410 KF_TRACE(10, (
"__kmp_initialize_root: after hot_team = %p\n", hot_team));
3412 root->r.r_hot_team = hot_team;
3413 root_team->
t.t_control_stack_top = NULL;
3416 hot_team->
t.t_parent = root_team;
3419 hot_team_max_nth = hot_team->
t.t_max_nproc;
3420 for (
f = 0;
f < hot_team_max_nth; ++
f) {
3421 hot_team->
t.t_threads[
f] = NULL;
3423 hot_team->
t.t_nproc = 1;
3425 hot_team->
t.t_sched.sched = r_sched.
sched;
3426 hot_team->
t.t_size_changed = 0;
3432typedef struct kmp_team_list_item {
3434 struct kmp_team_list_item *next;
3435} kmp_team_list_item_t;
3436typedef kmp_team_list_item_t *kmp_team_list_t;
3438static void __kmp_print_structure_team_accum(
3439 kmp_team_list_t list,
3455 __kmp_print_structure_team_accum(list, team->
t.t_parent);
3456 __kmp_print_structure_team_accum(list, team->
t.t_next_pool);
3460 while (l->next != NULL && l->entry != team) {
3463 if (l->next != NULL) {
3469 while (l->next != NULL && l->entry->t.t_id <= team->
t.t_id) {
3476 sizeof(kmp_team_list_item_t));
3483static void __kmp_print_structure_team(
char const *title,
kmp_team_p const *team
3494static void __kmp_print_structure_thread(
char const *title,
3497 if (thread != NULL) {
3506 kmp_team_list_t list;
3514 __kmp_printf(
"\n------------------------------\nGlobal Thread "
3515 "Table\n------------------------------\n");
3531 __kmp_printf(
"\n------------------------------\nThreads\n--------------------"
3537 if (thread != NULL) {
3540 __kmp_print_structure_team(
" Our Team: ", thread->th.th_team);
3541 __kmp_print_structure_team(
" Serial Team: ",
3542 thread->th.th_serial_team);
3543 __kmp_printf(
" Threads: %2d\n", thread->th.th_team_nproc);
3544 __kmp_print_structure_thread(
" Primary: ",
3545 thread->th.th_team_master);
3546 __kmp_printf(
" Serialized?: %2d\n", thread->th.th_team_serialized);
3547 __kmp_printf(
" Set NProc: %2d\n", thread->th.th_set_nproc);
3548 __kmp_printf(
" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
3549 __kmp_print_structure_thread(
" Next in pool: ",
3550 thread->th.th_next_pool);
3552 __kmp_print_structure_team_accum(list, thread->th.th_team);
3553 __kmp_print_structure_team_accum(list, thread->th.th_serial_team);
3561 __kmp_printf(
"\n------------------------------\nUbers\n----------------------"
3569 __kmp_print_structure_team(
" Root Team: ", root->r.r_root_team);
3570 __kmp_print_structure_team(
" Hot Team: ", root->r.r_hot_team);
3571 __kmp_print_structure_thread(
" Uber Thread: ",
3572 root->r.r_uber_thread);
3577 __kmp_print_structure_team_accum(list, root->r.r_root_team);
3578 __kmp_print_structure_team_accum(list, root->r.r_hot_team);
3585 __kmp_printf(
"\n------------------------------\nTeams\n----------------------"
3587 while (list->next != NULL) {
3591 __kmp_print_structure_team(
" Parent Team: ", team->
t.t_parent);
3594 __kmp_printf(
" Levels of serial: %2d\n", team->
t.t_serialized);
3596 for (
i = 0;
i < team->
t.t_nproc; ++
i) {
3598 __kmp_print_structure_thread(
"", team->
t.t_threads[
i]);
3600 __kmp_print_structure_team(
" Next in pool: ", team->
t.t_next_pool);
3606 __kmp_printf(
"\n------------------------------\nPools\n----------------------"
3608 __kmp_print_structure_thread(
"Thread pool: ",
3610 __kmp_print_structure_team(
"Team pool: ",
3615 while (list != NULL) {
3616 kmp_team_list_item_t *item = list;
3628 0x9e3779b1, 0xffe6cc59, 0x2109f6dd, 0x43977ab5, 0xba5703f5, 0xb495a877,
3629 0xe1626741, 0x79695e6b, 0xbc98c09f, 0xd5bee2b3, 0x287488f9, 0x3af18231,
3630 0x9677cd4d, 0xbe3a6929, 0xadc6a877, 0xdcf0674b, 0xbe4d6fe9, 0x5f15e201,
3631 0x99afc3fd, 0xf3f16801, 0xe222cfff, 0x24ba5fdb, 0x0620452d, 0x79f149e3,
3632 0xc8b93f49, 0x972702cd, 0xb07dd827, 0x6c97d5ed, 0x085a3d61, 0x46eb5ea7,
3633 0x3d9910ed, 0x2e687b5b, 0x29609227, 0x6eb081f1, 0x0954c4e1, 0x9d114db9,
3634 0x542acfa9, 0xb3e6bd7b, 0x0742d917, 0xe9f3ffa7, 0x54581edb, 0xf2480f45,
3635 0x0bb9288f, 0xef1affc7, 0x85fa0ca7, 0x3ccc14db, 0xe6baf34b, 0x343377f7,
3636 0x5ca19031, 0xe6d9293b, 0xf0a9f391, 0x5d2e980b, 0xfc411073, 0xc3749363,
3637 0xb892d829, 0x3549366b, 0x629750ad, 0xb98294e5, 0x892d9483, 0xc235baf3,
3638 0x3d2402a3, 0x6bdef3c9, 0xbec333cd, 0x40c9520f};
3643 unsigned x = thread->th.th_x;
3644 unsigned short r = (
unsigned short)(x >> 16);
3646 thread->th.th_x = x * thread->th.th_a + 1;
3648 KA_TRACE(30, (
"__kmp_get_random: THREAD: %d, RETURN: %u\n",
3649 thread->th.th_info.ds.ds_tid,
r));
3656 unsigned seed = thread->th.th_info.ds.ds_tid;
3660 thread->th.th_x = (seed + 1) * thread->th.th_a + 1;
3662 (
"__kmp_init_random: THREAD: %u; A: %u\n", seed, thread->th.th_a));
3668static int __kmp_reclaim_dead_roots(
void) {
3676 r += __kmp_unregister_root_other_thread(
i);
3703 int minimumRequiredCapacity;
3712#if KMP_OS_WINDOWS && !KMP_DYNAMIC_LIB
3715 added = __kmp_reclaim_dead_roots();
3757 }
while (newCapacity < minimumRequiredCapacity);
3801 KA_TRACE(20, (
"__kmp_register_root: entered\n"));
3855 KA_TRACE(1, (
"__kmp_register_root: found slot in threads array for "
3856 "hidden helper thread: T#%d\n",
3870 1, (
"__kmp_register_root: found slot in threads array: T#%d\n", gtid));
3892#ifdef KMP_ADJUST_BLOCKTIME
3897 __kmp_zero_bt =
TRUE;
3908#if KMP_STATS_ENABLED
3910 __kmp_stats_thread_ptr = __kmp_stats_list->push_back(gtid);
3911 __kmp_stats_thread_ptr->startLife();
3918 if (root->r.r_uber_thread) {
3919 root_thread = root->r.r_uber_thread;
3925 root_thread->th.th_info.ds.ds_gtid = gtid;
3927 root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
3929 root_thread->th.th_root = root;
3934 __kmp_initialize_fast_memory(root_thread);
3945 if (!root_thread->th.th_serial_team) {
3947 KF_TRACE(10, (
"__kmp_register_root: before serial_team\n"));
3948 root_thread->th.th_serial_team =
3956 KF_TRACE(10, (
"__kmp_register_root: after serial_team = %p\n",
3957 root_thread->th.th_serial_team));
3962 root->r.r_root_team->t.t_threads[0] = root_thread;
3963 root->r.r_hot_team->t.t_threads[0] = root_thread;
3964 root_thread->th.th_serial_team->t.t_threads[0] = root_thread;
3966 root_thread->th.th_serial_team->t.t_serialized = 0;
3967 root->r.r_uber_thread = root_thread;
3977 __kmp_itt_thread_name(gtid);
3980#ifdef KMP_TDATA_GTID
3986 KA_TRACE(20, (
"__kmp_register_root: T#%d init T#%d(%d:%d) arrived: join=%u, "
3996 root_thread->th.th_bar[
b].bb.b_worker_arrived = 0;
4003#if KMP_AFFINITY_SUPPORTED
4004 root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
4005 root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
4006 root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
4007 root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
4010 root_thread->th.th_prev_level = 0;
4011 root_thread->th.th_prev_num_threads = 1;
4017 KA_TRACE(100, (
"__kmp_register_root: Thread %p created node %p with"
4018 " cg_nthreads init to 1\n",
4021 root_thread->th.th_cg_roots = tmp;
4030 ompt_set_thread_state(root_thread, ompt_state_overhead);
4036 ompt_data_t *task_data;
4037 ompt_data_t *parallel_data;
4042 ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
4045 ompt_set_thread_state(root_thread, ompt_state_work_serial);
4049 if (ompd_state & OMPD_ENABLE_BP)
4050 ompd_bp_thread_begin();
4060 const int max_level) {
4063 if (!hot_teams || !hot_teams[
level].hot_team) {
4070 if (
level < max_level - 1) {
4071 for (
i = 0;
i < nth; ++
i) {
4074 if (
i > 0 && th->th.th_hot_teams) {
4076 th->th.th_hot_teams = NULL;
4089 int n = hot_team->
t.t_nproc;
4094 root->r.r_root_team = NULL;
4095 root->r.r_hot_team = NULL;
4101 for (
i = 0;
i < hot_team->
t.t_nproc; ++
i) {
4106 if (th->th.th_hot_teams) {
4108 th->th.th_hot_teams = NULL;
4126 (LPVOID) & (root->r.r_uber_thread->th),
4127 root->r.r_uber_thread->th.th_info.ds.ds_thread));
4132 if (ompd_state & OMPD_ENABLE_BP)
4133 ompd_bp_thread_end();
4137 ompt_data_t *task_data;
4138 ompt_data_t *parallel_data;
4143 ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
4147 &(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
4153 i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
4154 KA_TRACE(100, (
"__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
4156 root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
4157 root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
4161 root->r.r_uber_thread->th.th_cg_roots->cg_root);
4163 __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
4164 root->r.r_uber_thread->th.th_cg_roots = NULL;
4170 root->r.r_uber_thread = NULL;
4172 root->r.r_begin =
FALSE;
4178 KA_TRACE(1, (
"__kmp_unregister_root_current_thread: enter T#%d\n", gtid));
4184 KC_TRACE(10, (
"__kmp_unregister_root_current_thread: already finished, "
4208 thread->th.ompt_thread_info.state = ompt_state_undefined;
4217 (
"__kmp_unregister_root_current_thread: T#%d unregistered\n", gtid));
4226static int __kmp_unregister_root_other_thread(
int gtid) {
4230 KA_TRACE(1, (
"__kmp_unregister_root_other_thread: enter T#%d\n", gtid));
4238 (
"__kmp_unregister_root_other_thread: T#%d unregistered\n", gtid));
4244void __kmp_task_info() {
4249 kmp_team_t *steam = this_thr->th.th_serial_team;
4253 "__kmp_task_info: gtid=%d tid=%d t_thread=%p team=%p steam=%p curtask=%p "
4255 gtid, tid, this_thr, team, steam, this_thr->th.th_current_task,
4256 team->
t.t_implicit_task_taskdata[tid].td_parent);
4264 int tid,
int gtid) {
4281 this_thr->th.th_info.ds.ds_tid = tid;
4282 this_thr->th.th_set_nproc = 0;
4291#if KMP_AFFINITY_SUPPORTED
4292 this_thr->th.th_new_place = this_thr->th.th_current_place;
4294 this_thr->th.th_root = master->th.th_root;
4297 this_thr->th.th_team_nproc = team->
t.t_nproc;
4298 this_thr->th.th_team_master = master;
4299 this_thr->th.th_team_serialized = team->
t.t_serialized;
4303 KF_TRACE(10, (
"__kmp_initialize_info1: T#%d:%d this_thread=%p curtask=%p\n",
4304 tid, gtid, this_thr, this_thr->th.th_current_task));
4309 KF_TRACE(10, (
"__kmp_initialize_info2: T#%d:%d this_thread=%p curtask=%p\n",
4310 tid, gtid, this_thr, this_thr->th.th_current_task));
4315 this_thr->th.th_dispatch = &team->
t.t_dispatch[tid];
4317 this_thr->th.th_local.this_construct = 0;
4319 if (!this_thr->th.th_pri_common) {
4320 this_thr->th.th_pri_common =
4324 gtid, this_thr->th.th_pri_common, this_thr->th.th_pri_common + 1,
4325 sizeof(
struct common_table),
"th_%d.th_pri_common\n", gtid);
4327 this_thr->th.th_pri_head = NULL;
4330 if (this_thr != master &&
4331 this_thr->th.th_cg_roots != master->th.th_cg_roots) {
4338 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p decrement cg_nthreads"
4339 " on node %p of thread %p to %d\n",
4345 this_thr->th.th_cg_roots = master->th.th_cg_roots;
4347 this_thr->th.th_cg_roots->cg_nthreads++;
4348 KA_TRACE(100, (
"__kmp_initialize_info: Thread %p increment cg_nthreads on"
4349 " node %p of thread %p to %d\n",
4350 this_thr, this_thr->th.th_cg_roots,
4351 this_thr->th.th_cg_roots->cg_root,
4352 this_thr->th.th_cg_roots->cg_nthreads));
4353 this_thr->th.th_current_task->td_icvs.thread_limit =
4354 this_thr->th.th_cg_roots->cg_thread_limit;
4359 volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
4364 KD_TRACE(10, (
"__kmp_initialize_info: T#%d max_nproc: %d\n", gtid,
4365 team->
t.t_max_nproc));
4383 "th_%d.th_dispatch.th_disp_buffer "
4384 "(team_%d.t_dispatch[%d].th_disp_buffer)",
4385 gtid, team->
t.t_id, gtid);
4398 this_thr->th.th_next_pool = NULL;
4433 if (new_thr->th.th_active_in_pool ==
TRUE) {
4436 new_thr->th.th_active_in_pool =
FALSE;
4440 KA_TRACE(20, (
"__kmp_allocate_thread: T#%d using thread T#%d\n",
4447 new_thr->th.th_info.ds.ds_gtid);
4452 new_thr->th.th_task_state = 0;
4460#ifdef KMP_ADJUST_BLOCKTIME
4465 __kmp_zero_bt =
TRUE;
4479 KF_TRACE(10, (
"__kmp_allocate_thread: T#%d using thread %p T#%d\n",
4493 if (!
TCR_4(__kmp_init_monitor)) {
4495 if (!
TCR_4(__kmp_init_monitor)) {
4496 KF_TRACE(10, (
"before __kmp_create_monitor\n"));
4497 TCW_4(__kmp_init_monitor, 1);
4499 KF_TRACE(10, (
"after __kmp_create_monitor\n"));
4510 while (
TCR_4(__kmp_init_monitor) < 2) {
4513 KF_TRACE(10, (
"after monitor thread has started\n"));
4540 new_thr->th.th_nt_strict =
false;
4541 new_thr->th.th_nt_loc = NULL;
4543 new_thr->th.th_nt_msg = NULL;
4547#if USE_ITT_BUILD && USE_ITT_NOTIFY && KMP_DEBUG
4550 __itt_suppress_mark_range(
4551 __itt_suppress_range, __itt_suppress_threading_errors,
4552 &new_thr->th.th_sleep_loc,
sizeof(new_thr->th.th_sleep_loc));
4553 __itt_suppress_mark_range(
4554 __itt_suppress_range, __itt_suppress_threading_errors,
4555 &new_thr->th.th_reap_state,
sizeof(new_thr->th.th_reap_state));
4557 __itt_suppress_mark_range(
4558 __itt_suppress_range, __itt_suppress_threading_errors,
4559 &new_thr->th.th_suspend_init,
sizeof(new_thr->th.th_suspend_init));
4561 __itt_suppress_mark_range(__itt_suppress_range,
4562 __itt_suppress_threading_errors,
4563 &new_thr->th.th_suspend_init_count,
4564 sizeof(new_thr->th.th_suspend_init_count));
4567 __itt_suppress_mark_range(__itt_suppress_range,
4568 __itt_suppress_threading_errors,
4570 sizeof(new_thr->th.th_bar[0].bb.b_go));
4571 __itt_suppress_mark_range(__itt_suppress_range,
4572 __itt_suppress_threading_errors,
4574 sizeof(new_thr->th.th_bar[1].bb.b_go));
4575 __itt_suppress_mark_range(__itt_suppress_range,
4576 __itt_suppress_threading_errors,
4578 sizeof(new_thr->th.th_bar[2].bb.b_go));
4587 KF_TRACE(10, (
"__kmp_allocate_thread: before th_serial/serial_team\n"));
4588 new_thr->th.th_serial_team = serial_team =
4596 serial_team->
t.t_serialized = 0;
4598 serial_team->
t.t_threads[0] = new_thr;
4600 (
"__kmp_allocate_thread: after th_serial/serial_team : new_thr=%p\n",
4607 __kmp_initialize_fast_memory(new_thr);
4619 (
"__kmp_allocate_thread: T#%d init go fork=%u, plain=%u\n",
4626 balign[
b].
bb.team = NULL;
4628 balign[
b].
bb.use_oncore_barrier = 0;
4631 TCW_PTR(new_thr->th.th_sleep_loc, NULL);
4634 new_thr->th.th_spin_here =
FALSE;
4635 new_thr->th.th_next_waiting = 0;
4637 new_thr->th.th_blocking =
false;
4640#if KMP_AFFINITY_SUPPORTED
4641 new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
4642 new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
4643 new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
4644 new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
4647 new_thr->th.th_prev_level = 0;
4648 new_thr->th.th_prev_num_threads = 1;
4651 new_thr->th.th_active_in_pool =
FALSE;
4654 new_thr->th.th_set_nested_nth = NULL;
4655 new_thr->th.th_set_nested_nth_sz = 0;
4675#ifdef KMP_ADJUST_BLOCKTIME
4680 __kmp_zero_bt =
TRUE;
4685#if KMP_AFFINITY_SUPPORTED
4687 __kmp_affinity_set_init_mask(new_gtid,
FALSE);
4692 10, (
"__kmp_allocate_thread: before __kmp_create_worker: %p\n", new_thr));
4695 (
"__kmp_allocate_thread: after __kmp_create_worker: %p\n", new_thr));
4711 KF_TRACE(10, (
"__kmp_reinitialize_team: enter this_thread=%p team=%p\n",
4712 team->
t.t_threads[0], team));
4720 copy_icvs(&team->
t.t_implicit_task_taskdata[0].td_icvs, new_icvs);
4722 KF_TRACE(10, (
"__kmp_reinitialize_team: exit this_thread=%p team=%p\n",
4723 team->
t.t_threads[0], team));
4732 KF_TRACE(10, (
"__kmp_initialize_team: enter: team=%p\n", team));
4740 team->
t.t_master_tid = 0;
4742 team->
t.t_serialized = new_nproc > 1 ? 0 : 1;
4743 team->
t.t_nproc = new_nproc;
4746 team->
t.t_next_pool = NULL;
4751 team->
t.t_invoke = NULL;
4756#if KMP_ARCH_X86 || KMP_ARCH_X86_64
4757 team->
t.t_fp_control_saved =
FALSE;
4758 team->
t.t_x87_fpu_control_word = 0;
4759 team->
t.t_mxcsr = 0;
4762 team->
t.t_construct = 0;
4764 team->
t.t_ordered.dt.t_value = 0;
4765 team->
t.t_master_active =
FALSE;
4768 team->
t.t_copypriv_data = NULL;
4771 team->
t.t_copyin_counter = 0;
4774 team->
t.t_control_stack_top = NULL;
4779 KF_TRACE(10, (
"__kmp_initialize_team: exit: team=%p\n", team));
4782#if KMP_AFFINITY_SUPPORTED
4784 int first,
int last,
int newp) {
4785 th->th.th_first_place = first;
4786 th->th.th_last_place = last;
4787 th->th.th_new_place = newp;
4788 if (newp != th->th.th_current_place) {
4790 team->
t.t_display_affinity = 1;
4792 th->th.th_topology_ids = __kmp_affinity.ids[th->th.th_new_place];
4793 th->th.th_topology_attrs = __kmp_affinity.attrs[th->th.th_new_place];
4801static void __kmp_partition_places(
kmp_team_t *team,
int update_master_only) {
4809 int first_place = master_th->th.th_first_place;
4810 int last_place = master_th->th.th_last_place;
4811 int masters_place = master_th->th.th_current_place;
4812 int num_masks = __kmp_affinity.num_masks;
4813 team->
t.t_first_place = first_place;
4814 team->
t.t_last_place = last_place;
4816 KA_TRACE(20, (
"__kmp_partition_places: enter: proc_bind = %d T#%d(%d:0) "
4817 "bound to place %d partition = [%d,%d]\n",
4819 team->
t.t_id, masters_place, first_place, last_place));
4821 switch (proc_bind) {
4831 int n_th = team->
t.t_nproc;
4832 for (
f = 1;
f < n_th;
f++) {
4835 __kmp_set_thread_place(team, th, first_place, last_place, masters_place);
4837 KA_TRACE(100, (
"__kmp_partition_places: primary: T#%d(%d:%d) place %d "
4838 "partition = [%d,%d]\n",
4840 f, masters_place, first_place, last_place));
4846 int n_th = team->
t.t_nproc;
4848 if (first_place <= last_place) {
4849 n_places = last_place - first_place + 1;
4851 n_places = num_masks - first_place + last_place + 1;
4853 if (n_th <= n_places) {
4854 int place = masters_place;
4855 for (
f = 1;
f < n_th;
f++) {
4859 if (place == last_place) {
4860 place = first_place;
4861 }
else if (place == (num_masks - 1)) {
4866 __kmp_set_thread_place(team, th, first_place, last_place, place);
4868 KA_TRACE(100, (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4869 "partition = [%d,%d]\n",
4871 team->
t.t_id,
f, place, first_place, last_place));
4874 int S, rem, gap, s_count;
4875 S = n_th / n_places;
4877 rem = n_th - (
S * n_places);
4878 gap = rem > 0 ? n_places / rem : n_places;
4879 int place = masters_place;
4881 for (
f = 0;
f < n_th;
f++) {
4885 __kmp_set_thread_place(team, th, first_place, last_place, place);
4888 if ((s_count ==
S) && rem && (gap_ct == gap)) {
4890 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
4892 if (place == last_place) {
4893 place = first_place;
4894 }
else if (place == (num_masks - 1)) {
4902 }
else if (s_count ==
S) {
4903 if (place == last_place) {
4904 place = first_place;
4905 }
else if (place == (num_masks - 1)) {
4915 (
"__kmp_partition_places: close: T#%d(%d:%d) place %d "
4916 "partition = [%d,%d]\n",
4918 th->th.th_new_place, first_place, last_place));
4926 int n_th = team->
t.t_nproc;
4929 if (first_place <= last_place) {
4930 n_places = last_place - first_place + 1;
4932 n_places = num_masks - first_place + last_place + 1;
4934 if (n_th <= n_places) {
4937 if (n_places != num_masks) {
4938 int S = n_places / n_th;
4939 int s_count, rem, gap, gap_ct;
4941 place = masters_place;
4942 rem = n_places - n_th *
S;
4943 gap = rem ? n_th / rem : 1;
4946 if (update_master_only == 1)
4948 for (
f = 0;
f < thidx;
f++) {
4952 int fplace = place, nplace = place;
4954 while (s_count <
S) {
4955 if (place == last_place) {
4956 place = first_place;
4957 }
else if (place == (num_masks - 1)) {
4964 if (rem && (gap_ct == gap)) {
4965 if (place == last_place) {
4966 place = first_place;
4967 }
else if (place == (num_masks - 1)) {
4975 __kmp_set_thread_place(team, th, fplace, place, nplace);
4978 if (place == last_place) {
4979 place = first_place;
4980 }
else if (place == (num_masks - 1)) {
4987 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
4988 "partition = [%d,%d], num_masks: %u\n",
4990 f, th->th.th_new_place, th->th.th_first_place,
4991 th->th.th_last_place, num_masks));
4997 double current =
static_cast<double>(masters_place);
4999 (
static_cast<double>(n_places + 1) /
static_cast<double>(n_th));
5004 if (update_master_only == 1)
5006 for (
f = 0;
f < thidx;
f++) {
5007 first =
static_cast<int>(current);
5008 last =
static_cast<int>(current + spacing) - 1;
5010 if (first >= n_places) {
5011 if (masters_place) {
5014 if (first == (masters_place + 1)) {
5018 if (last == masters_place) {
5028 if (last >= n_places) {
5029 last = (n_places - 1);
5039 th = team->
t.t_threads[
f];
5041 __kmp_set_thread_place(team, th, first, last, place);
5043 (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5044 "partition = [%d,%d], spacing = %.4f\n",
5046 team->
t.t_id,
f, th->th.th_new_place,
5047 th->th.th_first_place, th->th.th_last_place, spacing));
5053 int S, rem, gap, s_count;
5054 S = n_th / n_places;
5056 rem = n_th - (
S * n_places);
5057 gap = rem > 0 ? n_places / rem : n_places;
5058 int place = masters_place;
5061 if (update_master_only == 1)
5063 for (
f = 0;
f < thidx;
f++) {
5067 __kmp_set_thread_place(team, th, place, place, place);
5070 if ((s_count ==
S) && rem && (gap_ct == gap)) {
5072 }
else if ((s_count ==
S + 1) && rem && (gap_ct == gap)) {
5074 if (place == last_place) {
5075 place = first_place;
5076 }
else if (place == (num_masks - 1)) {
5084 }
else if (s_count ==
S) {
5085 if (place == last_place) {
5086 place = first_place;
5087 }
else if (place == (num_masks - 1)) {
5096 KA_TRACE(100, (
"__kmp_partition_places: spread: T#%d(%d:%d) place %d "
5097 "partition = [%d,%d]\n",
5099 team->
t.t_id,
f, th->th.th_new_place,
5100 th->th.th_first_place, th->th.th_last_place));
5110 KA_TRACE(20, (
"__kmp_partition_places: exit T#%d\n", team->
t.t_id));
5119 ompt_data_t ompt_parallel_data,
5127 int use_hot_team = !root->r.r_active;
5129 int do_place_partition = 1;
5131 KA_TRACE(20, (
"__kmp_allocate_team: called\n"));
5138 team = master->th.th_team;
5139 level = team->
t.t_active_level;
5140 if (master->th.th_teams_microtask) {
5141 if (master->th.th_teams_size.nteams > 1 &&
5145 master->th.th_teams_level <
5152 if ((master->th.th_teams_size.nteams == 1 &&
5153 master->th.th_teams_level >= team->
t.t_level) ||
5155 do_place_partition = 0;
5157 hot_teams = master->th.th_hot_teams;
5159 hot_teams[
level].hot_team) {
5170 if (use_hot_team && new_nproc > 1) {
5175 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5176 "task_team[1] = %p before reinit\n",
5177 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5181 if (team->
t.t_nproc != new_nproc &&
5184 int old_nthr = team->
t.t_nproc;
5190 if (do_place_partition == 0)
5195 if (team->
t.t_nproc == new_nproc) {
5196 KA_TRACE(20, (
"__kmp_allocate_team: reusing hot team\n"));
5199 if (team->
t.t_size_changed == -1) {
5200 team->
t.t_size_changed = 1;
5211 root->r.r_uber_thread->th.th_ident);
5213 KF_TRACE(10, (
"__kmp_allocate_team2: T#%d, this_thread=%p team=%p\n", 0,
5214 team->
t.t_threads[0], team));
5217#if KMP_AFFINITY_SUPPORTED
5218 if ((team->
t.t_size_changed == 0) &&
5219 (team->
t.t_proc_bind == new_proc_bind)) {
5221 if (do_place_partition) {
5223 __kmp_partition_places(team, 1);
5226 KA_TRACE(200, (
"__kmp_allocate_team: reusing hot team #%d bindings: "
5227 "proc_bind = %d, partition = [%d,%d]\n",
5228 team->
t.t_id, new_proc_bind, team->
t.t_first_place,
5229 team->
t.t_last_place));
5231 if (do_place_partition) {
5233 __kmp_partition_places(team);
5239 }
else if (team->
t.t_nproc > new_nproc) {
5241 (
"__kmp_allocate_team: decreasing hot team thread count to %d\n",
5244 team->
t.t_size_changed = 1;
5253 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5256 th->th.th_task_team = NULL;
5265 for (
f = new_nproc;
f < team->
t.t_nproc;
f++) {
5268 team->
t.t_threads[
f] = NULL;
5274 for (
f = new_nproc;
f < team->
t.t_nproc; ++
f) {
5285 team->
t.t_nproc = new_nproc;
5289 root->r.r_uber_thread->th.th_ident);
5292 for (
f = 0;
f < new_nproc; ++
f) {
5293 team->
t.t_threads[
f]->th.th_team_nproc = new_nproc;
5298 KF_TRACE(10, (
"__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
5299 team->
t.t_threads[0], team));
5304 for (
f = 0;
f < team->
t.t_nproc;
f++) {
5306 team->
t.t_threads[
f]->th.th_team_nproc ==
5311 if (do_place_partition) {
5313#if KMP_AFFINITY_SUPPORTED
5314 __kmp_partition_places(team);
5320 (
"__kmp_allocate_team: increasing hot team thread count to %d\n",
5322 int old_nproc = team->
t.t_nproc;
5323 team->
t.t_size_changed = 1;
5326 if (new_nproc < avail_threads)
5327 avail_threads = new_nproc;
5329 for (
f = team->
t.t_nproc;
f < avail_threads; ++
f) {
5335 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5338 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5342 if (hot_teams[
level].hot_team_nth >= new_nproc) {
5346 team->
t.t_nproc = new_nproc;
5352 if (team->
t.t_max_nproc < new_nproc) {
5358#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5359 KMP_AFFINITY_SUPPORTED
5365 kmp_affinity_raii_t new_temp_affinity{__kmp_affin_fullMask};
5369 for (
f = team->
t.t_nproc;
f < new_nproc;
f++) {
5372 team->
t.t_threads[
f] = new_worker;
5375 (
"__kmp_allocate_team: team %d init T#%d arrived: "
5376 "join=%llu, plain=%llu\n",
5385 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5389 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5395#if (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DRAGONFLY) && \
5396 KMP_AFFINITY_SUPPORTED
5398 new_temp_affinity.restore();
5409 root->r.r_uber_thread->th.th_ident);
5413 for (
f = 0;
f < team->
t.t_nproc; ++
f)
5418 kmp_uint8 old_state = team->
t.t_threads[old_nproc - 1]->th.th_task_state;
5419 for (
f = old_nproc;
f < team->
t.t_nproc; ++
f)
5420 team->
t.t_threads[
f]->th.th_task_state = old_state;
5423 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5425 team->
t.t_threads[
f]->th.th_team_nproc ==
5430 if (do_place_partition) {
5432#if KMP_AFFINITY_SUPPORTED
5433 __kmp_partition_places(team);
5438 if (master->th.th_teams_microtask) {
5439 for (
f = 1;
f < new_nproc; ++
f) {
5442 thr->th.th_teams_microtask = master->th.th_teams_microtask;
5443 thr->th.th_teams_level = master->th.th_teams_level;
5444 thr->th.th_teams_size = master->th.th_teams_size;
5450 for (
f = 1;
f < new_nproc; ++
f) {
5455 balign[
b].
bb.b_arrived = team->
t.t_bar[
b].b_arrived;
5458 balign[
b].
bb.b_worker_arrived = team->
t.t_bar[
b].b_team_arrived;
5470 KF_TRACE(10, (
" hot_team = %p\n", team));
5474 KA_TRACE(20, (
"__kmp_allocate_team: hot team task_team[0] = %p "
5475 "task_team[1] = %p after reinit\n",
5476 team->
t.t_task_team[0], team->
t.t_task_team[1]));
5494 if (team->
t.t_max_nproc >= max_nproc) {
5498 if (max_nproc > 1 &&
5508 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and "
5509 "task_team[1] %p to NULL\n",
5510 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5511 team->
t.t_task_team[0] = NULL;
5512 team->
t.t_task_team[1] = NULL;
5519 20, (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5526 team->
t.t_bar[
b].b_master_arrived = 0;
5527 team->
t.t_bar[
b].b_team_arrived = 0;
5532 team->
t.t_proc_bind = new_proc_bind;
5534 KA_TRACE(20, (
"__kmp_allocate_team: using team from pool %d.\n",
5541 team->
t.t_nested_nth = NULL;
5561 team->
t.t_max_nproc = max_nproc;
5562 if (max_nproc > 1 &&
5572 KA_TRACE(20, (
"__kmp_allocate_team: making a new team\n"));
5575 KA_TRACE(20, (
"__kmp_allocate_team: setting task_team[0] %p and task_team[1] "
5577 &team->
t.t_task_team[0], &team->
t.t_task_team[1]));
5578 team->
t.t_task_team[0] = NULL;
5580 team->
t.t_task_team[1] = NULL;
5589 team->
t.t_argc = argc;
5592 (
"__kmp_allocate_team: team %d init arrived: join=%u, plain=%u\n",
5599 team->
t.t_bar[
b].b_master_arrived = 0;
5600 team->
t.t_bar[
b].b_team_arrived = 0;
5605 team->
t.t_proc_bind = new_proc_bind;
5609 team->
t.ompt_serialized_team_info = NULL;
5614 team->
t.t_nested_nth = NULL;
5616 KA_TRACE(20, (
"__kmp_allocate_team: done creating a new team %d.\n",
5638 int use_hot_team = team == root->r.r_hot_team;
5641 level = team->
t.t_active_level - 1;
5642 if (master->th.th_teams_microtask) {
5643 if (master->th.th_teams_size.nteams > 1) {
5648 master->th.th_teams_level == team->
t.t_level) {
5666 team->
t.t_copyin_counter = 0;
5671 if (!use_hot_team) {
5674 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5677 volatile kmp_uint32 *state = &th->th.th_reap_state;
5688 if (th->th.th_sleep_loc)
5696 for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
5698 if (task_team != NULL) {
5699 for (
f = 0;
f < team->
t.t_nproc; ++
f) {
5701 team->
t.t_threads[
f]->th.th_task_team = NULL;
5705 (
"__kmp_free_team: T#%d deactivating task_team %p on team %d\n",
5708 team->
t.t_task_team[tt_idx] = NULL;
5715 team->
t.t_nested_nth != team->
t.t_parent->t.t_nested_nth) {
5719 team->
t.t_nested_nth = NULL;
5722 team->
t.t_parent = NULL;
5723 team->
t.t_level = 0;
5724 team->
t.t_active_level = 0;
5727 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5731 &(team->
t.t_threads[
f]->th.th_used_in_team), 1, 2);
5739 team->
t.b->go_release();
5741 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5742 if (team->
t.b->sleep[
f].sleep) {
5744 team->
t.t_threads[
f]->th.th_info.ds.ds_gtid,
5750 for (
int f = 1;
f < team->
t.t_nproc; ++
f) {
5751 while (team->
t.t_threads[
f]->th.th_used_in_team.load() != 0)
5757 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5758 team->
t.t_threads[
f] = NULL;
5761 if (team->
t.t_max_nproc > 1 &&
5773 team->
t.t_threads[1]->th.th_cg_roots);
5774 if (team->
t.t_threads[1]->th.th_cg_roots->cg_root == team->
t.t_threads[1]) {
5776 for (
f = 1;
f < team->
t.t_nproc; ++
f) {
5779 thr->th.th_cg_roots->cg_root == thr);
5782 thr->th.th_cg_roots = tmp->
up;
5783 KA_TRACE(100, (
"__kmp_free_team: Thread %p popping node %p and moving"
5784 " up to node %p. cg_nthreads was %d\n",
5785 thr, tmp, thr->th.th_cg_roots, tmp->
cg_nthreads));
5791 if (thr->th.th_cg_roots)
5792 thr->th.th_current_task->td_icvs.thread_limit =
5793 thr->th.th_cg_roots->cg_thread_limit;
5815 if (team->
t.t_argv != &team->
t.t_inline_argv[0])
5852 KA_TRACE(20, (
"__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
5864 balign[
b].
bb.team = NULL;
5865 balign[
b].
bb.leaf_kids = 0;
5867 this_th->th.th_task_state = 0;
5871 TCW_PTR(this_th->th.th_team, NULL);
5872 TCW_PTR(this_th->th.th_root, NULL);
5873 TCW_PTR(this_th->th.th_dispatch, NULL);
5875 while (this_th->th.th_cg_roots) {
5876 this_th->th.th_cg_roots->cg_nthreads--;
5877 KA_TRACE(100, (
"__kmp_free_thread: Thread %p decrement cg_nthreads on node"
5878 " %p of thread %p to %d\n",
5879 this_th, this_th->th.th_cg_roots,
5880 this_th->th.th_cg_roots->cg_root,
5881 this_th->th.th_cg_roots->cg_nthreads));
5883 if (tmp->
cg_root == this_th) {
5886 5, (
"__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
5887 this_th->th.th_cg_roots = tmp->
up;
5893 this_th->th.th_cg_roots = NULL;
5904 this_th->th.th_current_task = NULL;
5908 gtid = this_th->th.th_info.ds.ds_gtid;
5926 for (; (*scan != NULL) && ((*scan)->th.th_info.ds.ds_gtid < gtid);
5927 scan = &((*scan)->th.th_next_pool))
5932 TCW_PTR(this_th->th.th_next_pool, *scan);
5935 (this_th->th.th_info.ds.ds_gtid <
5936 this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
5940 if (this_th->th.th_active ==
TRUE) {
5942 this_th->th.th_active_in_pool =
TRUE;
5953#ifdef KMP_ADJUST_BLOCKTIME
5959 __kmp_zero_bt =
FALSE;
5970#if OMP_PROFILING_SUPPORT
5971 ProfileTraceFile = getenv(
"LIBOMPTARGET_PROFILE");
5973 if (ProfileTraceFile)
5974 llvm::timeTraceProfilerInitialize(500 ,
"libomptarget");
5977 int gtid = this_thr->th.th_info.ds.ds_gtid;
5982 KA_TRACE(10, (
"__kmp_launch_thread: T#%d start\n", gtid));
5989 if (ompd_state & OMPD_ENABLE_BP)
5990 ompd_bp_thread_begin();
5994 ompt_data_t *thread_data =
nullptr;
5996 thread_data = &(this_thr->th.ompt_thread_info.thread_data);
5997 *thread_data = ompt_data_none;
5999 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6000 this_thr->th.ompt_thread_info.wait_id = 0;
6002 this_thr->th.ompt_thread_info.parallel_flags = 0;
6005 ompt_thread_worker, thread_data);
6007 this_thr->th.ompt_thread_info.state = ompt_state_idle;
6017 KA_TRACE(20, (
"__kmp_launch_thread: T#%d waiting for work\n", gtid));
6024 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6028 pteam = &this_thr->th.th_team;
6036 (
"__kmp_launch_thread: T#%d(%d:%d) invoke microtask = %p\n",
6038 (*pteam)->t.t_pkfn));
6044 this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
6048 rc = (*pteam)->t.t_invoke(gtid);
6052 KA_TRACE(20, (
"__kmp_launch_thread: T#%d(%d:%d) done microtask = %p\n",
6054 (*pteam)->t.t_pkfn));
6061 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
6070 if (ompd_state & OMPD_ENABLE_BP)
6071 ompd_bp_thread_end();
6076 ompt_callbacks.ompt_callback(ompt_callback_thread_end)(thread_data);
6080 this_thr->th.th_task_team = NULL;
6084 KA_TRACE(10, (
"__kmp_launch_thread: T#%d done\n", gtid));
6087#if OMP_PROFILING_SUPPORT
6088 llvm::timeTraceProfilerFinishThread();
6100 KA_TRACE(30, (
"__kmp_internal_end_dest: T#%d\n", gtid));
6107#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
6118 KA_TRACE(30, (
"__kmp_internal_end_atexit\n"));
6155 gtid = thread->th.th_info.ds.ds_gtid;
6161 20, (
"__kmp_reap_thread: releasing T#%d from fork barrier for reap\n",
6190 if (thread->th.th_active_in_pool) {
6191 thread->th.th_active_in_pool =
FALSE;
6201 __kmp_free_fast_memory(thread);
6212#ifdef KMP_ADJUST_BLOCKTIME
6218 __kmp_zero_bt =
FALSE;
6225 if (thread->th.th_cons) {
6227 thread->th.th_cons = NULL;
6231 if (thread->th.th_pri_common != NULL) {
6233 thread->th.th_pri_common = NULL;
6237 if (thread->th.th_local.bget_data != NULL) {
6242#if KMP_AFFINITY_SUPPORTED
6243 if (thread->th.th_affin_mask != NULL) {
6244 KMP_CPU_FREE(thread->th.th_affin_mask);
6245 thread->th.th_affin_mask = NULL;
6249#if KMP_USE_HIER_SCHED
6250 if (thread->th.th_hier_bar_data != NULL) {
6252 thread->th.th_hier_bar_data = NULL;
6257 thread->th.th_serial_team = NULL;
6266 if (__kmp_itt_region_domains.count > 0) {
6267 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6268 kmp_itthash_entry_t *bucket = __kmp_itt_region_domains.buckets[
i];
6270 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6276 if (__kmp_itt_barrier_domains.count > 0) {
6277 for (
int i = 0;
i < KMP_MAX_FRAME_DOMAINS; ++
i) {
6278 kmp_itthash_entry_t *bucket = __kmp_itt_barrier_domains.buckets[
i];
6280 kmp_itthash_entry_t *next = bucket->next_in_bucket;
6300 __kmp_reclaim_dead_roots();
6324 if (
TCR_4(__kmp_init_monitor)) {
6326 TCW_4(__kmp_init_monitor, 0);
6329 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6354 thread->th.th_next_pool = NULL;
6355 thread->th.th_in_pool =
FALSE;
6366 team->
t.t_next_pool = NULL;
6393 KA_TRACE(10, (
"__kmp_internal_end: all workers reaped\n"));
6402 if (
TCR_4(__kmp_init_monitor)) {
6404 TCW_4(__kmp_init_monitor, 0);
6407 KA_TRACE(10, (
"__kmp_internal_end: monitor reaped\n"));
6427 KA_TRACE(11, (
"__kmp_internal_end_library: abort, exiting\n"));
6432 KA_TRACE(10, (
"__kmp_internal_end_library: already finished\n"));
6451 10, (
"__kmp_internal_end_library: enter T#%d (%d)\n", gtid, gtid_req));
6453 KA_TRACE(10, (
"__kmp_internal_end_library: !__kmp_init_runtime, system "
6454 "already shutdown\n"));
6457 KA_TRACE(10, (
"__kmp_internal_end_library: monitor thread, gtid not "
6458 "registered, or system shutdown\n"));
6461 KA_TRACE(10, (
"__kmp_internal_end_library: gtid not registered or system "
6471 (
"__kmp_internal_end_library: root still active, abort T#%d\n",
6478 (
"__kmp_internal_end_library: unregistering sibling T#%d\n", gtid));
6486#ifdef DUMP_DEBUG_ON_EXIT
6502 KA_TRACE(10, (
"__kmp_internal_end_library: abort, exiting\n"));
6525 KA_TRACE(10, (
"__kmp_internal_end_library: exit\n"));
6527#ifdef DUMP_DEBUG_ON_EXIT
6550 KA_TRACE(11, (
"__kmp_internal_end_thread: abort, exiting\n"));
6555 KA_TRACE(10, (
"__kmp_internal_end_thread: already finished\n"));
6575 (
"__kmp_internal_end_thread: enter T#%d (%d)\n", gtid, gtid_req));
6577 KA_TRACE(10, (
"__kmp_internal_end_thread: !__kmp_init_runtime, system "
6578 "already shutdown\n"));
6581 KA_TRACE(10, (
"__kmp_internal_end_thread: monitor thread, gtid not "
6582 "registered, or system shutdown\n"));
6585 KA_TRACE(10, (
"__kmp_internal_end_thread: gtid not registered or system "
6595 (
"__kmp_internal_end_thread: root still active, abort T#%d\n",
6599 KA_TRACE(10, (
"__kmp_internal_end_thread: unregistering sibling T#%d\n",
6605 KA_TRACE(10, (
"__kmp_internal_end_thread: worker thread T#%d\n", gtid));
6612 (
"__kmp_internal_end_thread: worker thread done, exiting T#%d\n",
6622 KA_TRACE(10, (
"__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
6631 KA_TRACE(10, (
"__kmp_internal_end_thread: abort, exiting\n"));
6654 (
"__kmp_internal_end_thread: remaining sibling task: gtid==%d\n",
i));
6668 KA_TRACE(10, (
"__kmp_internal_end_thread: exit T#%d\n", gtid_req));
6670#ifdef DUMP_DEBUG_ON_EXIT
6690#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
6698#if defined(KMP_USE_SHM)
6699bool __kmp_shm_available =
false;
6700bool __kmp_tmp_available =
false;
6702char *temp_reg_status_file_name =
nullptr;
6713#if KMP_ARCH_X86 || KMP_ARCH_X86_64
6722 KA_TRACE(50, (
"__kmp_register_library_startup: %s=\"%s\"\n",
name,
6729#if defined(KMP_USE_SHM)
6730 char *shm_name =
nullptr;
6731 char *data1 =
nullptr;
6733 if (__kmp_shm_available) {
6736 int shm_preexist = 0;
6737 fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6738 if ((fd1 == -1) && (errno == EEXIST)) {
6741 fd1 = shm_open(shm_name, O_RDWR, 0600);
6744 __kmp_shm_available =
false;
6749 if (__kmp_shm_available && shm_preexist == 0) {
6750 if (ftruncate(fd1, SHM_SIZE) == -1) {
6751 KMP_WARNING(FunctionError,
"Can't set size of SHM");
6752 __kmp_shm_available =
false;
6755 if (__kmp_shm_available) {
6756 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6758 if (data1 == MAP_FAILED) {
6760 __kmp_shm_available =
false;
6763 if (__kmp_shm_available) {
6764 if (shm_preexist == 0) {
6769 munmap(data1, SHM_SIZE);
6774 if (!__kmp_shm_available)
6776 if (!__kmp_shm_available && __kmp_tmp_available) {
6784 int tmp_preexist = 0;
6785 fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
6786 if ((fd1 == -1) && (errno == EEXIST)) {
6789 fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
6792 __kmp_tmp_available =
false;
6797 if (__kmp_tmp_available && tmp_preexist == 0) {
6799 if (ftruncate(fd1, SHM_SIZE) == -1) {
6800 KMP_WARNING(FunctionError,
"Can't set size of /tmp file");
6801 __kmp_tmp_available =
false;
6804 if (__kmp_tmp_available) {
6805 data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
6807 if (data1 == MAP_FAILED) {
6809 __kmp_tmp_available =
false;
6812 if (__kmp_tmp_available) {
6813 if (tmp_preexist == 0) {
6818 munmap(data1, SHM_SIZE);
6823 if (!__kmp_shm_available && !__kmp_tmp_available) {
6844 char *flag_addr_str = NULL;
6845 char *flag_val_str = NULL;
6846 char const *file_name = NULL;
6851 unsigned long *flag_addr = 0;
6852 unsigned long flag_val = 0;
6855 if (flag_addr != 0 && flag_val != 0 && strcmp(file_name,
"") != 0) {
6873 file_name =
"unknown library";
6890#if defined(KMP_USE_SHM)
6891 if (__kmp_shm_available) {
6892 shm_unlink(shm_name);
6893 }
else if (__kmp_tmp_available) {
6894 unlink(temp_reg_status_file_name);
6910#if defined(KMP_USE_SHM)
6924#if defined(KMP_USE_SHM)
6925 char *shm_name =
nullptr;
6927 if (__kmp_shm_available) {
6929 fd1 = shm_open(shm_name, O_RDONLY, 0600);
6931 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6932 if (data1 != MAP_FAILED) {
6934 munmap(data1, SHM_SIZE);
6938 }
else if (__kmp_tmp_available) {
6939 fd1 = open(temp_reg_status_file_name, O_RDONLY);
6941 char *data1 = (
char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
6942 if (data1 != MAP_FAILED) {
6944 munmap(data1, SHM_SIZE);
6959#if defined(KMP_USE_SHM)
6960 if (__kmp_shm_available) {
6961 shm_unlink(shm_name);
6962 }
else if (__kmp_tmp_available) {
6963 unlink(temp_reg_status_file_name);
6972#if defined(KMP_USE_SHM)
6975 if (temp_reg_status_file_name)
6991#if KMP_MIC_SUPPORTED
6993static void __kmp_check_mic_type() {
6994 kmp_cpuid_t cpuid_state = {0};
6995 kmp_cpuid_t *cs_p = &cpuid_state;
6996 __kmp_x86_cpuid(1, 0, cs_p);
6998 if ((cs_p->eax & 0xff0) == 0xB10) {
6999 __kmp_mic_type = mic2;
7000 }
else if ((cs_p->eax & 0xf0ff0) == 0x50670) {
7001 __kmp_mic_type = mic3;
7003 __kmp_mic_type = non_mic;
7010static void __kmp_user_level_mwait_init() {
7011 struct kmp_cpuid
buf;
7012 __kmp_x86_cpuid(7, 0, &
buf);
7013 __kmp_waitpkg_enabled = ((
buf.ecx >> 5) & 1);
7014 __kmp_umwait_enabled = __kmp_waitpkg_enabled && __kmp_user_level_mwait;
7015 __kmp_tpause_enabled = __kmp_waitpkg_enabled && (__kmp_tpause_state > 0);
7016 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_umwait_enabled = %d\n",
7017 __kmp_umwait_enabled));
7020#ifndef AT_INTELPHIUSERMWAIT
7023#define AT_INTELPHIUSERMWAIT 10000
7029unsigned long getauxval(
unsigned long) {
return 0; }
7031static void __kmp_user_level_mwait_init() {
7036 if (__kmp_mic_type == mic3) {
7037 unsigned long res = getauxval(AT_INTELPHIUSERMWAIT);
7038 if ((
res & 0x1) || __kmp_user_level_mwait) {
7039 __kmp_mwait_enabled =
TRUE;
7040 if (__kmp_user_level_mwait) {
7044 __kmp_mwait_enabled =
FALSE;
7047 KF_TRACE(30, (
"__kmp_user_level_mwait_init: __kmp_mic_type = %d, "
7048 "__kmp_mwait_enabled = %d\n",
7049 __kmp_mic_type, __kmp_mwait_enabled));
7057 KA_TRACE(10, (
"__kmp_do_serial_initialize: enter\n"));
7075#if ENABLE_LIBOMPTARGET
7077 __kmp_init_omptarget();
7092 KA_TRACE(10, (
"__kmp_do_serial_initialize: reinitialization of library\n"));
7099#if KMP_USE_ADAPTIVE_LOCKS
7100#if KMP_DEBUG_ADAPTIVE_LOCKS
7101 __kmp_init_speculative_stats();
7104#if KMP_STATS_ENABLED
7132#if KMP_MIC_SUPPORTED
7133 __kmp_check_mic_type();
7135#if ENABLE_LIBOMPTARGET
7136 __kmp_target_init();
7165 __kmp_monitor_wakeups =
7167 __kmp_bt_intervals =
7180#if KMP_FAST_REDUCTION_BARRIER
7181#define kmp_reduction_barrier_gather_bb ((int)1)
7182#define kmp_reduction_barrier_release_bb ((int)1)
7183#define kmp_reduction_barrier_gather_pat __kmp_barrier_gather_pat_dflt
7184#define kmp_reduction_barrier_release_pat __kmp_barrier_release_pat_dflt
7191#if KMP_FAST_REDUCTION_BARRIER
7201#if KMP_FAST_REDUCTION_BARRIER
7202#undef kmp_reduction_barrier_release_pat
7203#undef kmp_reduction_barrier_gather_pat
7204#undef kmp_reduction_barrier_release_bb
7205#undef kmp_reduction_barrier_gather_bb
7207#if KMP_MIC_SUPPORTED
7208 if (__kmp_mic_type == mic2) {
7216#if KMP_FAST_REDUCTION_BARRIER
7217 if (__kmp_mic_type == mic2) {
7241#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
7242 __kmp_user_level_mwait_init();
7293 KA_TRACE(10, (
"__kmp_do_serial_initialize T#%d\n", gtid));
7306#if !KMP_DYNAMIC_LIB || \
7307 ((KMP_COMPILER_ICC || KMP_COMPILER_ICX) && KMP_OS_DARWIN)
7320#if KMP_HANDLE_SIGNALS
7326 __kmp_install_signals(
FALSE);
7329 __kmp_install_signals(
TRUE);
7356 KA_TRACE(10, (
"__kmp_do_serial_initialize: exit\n"));
7374 int prev_dflt_team_nth;
7380 KA_TRACE(10, (
"__kmp_middle_initialize: enter\n"));
7392#if KMP_AFFINITY_SUPPORTED
7395 __kmp_affinity_initialize(__kmp_affinity);
7414#ifdef KMP_DFLT_NTH_CORES
7417 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7418 "__kmp_ncores (%d)\n",
7423 KA_TRACE(20, (
"__kmp_middle_initialize: setting __kmp_dflt_team_nth = "
7424 "__kmp_avail_proc(%d)\n",
7452 if (thread->th.th_current_task->td_icvs.nproc != 0)
7460 (
"__kmp_middle_initialize: final value for __kmp_dflt_team_nth = %d\n",
7463#ifdef KMP_ADJUST_BLOCKTIME
7468 __kmp_zero_bt =
TRUE;
7476 KA_TRACE(10, (
"__kmp_do_middle_initialize: exit\n"));
7508 (
"__kmp_parallel_initialize: attempt to init while shutting down\n"));
7522 KA_TRACE(10, (
"__kmp_parallel_initialize: enter\n"));
7525#if KMP_ARCH_X86 || KMP_ARCH_X86_64
7528 __kmp_store_x87_fpu_control_word(&__kmp_init_x87_fpu_control_word);
7529 __kmp_store_mxcsr(&__kmp_init_mxcsr);
7530 __kmp_init_mxcsr &= KMP_X86_MXCSR_MASK;
7534#if KMP_HANDLE_SIGNALS
7536 __kmp_install_signals(
TRUE);
7542#if defined(USE_LOAD_BALANCE)
7560 KA_TRACE(10, (
"__kmp_parallel_initialize: exit\n"));
7581#if KMP_AFFINITY_SUPPORTED
7585 if (!__kmp_hh_affinity.flags.initialized)
7586 __kmp_affinity_initialize(__kmp_hh_affinity);
7617 this_thr->th.th_local.this_construct = 0;
7651 if (__itt_stack_caller_create_ptr) {
7653 if (team->
t.t_stack_id != NULL) {
7654 __kmp_itt_stack_callee_enter((__itt_caller)team->
t.t_stack_id);
7657 __kmp_itt_stack_callee_enter(
7658 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7662#if INCLUDE_SSC_MARKS
7663 SSC_MARK_INVOKING();
7668 void **exit_frame_p;
7669 ompt_data_t *my_task_data;
7670 ompt_data_t *my_parallel_data;
7674 exit_frame_p = &(team->
t.t_implicit_task_taskdata[tid]
7675 .ompt_task_info.frame.exit_frame.ptr);
7677 exit_frame_p = &dummy;
7681 &(team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data);
7682 my_parallel_data = &(team->
t.ompt_team_info.parallel_data);
7684 ompt_team_size = team->
t.t_nproc;
7686 ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
7692#if KMP_STATS_ENABLED
7694 if (previous_state == stats_state_e::TEAMS_REGION) {
7703 tid, (
int)team->
t.t_argc, (
void **)team->
t.t_argv
7710 *exit_frame_p = NULL;
7711 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_team;
7714#if KMP_STATS_ENABLED
7715 if (previous_state == stats_state_e::TEAMS_REGION) {
7722 if (__itt_stack_caller_create_ptr) {
7724 if (team->
t.t_stack_id != NULL) {
7725 __kmp_itt_stack_callee_leave((__itt_caller)team->
t.t_stack_id);
7728 __kmp_itt_stack_callee_leave(
7729 (__itt_caller)team->
t.t_parent->t.t_stack_id);
7743 thr->th.th_set_nproc = thr->th.th_teams_size.nth;
7746 KA_TRACE(20, (
"__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
7755 KA_TRACE(100, (
"__kmp_teams_master: Thread %p created node %p and init"
7756 " cg_nthreads to 1\n",
7758 tmp->
up = thr->th.th_cg_roots;
7759 thr->th.th_cg_roots = tmp;
7763#if INCLUDE_SSC_MARKS
7769#if INCLUDE_SSC_MARKS
7773 if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
7774 thr->th.th_teams_size.nth = thr->th.th_team_nproc;
7797 ompt_data_t *task_data =
7798 &team->
t.t_implicit_task_taskdata[tid].ompt_task_info.task_data;
7799 ompt_data_t *parallel_data = &team->
t.ompt_team_info.parallel_data;
7802 ompt_scope_begin, parallel_data, task_data, team->
t.t_nproc, tid,
7804 OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid;
7809 this_thr->th.ompt_thread_info.parallel_flags = ompt_parallel_league;
7822 if (num_threads > 0)
7823 thr->th.th_set_nproc = num_threads;
7827 int *num_threads_list) {
7832 if (num_threads_list[0] > 0)
7833 thr->th.th_set_nproc = num_threads_list[0];
7834 thr->th.th_set_nested_nth =
7837 thr->th.th_set_nested_nth[
i] = num_threads_list[
i];
7838 thr->th.th_set_nested_nth_sz = list_length;
7844 thr->th.th_nt_strict =
true;
7845 thr->th.th_nt_loc =
loc;
7848 thr->th.th_nt_sev = sev;
7853 thr->th.th_nt_msg = msg;
7855 thr->th.th_nt_msg =
"Cannot form team with number of threads specified by "
7856 "strict num_threads clause.";
7869 if (num_threads == 0) {
7881 if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) {
7882 num_threads = thr->th.th_current_task->td_icvs.thread_limit;
7887 if (num_threads == 0) {
7891 if (num_threads < 0) {
7898 thr->th.th_current_task->td_icvs.thread_limit = num_threads;
7905 if (new_threads == 0) {
7908 if (new_threads != num_threads) {
7912 KMP_MSG(CantFormThrTeam, num_threads, new_threads),
7916 num_threads = new_threads;
7919 thr->th.th_teams_size.nth = num_threads;
7927 if (num_teams < 0) {
7934 if (num_teams == 0) {
7952 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
7960 int num_teams_ub,
int num_threads) {
7966 if (num_teams_lb > num_teams_ub) {
7973 if (num_teams_lb == 0 && num_teams_ub > 0)
7974 num_teams_lb = num_teams_ub;
7976 if (num_teams_lb == 0 && num_teams_ub == 0) {
7987 }
else if (num_teams_lb == num_teams_ub) {
7988 num_teams = num_teams_ub;
7990 if (num_threads <= 0) {
7992 num_teams = num_teams_lb;
7994 num_teams = num_teams_ub;
8000 if (num_teams < num_teams_lb) {
8001 num_teams = num_teams_lb;
8002 }
else if (num_teams > num_teams_ub) {
8003 num_teams = num_teams_ub;
8009 thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams;
8017 thr->th.th_set_proc_bind = proc_bind;
8034 team->
t.t_construct = 0;
8035 team->
t.t_ordered.dt.t_value =
8040 if (team->
t.t_max_nproc > 1) {
8043 team->
t.t_disp_buffer[
i].buffer_index =
i;
8044 team->
t.t_disp_buffer[
i].doacross_buf_idx =
i;
8047 team->
t.t_disp_buffer[0].buffer_index = 0;
8048 team->
t.t_disp_buffer[0].doacross_buf_idx = 0;
8055 for (
f = 0;
f < team->
t.t_nproc;
f++) {
8057 team->
t.t_threads[
f]->th.th_team_nproc == team->
t.t_nproc);
8078 __kmp_printf(
"GTID: %d, __kmp_threads[%d]=%p\n", gtid, gtid,
8080 __kmp_printf(
"__kmp_threads[%d]->th.th_team_nproc=%d, TEAM: %p, "
8081 "team->t.t_nproc=%d\n",
8092 ompt_state_t ompt_state = this_thr->th.ompt_thread_info.state;
8094 (ompt_state == ompt_state_wait_barrier_teams ||
8095 ompt_state == ompt_state_wait_barrier_implicit_parallel)) {
8096 int ds_tid = this_thr->th.th_info.ds.ds_tid;
8097 ompt_data_t *task_data = OMPT_CUR_TASK_DATA(this_thr);
8098 this_thr->th.ompt_thread_info.state = ompt_state_overhead;
8100 void *codeptr = NULL;
8104 codeptr = OMPT_CUR_TEAM_INFO(this_thr)->master_return_address;
8106 ompt_sync_region_t sync_kind = ompt_sync_region_barrier_implicit_parallel;
8107 if (this_thr->th.ompt_thread_info.parallel_flags & ompt_parallel_league)
8108 sync_kind = ompt_sync_region_barrier_teams;
8111 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8115 sync_kind, ompt_scope_end, NULL, task_data, codeptr);
8120 ompt_scope_end, NULL, task_data, 0, ds_tid,
8121 ompt_task_implicit);
8132#ifdef USE_LOAD_BALANCE
8136static int __kmp_active_hot_team_nproc(
kmp_root_t *root) {
8141 if (root->r.r_active) {
8144 hot_team = root->r.r_hot_team;
8146 return hot_team->
t.t_nproc - 1;
8151 for (
i = 1;
i < hot_team->
t.t_nproc;
i++) {
8152 if (hot_team->
t.t_threads[
i]->th.th_active) {
8161static int __kmp_load_balance_nproc(
kmp_root_t *root,
int set_nproc) {
8164 int hot_team_active;
8165 int team_curr_active;
8168 KB_TRACE(20, (
"__kmp_load_balance_nproc: called root:%p set_nproc:%d\n", root,
8172 ->th.th_current_task->td_icvs.dynamic ==
TRUE);
8175 if (set_nproc == 1) {
8176 KB_TRACE(20, (
"__kmp_load_balance_nproc: serial execution.\n"));
8186 hot_team_active = __kmp_active_hot_team_nproc(root);
8187 team_curr_active = pool_active + hot_team_active + 1;
8191 KB_TRACE(30, (
"__kmp_load_balance_nproc: system active = %d pool active = %d "
8192 "hot team active = %d\n",
8193 system_active, pool_active, hot_team_active));
8195 if (system_active < 0) {
8200 KMP_WARNING(CantLoadBalUsing,
"KMP_DYNAMIC_MODE=thread limit");
8204 (root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
8205 if (retval > set_nproc) {
8212 KB_TRACE(20, (
"__kmp_load_balance_nproc: thread limit exit. retval:%d\n",
8220 if (system_active < team_curr_active) {
8221 system_active = team_curr_active;
8224 if (retval > set_nproc) {
8231 KB_TRACE(20, (
"__kmp_load_balance_nproc: exit. retval:%d\n", retval));
8243 KA_TRACE(10, (
"__kmp_cleanup: enter\n"));
8246#if KMP_HANDLE_SIGNALS
8247 __kmp_remove_signals();
8253#if KMP_AFFINITY_SUPPORTED
8254 __kmp_affinity_uninitialize();
8260 KA_TRACE(10, (
"__kmp_cleanup: go serial cleanup\n"));
8292#if KMP_USE_DYNAMIC_LOCK
8293 __kmp_cleanup_indirect_user_locks();
8298 if (ompd_env_block) {
8300 ompd_env_block = NULL;
8301 ompd_env_block_size = 0;
8305#if KMP_AFFINITY_SUPPORTED
8307 __kmp_cpuinfo_file = NULL;
8310#if KMP_USE_ADAPTIVE_LOCKS
8311#if KMP_DEBUG_ADAPTIVE_LOCKS
8312 __kmp_print_speculative_stats();
8336#if KMP_USE_HIER_SCHED
8340#if KMP_STATS_ENABLED
8347 KA_TRACE(10, (
"__kmp_cleanup: exit\n"));
8355 if ((env = getenv(
"KMP_IGNORE_MPPBEG")) != NULL) {
8366 if ((env = getenv(
"KMP_IGNORE_MPPEND")) != NULL) {
8384 if (root->r.r_begin)
8387 if (root->r.r_begin) {
8392 root->r.r_begin =
TRUE;
8409 root = thread->th.th_root;
8411 KA_TRACE(20, (
"__kmp_user_set_library: enter T#%d, arg: %d, %d\n", gtid, arg,
8413 if (root->r.r_in_parallel) {
8421 thread->th.th_set_nproc = 0;
8425 thread->th.th_set_nproc = 0;
8430 thread->th.th_set_nproc = 0;
8446 if (arg & (0x1000 - 1)) {
8447 arg &= ~(0x1000 - 1);
8497 teams_serialized = 0;
8498 if (thr->th.th_teams_microtask) {
8500 int tlevel = thr->th.th_teams_level;
8501 int ii = team->
t.t_level;
8502 teams_serialized = team->
t.t_serialized;
8503 int level = tlevel + 1;
8506 for (teams_serialized = team->
t.t_serialized;
8507 (teams_serialized > 0) && (
ii >
level); teams_serialized--,
ii--) {
8509 if (team->
t.t_serialized && (!teams_serialized)) {
8510 team = team->
t.t_parent;
8514 team = team->
t.t_parent;
8527 if (serialized > 1) {
8530 return team->
t.t_master_tid;
8540 if (serialized > 1) {
8543 return team->
t.t_parent->t.t_nproc;
8590#if KMP_AFFINITY_SUPPORTED
8591 {
'A',
"thread_affinity",
's'},
8593 {
't',
"team_num",
'd'},
8594 {
'T',
"num_teams",
'd'},
8595 {
'L',
"nesting_level",
'd'},
8596 {
'n',
"thread_num",
'd'},
8597 {
'N',
"num_threads",
'd'},
8598 {
'a',
"ancestor_tnum",
'd'},
8600 {
'P',
"process_id",
'd'},
8601 {
'i',
"native_thread_id",
'd'}};
8607 int rc, format_index, field_value;
8608 const char *width_left, *width_right;
8609 bool pad_zeros, right_justify, parse_long_name, found_valid_name;
8610 static const int FORMAT_SIZE = 20;
8611 char format[FORMAT_SIZE] = {0};
8612 char absolute_short_name = 0;
8637 right_justify =
false;
8639 right_justify =
true;
8643 width_left = width_right = NULL;
8644 if (**ptr >=
'0' && **ptr <=
'9') {
8652 format[format_index++] =
'%';
8654 format[format_index++] =
'-';
8656 format[format_index++] =
'0';
8657 if (width_left && width_right) {
8661 while (
i < 8 && width_left < width_right) {
8662 format[format_index++] = *width_left;
8670 found_valid_name =
false;
8671 parse_long_name = (**ptr ==
'{');
8672 if (parse_long_name)
8680 if (parse_long_name) {
8682 if (strncmp(*ptr, long_name,
length) == 0) {
8683 found_valid_name =
true;
8686 }
else if (**ptr == short_name) {
8687 found_valid_name =
true;
8690 if (found_valid_name) {
8691 format[format_index++] = field_format;
8692 format[format_index++] =
'\0';
8693 absolute_short_name = short_name;
8697 if (parse_long_name) {
8699 absolute_short_name = 0;
8707 switch (absolute_short_name) {
8740#if KMP_AFFINITY_SUPPORTED
8742 if (th->th.th_affin_mask) {
8745 __kmp_affinity_str_buf_mask(&
buf, th->th.th_affin_mask);
8758 if (parse_long_name) {
8779 const char *parse_ptr;
8796 if (parse_ptr == NULL || *parse_ptr ==
'\0') {
8801 while (*parse_ptr !=
'\0') {
8803 if (*parse_ptr ==
'%') {
8830 int blocktime = arg;
8849 bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME(blocktime, __kmp_monitor_wakeups);
8851 set__bt_intervals_team(thread->th.th_team, tid, bt_intervals);
8852 set__bt_intervals_team(thread->th.th_serial_team, 0, bt_intervals);
8861 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d, "
8862 "bt_intervals=%d, monitor_updates=%d\n",
8864 thread->th.th_team->t.t_id, tid, blocktime, bt_intervals,
8865 __kmp_monitor_wakeups));
8867 KF_TRACE(10, (
"kmp_set_blocktime: T#%d(%d:%d), blocktime=%d\n",
8869 thread->th.th_team->t.t_id, tid, blocktime));
8890 void *reduce_data,
void (*reduce_func)(
void *lhs_data,
void *rhs_data),
8908#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED \
8910 ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
8911#define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
8917 if (team_size == 1) {
8925#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
8926 KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || \
8927 KMP_ARCH_VE || KMP_ARCH_S390X || KMP_ARCH_WASM
8929#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8930 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HAIKU || \
8931 KMP_OS_HURD || KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8933 int teamsize_cutoff = 4;
8935#if KMP_MIC_SUPPORTED
8936 if (__kmp_mic_type != non_mic) {
8937 teamsize_cutoff = 8;
8941 if (tree_available) {
8942 if (team_size <= teamsize_cutoff) {
8943 if (atomic_available) {
8947 retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
8949 }
else if (atomic_available) {
8953#error "Unknown or unsupported OS"
8958#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS || \
8959 KMP_ARCH_WASM || KMP_ARCH_PPC || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC
8961#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
8962 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_HAIKU || KMP_OS_HURD || \
8963 KMP_OS_SOLARIS || KMP_OS_WASI || KMP_OS_AIX
8967 if (atomic_available) {
8968 if (num_vars <= 2) {
8976 if (atomic_available && (num_vars <= 3)) {
8978 }
else if (tree_available) {
8979 if ((reduce_size > (9 *
sizeof(
kmp_real64))) &&
8980 (reduce_size < (2000 *
sizeof(
kmp_real64)))) {
8981 retval = TREE_REDUCE_BLOCK_WITH_PLAIN_BARRIER;
8986#error "Unknown or unsupported OS"
8990#error "Unknown or unsupported architecture"
9003 int atomic_available, tree_available;
9012 if (!atomic_available) {
9020 if (!tree_available) {
9024#if KMP_FAST_REDUCTION_BARRIER
9025 forced_retval = TREE_REDUCE_BLOCK_WITH_REDUCTION_BARRIER;
9034 retval = forced_retval;
9037 KA_TRACE(10, (
"reduction method selected=%08x\n", retval));
9039#undef FAST_REDUCTION_TREE_METHOD_GENERATED
9040#undef FAST_REDUCTION_ATOMIC_METHOD_GENERATED
9143 for (
int f = 1;
f < old_nthreads; ++
f) {
9146 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 0) {
9152 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3) {
9153 while (team->
t.t_threads[
f]->th.th_used_in_team.load() == 3)
9159 team->
t.t_threads[
f]->th.th_used_in_team.store(2);
9163 team->
t.b->go_release();
9169 int count = old_nthreads - 1;
9171 count = old_nthreads - 1;
9172 for (
int f = 1;
f < old_nthreads; ++
f) {
9173 if (other_threads[
f]->th.th_used_in_team.load() != 0) {
9176 void *, other_threads[
f]->th.th_sleep_loc);
9186 team->
t.b->update_num_threads(new_nthreads);
9187 team->
t.b->go_reset();
9198 for (
int f = 1;
f < new_nthreads; ++
f) {
9201 &(team->
t.t_threads[
f]->th.th_used_in_team), 0, 3);
9210 int count = new_nthreads - 1;
9212 count = new_nthreads - 1;
9213 for (
int f = 1;
f < new_nthreads; ++
f) {
9214 if (team->
t.t_threads[
f]->th.th_used_in_team.load() == 1) {
9234std::atomic<kmp_int32> __kmp_hit_hidden_helper_threads_num;
9236void __kmp_hidden_helper_wrapper_fn(
int *gtid,
int *, ...) {
9253 for (
int i = 1;
i < __kmp_hit_hidden_helper_threads_num; ++
i) {
9299 for (
int i = 0;
i < levels; ++
i)
9321 loc++, hw_level++) {
9330 int upper_levels = 1;
9364#if ENABLE_LIBOMPTARGET
9365void (*kmp_target_sync_cb)(
ident_t *loc_ref,
int gtid,
void *current_task,
9366 void *
event) = NULL;
9367void __kmp_target_init() {
9369 *(
void **)(&kmp_target_sync_cb) =
KMP_DLSYM(
"__tgt_target_sync");
9375#if !KMP_STATS_ENABLED
9382#if !USE_ITT_BUILD || !USE_ITT_NOTIFY
A simple pure header implementation of VLA that aims to replace uses of actual VLA,...
static void deallocate(distributedBarrier *db)
static distributedBarrier * allocate(int nThreads)
bool is_sleeping()
Test whether there are threads sleeping on the flag.
@ KMP_IDENT_AUTOPAR
Entry point generated by auto-parallelization.
KMP_EXPORT void __kmpc_serialized_parallel(ident_t *, kmp_int32 global_tid)
KMP_EXPORT void __kmpc_fork_call(ident_t *, kmp_int32 nargs, kmpc_micro microtask,...)
KMP_EXPORT void __kmpc_end_serialized_parallel(ident_t *, kmp_int32 global_tid)
sched_type
Describes the loop schedule to be used for a parallel for loop.
KMP_EXPORT kmp_int32 __kmpc_master(ident_t *, kmp_int32 global_tid)
@ kmp_sch_static
static unspecialized
@ kmp_sch_guided_chunked
guided unspecialized
@ kmp_sch_dynamic_chunked
@ kmp_sch_guided_analytical_chunked
@ kmp_sch_static_balanced
@ kmp_sch_guided_iterative_chunked
__itt_string_handle * name
void const char const char int ITT_FORMAT __itt_group_sync s
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t new_size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t count
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t length
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark S
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d __itt_event event
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id tail
void __kmp_free_task_team(kmp_info_t *thread, kmp_task_team_t *task_team)
struct kmp_disp kmp_disp_t
int __kmp_hot_teams_max_level
void __kmp_finish_implicit_task(kmp_info_t *this_thr)
volatile kmp_team_t * __kmp_team_pool
#define get__dynamic_2(xteam, xtid)
kmp_bar_pat_e __kmp_barrier_release_pat_dflt
kmp_info_t * __kmp_hidden_helper_main_thread
int __kmp_generate_warnings
kmp_proc_bind_t __kmp_teams_proc_bind
#define KMP_INTERNAL_MALLOC(sz)
#define KMP_DEFAULT_CHUNK
kmp_bootstrap_lock_t __kmp_initz_lock
#define KMP_MAX_STKPADDING
int __kmp_display_env_verbose
kmp_global_t __kmp_global
void __kmp_init_target_mem()
union kmp_task_team kmp_task_team_t
void __kmp_hidden_helper_worker_thread_signal()
void __kmp_teams_master(int gtid)
void __kmp_common_initialize(void)
void __kmp_release_64(kmp_flag_64<> *flag)
kmp_pause_status_t __kmp_pause_status
#define KMP_MAX_BLOCKTIME
void __kmp_read_system_time(double *delta)
kmp_bootstrap_lock_t __kmp_tp_cached_lock
void __kmp_reap_task_teams(void)
kmp_int32 __kmp_use_yield
int __kmp_dflt_team_nth_ub
void __kmp_hidden_helper_threads_initz_wait()
struct dispatch_shared_info dispatch_shared_info_t
void __kmp_fini_target_mem()
Finalize target memory support.
#define KMP_INTERNAL_REALLOC(p, sz)
#define get__nproc_2(xteam, xtid)
void __kmp_wait_to_unref_task_teams(void)
union kmp_team kmp_team_p
struct KMP_ALIGN_CACHE dispatch_private_info dispatch_private_info_t
#define __kmp_assign_root_init_mask()
int __kmp_dflt_max_active_levels
struct kmp_hot_team_ptr kmp_hot_team_ptr_t
#define KMP_NOT_SAFE_TO_REAP
void __kmp_unlock_suspend_mx(kmp_info_t *th)
kmp_bar_pat_e __kmp_barrier_gather_pat_dflt
#define KMP_HIDDEN_HELPER_TEAM(team)
static kmp_team_t * __kmp_team_from_gtid(int gtid)
void __kmp_do_initialize_hidden_helper_threads()
struct kmp_local kmp_local_t
kmp_bar_pat_e __kmp_barrier_gather_pattern[bs_last_barrier]
kmp_tasking_mode_t __kmp_tasking_mode
char * __kmp_affinity_format
volatile kmp_info_t * __kmp_thread_pool
void __kmp_internal_end_atexit(void)
volatile int __kmp_init_gtid
omp_allocator_handle_t __kmp_def_allocator
static void __kmp_resume_if_hard_paused()
#define get__max_active_levels(xthread)
kmp_nested_proc_bind_t __kmp_nested_proc_bind
void __kmp_free_implicit_task(kmp_info_t *this_thr)
void __kmp_hidden_helper_main_thread_release()
fork_context_e
Tell the fork call which compiler generated the fork call, and therefore how to deal with the call.
@ fork_context_gnu
Called from GNU generated code, so must not invoke the microtask internally.
@ fork_context_intel
Called from Intel generated code.
void __kmp_suspend_initialize(void)
kmp_nested_nthreads_t __kmp_nested_nth
omp_allocator_handle_t const omp_default_mem_alloc
#define KMP_GTID_SHUTDOWN
void __kmp_internal_end_dtor(void)
volatile int __kmp_all_nth
#define set__nproc(xthread, xval)
int __kmp_is_address_mapped(void *addr)
kmp_lock_t __kmp_global_lock
void __kmpc_destroy_allocator(int gtid, omp_allocator_handle_t al)
union KMP_ALIGN_CACHE kmp_root kmp_root_t
int __kmp_adjust_gtid_mode
#define __kmp_entry_gtid()
kmp_old_threads_list_t * __kmp_old_threads_list
struct kmp_internal_control kmp_internal_control_t
volatile int __kmp_init_common
static int __kmp_tid_from_gtid(int gtid)
static bool KMP_UBER_GTID(int gtid)
kmp_int32 __kmp_use_yield_exp_set
volatile int __kmp_init_hidden_helper
#define KMP_DEBUG_ASSERT_TASKTEAM_INVARIANT(team, thr)
int __kmp_gtid_get_specific(void)
volatile int __kmp_init_middle
void __kmp_hidden_helper_threads_deinitz_wait()
void __kmpc_error(ident_t *loc, int severity, const char *message)
static kmp_sched_t __kmp_sched_without_mods(kmp_sched_t kind)
#define KMP_CHECK_UPDATE(a, b)
int __kmp_storage_map_verbose
int __kmp_allThreadsSpecified
enum sched_type __kmp_static
#define KMP_INITIAL_GTID(gtid)
int PACKED_REDUCTION_METHOD_T
std::atomic< int > __kmp_thread_pool_active_nth
#define KMP_MASTER_TID(tid)
int __kmp_duplicate_library_ok
volatile int __kmp_need_register_serial
kmp_bootstrap_lock_t __kmp_forkjoin_lock
struct kmp_cg_root kmp_cg_root_t
kmp_uint32 __kmp_barrier_release_branch_bits[bs_last_barrier]
static kmp_info_t * __kmp_entry_thread()
void __kmp_init_memkind()
void __kmp_hidden_helper_main_thread_wait()
#define KMP_GEN_TEAM_ID()
void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr, kmp_team_t *team, int tid, int set_curr_task)
kmp_int32 __kmp_default_device
#define get__sched_2(xteam, xtid)
void __kmp_cleanup_threadprivate_caches()
static void copy_icvs(kmp_internal_control_t *dst, kmp_internal_control_t *src)
kmp_bootstrap_lock_t __kmp_exit_lock
kmp_info_t ** __kmp_threads
void __kmp_hidden_helper_initz_release()
enum sched_type __kmp_sched
#define KMP_BARRIER_PARENT_FLAG
void __kmp_suspend_uninitialize_thread(kmp_info_t *th)
void __kmp_finalize_bget(kmp_info_t *th)
#define KMP_BARRIER_SWITCH_TO_OWN_FLAG
static void __kmp_reset_root_init_mask(int gtid)
kmp_uint32 __kmp_barrier_gather_bb_dflt
kmp_uint32 __kmp_barrier_release_bb_dflt
int __kmp_dispatch_num_buffers
#define SCHEDULE_WITHOUT_MODIFIERS(s)
union kmp_team kmp_team_t
#define set__max_active_levels(xthread, xval)
#define __kmp_get_team_num_threads(gtid)
#define KMP_MIN_MALLOC_ARGV_ENTRIES
#define KMP_MASTER_GTID(gtid)
void __kmp_lock_suspend_mx(kmp_info_t *th)
int __kmp_nesting_mode_nlevels
int(* launch_t)(int gtid)
void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size)
int * __kmp_nesting_nth_level
volatile int __kmp_init_parallel
union kmp_barrier_union kmp_balign_t
kmp_int32 __kmp_enable_hidden_helper
#define KMP_DEFAULT_BLOCKTIME
#define set__blocktime_team(xteam, xtid, xval)
#define __kmp_allocate(size)
enum kmp_sched kmp_sched_t
enum library_type __kmp_library
kmp_info_t * __kmp_thread_pool_insert_pt
int __kmp_env_consistency_check
#define bs_reduction_barrier
void __kmp_runtime_destroy(void)
union KMP_ALIGN_CACHE kmp_desc kmp_desc_t
static void __kmp_sched_apply_mods_intkind(kmp_sched_t kind, enum sched_type *internal_kind)
volatile int __kmp_hidden_helper_team_done
static void __kmp_sched_apply_mods_stdkind(kmp_sched_t *kind, enum sched_type internal_kind)
union kmp_barrier_team_union kmp_balign_team_t
std::atomic< kmp_int32 > __kmp_unexecuted_hidden_helper_tasks
#define KMP_INIT_BARRIER_STATE
size_t __kmp_sys_min_stksize
union kmp_info kmp_info_p
#define set__bt_set_team(xteam, xtid, xval)
int __kmp_invoke_task_func(int gtid)
kmp_uint32 __kmp_barrier_gather_branch_bits[bs_last_barrier]
#define KMP_BARRIER_NOT_WAITING
#define KMP_INTERNAL_FREE(p)
int __kmp_threads_capacity
kmp_info_t ** __kmp_hidden_helper_threads
void __kmp_push_current_task_to_thread(kmp_info_t *this_thr, kmp_team_t *team, int tid)
static int __kmp_gtid_from_tid(int tid, const kmp_team_t *team)
void __kmp_push_task_team_node(kmp_info_t *thread, kmp_team_t *team)
void __kmp_threadprivate_resize_cache(int newCapacity)
union kmp_r_sched kmp_r_sched_t
void __kmp_runtime_initialize(void)
volatile int __kmp_init_hidden_helper_threads
void __kmp_common_destroy_gtid(int gtid)
int __kmp_try_suspend_mx(kmp_info_t *th)
int __kmp_display_affinity
enum sched_type __kmp_guided
void __kmp_resume_32(int target_gtid, kmp_flag_32< C, S > *flag)
#define KMP_INLINE_ARGV_ENTRIES
#define SCHEDULE_GET_MODIFIERS(s)
PACKED_REDUCTION_METHOD_T __kmp_force_reduction_method
#define __kmp_page_allocate(size)
void __kmp_initialize_bget(kmp_info_t *th)
int __kmp_teams_thread_limit
void __kmp_cleanup_hierarchy()
void __kmp_pop_current_task_from_thread(kmp_info_t *this_thr)
void __kmp_gtid_set_specific(int gtid)
void __kmp_atomic_resume_64(int target_gtid, kmp_atomic_flag_64< C, S > *flag)
static int __kmp_gtid_from_thread(const kmp_info_t *thr)
#define KMP_MIN_BLOCKTIME
#define SCHEDULE_SET_MODIFIERS(s, m)
void __kmp_suspend_initialize_thread(kmp_info_t *th)
volatile int __kmp_init_serial
@ reduction_method_not_defined
#define KMP_CHECK_UPDATE_SYNC(a, b)
int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int npr, int argc, void *argv[])
kmp_int32 __kmp_hidden_helper_threads_num
#define KMP_MAX_ACTIVE_LEVELS_LIMIT
static void __kmp_type_convert(T1 src, T2 *dest)
void __kmp_fini_memkind()
struct kmp_taskdata kmp_taskdata_t
kmp_bar_pat_e __kmp_barrier_release_pattern[bs_last_barrier]
void __kmp_reap_worker(kmp_info_t *th)
void __kmp_hidden_helper_threads_deinitz_release()
void __kmp_expand_host_name(char *buffer, size_t size)
union KMP_ALIGN_CACHE kmp_info kmp_info_t
enum sched_type __kmp_sch_map[]
void __kmp_task_team_wait(kmp_info_t *this_thr, kmp_team_t *team, int wait=1)
#define __kmp_thread_free(th, ptr)
kmp_topology_t * __kmp_topology
kmp_atomic_lock_t __kmp_atomic_lock_8c
kmp_atomic_lock_t __kmp_atomic_lock_8r
kmp_atomic_lock_t __kmp_atomic_lock_4i
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 kmp_int16
kmp_atomic_lock_t __kmp_atomic_lock_20c
kmp_atomic_lock_t __kmp_atomic_lock_16c
kmp_atomic_lock_t __kmp_atomic_lock_2i
kmp_atomic_lock_t __kmp_atomic_lock_32c
kmp_atomic_lock_t __kmp_atomic_lock_8i
kmp_atomic_lock_t __kmp_atomic_lock
kmp_atomic_lock_t __kmp_atomic_lock_10r
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 kmp_int8
kmp_atomic_lock_t __kmp_atomic_lock_1i
kmp_atomic_lock_t __kmp_atomic_lock_16r
KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86 KMP_ARCH_X86<<, 2i, 1, KMP_ARCH_X86) ATOMIC_CMPXCHG(fixed2, shr, kmp_int16, 16, > KMP_ARCH_X86 KMP_ARCH_X86 kmp_uint32
kmp_atomic_lock_t __kmp_atomic_lock_4r
static void __kmp_init_atomic_lock(kmp_atomic_lock_t *lck)
void __kmp_print_structure(void)
void __kmp_dump_debug_buffer(void)
#define KMP_BUILD_ASSERT(expr)
#define KMP_DEBUG_ASSERT(cond)
#define KMP_ASSERT2(cond, msg)
unsigned long long kmp_uint64
kmp_hier_sched_env_t __kmp_hier_scheds
void __kmp_dispatch_free_hierarchies(kmp_team_t *team)
void __kmp_env_free(char const **value)
char * __kmp_env_get(char const *name)
void __kmp_env_set(char const *name, char const *value, int overwrite)
void __kmp_env_unset(char const *name)
void __kmp_push_sync(int gtid, enum cons_type ct, ident_t const *ident, kmp_user_lock_p lck)
void __kmp_push_parallel(int gtid, ident_t const *ident)
void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_push_workshare(int gtid, enum cons_type ct, ident_t const *ident)
enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct, ident_t const *ident)
void __kmp_pop_sync(int gtid, enum cons_type ct, ident_t const *ident)
struct cons_header * __kmp_allocate_cons_stack(int gtid)
void __kmp_pop_parallel(int gtid, ident_t const *ident)
void __kmp_free_cons_stack(void *ptr)
static volatile kmp_i18n_cat_status_t status
static void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, va_list ap)
void __kmp_i18n_dump_catalog(kmp_str_buf_t *buffer)
void __kmp_fatal(kmp_msg_t message,...)
void __kmp_i18n_catclose()
kmp_bootstrap_lock_t __kmp_stdio_lock
void __kmp_fprintf(enum kmp_io stream, char const *format,...)
void __kmp_vprintf(enum kmp_io out_stream, char const *format, va_list ap)
void __kmp_printf(char const *format,...)
void __kmp_printf_no_lock(char const *format,...)
void __kmp_close_console(void)
#define USE_ITT_BUILD_ARG(x)
void __kmp_cleanup_user_locks(void)
void __kmp_validate_locks(void)
static void __kmp_release_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static int __kmp_acquire_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_lock(kmp_lock_t *lck)
static int __kmp_acquire_bootstrap_lock(kmp_bootstrap_lock_t *lck)
static void __kmp_release_lock(kmp_lock_t *lck, kmp_int32 gtid)
static void __kmp_init_bootstrap_lock(kmp_bootstrap_lock_t *lck)
void(* microtask_t)(int *gtid, int *npr,...)
#define TCW_SYNC_PTR(a, b)
#define KMP_ATOMIC_ST_REL(p, v)
#define KMP_CACHE_PREFETCH(ADDR)
#define KMP_ATOMIC_LD_ACQ(p)
bool __kmp_atomic_compare_store_acq(std::atomic< T > *p, T expected, T desired)
#define KMP_FALLTHROUGH()
#define KMP_ATOMIC_DEC(p)
#define KMP_GET_PAGE_SIZE()
#define KMP_ATOMIC_LD_RLX(p)
#define KMP_COMPARE_AND_STORE_ACQ32(p, cv, sv)
#define KMP_WEAK_ATTRIBUTE_EXTERNAL
#define KMP_ATOMIC_INC(p)
int __kmp_pause_resource(kmp_pause_status_t level)
void __kmp_warn(char const *format,...)
void __kmp_set_schedule(int gtid, kmp_sched_t kind, int chunk)
static void __kmp_initialize_team(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc)
static void __kmp_fini_allocator()
static void __kmp_init_allocator()
void __kmp_aux_set_defaults(char const *str, size_t len)
static int __kmp_free_hot_teams(kmp_root_t *root, kmp_info_t *thr, int level, const int max_level)
static kmp_team_t * __kmp_aux_get_team_info(int &teams_serialized)
static int __kmp_expand_threads(int nNeed)
void __kmp_teams_master(int gtid)
static void __kmp_itthash_clean(kmp_info_t *th)
#define propagateFPControl(x)
void __kmp_itt_init_ittlib()
void __kmp_infinite_loop(void)
void __kmp_push_num_teams_51(ident_t *id, int gtid, int num_teams_lb, int num_teams_ub, int num_threads)
int __kmp_aux_get_num_teams()
kmp_team_t * __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc, kmp_proc_bind_t new_proc_bind, kmp_internal_control_t *new_icvs, int argc, kmp_info_t *master)
kmp_info_t * __kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team, int new_tid)
void __kmp_run_before_invoked_task(int gtid, int tid, kmp_info_t *this_thr, kmp_team_t *team)
static long __kmp_registration_flag
int __kmp_get_max_active_levels(int gtid)
void __kmp_aux_set_library(enum library_type arg)
void __kmp_print_storage_map_gtid(int gtid, void *p1, void *p2, size_t size, char const *format,...)
void __kmp_free_team(kmp_root_t *root, kmp_team_t *team, kmp_info_t *master)
unsigned short __kmp_get_random(kmp_info_t *thread)
int __kmp_register_root(int initial_thread)
static void __kmp_internal_end(void)
void __kmp_set_max_active_levels(int gtid, int max_active_levels)
void __kmp_abort_thread(void)
void __kmp_setup_icv_copy(kmp_team_t *team, int new_nproc, kmp_internal_control_t *new_icvs, ident_t *loc)
void __kmp_internal_end_atexit(void)
static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team, kmp_info_t *master_th, int master_gtid, int fork_teams_workers)
void __kmp_push_proc_bind(ident_t *id, int gtid, kmp_proc_bind_t proc_bind)
kmp_team_t * __kmp_reap_team(kmp_team_t *team)
void __kmp_exit_single(int gtid)
void __kmp_check_stack_overlap(kmp_info_t *th)
void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams, int num_threads)
int __kmp_get_team_size(int gtid, int level)
static void __kmp_allocate_team_arrays(kmp_team_t *team, int max_nth)
static void __kmp_do_middle_initialize(void)
int __kmp_get_max_teams(void)
static void __kmp_free_team_arrays(kmp_team_t *team)
static void __kmp_initialize_root(kmp_root_t *root)
static void __kmp_reinitialize_team(kmp_team_t *team, kmp_internal_control_t *new_icvs, ident_t *loc)
int __kmp_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, kmp_int32 argc, microtask_t microtask, launch_t invoker, kmp_va_list ap)
void __kmp_parallel_dxo(int *gtid_ref, int *cid_ref, ident_t *loc_ref)
void * __kmp_launch_thread(kmp_info_t *this_thr)
void __kmp_set_teams_thread_limit(int limit)
static int __kmp_serial_fork_call(ident_t *loc, int gtid, enum fork_context_e call_context, kmp_int32 argc, microtask_t microtask, launch_t invoker, kmp_info_t *master_th, kmp_team_t *parent_team, kmp_va_list ap)
void __kmp_join_barrier(int gtid)
static kmp_internal_control_t __kmp_get_x_global_icvs(const kmp_team_t *team)
void __kmp_init_random(kmp_info_t *thread)
static void __kmp_push_thread_limit(kmp_info_t *thr, int num_teams, int num_threads)
void __kmp_push_num_threads(ident_t *id, int gtid, int num_threads)
void __kmp_user_set_library(enum library_type arg)
#define updateHWFPControl(x)
#define FAST_REDUCTION_ATOMIC_METHOD_GENERATED
void __kmp_internal_end_dest(void *specific_gtid)
int __kmp_aux_get_team_num()
void __kmp_set_num_threads(int new_nth, int gtid)
void __kmp_internal_end_thread(int gtid_req)
static bool __kmp_is_fork_in_teams(kmp_info_t *master_th, microtask_t microtask, int level, int teams_level, kmp_va_list ap)
PACKED_REDUCTION_METHOD_T __kmp_determine_reduction_method(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars, size_t reduce_size, void *reduce_data, void(*reduce_func)(void *lhs_data, void *rhs_data), kmp_critical_name *lck)
void __kmp_hidden_helper_threads_initz_routine()
int __kmp_enter_single(int gtid, ident_t *id_ref, int push_ws)
static void __kmp_initialize_info(kmp_info_t *, kmp_team_t *, int tid, int gtid)
void __kmp_internal_join(ident_t *id, int gtid, kmp_team_t *team)
void __kmp_join_call(ident_t *loc, int gtid, int exit_teams)
static int __kmp_reset_root(int gtid, kmp_root_t *root)
int __kmp_get_ancestor_thread_num(int gtid, int level)
void __kmp_itt_fini_ittlib()
void __kmp_omp_display_env(int verbose)
void __kmp_middle_initialize(void)
void __kmp_unregister_root_current_thread(int gtid)
static void __kmp_reap_thread(kmp_info_t *thread, int is_root)
static const unsigned __kmp_primes[]
int __kmp_get_teams_thread_limit(void)
#define FAST_REDUCTION_TREE_METHOD_GENERATED
void __kmp_parallel_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref)
kmp_r_sched_t __kmp_get_schedule_global()
void __kmp_run_after_invoked_task(int gtid, int tid, kmp_info_t *this_thr, kmp_team_t *team)
static kmp_internal_control_t __kmp_get_global_icvs(void)
void __kmp_parallel_initialize(void)
void __kmp_set_nesting_mode_threads()
void __kmp_unregister_library(void)
char const __kmp_version_omp_api[]
static char * __kmp_registration_str
int __kmp_ignore_mppbeg(void)
void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team)
void __kmp_aux_set_stacksize(size_t arg)
void __kmp_internal_end_library(int gtid_req)
size_t __kmp_aux_capture_affinity(int gtid, const char *format, kmp_str_buf_t *buffer)
void __kmp_resize_dist_barrier(kmp_team_t *team, int old_nthreads, int new_nthreads)
int __kmp_omp_debug_struct_info
static void __kmp_print_thread_storage_map(kmp_info_t *thr, int gtid)
void __kmp_aux_display_affinity(int gtid, const char *format)
void __kmp_init_nesting_mode()
void __kmp_register_library_startup(void)
void __kmp_free_thread(kmp_info_t *this_th)
int __kmp_invoke_task_func(int gtid)
void __kmp_get_schedule(int gtid, kmp_sched_t *kind, int *chunk)
void __kmp_set_strict_num_threads(ident_t *loc, int gtid, int sev, const char *msg)
void __kmp_abort_process()
static const kmp_affinity_format_field_t __kmp_affinity_format_table[]
void __kmp_set_num_teams(int num_teams)
static void __kmp_alloc_argv_entries(int argc, kmp_team_t *team, int realloc)
void __kmp_save_internal_controls(kmp_info_t *thread)
int __kmp_invoke_teams_master(int gtid)
void __kmp_hidden_helper_initialize()
void __kmp_add_threads_to_team(kmp_team_t *team, int new_nthreads)
void __kmp_push_num_threads_list(ident_t *id, int gtid, kmp_uint32 list_length, int *num_threads_list)
static void __kmp_reallocate_team_arrays(kmp_team_t *team, int max_nth)
static int __kmp_reserve_threads(kmp_root_t *root, kmp_team_t *parent_team, int master_tid, int set_nthreads, int enter_teams)
void __kmp_serial_initialize(void)
static bool __kmp_is_entering_teams(int active_level, int level, int teams_level, kmp_va_list ap)
void __kmp_resume_if_soft_paused()
void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid)
int __kmp_get_global_thread_id()
void __kmp_internal_begin(void)
static char * __kmp_reg_status_name()
static void __kmp_print_team_storage_map(const char *header, kmp_team_t *team, int team_id, int num_thr)
static void __kmp_do_serial_initialize(void)
void __kmp_fork_barrier(int gtid, int tid)
int __kmp_get_global_thread_id_reg()
int __kmp_ignore_mppend(void)
static kmp_nested_nthreads_t * __kmp_override_nested_nth(kmp_info_t *thr, int level)
kmp_int32 __kmp_get_reduce_method(void)
static int __kmp_aux_capture_affinity_field(int gtid, const kmp_info_t *th, const char **ptr, kmp_str_buf_t *field_buffer)
static int __kmp_fork_in_teams(ident_t *loc, int gtid, kmp_team_t *parent_team, kmp_int32 argc, kmp_info_t *master_th, kmp_root_t *root, enum fork_context_e call_context, microtask_t microtask, launch_t invoker, int master_set_numthreads, int level, kmp_va_list ap)
void __kmp_aux_set_blocktime(int arg, kmp_info_t *thread, int tid)
#define KMP_STRCPY_S(dst, bsz, src)
int __kmp_default_tp_capacity(int req_nproc, int max_nth, int all_threads_specified)
int __kmp_initial_threads_capacity(int req_nproc)
void __kmp_env_initialize(char const *string)
void __kmp_display_env_impl(int display_env, int display_env_verbose)
void __kmp_stats_init(void)
void __kmp_stats_fini(void)
Functions for collecting statistics.
#define KMP_COUNT_VALUE(n, v)
#define KMP_PUSH_PARTITIONED_TIMER(name)
#define KMP_GET_THREAD_STATE()
#define KMP_POP_PARTITIONED_TIMER()
#define KMP_INIT_PARTITIONED_TIMERS(name)
#define KMP_SET_THREAD_STATE_BLOCK(state_name)
#define KMP_TIME_PARTITIONED_BLOCK(name)
#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n)
#define KMP_SET_THREAD_STATE(state_name)
void __kmp_str_split(char *str, char delim, char **head, char **tail)
void __kmp_str_buf_clear(kmp_str_buf_t *buffer)
void __kmp_str_buf_free(kmp_str_buf_t *buffer)
char * __kmp_str_format(char const *format,...)
int __kmp_str_match_true(char const *data)
void __kmp_str_buf_cat(kmp_str_buf_t *buffer, char const *str, size_t len)
void __kmp_str_buf_catbuf(kmp_str_buf_t *dest, const kmp_str_buf_t *src)
int __kmp_str_buf_print(kmp_str_buf_t *buffer, char const *format,...)
int __kmp_str_match_false(char const *data)
struct kmp_str_buf kmp_str_buf_t
#define __kmp_str_buf_init(b)
void __kmp_print_version_1(void)
void __kmp_print_version_2(void)
#define KMP_VERSION_PREFIX
char const __kmp_version_alt_comp[]
char const __kmp_version_lock[]
static void __kmp_null_resume_wrapper(kmp_info_t *thr)
void microtask(int *global_tid, int *bound_tid)
ompt_callbacks_active_t ompt_enabled
ompt_callbacks_internal_t ompt_callbacks
struct ompt_lw_taskteam_s ompt_lw_taskteam_t
#define OMPT_GET_FRAME_ADDRESS(level)
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid, ompt_data_t *ompt_pid, void *codeptr)
int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame, ompt_data_t **parallel_data, int *thread_num)
void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int on_heap, bool always)
ompt_task_info_t * __ompt_get_task_info_object(int depth)
void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid)
void __ompt_lw_taskteam_unlink(kmp_info_t *thr)
ompt_data_t * __ompt_get_thread_data_internal()
__attribute__((noinline))
kmp_int32 tt_found_proxy_tasks
kmp_int32 tt_hidden_helper_task_encountered
kmp_int32 cg_thread_limit
void(* th_dxo_fcn)(int *gtid, int *cid, ident_t *)
kmp_int32 th_doacross_buf_idx
dispatch_private_info_t * th_dispatch_pr_current
dispatch_private_info_t * th_disp_buffer
void(* th_deo_fcn)(int *gtid, int *cid, ident_t *)
dispatch_shared_info_t * th_dispatch_sh_current
kmp_proc_bind_t proc_bind
struct kmp_internal_control * next
struct kmp_old_threads_list_t * next
ompt_task_info_t ompt_task_info
enum sched_type r_sched_type
void __kmp_reap_monitor(kmp_info_t *th)
void __kmp_register_atfork(void)
void __kmp_free_handle(kmp_thread_t tHandle)
int __kmp_get_load_balance(int max)
int __kmp_still_running(kmp_info_t *th)
void __kmp_initialize_system_tick(void)
int __kmp_is_thread_alive(kmp_info_t *th, DWORD *exit_val)