14#include "kmp_affinity.h"
15#include "kmp_atomic.h"
17#include "kmp_dispatch_hier.h"
19#include "kmp_environment.h"
24#include "kmp_settings.h"
26#include "kmp_traits.h"
27#include "kmp_wrapper_getpid.h"
30#include "ompd-specific.h"
33static int __kmp_env_toPrint(
char const *name,
int flag);
35bool __kmp_env_format = 0;
40#ifdef USE_LOAD_BALANCE
41static double __kmp_convert_to_double(
char const *s) {
44 if (KMP_SSCANF(s,
"%lf", &result) < 1) {
53static unsigned int __kmp_readstr_with_sentinel(
char *dest,
char const *src,
54 size_t len,
char sentinel) {
56 for (i = 0; i < len; i++) {
57 if ((*src ==
'\0') || (*src == sentinel)) {
67static int __kmp_match_with_sentinel(
char const *a,
char const *b,
size_t len,
75 while (*a && *b && *b != sentinel) {
76 char ca = *a, cb = *b;
78 if (ca >=
'a' && ca <=
'z')
80 if (cb >=
'a' && cb <=
'z')
114static int __kmp_match_str(
char const *token,
char const *buf,
117 KMP_ASSERT(token != NULL);
118 KMP_ASSERT(buf != NULL);
119 KMP_ASSERT(end != NULL);
121 while (*token && *buf) {
122 char ct = *token, cb = *buf;
124 if (ct >=
'a' && ct <=
'z')
126 if (cb >=
'a' && cb <=
'z')
141static size_t __kmp_round4k(
size_t size) {
142 size_t _4k = 4 * 1024;
143 if (size & (_4k - 1)) {
145 if (size <= KMP_SIZE_T_MAX - _4k) {
153static int __kmp_strcasecmp_with_sentinel(
char const *a,
char const *b,
159 while (*a && *b && *b != sentinel) {
160 char ca = *a, cb = *b;
162 if (ca >=
'a' && ca <=
'z')
164 if (cb >=
'a' && cb <=
'z')
167 return (
int)(
unsigned char)*a - (
int)(
unsigned char)*b;
171 return *a ? (*b && *b != sentinel)
172 ? (
int)(
unsigned char)*a - (
int)(
unsigned char)*b
174 : (*b && *b != sentinel) ? -1
181typedef struct __kmp_setting kmp_setting_t;
182typedef struct __kmp_stg_ss_data kmp_stg_ss_data_t;
183typedef struct __kmp_stg_wp_data kmp_stg_wp_data_t;
184typedef struct __kmp_stg_fr_data kmp_stg_fr_data_t;
186typedef void (*kmp_stg_parse_func_t)(
char const *name,
char const *value,
188typedef void (*kmp_stg_print_func_t)(kmp_str_buf_t *buffer,
char const *name,
191struct __kmp_setting {
193 kmp_stg_parse_func_t parse;
194 kmp_stg_print_func_t print;
201struct __kmp_stg_ss_data {
203 kmp_setting_t **rivals;
206struct __kmp_stg_wp_data {
208 kmp_setting_t **rivals;
211struct __kmp_stg_fr_data {
213 kmp_setting_t **rivals;
216static int __kmp_stg_check_rivals(
219 kmp_setting_t **rivals
223struct kmp_trimmed_str_t {
225 kmp_trimmed_str_t(
const char *str) {
226 __kmp_str_buf_init(&buf);
227 size_t len = KMP_STRLEN(str);
230 const char *begin = str;
231 const char *end = str + KMP_STRLEN(str) - 1;
233 while (begin < end && *end ==
' ')
235 __kmp_str_buf_cat(&buf, begin, end - begin + 1);
237 ~kmp_trimmed_str_t() { __kmp_str_buf_free(&buf); }
238 const char *get() {
return buf.str; }
244static void __kmp_stg_parse_bool(
char const *name,
char const *value,
246 if (__kmp_str_match_true(value)) {
248 }
else if (__kmp_str_match_false(value)) {
251 __kmp_msg(kmp_ms_warning, KMP_MSG(BadBoolValue, name, value),
252 KMP_HNT(ValidBoolValues), __kmp_msg_null);
257void __kmp_check_stksize(
size_t *val) {
260 if (*val > KMP_DEFAULT_STKSIZE * 2)
261 *val = KMP_DEFAULT_STKSIZE * 2;
263 if (*val > KMP_DEFAULT_STKSIZE * 16)
264 *val = KMP_DEFAULT_STKSIZE * 16;
266 if (*val < __kmp_sys_min_stksize)
267 *val = __kmp_sys_min_stksize;
268 if (*val > KMP_MAX_STKSIZE)
269 *val = KMP_MAX_STKSIZE;
271 *val = __kmp_round4k(*val);
275static void __kmp_stg_parse_size(
char const *name,
char const *value,
276 size_t size_min,
size_t size_max,
277 int *is_specified,
size_t *out,
279 char const *msg = NULL;
281 size_min = __kmp_round4k(size_min);
282 size_max = __kmp_round4k(size_max);
285 if (is_specified != NULL) {
288 __kmp_str_to_size(value, out, factor, &msg);
290 if (*out > size_max) {
292 msg = KMP_I18N_STR(ValueTooLarge);
293 }
else if (*out < size_min) {
295 msg = KMP_I18N_STR(ValueTooSmall);
298 size_t round4k = __kmp_round4k(*out);
299 if (*out != round4k) {
301 msg = KMP_I18N_STR(NotMultiple4K);
308 if (*out < size_min) {
310 }
else if (*out > size_max) {
317 __kmp_str_buf_init(&buf);
318 __kmp_str_buf_print_size(&buf, *out);
319 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
320 KMP_INFORM(Using_str_Value, name, buf.str);
321 __kmp_str_buf_free(&buf);
326static void __kmp_stg_parse_str(
char const *name,
char const *value,
329 *out = __kmp_str_format(
"%s", value);
332static void __kmp_stg_parse_int(
340 char const *msg = NULL;
341 kmp_uint64 uint = *out;
342 __kmp_str_to_uint(value, &uint, &msg);
344 if (uint < (
unsigned int)min) {
345 msg = KMP_I18N_STR(ValueTooSmall);
347 }
else if (uint > (
unsigned int)max) {
348 msg = KMP_I18N_STR(ValueTooLarge);
354 if (uint < (
unsigned int)min) {
356 }
else if (uint > (
unsigned int)max) {
363 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
364 __kmp_str_buf_init(&buf);
365 __kmp_str_buf_print(&buf,
"%" KMP_UINT64_SPEC
"", uint);
366 KMP_INFORM(Using_uint64_Value, name, buf.str);
367 __kmp_str_buf_free(&buf);
369 __kmp_type_convert(uint, out);
372#if KMP_DEBUG_ADAPTIVE_LOCKS
373static void __kmp_stg_parse_file(
char const *name,
char const *value,
374 const char *suffix,
char **out) {
379 t = (
char *)strrchr(value,
'.');
380 hasSuffix = t && __kmp_str_eqf(t, suffix);
381 t = __kmp_str_format(
"%s%s", value, hasSuffix ?
"" : suffix);
382 __kmp_expand_file_name(buffer,
sizeof(buffer), t);
384 *out = __kmp_str_format(
"%s", buffer);
389static char *par_range_to_print = NULL;
391static void __kmp_stg_parse_par_range(
char const *name,
char const *value,
392 int *out_range,
char *out_routine,
393 char *out_file,
int *out_lb,
395 const char *par_range_value;
396 size_t len = KMP_STRLEN(value) + 1;
397 par_range_to_print = (
char *)KMP_INTERNAL_MALLOC(len + 1);
398 KMP_STRNCPY_S(par_range_to_print, len + 1, value, len + 1);
399 __kmp_par_range = +1;
400 __kmp_par_range_lb = 0;
401 __kmp_par_range_ub = INT_MAX;
404 if (!value || *value ==
'\0') {
407 if (!__kmp_strcasecmp_with_sentinel(
"routine", value,
'=')) {
408 par_range_value = strchr(value,
'=') + 1;
409 if (!par_range_value)
410 goto par_range_error;
411 value = par_range_value;
412 len = __kmp_readstr_with_sentinel(out_routine, value,
413 KMP_PAR_RANGE_ROUTINE_LEN - 1,
',');
415 goto par_range_error;
417 value = strchr(value,
',');
423 if (!__kmp_strcasecmp_with_sentinel(
"filename", value,
'=')) {
424 par_range_value = strchr(value,
'=') + 1;
425 if (!par_range_value)
426 goto par_range_error;
427 value = par_range_value;
428 len = __kmp_readstr_with_sentinel(out_file, value,
429 KMP_PAR_RANGE_FILENAME_LEN - 1,
',');
431 goto par_range_error;
433 value = strchr(value,
',');
439 if ((!__kmp_strcasecmp_with_sentinel(
"range", value,
'=')) ||
440 (!__kmp_strcasecmp_with_sentinel(
"incl_range", value,
'='))) {
441 par_range_value = strchr(value,
'=') + 1;
442 if (!par_range_value)
443 goto par_range_error;
444 value = par_range_value;
445 if (KMP_SSCANF(value,
"%d:%d", out_lb, out_ub) != 2) {
446 goto par_range_error;
449 value = strchr(value,
',');
455 if (!__kmp_strcasecmp_with_sentinel(
"excl_range", value,
'=')) {
456 par_range_value = strchr(value,
'=') + 1;
457 if (!par_range_value)
458 goto par_range_error;
459 value = par_range_value;
460 if (KMP_SSCANF(value,
"%d:%d", out_lb, out_ub) != 2) {
461 goto par_range_error;
464 value = strchr(value,
',');
471 KMP_WARNING(ParRangeSyntax, name);
478int __kmp_initial_threads_capacity(
int req_nproc) {
483 if (nth < (4 * req_nproc))
484 nth = (4 * req_nproc);
485 if (nth < (4 * __kmp_xproc))
486 nth = (4 * __kmp_xproc);
490 if (__kmp_enable_hidden_helper) {
491 nth += __kmp_hidden_helper_threads_num;
494 if (nth > __kmp_max_nth)
500int __kmp_default_tp_capacity(
int req_nproc,
int max_nth,
501 int all_threads_specified) {
504 if (all_threads_specified)
508 if (nth < (4 * req_nproc))
509 nth = (4 * req_nproc);
510 if (nth < (4 * __kmp_xproc))
511 nth = (4 * __kmp_xproc);
513 if (nth > __kmp_max_nth)
522static void __kmp_stg_print_bool(kmp_str_buf_t *buffer,
char const *name,
524 if (__kmp_env_format) {
525 KMP_STR_BUF_PRINT_BOOL;
527 __kmp_str_buf_print(buffer,
" %s=%s\n", name, value ?
"true" :
"false");
531static void __kmp_stg_print_int(kmp_str_buf_t *buffer,
char const *name,
533 if (__kmp_env_format) {
534 KMP_STR_BUF_PRINT_INT;
536 __kmp_str_buf_print(buffer,
" %s=%d\n", name, value);
540static void __kmp_stg_print_uint64(kmp_str_buf_t *buffer,
char const *name,
542 if (__kmp_env_format) {
543 KMP_STR_BUF_PRINT_UINT64;
545 __kmp_str_buf_print(buffer,
" %s=%" KMP_UINT64_SPEC
"\n", name, value);
549static void __kmp_stg_print_str(kmp_str_buf_t *buffer,
char const *name,
551 if (__kmp_env_format) {
552 KMP_STR_BUF_PRINT_STR;
554 __kmp_str_buf_print(buffer,
" %s=%s\n", name, value);
558static void __kmp_stg_print_size(kmp_str_buf_t *buffer,
char const *name,
560 if (__kmp_env_format) {
561 KMP_STR_BUF_PRINT_NAME_EX(name);
562 __kmp_str_buf_print_size(buffer, value);
563 __kmp_str_buf_print(buffer,
"'\n");
565 __kmp_str_buf_print(buffer,
" %s=", name);
566 __kmp_str_buf_print_size(buffer, value);
567 __kmp_str_buf_print(buffer,
"\n");
578static void __kmp_stg_parse_device_thread_limit(
char const *name,
579 char const *value,
void *data) {
580 kmp_setting_t **rivals = (kmp_setting_t **)data;
582 if (strcmp(name,
"KMP_ALL_THREADS") == 0) {
583 KMP_INFORM(EnvVarDeprecated, name,
"KMP_DEVICE_THREAD_LIMIT");
585 rc = __kmp_stg_check_rivals(name, value, rivals);
589 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
590 __kmp_max_nth = __kmp_xproc;
591 __kmp_allThreadsSpecified = 1;
593 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_max_nth);
594 __kmp_allThreadsSpecified = 0;
596 K_DIAG(1, (
"__kmp_max_nth == %d\n", __kmp_max_nth));
600static void __kmp_stg_print_device_thread_limit(kmp_str_buf_t *buffer,
601 char const *name,
void *data) {
602 __kmp_stg_print_int(buffer, name, __kmp_max_nth);
607static void __kmp_stg_parse_thread_limit(
char const *name,
char const *value,
609 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_cg_max_nth);
610 K_DIAG(1, (
"__kmp_cg_max_nth == %d\n", __kmp_cg_max_nth));
614static void __kmp_stg_print_thread_limit(kmp_str_buf_t *buffer,
615 char const *name,
void *data) {
616 __kmp_stg_print_int(buffer, name, __kmp_cg_max_nth);
621static void __kmp_stg_parse_nteams(
char const *name,
char const *value,
623 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_nteams);
624 K_DIAG(1, (
"__kmp_nteams == %d\n", __kmp_nteams));
627static void __kmp_stg_print_nteams(kmp_str_buf_t *buffer,
char const *name,
629 __kmp_stg_print_int(buffer, name, __kmp_nteams);
634static void __kmp_stg_parse_teams_th_limit(
char const *name,
char const *value,
636 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth,
637 &__kmp_teams_thread_limit);
638 K_DIAG(1, (
"__kmp_teams_thread_limit == %d\n", __kmp_teams_thread_limit));
641static void __kmp_stg_print_teams_th_limit(kmp_str_buf_t *buffer,
642 char const *name,
void *data) {
643 __kmp_stg_print_int(buffer, name, __kmp_teams_thread_limit);
648static void __kmp_stg_parse_teams_thread_limit(
char const *name,
649 char const *value,
void *data) {
650 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_teams_max_nth);
653static void __kmp_stg_print_teams_thread_limit(kmp_str_buf_t *buffer,
654 char const *name,
void *data) {
655 __kmp_stg_print_int(buffer, name, __kmp_teams_max_nth);
660static void __kmp_stg_parse_use_yield(
char const *name,
char const *value,
662 __kmp_stg_parse_int(name, value, 0, 2, &__kmp_use_yield);
663 __kmp_use_yield_exp_set = 1;
666static void __kmp_stg_print_use_yield(kmp_str_buf_t *buffer,
char const *name,
668 __kmp_stg_print_int(buffer, name, __kmp_use_yield);
674static void __kmp_stg_parse_blocktime(
char const *name,
char const *value,
676 const char *buf = value;
678 const int ms_mult = 1000;
684 if ((*buf >=
'0') && (*buf <=
'9')) {
687 num = __kmp_basic_str_to_int(buf);
688 KMP_ASSERT(num >= 0);
697 if (*buf ==
'\0' || __kmp_match_str(
"ms", buf, &next)) {
699 __kmp_dflt_blocktime = ms_mult * num;
700 __kmp_blocktime_units =
'm';
701 multiplier = ms_mult;
702 }
else if (__kmp_match_str(
"us", buf, &next)) {
704 __kmp_dflt_blocktime = num;
705 __kmp_blocktime_units =
'u';
706 }
else if (__kmp_match_str(
"infinite", buf, &next) ||
707 __kmp_match_str(
"infinity", buf, &next)) {
709 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
710 __kmp_blocktime_units =
'm';
711 multiplier = ms_mult;
713 KMP_WARNING(StgInvalidValue, name, value);
715 __kmp_dflt_blocktime = ms_mult * num;
716 __kmp_blocktime_units =
'm';
717 multiplier = ms_mult;
720 if (num < 0 && __kmp_dflt_blocktime < 0) {
721 __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
722 __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidValue, name, value),
725 KMP_INFORM(Using_int_Value, name, __kmp_dflt_blocktime / multiplier);
726 __kmp_env_blocktime = FALSE;
727 }
else if (num > 0 && __kmp_dflt_blocktime < 0) {
728 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
729 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeValue, name, value), __kmp_msg_null);
730 KMP_INFORM(MaxValueUsing, name, __kmp_dflt_blocktime / multiplier);
731 __kmp_env_blocktime = TRUE;
733 if (__kmp_dflt_blocktime < KMP_MIN_BLOCKTIME) {
734 __kmp_dflt_blocktime = KMP_MIN_BLOCKTIME;
735 __kmp_msg(kmp_ms_warning, KMP_MSG(SmallValue, name, value),
737 KMP_INFORM(MinValueUsing, name, __kmp_dflt_blocktime / multiplier);
738 }
else if (__kmp_dflt_blocktime > KMP_MAX_BLOCKTIME) {
739 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
740 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeValue, name, value),
742 KMP_INFORM(MaxValueUsing, name, __kmp_dflt_blocktime / multiplier);
744 __kmp_env_blocktime = TRUE;
749 __kmp_monitor_wakeups =
750 KMP_WAKEUPS_FROM_BLOCKTIME(__kmp_dflt_blocktime, __kmp_monitor_wakeups);
752 KMP_INTERVALS_FROM_BLOCKTIME(__kmp_dflt_blocktime, __kmp_monitor_wakeups);
754 K_DIAG(1, (
"__kmp_env_blocktime == %d\n", __kmp_env_blocktime));
755 if (__kmp_env_blocktime) {
756 K_DIAG(1, (
"__kmp_dflt_blocktime == %d\n", __kmp_dflt_blocktime));
760static void __kmp_stg_print_blocktime(kmp_str_buf_t *buffer,
char const *name,
762 int num = __kmp_dflt_blocktime;
763 if (__kmp_blocktime_units ==
'm') {
766 if (__kmp_env_format) {
767 KMP_STR_BUF_PRINT_NAME_EX(name);
769 __kmp_str_buf_print(buffer,
" %s=", name);
771 __kmp_str_buf_print(buffer,
"%d", num);
772 __kmp_str_buf_print(buffer,
"%cs\n", __kmp_blocktime_units);
778static void __kmp_stg_parse_duplicate_lib_ok(
char const *name,
779 char const *value,
void *data) {
782 __kmp_stg_parse_bool(name, value, &__kmp_duplicate_library_ok);
785static void __kmp_stg_print_duplicate_lib_ok(kmp_str_buf_t *buffer,
786 char const *name,
void *data) {
787 __kmp_stg_print_bool(buffer, name, __kmp_duplicate_library_ok);
793#if KMP_ARCH_X86 || KMP_ARCH_X86_64
795static void __kmp_stg_parse_inherit_fp_control(
char const *name,
796 char const *value,
void *data) {
797 __kmp_stg_parse_bool(name, value, &__kmp_inherit_fp_control);
800static void __kmp_stg_print_inherit_fp_control(kmp_str_buf_t *buffer,
801 char const *name,
void *data) {
803 __kmp_stg_print_bool(buffer, name, __kmp_inherit_fp_control);
810static char const *blocktime_str = NULL;
811static char const *use_yield_str = NULL;
816static void __kmp_stg_parse_wait_policy(
char const *name,
char const *value,
819 kmp_stg_wp_data_t *wait = (kmp_stg_wp_data_t *)data;
822 rc = __kmp_stg_check_rivals(name, value, wait->rivals);
828 if (__kmp_str_match(
"ACTIVE", 1, value)) {
829 __kmp_library = library_turnaround;
830 if (blocktime_str == NULL) {
832 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
834 if (use_yield_str == NULL) {
838 }
else if (__kmp_str_match(
"PASSIVE", 1, value)) {
839 __kmp_library = library_throughput;
840 __kmp_wpolicy_passive =
true;
841 if (blocktime_str == NULL) {
843 __kmp_dflt_blocktime = 0;
846 KMP_WARNING(StgInvalidValue, name, value);
849 if (__kmp_str_match(
"serial", 1, value)) {
850 __kmp_library = library_serial;
851 }
else if (__kmp_str_match(
"throughput", 2, value)) {
852 __kmp_library = library_throughput;
853 if (blocktime_str == NULL) {
855 __kmp_dflt_blocktime = 0;
857 }
else if (__kmp_str_match(
"turnaround", 2, value)) {
858 __kmp_library = library_turnaround;
859 }
else if (__kmp_str_match(
"dedicated", 1, value)) {
860 __kmp_library = library_turnaround;
861 }
else if (__kmp_str_match(
"multiuser", 1, value)) {
862 __kmp_library = library_throughput;
863 if (blocktime_str == NULL) {
865 __kmp_dflt_blocktime = 0;
868 KMP_WARNING(StgInvalidValue, name, value);
873static void __kmp_stg_print_wait_policy(kmp_str_buf_t *buffer,
char const *name,
876 kmp_stg_wp_data_t *wait = (kmp_stg_wp_data_t *)data;
877 char const *value = NULL;
880 switch (__kmp_library) {
881 case library_turnaround: {
884 case library_throughput: {
888 case library_serial: {
893 switch (__kmp_library) {
894 case library_serial: {
897 case library_turnaround: {
898 value =
"turnaround";
900 case library_throughput: {
901 value =
"throughput";
909 __kmp_stg_print_str(buffer, name, value);
918static void __kmp_stg_parse_monitor_stacksize(
char const *name,
919 char const *value,
void *data) {
920 __kmp_stg_parse_size(name, value, __kmp_sys_min_stksize, KMP_MAX_STKSIZE,
921 NULL, &__kmp_monitor_stksize, 1);
924static void __kmp_stg_print_monitor_stacksize(kmp_str_buf_t *buffer,
925 char const *name,
void *data) {
926 if (__kmp_env_format) {
927 if (__kmp_monitor_stksize > 0)
928 KMP_STR_BUF_PRINT_NAME_EX(name);
930 KMP_STR_BUF_PRINT_NAME;
932 __kmp_str_buf_print(buffer,
" %s", name);
934 if (__kmp_monitor_stksize > 0) {
935 __kmp_str_buf_print_size(buffer, __kmp_monitor_stksize);
937 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
939 if (__kmp_env_format && __kmp_monitor_stksize) {
940 __kmp_str_buf_print(buffer,
"'\n");
948static void __kmp_stg_parse_settings(
char const *name,
char const *value,
950 __kmp_stg_parse_bool(name, value, &__kmp_settings);
953static void __kmp_stg_print_settings(kmp_str_buf_t *buffer,
char const *name,
955 __kmp_stg_print_bool(buffer, name, __kmp_settings);
961static void __kmp_stg_parse_stackpad(
char const *name,
char const *value,
963 __kmp_stg_parse_int(name,
971static void __kmp_stg_print_stackpad(kmp_str_buf_t *buffer,
char const *name,
973 __kmp_stg_print_int(buffer, name, __kmp_stkpadding);
979static void __kmp_stg_parse_stackoffset(
char const *name,
char const *value,
981 __kmp_stg_parse_size(name,
990static void __kmp_stg_print_stackoffset(kmp_str_buf_t *buffer,
char const *name,
992 __kmp_stg_print_size(buffer, name, __kmp_stkoffset);
998static void __kmp_stg_parse_stacksize(
char const *name,
char const *value,
1001 kmp_stg_ss_data_t *stacksize = (kmp_stg_ss_data_t *)data;
1004 rc = __kmp_stg_check_rivals(name, value, stacksize->rivals);
1008 __kmp_stg_parse_size(name,
1010 __kmp_sys_min_stksize,
1022static void __kmp_stg_print_stacksize(kmp_str_buf_t *buffer,
char const *name,
1024 kmp_stg_ss_data_t *stacksize = (kmp_stg_ss_data_t *)data;
1025 if (__kmp_env_format) {
1026 KMP_STR_BUF_PRINT_NAME_EX(name);
1027 __kmp_str_buf_print_size(buffer, (__kmp_stksize % 1024)
1028 ? __kmp_stksize / stacksize->factor
1030 __kmp_str_buf_print(buffer,
"'\n");
1032 __kmp_str_buf_print(buffer,
" %s=", name);
1033 __kmp_str_buf_print_size(buffer, (__kmp_stksize % 1024)
1034 ? __kmp_stksize / stacksize->factor
1036 __kmp_str_buf_print(buffer,
"\n");
1043static void __kmp_stg_parse_version(
char const *name,
char const *value,
1045 __kmp_stg_parse_bool(name, value, &__kmp_version);
1048static void __kmp_stg_print_version(kmp_str_buf_t *buffer,
char const *name,
1050 __kmp_stg_print_bool(buffer, name, __kmp_version);
1056static void __kmp_stg_parse_warnings(
char const *name,
char const *value,
1058 __kmp_stg_parse_bool(name, value, &__kmp_generate_warnings);
1059 if (__kmp_generate_warnings != kmp_warnings_off) {
1062 __kmp_generate_warnings = kmp_warnings_explicit;
1066static void __kmp_stg_print_warnings(kmp_str_buf_t *buffer,
char const *name,
1069 __kmp_stg_print_bool(buffer, name, __kmp_generate_warnings);
1075static void __kmp_stg_parse_nesting_mode(
char const *name,
char const *value,
1077 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_nesting_mode);
1078#if KMP_HWLOC_ENABLED
1079 if (__kmp_nesting_mode > 0)
1080 __kmp_affinity_top_method = affinity_top_method_hwloc;
1084static void __kmp_stg_print_nesting_mode(kmp_str_buf_t *buffer,
1085 char const *name,
void *data) {
1086 if (__kmp_env_format) {
1087 KMP_STR_BUF_PRINT_NAME;
1089 __kmp_str_buf_print(buffer,
" %s", name);
1091 __kmp_str_buf_print(buffer,
"=%d\n", __kmp_nesting_mode);
1097static void __kmp_stg_parse_nested(
char const *name,
char const *value,
1100 KMP_INFORM(EnvVarDeprecated, name,
"OMP_MAX_ACTIVE_LEVELS");
1101 __kmp_stg_parse_bool(name, value, &nested);
1103 if (!__kmp_dflt_max_active_levels_set)
1104 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
1106 __kmp_dflt_max_active_levels = 1;
1107 __kmp_dflt_max_active_levels_set =
true;
1111static void __kmp_stg_print_nested(kmp_str_buf_t *buffer,
char const *name,
1113 if (__kmp_env_format) {
1114 KMP_STR_BUF_PRINT_NAME;
1116 __kmp_str_buf_print(buffer,
" %s", name);
1118 __kmp_str_buf_print(buffer,
": deprecated; max-active-levels-var=%d\n",
1119 __kmp_dflt_max_active_levels);
1122static void __kmp_parse_nested_num_threads(
const char *var,
const char *env,
1123 kmp_nested_nthreads_t *nth_array) {
1124 const char *next = env;
1125 const char *scan = next;
1128 int prev_comma = FALSE;
1134 if (*next ==
'\0') {
1138 if (((*next <
'0') || (*next >
'9')) && (*next !=
',')) {
1139 KMP_WARNING(NthSyntaxError, var, env);
1145 if (total == 0 || prev_comma) {
1153 if (*next >=
'0' && *next <=
'9') {
1157 const char *tmp = next;
1159 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
1160 KMP_WARNING(NthSpacesNotAllowed, var, env);
1165 if (!__kmp_dflt_max_active_levels_set && total > 1)
1166 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
1168 KMP_WARNING(NthSyntaxError, var, env);
1173 if (!nth_array->nth) {
1175 nth_array->nth = (
int *)KMP_INTERNAL_MALLOC(
sizeof(
int) * total * 2);
1176 if (nth_array->nth == NULL) {
1177 KMP_FATAL(MemoryAllocFailed);
1179 nth_array->size = total * 2;
1181 if (nth_array->size < total) {
1184 nth_array->size *= 2;
1185 }
while (nth_array->size < total);
1187 nth_array->nth = (
int *)KMP_INTERNAL_REALLOC(
1188 nth_array->nth,
sizeof(
int) * nth_array->size);
1189 if (nth_array->nth == NULL) {
1190 KMP_FATAL(MemoryAllocFailed);
1194 nth_array->used = total;
1202 if (*scan ==
'\0') {
1212 nth_array->nth[i++] = 0;
1214 }
else if (prev_comma) {
1216 nth_array->nth[i] = nth_array->nth[i - 1];
1225 if (*scan >=
'0' && *scan <=
'9') {
1227 const char *buf = scan;
1228 char const *msg = NULL;
1233 num = __kmp_str_to_int(buf, *scan);
1234 if (num < KMP_MIN_NTH) {
1235 msg = KMP_I18N_STR(ValueTooSmall);
1237 }
else if (num > __kmp_sys_max_nth) {
1238 msg = KMP_I18N_STR(ValueTooLarge);
1239 num = __kmp_sys_max_nth;
1243 KMP_WARNING(ParseSizeIntWarn, var, env, msg);
1244 KMP_INFORM(Using_int_Value, var, num);
1246 nth_array->nth[i++] = num;
1251static void __kmp_stg_parse_num_threads(
char const *name,
char const *value,
1254 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
1256 if (!__kmp_nested_nth.nth) {
1257 __kmp_nested_nth.nth = (
int *)KMP_INTERNAL_MALLOC(
sizeof(
int));
1258 __kmp_nested_nth.size = 1;
1260 __kmp_nested_nth.used = 1;
1261 __kmp_nested_nth.nth[0] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub =
1264 __kmp_parse_nested_num_threads(name, value, &__kmp_nested_nth);
1265 if (__kmp_nested_nth.nth) {
1266 __kmp_dflt_team_nth = __kmp_nested_nth.nth[0];
1267 if (__kmp_dflt_team_nth_ub < __kmp_dflt_team_nth) {
1268 __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth;
1272 K_DIAG(1, (
"__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth));
1275#if OMP_TASKGRAPH_EXPERIMENTAL
1276static void __kmp_stg_parse_max_tdgs(
char const *name,
char const *value,
1278 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_max_tdgs);
1281static void __kmp_std_print_max_tdgs(kmp_str_buf_t *buffer,
char const *name,
1283 __kmp_stg_print_int(buffer, name, __kmp_max_tdgs);
1286static void __kmp_stg_parse_tdg_dot(
char const *name,
char const *value,
1288 __kmp_stg_parse_bool(name, value, &__kmp_tdg_dot);
1291static void __kmp_stg_print_tdg_dot(kmp_str_buf_t *buffer,
char const *name,
1293 __kmp_stg_print_bool(buffer, name, __kmp_tdg_dot);
1297static void __kmp_stg_parse_num_hidden_helper_threads(
char const *name,
1300 __kmp_stg_parse_int(name, value, 0, 16, &__kmp_hidden_helper_threads_num);
1303 if (__kmp_hidden_helper_threads_num == 0) {
1304 __kmp_enable_hidden_helper = FALSE;
1309 __kmp_hidden_helper_threads_num++;
1313static void __kmp_stg_print_num_hidden_helper_threads(kmp_str_buf_t *buffer,
1316 if (__kmp_hidden_helper_threads_num == 0) {
1317 __kmp_stg_print_int(buffer, name, __kmp_hidden_helper_threads_num);
1319 KMP_DEBUG_ASSERT(__kmp_hidden_helper_threads_num > 1);
1322 __kmp_stg_print_int(buffer, name, __kmp_hidden_helper_threads_num - 1);
1326static void __kmp_stg_parse_use_hidden_helper(
char const *name,
1327 char const *value,
void *data) {
1328 __kmp_stg_parse_bool(name, value, &__kmp_enable_hidden_helper);
1330 __kmp_enable_hidden_helper = FALSE;
1332 (
"__kmp_stg_parse_use_hidden_helper: Disable hidden helper task on "
1333 "non-Linux platform although it is enabled by user explicitly.\n"));
1337static void __kmp_stg_print_use_hidden_helper(kmp_str_buf_t *buffer,
1338 char const *name,
void *data) {
1339 __kmp_stg_print_bool(buffer, name, __kmp_enable_hidden_helper);
1342static void __kmp_stg_print_num_threads(kmp_str_buf_t *buffer,
char const *name,
1344 if (__kmp_env_format) {
1345 KMP_STR_BUF_PRINT_NAME;
1347 __kmp_str_buf_print(buffer,
" %s", name);
1349 if (__kmp_nested_nth.used) {
1351 __kmp_str_buf_init(&buf);
1352 for (
int i = 0; i < __kmp_nested_nth.used; i++) {
1353 __kmp_str_buf_print(&buf,
"%d", __kmp_nested_nth.nth[i]);
1354 if (i < __kmp_nested_nth.used - 1) {
1355 __kmp_str_buf_print(&buf,
",");
1358 __kmp_str_buf_print(buffer,
"='%s'\n", buf.str);
1359 __kmp_str_buf_free(&buf);
1361 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1368static void __kmp_stg_parse_tasking(
char const *name,
char const *value,
1370 __kmp_stg_parse_int(name, value, 0, (
int)tskm_max,
1371 (
int *)&__kmp_tasking_mode);
1373 if (__kmp_tasking_mode == tskm_extra_barrier) {
1374 KMP_WARNING(StgInvalidValue, name, value);
1375 __kmp_tasking_mode = tskm_task_teams;
1379static void __kmp_stg_print_tasking(kmp_str_buf_t *buffer,
char const *name,
1381 __kmp_stg_print_int(buffer, name, __kmp_tasking_mode);
1384static void __kmp_stg_parse_task_stealing(
char const *name,
char const *value,
1386 __kmp_stg_parse_int(name, value, 0, 1,
1387 (
int *)&__kmp_task_stealing_constraint);
1390static void __kmp_stg_print_task_stealing(kmp_str_buf_t *buffer,
1391 char const *name,
void *data) {
1392 __kmp_stg_print_int(buffer, name, __kmp_task_stealing_constraint);
1395static void __kmp_stg_parse_max_active_levels(
char const *name,
1396 char const *value,
void *data) {
1397 kmp_uint64 tmp_dflt = 0;
1398 char const *msg = NULL;
1399 if (!__kmp_dflt_max_active_levels_set) {
1401 __kmp_str_to_uint(value, &tmp_dflt, &msg);
1403 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
1404 }
else if (tmp_dflt > KMP_MAX_ACTIVE_LEVELS_LIMIT) {
1406 msg = KMP_I18N_STR(ValueTooLarge);
1407 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
1409 __kmp_type_convert(tmp_dflt, &(__kmp_dflt_max_active_levels));
1410 __kmp_dflt_max_active_levels_set =
true;
1415static void __kmp_stg_print_max_active_levels(kmp_str_buf_t *buffer,
1416 char const *name,
void *data) {
1417 __kmp_stg_print_int(buffer, name, __kmp_dflt_max_active_levels);
1422static void __kmp_stg_parse_default_device(
char const *name,
char const *value,
1424 __kmp_default_device = kmp_trait_context::parse_single_device(
1425 value, 0, KMP_MAX_DEFAULT_DEVICE_LIMIT, name);
1428static void __kmp_stg_print_default_device(kmp_str_buf_t *buffer,
1429 char const *name,
void *data) {
1430 __kmp_stg_print_int(buffer, name, __kmp_default_device);
1435static void __kmp_stg_parse_target_offload(
char const *name,
char const *value,
1437 kmp_trimmed_str_t value_str(value);
1438 const char *scan = value_str.get();
1439 __kmp_target_offload = tgt_default;
1444 if (!__kmp_strcasecmp_with_sentinel(
"mandatory", scan, 0)) {
1445 __kmp_target_offload = tgt_mandatory;
1446 }
else if (!__kmp_strcasecmp_with_sentinel(
"disabled", scan, 0)) {
1447 __kmp_target_offload = tgt_disabled;
1448 }
else if (!__kmp_strcasecmp_with_sentinel(
"default", scan, 0)) {
1449 __kmp_target_offload = tgt_default;
1451 KMP_WARNING(SyntaxErrorUsing, name,
"DEFAULT");
1455static void __kmp_stg_print_target_offload(kmp_str_buf_t *buffer,
1456 char const *name,
void *data) {
1457 const char *value = NULL;
1458 if (__kmp_target_offload == tgt_default)
1460 else if (__kmp_target_offload == tgt_mandatory)
1461 value =
"MANDATORY";
1462 else if (__kmp_target_offload == tgt_disabled)
1464 KMP_DEBUG_ASSERT(value);
1465 if (__kmp_env_format) {
1466 KMP_STR_BUF_PRINT_NAME;
1468 __kmp_str_buf_print(buffer,
" %s", name);
1470 __kmp_str_buf_print(buffer,
"=%s\n", value);
1475static void __kmp_stg_parse_max_task_priority(
char const *name,
1476 char const *value,
void *data) {
1477 __kmp_stg_parse_int(name, value, 0, KMP_MAX_TASK_PRIORITY_LIMIT,
1478 &__kmp_max_task_priority);
1481static void __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer,
1482 char const *name,
void *data) {
1483 __kmp_stg_print_int(buffer, name, __kmp_max_task_priority);
1488static void __kmp_stg_parse_taskloop_min_tasks(
char const *name,
1489 char const *value,
void *data) {
1491 __kmp_stg_parse_int(name, value, 0, INT_MAX, &tmp);
1492 __kmp_taskloop_min_tasks = tmp;
1495static void __kmp_stg_print_taskloop_min_tasks(kmp_str_buf_t *buffer,
1496 char const *name,
void *data) {
1497 __kmp_stg_print_uint64(buffer, name, __kmp_taskloop_min_tasks);
1502static void __kmp_stg_parse_disp_buffers(
char const *name,
char const *value,
1504 if (TCR_4(__kmp_init_serial)) {
1505 KMP_WARNING(EnvSerialWarn, name);
1508 __kmp_stg_parse_int(name, value, KMP_MIN_DISP_NUM_BUFF, KMP_MAX_DISP_NUM_BUFF,
1509 &__kmp_dispatch_num_buffers);
1512static void __kmp_stg_print_disp_buffers(kmp_str_buf_t *buffer,
1513 char const *name,
void *data) {
1514 __kmp_stg_print_int(buffer, name, __kmp_dispatch_num_buffers);
1520static void __kmp_stg_parse_hot_teams_level(
char const *name,
char const *value,
1522 if (TCR_4(__kmp_init_parallel)) {
1523 KMP_WARNING(EnvParallelWarn, name);
1526 __kmp_stg_parse_int(name, value, 0, 1024, &__kmp_hot_teams_max_level);
1530static void __kmp_stg_print_hot_teams_level(kmp_str_buf_t *buffer,
1531 char const *name,
void *data) {
1532 __kmp_stg_print_int(buffer, name, __kmp_hot_teams_max_level);
1535static void __kmp_stg_parse_hot_teams_mode(
char const *name,
char const *value,
1537 if (TCR_4(__kmp_init_parallel)) {
1538 KMP_WARNING(EnvParallelWarn, name);
1541 __kmp_stg_parse_int(name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT,
1542 &__kmp_hot_teams_mode);
1545static void __kmp_stg_print_hot_teams_mode(kmp_str_buf_t *buffer,
1546 char const *name,
void *data) {
1547 __kmp_stg_print_int(buffer, name, __kmp_hot_teams_mode);
1553#if KMP_HANDLE_SIGNALS
1555static void __kmp_stg_parse_handle_signals(
char const *name,
char const *value,
1557 __kmp_stg_parse_bool(name, value, &__kmp_handle_signals);
1560static void __kmp_stg_print_handle_signals(kmp_str_buf_t *buffer,
1561 char const *name,
void *data) {
1562 __kmp_stg_print_bool(buffer, name, __kmp_handle_signals);
1572#define KMP_STG_X_DEBUG(x) \
1573 static void __kmp_stg_parse_##x##_debug(char const *name, char const *value, \
1575 __kmp_stg_parse_int(name, value, 0, INT_MAX, &kmp_##x##_debug); \
1577 static void __kmp_stg_print_##x##_debug(kmp_str_buf_t *buffer, \
1578 char const *name, void *data) { \
1579 __kmp_stg_print_int(buffer, name, kmp_##x##_debug); \
1589#undef KMP_STG_X_DEBUG
1591static void __kmp_stg_parse_debug(
char const *name,
char const *value,
1594 __kmp_stg_parse_int(name, value, 0, INT_MAX, &debug);
1595 if (kmp_a_debug < debug) {
1596 kmp_a_debug = debug;
1598 if (kmp_b_debug < debug) {
1599 kmp_b_debug = debug;
1601 if (kmp_c_debug < debug) {
1602 kmp_c_debug = debug;
1604 if (kmp_d_debug < debug) {
1605 kmp_d_debug = debug;
1607 if (kmp_e_debug < debug) {
1608 kmp_e_debug = debug;
1610 if (kmp_f_debug < debug) {
1611 kmp_f_debug = debug;
1615static void __kmp_stg_parse_debug_buf(
char const *name,
char const *value,
1617 __kmp_stg_parse_bool(name, value, &__kmp_debug_buf);
1621 if (__kmp_debug_buf) {
1623 int elements = __kmp_debug_buf_lines * __kmp_debug_buf_chars;
1626 __kmp_debug_buffer = (
char *)__kmp_page_allocate(elements *
sizeof(
char));
1627 for (i = 0; i < elements; i += __kmp_debug_buf_chars)
1628 __kmp_debug_buffer[i] =
'\0';
1630 __kmp_debug_count = 0;
1632 K_DIAG(1, (
"__kmp_debug_buf = %d\n", __kmp_debug_buf));
1635static void __kmp_stg_print_debug_buf(kmp_str_buf_t *buffer,
char const *name,
1637 __kmp_stg_print_bool(buffer, name, __kmp_debug_buf);
1640static void __kmp_stg_parse_debug_buf_atomic(
char const *name,
1641 char const *value,
void *data) {
1642 __kmp_stg_parse_bool(name, value, &__kmp_debug_buf_atomic);
1645static void __kmp_stg_print_debug_buf_atomic(kmp_str_buf_t *buffer,
1646 char const *name,
void *data) {
1647 __kmp_stg_print_bool(buffer, name, __kmp_debug_buf_atomic);
1650static void __kmp_stg_parse_debug_buf_chars(
char const *name,
char const *value,
1652 __kmp_stg_parse_int(name, value, KMP_DEBUG_BUF_CHARS_MIN, INT_MAX,
1653 &__kmp_debug_buf_chars);
1656static void __kmp_stg_print_debug_buf_chars(kmp_str_buf_t *buffer,
1657 char const *name,
void *data) {
1658 __kmp_stg_print_int(buffer, name, __kmp_debug_buf_chars);
1661static void __kmp_stg_parse_debug_buf_lines(
char const *name,
char const *value,
1663 __kmp_stg_parse_int(name, value, KMP_DEBUG_BUF_LINES_MIN, INT_MAX,
1664 &__kmp_debug_buf_lines);
1667static void __kmp_stg_print_debug_buf_lines(kmp_str_buf_t *buffer,
1668 char const *name,
void *data) {
1669 __kmp_stg_print_int(buffer, name, __kmp_debug_buf_lines);
1672static void __kmp_stg_parse_diag(
char const *name,
char const *value,
1674 __kmp_stg_parse_int(name, value, 0, INT_MAX, &kmp_diag);
1677static void __kmp_stg_print_diag(kmp_str_buf_t *buffer,
char const *name,
1679 __kmp_stg_print_int(buffer, name, kmp_diag);
1687static void __kmp_stg_parse_align_alloc(
char const *name,
char const *value,
1689 __kmp_stg_parse_size(name, value, CACHE_LINE, INT_MAX, NULL,
1690 &__kmp_align_alloc, 1);
1692 if (__kmp_align_alloc == 0 || ((__kmp_align_alloc - 1) & __kmp_align_alloc)) {
1693 KMP_WARNING(StgInvalidValue, name, value);
1694 __kmp_align_alloc = CACHE_LINE;
1698static void __kmp_stg_print_align_alloc(kmp_str_buf_t *buffer,
char const *name,
1700 __kmp_stg_print_size(buffer, name, __kmp_align_alloc);
1709static void __kmp_stg_parse_barrier_branch_bit(
char const *name,
1710 char const *value,
void *data) {
1714 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1715 var = __kmp_barrier_branch_bit_env_name[i];
1716 if ((strcmp(var, name) == 0) && (value != 0)) {
1719 comma = CCAST(
char *, strchr(value,
','));
1720 __kmp_barrier_gather_branch_bits[i] =
1721 (kmp_uint32)__kmp_str_to_int(value,
',');
1723 if (comma == NULL) {
1724 __kmp_barrier_release_branch_bits[i] = __kmp_barrier_release_bb_dflt;
1726 __kmp_barrier_release_branch_bits[i] =
1727 (kmp_uint32)__kmp_str_to_int(comma + 1, 0);
1728 if (__kmp_barrier_release_branch_bits[i] == 0 ||
1729 __kmp_barrier_release_branch_bits[i] > KMP_MAX_BRANCH_BITS) {
1730 __kmp_msg(kmp_ms_warning,
1731 KMP_MSG(BarrReleaseValueInvalid, name, comma + 1),
1733 __kmp_barrier_release_branch_bits[i] = __kmp_barrier_release_bb_dflt;
1736 if (__kmp_barrier_gather_branch_bits[i] == 0 ||
1737 __kmp_barrier_gather_branch_bits[i] > KMP_MAX_BRANCH_BITS) {
1738 KMP_WARNING(BarrGatherValueInvalid, name, value);
1739 KMP_INFORM(Using_uint_Value, name, __kmp_barrier_gather_bb_dflt);
1740 __kmp_barrier_gather_branch_bits[i] = __kmp_barrier_gather_bb_dflt;
1743 K_DIAG(1, (
"%s == %d,%d\n", __kmp_barrier_branch_bit_env_name[i],
1744 __kmp_barrier_gather_branch_bits[i],
1745 __kmp_barrier_release_branch_bits[i]))
1749static void __kmp_stg_print_barrier_branch_bit(kmp_str_buf_t *buffer,
1750 char const *name,
void *data) {
1752 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1753 var = __kmp_barrier_branch_bit_env_name[i];
1754 if (strcmp(var, name) == 0) {
1755 if (__kmp_env_format) {
1756 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_branch_bit_env_name[i]);
1758 __kmp_str_buf_print(buffer,
" %s='",
1759 __kmp_barrier_branch_bit_env_name[i]);
1761 __kmp_str_buf_print(buffer,
"%d,%d'\n",
1762 __kmp_barrier_gather_branch_bits[i],
1763 __kmp_barrier_release_branch_bits[i]);
1775static void __kmp_stg_parse_barrier_pattern(
char const *name,
char const *value,
1780 static int dist_req = 0, non_dist_req = 0;
1781 static bool warn = 1;
1782 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1783 var = __kmp_barrier_pattern_env_name[i];
1785 if ((strcmp(var, name) == 0) && (value != 0)) {
1787 char *comma = CCAST(
char *, strchr(value,
','));
1790 for (j = bp_linear_bar; j < bp_last_bar; j++) {
1791 if (__kmp_match_with_sentinel(__kmp_barrier_pattern_name[j], value, 1,
1793 if (j == bp_dist_bar) {
1798 __kmp_barrier_gather_pattern[i] = (kmp_bar_pat_e)j;
1802 if (j == bp_last_bar) {
1803 KMP_WARNING(BarrGatherValueInvalid, name, value);
1804 KMP_INFORM(Using_str_Value, name,
1805 __kmp_barrier_pattern_name[bp_linear_bar]);
1809 if (comma != NULL) {
1810 for (j = bp_linear_bar; j < bp_last_bar; j++) {
1811 if (__kmp_str_match(__kmp_barrier_pattern_name[j], 1, comma + 1)) {
1812 if (j == bp_dist_bar) {
1817 __kmp_barrier_release_pattern[i] = (kmp_bar_pat_e)j;
1821 if (j == bp_last_bar) {
1822 __kmp_msg(kmp_ms_warning,
1823 KMP_MSG(BarrReleaseValueInvalid, name, comma + 1),
1825 KMP_INFORM(Using_str_Value, name,
1826 __kmp_barrier_pattern_name[bp_linear_bar]);
1831 if (dist_req != 0) {
1833 if ((non_dist_req != 0) && warn) {
1834 KMP_INFORM(BarrierPatternOverride, name,
1835 __kmp_barrier_pattern_name[bp_dist_bar]);
1838 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1839 if (__kmp_barrier_release_pattern[i] != bp_dist_bar)
1840 __kmp_barrier_release_pattern[i] = bp_dist_bar;
1841 if (__kmp_barrier_gather_pattern[i] != bp_dist_bar)
1842 __kmp_barrier_gather_pattern[i] = bp_dist_bar;
1847static void __kmp_stg_print_barrier_pattern(kmp_str_buf_t *buffer,
1848 char const *name,
void *data) {
1850 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1851 var = __kmp_barrier_pattern_env_name[i];
1852 if (strcmp(var, name) == 0) {
1853 int j = __kmp_barrier_gather_pattern[i];
1854 int k = __kmp_barrier_release_pattern[i];
1855 if (__kmp_env_format) {
1856 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_pattern_env_name[i]);
1858 __kmp_str_buf_print(buffer,
" %s='",
1859 __kmp_barrier_pattern_env_name[i]);
1861 KMP_DEBUG_ASSERT(j < bp_last_bar && k < bp_last_bar);
1862 __kmp_str_buf_print(buffer,
"%s,%s'\n", __kmp_barrier_pattern_name[j],
1863 __kmp_barrier_pattern_name[k]);
1871static void __kmp_stg_parse_abort_delay(
char const *name,
char const *value,
1875 int delay = __kmp_abort_delay / 1000;
1876 __kmp_stg_parse_int(name, value, 0, INT_MAX / 1000, &delay);
1877 __kmp_abort_delay = delay * 1000;
1880static void __kmp_stg_print_abort_delay(kmp_str_buf_t *buffer,
char const *name,
1882 __kmp_stg_print_int(buffer, name, __kmp_abort_delay);
1888static void __kmp_stg_parse_cpuinfo_file(
char const *name,
char const *value,
1890#if KMP_AFFINITY_SUPPORTED
1891 __kmp_stg_parse_str(name, value, &__kmp_cpuinfo_file);
1892 K_DIAG(1, (
"__kmp_cpuinfo_file == %s\n", __kmp_cpuinfo_file));
1896static void __kmp_stg_print_cpuinfo_file(kmp_str_buf_t *buffer,
1897 char const *name,
void *data) {
1898#if KMP_AFFINITY_SUPPORTED
1899 if (__kmp_env_format) {
1900 KMP_STR_BUF_PRINT_NAME;
1902 __kmp_str_buf_print(buffer,
" %s", name);
1904 if (__kmp_cpuinfo_file) {
1905 __kmp_str_buf_print(buffer,
"='%s'\n", __kmp_cpuinfo_file);
1907 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1915static void __kmp_stg_parse_force_reduction(
char const *name,
char const *value,
1917 kmp_stg_fr_data_t *reduction = (kmp_stg_fr_data_t *)data;
1920 rc = __kmp_stg_check_rivals(name, value, reduction->rivals);
1924 if (reduction->force) {
1926 if (__kmp_str_match(
"critical", 0, value))
1927 __kmp_force_reduction_method = critical_reduce_block;
1928 else if (__kmp_str_match(
"atomic", 0, value))
1929 __kmp_force_reduction_method = atomic_reduce_block;
1930 else if (__kmp_str_match(
"tree", 0, value))
1931 __kmp_force_reduction_method = tree_reduce_block;
1933 KMP_FATAL(UnknownForceReduction, name, value);
1937 __kmp_stg_parse_bool(name, value, &__kmp_determ_red);
1938 if (__kmp_determ_red) {
1939 __kmp_force_reduction_method = tree_reduce_block;
1941 __kmp_force_reduction_method = reduction_method_not_defined;
1944 K_DIAG(1, (
"__kmp_force_reduction_method == %d\n",
1945 __kmp_force_reduction_method));
1948static void __kmp_stg_print_force_reduction(kmp_str_buf_t *buffer,
1949 char const *name,
void *data) {
1951 kmp_stg_fr_data_t *reduction = (kmp_stg_fr_data_t *)data;
1952 if (reduction->force) {
1953 if (__kmp_force_reduction_method == critical_reduce_block) {
1954 __kmp_stg_print_str(buffer, name,
"critical");
1955 }
else if (__kmp_force_reduction_method == atomic_reduce_block) {
1956 __kmp_stg_print_str(buffer, name,
"atomic");
1957 }
else if (__kmp_force_reduction_method == tree_reduce_block) {
1958 __kmp_stg_print_str(buffer, name,
"tree");
1960 if (__kmp_env_format) {
1961 KMP_STR_BUF_PRINT_NAME;
1963 __kmp_str_buf_print(buffer,
" %s", name);
1965 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1968 __kmp_stg_print_bool(buffer, name, __kmp_determ_red);
1976static void __kmp_stg_parse_storage_map(
char const *name,
char const *value,
1978 if (__kmp_str_match(
"verbose", 1, value)) {
1979 __kmp_storage_map = TRUE;
1980 __kmp_storage_map_verbose = TRUE;
1981 __kmp_storage_map_verbose_specified = TRUE;
1984 __kmp_storage_map_verbose = FALSE;
1985 __kmp_stg_parse_bool(name, value, &__kmp_storage_map);
1989static void __kmp_stg_print_storage_map(kmp_str_buf_t *buffer,
char const *name,
1991 if (__kmp_storage_map_verbose || __kmp_storage_map_verbose_specified) {
1992 __kmp_stg_print_str(buffer, name,
"verbose");
1994 __kmp_stg_print_bool(buffer, name, __kmp_storage_map);
2001static void __kmp_stg_parse_all_threadprivate(
char const *name,
2002 char const *value,
void *data) {
2003 __kmp_stg_parse_int(name, value,
2004 __kmp_allThreadsSpecified ? __kmp_max_nth : 1,
2005 __kmp_max_nth, &__kmp_tp_capacity);
2008static void __kmp_stg_print_all_threadprivate(kmp_str_buf_t *buffer,
2009 char const *name,
void *data) {
2010 __kmp_stg_print_int(buffer, name, __kmp_tp_capacity);
2016static void __kmp_stg_parse_foreign_threads_threadprivate(
char const *name,
2019 __kmp_stg_parse_bool(name, value, &__kmp_foreign_tp);
2022static void __kmp_stg_print_foreign_threads_threadprivate(kmp_str_buf_t *buffer,
2025 __kmp_stg_print_bool(buffer, name, __kmp_foreign_tp);
2031static inline const char *
2032__kmp_hw_get_core_type_keyword(kmp_hw_core_type_t type) {
2034 case KMP_HW_CORE_TYPE_UNKNOWN:
2035 case KMP_HW_MAX_NUM_CORE_TYPES:
2037#if KMP_ARCH_X86 || KMP_ARCH_X86_64
2038 case KMP_HW_CORE_TYPE_ATOM:
2039 return "intel_atom";
2040 case KMP_HW_CORE_TYPE_CORE:
2041 return "intel_core";
2044 KMP_ASSERT2(
false,
"Unhandled kmp_hw_core_type_t enumeration");
2045 KMP_BUILTIN_UNREACHABLE;
2048#if KMP_AFFINITY_SUPPORTED
2050static int __kmp_parse_affinity_proc_id_list(
const char *var,
const char *env,
2051 const char **nextEnv,
2053 const char *scan = env;
2054 const char *next = scan;
2060 int start, end, stride;
2064 if (*next ==
'\0') {
2075 if ((*next <
'0') || (*next >
'9')) {
2076 KMP_WARNING(AffSyntaxError, var);
2080 num = __kmp_str_to_int(scan, *next);
2081 KMP_ASSERT(num >= 0);
2099 if ((*next <
'0') || (*next >
'9')) {
2100 KMP_WARNING(AffSyntaxError, var);
2105 num = __kmp_str_to_int(scan, *next);
2106 KMP_ASSERT(num >= 0);
2119 if ((*next <
'0') || (*next >
'9')) {
2121 KMP_WARNING(AffSyntaxError, var);
2129 start = __kmp_str_to_int(scan, *next);
2130 KMP_ASSERT(start >= 0);
2149 if ((*next <
'0') || (*next >
'9')) {
2150 KMP_WARNING(AffSyntaxError, var);
2154 end = __kmp_str_to_int(scan, *next);
2155 KMP_ASSERT(end >= 0);
2172 if ((*next <
'0') || (*next >
'9')) {
2173 KMP_WARNING(AffSyntaxError, var);
2177 stride = __kmp_str_to_int(scan, *next);
2178 KMP_ASSERT(stride >= 0);
2184 KMP_WARNING(AffZeroStride, var);
2189 KMP_WARNING(AffStartGreaterEnd, var, start, end);
2194 KMP_WARNING(AffStrideLessZero, var, start, end);
2198 if ((end - start) / stride > 65536) {
2199 KMP_WARNING(AffRangeTooBig, var, end, start, stride);
2216 ptrdiff_t len = next - env;
2217 char *retlist = (
char *)KMP_INTERNAL_MALLOC((len + 1) *
sizeof(char));
2218 KMP_MEMCPY_S(retlist, (len + 1) *
sizeof(
char), env, len *
sizeof(
char));
2219 retlist[len] =
'\0';
2220 *proclist = retlist;
2227static kmp_setting_t *__kmp_affinity_notype = NULL;
2229static void __kmp_parse_affinity_env(
char const *name,
char const *value,
2230 kmp_affinity_t *out_affinity) {
2231 char *buffer = NULL;
2249 KMP_ASSERT(value != NULL);
2251 if (TCR_4(__kmp_init_middle)) {
2252 KMP_WARNING(EnvMiddleWarn, name);
2253 __kmp_env_toPrint(name, 0);
2256 __kmp_env_toPrint(name, 1);
2259 __kmp_str_format(
"%s", value);
2269#define EMIT_WARN(skip, errlist) \
2273 SKIP_TO(next, ','); \
2277 KMP_WARNING errlist; \
2286#define _set_param(_guard, _var, _val) \
2288 if (_guard == 0) { \
2291 EMIT_WARN(FALSE, (AffParamDefined, name, start)); \
2296#define set_type(val) _set_param(type, out_affinity->type, val)
2297#define set_verbose(val) _set_param(verbose, out_affinity->flags.verbose, val)
2298#define set_warnings(val) \
2299 _set_param(warnings, out_affinity->flags.warnings, val)
2300#define set_respect(val) _set_param(respect, out_affinity->flags.respect, val)
2301#define set_dups(val) _set_param(dups, out_affinity->flags.dups, val)
2302#define set_proclist(val) _set_param(proclist, out_affinity->proclist, val)
2303#define set_reset(val) _set_param(reset, out_affinity->flags.reset, val)
2305#define set_gran(val, levels) \
2308 out_affinity->gran = val; \
2309 out_affinity->gran_levels = levels; \
2311 EMIT_WARN(FALSE, (AffParamDefined, name, start)); \
2316 KMP_DEBUG_ASSERT((__kmp_nested_proc_bind.bind_types != NULL) &&
2317 (__kmp_nested_proc_bind.used > 0));
2319 while (*buf !=
'\0') {
2322 if (__kmp_match_str(
"none", buf, CCAST(
const char **, &next))) {
2323 set_type(affinity_none);
2324 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2326 }
else if (__kmp_match_str(
"scatter", buf, CCAST(
const char **, &next))) {
2327 set_type(affinity_scatter);
2328 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2330 }
else if (__kmp_match_str(
"compact", buf, CCAST(
const char **, &next))) {
2331 set_type(affinity_compact);
2332 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2334 }
else if (__kmp_match_str(
"logical", buf, CCAST(
const char **, &next))) {
2335 set_type(affinity_logical);
2336 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2338 }
else if (__kmp_match_str(
"physical", buf, CCAST(
const char **, &next))) {
2339 set_type(affinity_physical);
2340 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2342 }
else if (__kmp_match_str(
"explicit", buf, CCAST(
const char **, &next))) {
2343 set_type(affinity_explicit);
2344 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2346 }
else if (__kmp_match_str(
"balanced", buf, CCAST(
const char **, &next))) {
2347 set_type(affinity_balanced);
2348 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2350 }
else if (__kmp_match_str(
"disabled", buf, CCAST(
const char **, &next))) {
2351 set_type(affinity_disabled);
2352 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2354 }
else if (__kmp_match_str(
"verbose", buf, CCAST(
const char **, &next))) {
2357 }
else if (__kmp_match_str(
"noverbose", buf, CCAST(
const char **, &next))) {
2360 }
else if (__kmp_match_str(
"warnings", buf, CCAST(
const char **, &next))) {
2363 }
else if (__kmp_match_str(
"nowarnings", buf,
2364 CCAST(
const char **, &next))) {
2365 set_warnings(FALSE);
2367 }
else if (__kmp_match_str(
"respect", buf, CCAST(
const char **, &next))) {
2370 }
else if (__kmp_match_str(
"norespect", buf, CCAST(
const char **, &next))) {
2373 }
else if (__kmp_match_str(
"reset", buf, CCAST(
const char **, &next))) {
2376 }
else if (__kmp_match_str(
"noreset", buf, CCAST(
const char **, &next))) {
2379 }
else if (__kmp_match_str(
"duplicates", buf,
2380 CCAST(
const char **, &next)) ||
2381 __kmp_match_str(
"dups", buf, CCAST(
const char **, &next))) {
2384 }
else if (__kmp_match_str(
"noduplicates", buf,
2385 CCAST(
const char **, &next)) ||
2386 __kmp_match_str(
"nodups", buf, CCAST(
const char **, &next))) {
2389 }
else if (__kmp_match_str(
"granularity", buf,
2390 CCAST(
const char **, &next)) ||
2391 __kmp_match_str(
"gran", buf, CCAST(
const char **, &next))) {
2394 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2404 if (__kmp_match_str(
"core_type", buf, CCAST(
const char **, &next))) {
2405 set_gran(KMP_HW_CORE, -1);
2406 out_affinity->flags.core_types_gran = 1;
2409 }
else if (__kmp_match_str(
"core_efficiency", buf,
2410 CCAST(
const char **, &next)) ||
2411 __kmp_match_str(
"core_eff", buf,
2412 CCAST(
const char **, &next))) {
2413 set_gran(KMP_HW_CORE, -1);
2414 out_affinity->flags.core_effs_gran = 1;
2420 KMP_FOREACH_HW_TYPE(type) {
2421 const char *name = __kmp_hw_get_keyword(type);
2422 if (__kmp_match_str(name, buf, CCAST(
const char **, &next))) {
2432 if (__kmp_match_str(
"fine", buf, CCAST(
const char **, &next))) {
2433 set_gran(KMP_HW_THREAD, -1);
2436 }
else if (__kmp_match_str(
"package", buf,
2437 CCAST(
const char **, &next))) {
2438 set_gran(KMP_HW_SOCKET, -1);
2441 }
else if (__kmp_match_str(
"node", buf, CCAST(
const char **, &next))) {
2442 set_gran(KMP_HW_NUMA, -1);
2445#if KMP_GROUP_AFFINITY
2446 }
else if (__kmp_match_str(
"group", buf, CCAST(
const char **, &next))) {
2447 set_gran(KMP_HW_PROC_GROUP, -1);
2451 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2455 n = __kmp_str_to_int(buf, *next);
2458 set_gran(KMP_HW_UNKNOWN, n);
2461 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2465 }
else if (__kmp_match_str(
"proclist", buf, CCAST(
const char **, &next))) {
2466 char *temp_proclist;
2470 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2476 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2481 if (!__kmp_parse_affinity_proc_id_list(
2482 name, buf, CCAST(
const char **, &next), &temp_proclist)) {
2494 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2498 set_proclist(temp_proclist);
2499 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2504 n = __kmp_str_to_int(buf, *next);
2510 KMP_WARNING(AffManyParams, name, start);
2514 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2522 }
else if (*next !=
'\0') {
2523 const char *temp = next;
2524 EMIT_WARN(TRUE, (ParseExtraCharsWarn, name, temp));
2536#undef set_granularity
2539 __kmp_str_free(&buffer);
2543 KMP_WARNING(AffProcListNoType, name);
2544 out_affinity->type = affinity_explicit;
2545 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2546 }
else if (out_affinity->type != affinity_explicit) {
2547 KMP_WARNING(AffProcListNotExplicit, name);
2548 KMP_ASSERT(out_affinity->proclist != NULL);
2549 KMP_INTERNAL_FREE(out_affinity->proclist);
2550 out_affinity->proclist = NULL;
2553 switch (out_affinity->type) {
2554 case affinity_logical:
2555 case affinity_physical: {
2557 out_affinity->offset = number[0];
2560 KMP_WARNING(AffManyParamsForLogic, name, number[1]);
2563 case affinity_balanced: {
2565 out_affinity->compact = number[0];
2568 out_affinity->offset = number[1];
2571 if (__kmp_affinity.gran == KMP_HW_UNKNOWN) {
2572 int verbose = out_affinity->flags.verbose;
2573 int warnings = out_affinity->flags.warnings;
2574#if KMP_MIC_SUPPORTED
2575 if (__kmp_mic_type != non_mic) {
2576 if (verbose || warnings) {
2577 KMP_WARNING(AffGranUsing, out_affinity->env_var,
"fine");
2579 out_affinity->gran = KMP_HW_THREAD;
2583 if (verbose || warnings) {
2584 KMP_WARNING(AffGranUsing, out_affinity->env_var,
"core");
2586 out_affinity->gran = KMP_HW_CORE;
2590 case affinity_scatter:
2591 case affinity_compact: {
2593 out_affinity->compact = number[0];
2596 out_affinity->offset = number[1];
2599 case affinity_explicit: {
2600 if (out_affinity->proclist == NULL) {
2601 KMP_WARNING(AffNoProcList, name);
2602 out_affinity->type = affinity_none;
2605 KMP_WARNING(AffNoParam, name,
"explicit");
2608 case affinity_none: {
2610 KMP_WARNING(AffNoParam, name,
"none");
2613 case affinity_disabled: {
2615 KMP_WARNING(AffNoParam, name,
"disabled");
2618 case affinity_default: {
2620 KMP_WARNING(AffNoParam, name,
"default");
2629static void __kmp_stg_parse_affinity(
char const *name,
char const *value,
2631 kmp_setting_t **rivals = (kmp_setting_t **)data;
2634 rc = __kmp_stg_check_rivals(name, value, rivals);
2639 __kmp_parse_affinity_env(name, value, &__kmp_affinity);
2642static void __kmp_stg_parse_hh_affinity(
char const *name,
char const *value,
2644 __kmp_parse_affinity_env(name, value, &__kmp_hh_affinity);
2646 if (__kmp_hh_affinity.flags.reset) {
2647 KMP_WARNING(AffInvalidParam, name,
"reset");
2649 if (__kmp_hh_affinity.flags.respect != affinity_respect_mask_default) {
2650 KMP_WARNING(AffInvalidParam, name,
"respect");
2654static void __kmp_print_affinity_env(kmp_str_buf_t *buffer,
char const *name,
2655 const kmp_affinity_t &affinity) {
2656 bool is_hh_affinity = (&affinity == &__kmp_hh_affinity);
2657 if (__kmp_env_format) {
2658 KMP_STR_BUF_PRINT_NAME_EX(name);
2660 __kmp_str_buf_print(buffer,
" %s='", name);
2662 if (affinity.flags.verbose) {
2663 __kmp_str_buf_print(buffer,
"%s,",
"verbose");
2665 __kmp_str_buf_print(buffer,
"%s,",
"noverbose");
2667 if (affinity.flags.warnings) {
2668 __kmp_str_buf_print(buffer,
"%s,",
"warnings");
2670 __kmp_str_buf_print(buffer,
"%s,",
"nowarnings");
2672 if (KMP_AFFINITY_CAPABLE()) {
2675 if (!is_hh_affinity) {
2676 if (affinity.flags.respect) {
2677 __kmp_str_buf_print(buffer,
"%s,",
"respect");
2679 __kmp_str_buf_print(buffer,
"%s,",
"norespect");
2681 if (affinity.flags.reset) {
2682 __kmp_str_buf_print(buffer,
"%s,",
"reset");
2684 __kmp_str_buf_print(buffer,
"%s,",
"noreset");
2687 __kmp_str_buf_print(buffer,
"granularity=");
2688 if (affinity.flags.core_types_gran)
2689 __kmp_str_buf_print(buffer,
"core_type,");
2690 else if (affinity.flags.core_effs_gran) {
2691 __kmp_str_buf_print(buffer,
"core_eff,");
2693 __kmp_str_buf_print(
2694 buffer,
"%s,", __kmp_hw_get_keyword(affinity.gran,
false));
2697 if (!KMP_AFFINITY_CAPABLE()) {
2698 __kmp_str_buf_print(buffer,
"%s",
"disabled");
2700 int compact = affinity.compact;
2701 int offset = affinity.offset;
2702 switch (affinity.type) {
2704 __kmp_str_buf_print(buffer,
"%s",
"none");
2706 case affinity_physical:
2707 __kmp_str_buf_print(buffer,
"%s,%d",
"physical", offset);
2709 case affinity_logical:
2710 __kmp_str_buf_print(buffer,
"%s,%d",
"logical", offset);
2712 case affinity_compact:
2713 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"compact", compact, offset);
2715 case affinity_scatter:
2716 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"scatter", compact, offset);
2718 case affinity_explicit:
2719 __kmp_str_buf_print(buffer,
"%s=[%s],%s",
"proclist", affinity.proclist,
2722 case affinity_balanced:
2723 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"balanced", compact, offset);
2725 case affinity_disabled:
2726 __kmp_str_buf_print(buffer,
"%s",
"disabled");
2728 case affinity_default:
2729 __kmp_str_buf_print(buffer,
"%s",
"default");
2732 __kmp_str_buf_print(buffer,
"%s",
"<unknown>");
2736 __kmp_str_buf_print(buffer,
"'\n");
2739static void __kmp_stg_print_affinity(kmp_str_buf_t *buffer,
char const *name,
2741 __kmp_print_affinity_env(buffer, name, __kmp_affinity);
2743static void __kmp_stg_print_hh_affinity(kmp_str_buf_t *buffer,
char const *name,
2745 __kmp_print_affinity_env(buffer, name, __kmp_hh_affinity);
2748#ifdef KMP_GOMP_COMPAT
2750static void __kmp_stg_parse_gomp_cpu_affinity(
char const *name,
2751 char const *value,
void *data) {
2752 const char *next = NULL;
2753 char *temp_proclist;
2754 kmp_setting_t **rivals = (kmp_setting_t **)data;
2757 rc = __kmp_stg_check_rivals(name, value, rivals);
2762 if (TCR_4(__kmp_init_middle)) {
2763 KMP_WARNING(EnvMiddleWarn, name);
2764 __kmp_env_toPrint(name, 0);
2768 __kmp_env_toPrint(name, 1);
2770 if (__kmp_parse_affinity_proc_id_list(name, value, &next, &temp_proclist)) {
2772 if (*next ==
'\0') {
2774 __kmp_affinity.proclist = temp_proclist;
2775 __kmp_affinity.type = affinity_explicit;
2776 __kmp_affinity.gran = KMP_HW_THREAD;
2777 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2779 KMP_WARNING(AffSyntaxError, name);
2780 if (temp_proclist != NULL) {
2781 KMP_INTERNAL_FREE((
void *)temp_proclist);
2786 __kmp_affinity.type = affinity_none;
2787 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2814static int __kmp_parse_subplace_list(
const char *var,
const char **scan) {
2818 int start, count, stride;
2824 if ((**scan <
'0') || (**scan >
'9')) {
2829 start = __kmp_str_to_int(*scan, *next);
2830 KMP_ASSERT(start >= 0);
2835 if (**scan ==
'}') {
2838 if (**scan ==
',') {
2842 if (**scan !=
':') {
2849 if ((**scan <
'0') || (**scan >
'9')) {
2854 count = __kmp_str_to_int(*scan, *next);
2855 KMP_ASSERT(count >= 0);
2860 if (**scan ==
'}') {
2863 if (**scan ==
',') {
2867 if (**scan !=
':') {
2876 if (**scan ==
'+') {
2880 if (**scan ==
'-') {
2888 if ((**scan <
'0') || (**scan >
'9')) {
2893 stride = __kmp_str_to_int(*scan, *next);
2894 KMP_ASSERT(stride >= 0);
2900 if (**scan ==
'}') {
2903 if (**scan ==
',') {
2913static int __kmp_parse_place(
const char *var,
const char **scan) {
2918 if (**scan ==
'{') {
2920 if (!__kmp_parse_subplace_list(var, scan)) {
2923 if (**scan !=
'}') {
2927 }
else if (**scan ==
'!') {
2929 return __kmp_parse_place(var, scan);
2930 }
else if ((**scan >=
'0') && (**scan <=
'9')) {
2933 int proc = __kmp_str_to_int(*scan, *next);
2934 KMP_ASSERT(proc >= 0);
2943static int __kmp_parse_place_list(
const char *var,
const char *env,
2944 char **place_list) {
2945 const char *scan = env;
2946 const char *next = scan;
2951 if (!__kmp_parse_place(var, &scan)) {
2957 if (*scan ==
'\0') {
2971 if ((*scan <
'0') || (*scan >
'9')) {
2976 count = __kmp_str_to_int(scan, *next);
2977 KMP_ASSERT(count >= 0);
2982 if (*scan ==
'\0') {
3010 if ((*scan <
'0') || (*scan >
'9')) {
3015 stride = __kmp_str_to_int(scan, *next);
3016 KMP_ASSERT(stride >= 0);
3022 if (*scan ==
'\0') {
3034 ptrdiff_t len = scan - env;
3035 char *retlist = (
char *)KMP_INTERNAL_MALLOC((len + 1) *
sizeof(char));
3036 KMP_MEMCPY_S(retlist, (len + 1) *
sizeof(
char), env, len *
sizeof(
char));
3037 retlist[len] =
'\0';
3038 *place_list = retlist;
3043static inline void __kmp_places_set(
enum affinity_type type, kmp_hw_t kind) {
3044 __kmp_affinity.type = type;
3045 __kmp_affinity.gran = kind;
3046 __kmp_affinity.flags.dups = FALSE;
3047 __kmp_affinity.flags.omp_places = TRUE;
3050static void __kmp_places_syntax_error_fallback(
char const *name,
3052 const char *str = __kmp_hw_get_catalog_string(kind,
true);
3053 KMP_WARNING(SyntaxErrorUsing, name, str);
3054 __kmp_places_set(affinity_compact, kind);
3055 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default)
3056 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3059static void __kmp_stg_parse_places(
char const *name,
char const *value,
3061 struct kmp_place_t {
3067 const char *scan = value;
3068 const char *next = scan;
3069 kmp_place_t std_places[] = {{
"threads", KMP_HW_THREAD},
3070 {
"cores", KMP_HW_CORE},
3071 {
"numa_domains", KMP_HW_NUMA},
3072 {
"ll_caches", KMP_HW_LLC},
3073 {
"sockets", KMP_HW_SOCKET}};
3074 kmp_setting_t **rivals = (kmp_setting_t **)data;
3077 rc = __kmp_stg_check_rivals(name, value, rivals);
3083 for (
size_t i = 0; i <
sizeof(std_places) /
sizeof(std_places[0]); ++i) {
3084 const kmp_place_t &place = std_places[i];
3085 if (__kmp_match_str(place.name, scan, &next)) {
3087 __kmp_places_set(affinity_compact, place.type);
3090 if (KMP_HW_MAX_NUM_CORE_TYPES > 1) {
3093 if (place.type != KMP_HW_CORE) {
3094 __kmp_places_syntax_error_fallback(name, place.type);
3099#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3100 if (__kmp_match_str(
"intel_core", scan, &next)) {
3101 __kmp_affinity.core_attr_gran.core_type = KMP_HW_CORE_TYPE_CORE;
3102 __kmp_affinity.core_attr_gran.valid = 1;
3104 }
else if (__kmp_match_str(
"intel_atom", scan, &next)) {
3105 __kmp_affinity.core_attr_gran.core_type = KMP_HW_CORE_TYPE_ATOM;
3106 __kmp_affinity.core_attr_gran.valid = 1;
3110 if (__kmp_match_str(
"eff", scan, &next)) {
3112 if (!isdigit(*next)) {
3113 __kmp_places_syntax_error_fallback(name, place.type);
3118 eff = __kmp_str_to_int(scan, *next);
3120 __kmp_places_syntax_error_fallback(name, place.type);
3123 if (eff >= KMP_HW_MAX_NUM_CORE_EFFS)
3124 eff = KMP_HW_MAX_NUM_CORE_EFFS - 1;
3125 __kmp_affinity.core_attr_gran.core_eff = eff;
3126 __kmp_affinity.core_attr_gran.valid = 1;
3129 if (!__kmp_affinity.core_attr_gran.valid) {
3130 __kmp_places_syntax_error_fallback(name, place.type);
3140 KMP_FOREACH_HW_TYPE(type) {
3141 const char *name = __kmp_hw_get_keyword(type,
true);
3142 if (__kmp_match_str(
"unknowns", scan, &next))
3144 if (__kmp_match_str(name, scan, &next)) {
3146 __kmp_places_set(affinity_compact, type);
3154 if (__kmp_match_str(
"core_types", scan, &next)) {
3156 if (*scan !=
'\0') {
3157 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3159 __kmp_places_set(affinity_compact, KMP_HW_CORE);
3160 __kmp_affinity.flags.core_types_gran = 1;
3162 }
else if (__kmp_match_str(
"core_effs", scan, &next) ||
3163 __kmp_match_str(
"core_efficiencies", scan, &next)) {
3165 if (*scan !=
'\0') {
3166 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3168 __kmp_places_set(affinity_compact, KMP_HW_CORE);
3169 __kmp_affinity.flags.core_effs_gran = 1;
3175 if (__kmp_affinity.proclist != NULL) {
3176 KMP_INTERNAL_FREE((
void *)__kmp_affinity.proclist);
3177 __kmp_affinity.proclist = NULL;
3179 if (__kmp_parse_place_list(name, value, &__kmp_affinity.proclist)) {
3180 __kmp_places_set(affinity_explicit, KMP_HW_THREAD);
3183 __kmp_places_syntax_error_fallback(name, KMP_HW_CORE);
3185 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
3186 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3191 kmp_hw_t gran = __kmp_affinity.gran;
3192 if (__kmp_affinity.gran != KMP_HW_UNKNOWN) {
3193 gran = __kmp_affinity.gran;
3198 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
3199 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3203 if (*scan ==
'\0') {
3209 __kmp_places_syntax_error_fallback(name, gran);
3217 count = __kmp_str_to_int(scan, *next);
3218 KMP_ASSERT(count >= 0);
3223 __kmp_places_syntax_error_fallback(name, gran);
3229 if (*scan !=
'\0') {
3230 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3232 __kmp_affinity_num_places = count;
3235static void __kmp_stg_print_places(kmp_str_buf_t *buffer,
char const *name,
3237 enum affinity_type type = __kmp_affinity.type;
3238 const char *proclist = __kmp_affinity.proclist;
3239 kmp_hw_t gran = __kmp_affinity.gran;
3241 if (__kmp_env_format) {
3242 KMP_STR_BUF_PRINT_NAME;
3244 __kmp_str_buf_print(buffer,
" %s", name);
3246 if ((__kmp_nested_proc_bind.used == 0) ||
3247 (__kmp_nested_proc_bind.bind_types == NULL) ||
3248 (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)) {
3249 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3250 }
else if (type == affinity_explicit) {
3251 if (proclist != NULL) {
3252 __kmp_str_buf_print(buffer,
"='%s'\n", proclist);
3254 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3256 }
else if (type == affinity_compact) {
3258 if (__kmp_affinity.num_masks > 0) {
3259 num = __kmp_affinity.num_masks;
3260 }
else if (__kmp_affinity_num_places > 0) {
3261 num = __kmp_affinity_num_places;
3265 if (gran != KMP_HW_UNKNOWN) {
3267 if (__kmp_affinity.flags.core_types_gran) {
3268 __kmp_str_buf_print(buffer,
"='%s'\n",
"core_types");
3271 if (__kmp_affinity.flags.core_effs_gran) {
3272 __kmp_str_buf_print(buffer,
"='%s'\n",
"core_effs");
3277 const char *name = __kmp_hw_get_keyword(gran,
true);
3278 __kmp_str_buf_print(buffer,
"='%s", name);
3281 if (__kmp_affinity.core_attr_gran.valid) {
3282 kmp_hw_core_type_t ct =
3283 (kmp_hw_core_type_t)__kmp_affinity.core_attr_gran.core_type;
3284 int eff = __kmp_affinity.core_attr_gran.core_eff;
3285 if (ct != KMP_HW_CORE_TYPE_UNKNOWN) {
3286 const char *ct_name = __kmp_hw_get_core_type_keyword(ct);
3287 __kmp_str_buf_print(buffer,
":%s", ct_name);
3288 }
else if (eff >= 0 && eff < KMP_HW_MAX_NUM_CORE_EFFS) {
3289 __kmp_str_buf_print(buffer,
":eff%d", eff);
3295 __kmp_str_buf_print(buffer,
"(%d)", num);
3296 __kmp_str_buf_print(buffer,
"'\n");
3298 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3301 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3305static void __kmp_stg_parse_topology_method(
char const *name,
char const *value,
3307 if (__kmp_str_match(
"all", 1, value)) {
3308 __kmp_affinity_top_method = affinity_top_method_all;
3310#if KMP_HWLOC_ENABLED
3311 else if (__kmp_str_match(
"hwloc", 1, value)) {
3312 __kmp_affinity_top_method = affinity_top_method_hwloc;
3315#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3316 else if (__kmp_str_match(
"cpuid_leaf31", 12, value) ||
3317 __kmp_str_match(
"cpuid 1f", 8, value) ||
3318 __kmp_str_match(
"cpuid 31", 8, value) ||
3319 __kmp_str_match(
"cpuid1f", 7, value) ||
3320 __kmp_str_match(
"cpuid31", 7, value) ||
3321 __kmp_str_match(
"leaf 1f", 7, value) ||
3322 __kmp_str_match(
"leaf 31", 7, value) ||
3323 __kmp_str_match(
"leaf1f", 6, value) ||
3324 __kmp_str_match(
"leaf31", 6, value)) {
3325 __kmp_affinity_top_method = affinity_top_method_x2apicid_1f;
3326 }
else if (__kmp_str_match(
"x2apic id", 9, value) ||
3327 __kmp_str_match(
"x2apic_id", 9, value) ||
3328 __kmp_str_match(
"x2apic-id", 9, value) ||
3329 __kmp_str_match(
"x2apicid", 8, value) ||
3330 __kmp_str_match(
"cpuid leaf 11", 13, value) ||
3331 __kmp_str_match(
"cpuid_leaf_11", 13, value) ||
3332 __kmp_str_match(
"cpuid-leaf-11", 13, value) ||
3333 __kmp_str_match(
"cpuid leaf11", 12, value) ||
3334 __kmp_str_match(
"cpuid_leaf11", 12, value) ||
3335 __kmp_str_match(
"cpuid-leaf11", 12, value) ||
3336 __kmp_str_match(
"cpuidleaf 11", 12, value) ||
3337 __kmp_str_match(
"cpuidleaf_11", 12, value) ||
3338 __kmp_str_match(
"cpuidleaf-11", 12, value) ||
3339 __kmp_str_match(
"cpuidleaf11", 11, value) ||
3340 __kmp_str_match(
"cpuid 11", 8, value) ||
3341 __kmp_str_match(
"cpuid_11", 8, value) ||
3342 __kmp_str_match(
"cpuid-11", 8, value) ||
3343 __kmp_str_match(
"cpuid11", 7, value) ||
3344 __kmp_str_match(
"leaf 11", 7, value) ||
3345 __kmp_str_match(
"leaf_11", 7, value) ||
3346 __kmp_str_match(
"leaf-11", 7, value) ||
3347 __kmp_str_match(
"leaf11", 6, value)) {
3348 __kmp_affinity_top_method = affinity_top_method_x2apicid;
3349 }
else if (__kmp_str_match(
"apic id", 7, value) ||
3350 __kmp_str_match(
"apic_id", 7, value) ||
3351 __kmp_str_match(
"apic-id", 7, value) ||
3352 __kmp_str_match(
"apicid", 6, value) ||
3353 __kmp_str_match(
"cpuid leaf 4", 12, value) ||
3354 __kmp_str_match(
"cpuid_leaf_4", 12, value) ||
3355 __kmp_str_match(
"cpuid-leaf-4", 12, value) ||
3356 __kmp_str_match(
"cpuid leaf4", 11, value) ||
3357 __kmp_str_match(
"cpuid_leaf4", 11, value) ||
3358 __kmp_str_match(
"cpuid-leaf4", 11, value) ||
3359 __kmp_str_match(
"cpuidleaf 4", 11, value) ||
3360 __kmp_str_match(
"cpuidleaf_4", 11, value) ||
3361 __kmp_str_match(
"cpuidleaf-4", 11, value) ||
3362 __kmp_str_match(
"cpuidleaf4", 10, value) ||
3363 __kmp_str_match(
"cpuid 4", 7, value) ||
3364 __kmp_str_match(
"cpuid_4", 7, value) ||
3365 __kmp_str_match(
"cpuid-4", 7, value) ||
3366 __kmp_str_match(
"cpuid4", 6, value) ||
3367 __kmp_str_match(
"leaf 4", 6, value) ||
3368 __kmp_str_match(
"leaf_4", 6, value) ||
3369 __kmp_str_match(
"leaf-4", 6, value) ||
3370 __kmp_str_match(
"leaf4", 5, value)) {
3371 __kmp_affinity_top_method = affinity_top_method_apicid;
3374 else if (__kmp_str_match(
"/proc/cpuinfo", 2, value) ||
3375 __kmp_str_match(
"cpuinfo", 5, value)) {
3376 __kmp_affinity_top_method = affinity_top_method_cpuinfo;
3378#if KMP_GROUP_AFFINITY
3379 else if (__kmp_str_match(
"group", 1, value)) {
3380 KMP_WARNING(StgDeprecatedValue, name, value,
"all");
3381 __kmp_affinity_top_method = affinity_top_method_group;
3384 else if (__kmp_str_match(
"flat", 1, value)) {
3385 __kmp_affinity_top_method = affinity_top_method_flat;
3387 KMP_WARNING(StgInvalidValue, name, value);
3391static void __kmp_stg_print_topology_method(kmp_str_buf_t *buffer,
3392 char const *name,
void *data) {
3393 char const *value = NULL;
3395 switch (__kmp_affinity_top_method) {
3396 case affinity_top_method_default:
3400 case affinity_top_method_all:
3404#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3405 case affinity_top_method_x2apicid_1f:
3406 value =
"x2APIC id leaf 0x1f";
3409 case affinity_top_method_x2apicid:
3410 value =
"x2APIC id leaf 0xb";
3413 case affinity_top_method_apicid:
3418#if KMP_HWLOC_ENABLED
3419 case affinity_top_method_hwloc:
3424 case affinity_top_method_cpuinfo:
3428#if KMP_GROUP_AFFINITY
3429 case affinity_top_method_group:
3434 case affinity_top_method_flat:
3439 if (value != NULL) {
3440 __kmp_stg_print_str(buffer, name, value);
3445struct kmp_proc_bind_info_t {
3447 kmp_proc_bind_t proc_bind;
3449static kmp_proc_bind_info_t proc_bind_table[] = {
3450 {
"spread", proc_bind_spread},
3451 {
"true", proc_bind_spread},
3452 {
"close", proc_bind_close},
3454 {
"false", proc_bind_primary},
3455 {
"primary", proc_bind_primary}};
3456static void __kmp_stg_parse_teams_proc_bind(
char const *name,
char const *value,
3461 for (
size_t i = 0; i <
sizeof(proc_bind_table) /
sizeof(proc_bind_table[0]);
3463 if (__kmp_match_str(proc_bind_table[i].name, value, &end)) {
3464 __kmp_teams_proc_bind = proc_bind_table[i].proc_bind;
3470 KMP_WARNING(StgInvalidValue, name, value);
3473static void __kmp_stg_print_teams_proc_bind(kmp_str_buf_t *buffer,
3474 char const *name,
void *data) {
3475 const char *value = KMP_I18N_STR(NotDefined);
3476 for (
size_t i = 0; i <
sizeof(proc_bind_table) /
sizeof(proc_bind_table[0]);
3478 if (__kmp_teams_proc_bind == proc_bind_table[i].proc_bind) {
3479 value = proc_bind_table[i].name;
3483 __kmp_stg_print_str(buffer, name, value);
3489static void __kmp_stg_parse_proc_bind(
char const *name,
char const *value,
3491 kmp_setting_t **rivals = (kmp_setting_t **)data;
3494 rc = __kmp_stg_check_rivals(name, value, rivals);
3500 KMP_DEBUG_ASSERT((__kmp_nested_proc_bind.bind_types != NULL) &&
3501 (__kmp_nested_proc_bind.used > 0));
3503 const char *buf = value;
3509 if (__kmp_match_str(
"disabled", buf, &next)) {
3512#if KMP_AFFINITY_SUPPORTED
3513 __kmp_affinity.type = affinity_disabled;
3515 __kmp_nested_proc_bind.used = 1;
3516 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3517 }
else if (__kmp_match_str(
"false", buf, &next)) {
3520#if KMP_AFFINITY_SUPPORTED
3521 __kmp_affinity.type = affinity_none;
3523 __kmp_nested_proc_bind.used = 1;
3524 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3525 }
else if (__kmp_match_str(
"true", buf, &next)) {
3528 __kmp_nested_proc_bind.used = 1;
3529 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3534 for (scan = buf; *scan !=
'\0'; scan++) {
3541 if (__kmp_nested_proc_bind.size < nelem) {
3542 __kmp_nested_proc_bind.bind_types =
3543 (kmp_proc_bind_t *)KMP_INTERNAL_REALLOC(
3544 __kmp_nested_proc_bind.bind_types,
3545 sizeof(kmp_proc_bind_t) * nelem);
3546 if (__kmp_nested_proc_bind.bind_types == NULL) {
3547 KMP_FATAL(MemoryAllocFailed);
3549 __kmp_nested_proc_bind.size = nelem;
3551 __kmp_nested_proc_bind.used = nelem;
3553 if (nelem > 1 && !__kmp_dflt_max_active_levels_set)
3554 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
3559 enum kmp_proc_bind_t bind;
3561 if (__kmp_match_str(
"master", buf, &next) ||
3562 __kmp_match_str(
"primary", buf, &next)) {
3565 bind = proc_bind_primary;
3566 }
else if (__kmp_match_str(
"close", buf, &next)) {
3569 bind = proc_bind_close;
3570 }
else if (__kmp_match_str(
"spread", buf, &next)) {
3573 bind = proc_bind_spread;
3575 KMP_WARNING(StgInvalidValue, name, value);
3576 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3577 __kmp_nested_proc_bind.used = 1;
3581 __kmp_nested_proc_bind.bind_types[i++] = bind;
3586 KMP_WARNING(ParseExtraCharsWarn, name, buf);
3596 KMP_WARNING(ParseExtraCharsWarn, name, buf);
3600static void __kmp_stg_print_proc_bind(kmp_str_buf_t *buffer,
char const *name,
3602 int nelem = __kmp_nested_proc_bind.used;
3603 if (__kmp_env_format) {
3604 KMP_STR_BUF_PRINT_NAME;
3606 __kmp_str_buf_print(buffer,
" %s", name);
3609 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3612 __kmp_str_buf_print(buffer,
"='", name);
3613 for (i = 0; i < nelem; i++) {
3614 switch (__kmp_nested_proc_bind.bind_types[i]) {
3615 case proc_bind_false:
3616 __kmp_str_buf_print(buffer,
"false");
3619 case proc_bind_true:
3620 __kmp_str_buf_print(buffer,
"true");
3623 case proc_bind_primary:
3624 __kmp_str_buf_print(buffer,
"primary");
3627 case proc_bind_close:
3628 __kmp_str_buf_print(buffer,
"close");
3631 case proc_bind_spread:
3632 __kmp_str_buf_print(buffer,
"spread");
3635 case proc_bind_intel:
3636 __kmp_str_buf_print(buffer,
"intel");
3639 case proc_bind_default:
3640 __kmp_str_buf_print(buffer,
"default");
3643 if (i < nelem - 1) {
3644 __kmp_str_buf_print(buffer,
",");
3647 __kmp_str_buf_print(buffer,
"'\n");
3651static void __kmp_stg_parse_display_affinity(
char const *name,
3652 char const *value,
void *data) {
3653 __kmp_stg_parse_bool(name, value, &__kmp_display_affinity);
3655static void __kmp_stg_print_display_affinity(kmp_str_buf_t *buffer,
3656 char const *name,
void *data) {
3657 __kmp_stg_print_bool(buffer, name, __kmp_display_affinity);
3659static void __kmp_stg_parse_affinity_format(
char const *name,
char const *value,
3661 size_t length = KMP_STRLEN(value);
3662 __kmp_strncpy_truncate(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, value,
3665static void __kmp_stg_print_affinity_format(kmp_str_buf_t *buffer,
3666 char const *name,
void *data) {
3667 if (__kmp_env_format) {
3668 KMP_STR_BUF_PRINT_NAME_EX(name);
3670 __kmp_str_buf_print(buffer,
" %s='", name);
3672 __kmp_str_buf_print(buffer,
"%s'\n", __kmp_affinity_format);
3694static void __kmp_stg_parse_allocator(
char const *name,
char const *value,
3696 const char *buf = value;
3697 const char *next, *scan, *start;
3699 omp_allocator_handle_t al;
3700 omp_memspace_handle_t ms = omp_default_mem_space;
3701 bool is_memspace =
false;
3702 int ntraits = 0, count = 0;
3706 const char *delim = strchr(buf,
':');
3707 const char *predef_mem_space = strstr(buf,
"mem_space");
3709 bool is_memalloc = (!predef_mem_space && !delim) ?
true : false;
3714 for (scan = buf; *scan !=
'\0'; scan++) {
3719 omp_alloctrait_t *traits =
3720 (omp_alloctrait_t *)KMP_ALLOCA(ntraits *
sizeof(omp_alloctrait_t));
3723#define IS_POWER_OF_TWO(n) (((n) & ((n)-1)) == 0)
3725#define GET_NEXT(sentinel) \
3728 if (*next == sentinel) \
3734#define SKIP_PAIR(key) \
3736 char const str_delimiter[] = {',', 0}; \
3737 char *value = __kmp_str_token(CCAST(char *, scan), str_delimiter, \
3738 CCAST(char **, &next)); \
3739 KMP_WARNING(StgInvalidValue, key, value); \
3747 char const str_delimiter[] = {'=', 0}; \
3748 key = __kmp_str_token(CCAST(char *, start), str_delimiter, \
3749 CCAST(char **, &next)); \
3754 while (*next !=
'\0') {
3756 __kmp_match_str(
"fb_data", scan, &next)) {
3760 if (__kmp_match_str(
"omp_high_bw_mem_alloc", scan, &next)) {
3763 if (__kmp_hwloc_available || __kmp_memkind_available) {
3764 __kmp_def_allocator = omp_high_bw_mem_alloc;
3767 KMP_WARNING(OmpNoAllocator,
"omp_high_bw_mem_alloc");
3770 traits[count].key = omp_atk_fb_data;
3771 traits[count].value = RCAST(omp_uintptr_t, omp_high_bw_mem_alloc);
3773 }
else if (__kmp_match_str(
"omp_large_cap_mem_alloc", scan, &next)) {
3776 if (__kmp_hwloc_available || __kmp_memkind_available) {
3777 __kmp_def_allocator = omp_large_cap_mem_alloc;
3780 KMP_WARNING(OmpNoAllocator,
"omp_large_cap_mem_alloc");
3783 traits[count].key = omp_atk_fb_data;
3784 traits[count].value = RCAST(omp_uintptr_t, omp_large_cap_mem_alloc);
3786 }
else if (__kmp_match_str(
"omp_default_mem_alloc", scan, &next)) {
3790 traits[count].key = omp_atk_fb_data;
3791 traits[count].value = RCAST(omp_uintptr_t, omp_default_mem_alloc);
3793 }
else if (__kmp_match_str(
"omp_const_mem_alloc", scan, &next)) {
3796 KMP_WARNING(OmpNoAllocator,
"omp_const_mem_alloc");
3798 traits[count].key = omp_atk_fb_data;
3799 traits[count].value = RCAST(omp_uintptr_t, omp_const_mem_alloc);
3801 }
else if (__kmp_match_str(
"omp_low_lat_mem_alloc", scan, &next)) {
3804 KMP_WARNING(OmpNoAllocator,
"omp_low_lat_mem_alloc");
3806 traits[count].key = omp_atk_fb_data;
3807 traits[count].value = RCAST(omp_uintptr_t, omp_low_lat_mem_alloc);
3809 }
else if (__kmp_match_str(
"omp_cgroup_mem_alloc", scan, &next)) {
3812 KMP_WARNING(OmpNoAllocator,
"omp_cgroup_mem_alloc");
3814 traits[count].key = omp_atk_fb_data;
3815 traits[count].value = RCAST(omp_uintptr_t, omp_cgroup_mem_alloc);
3817 }
else if (__kmp_match_str(
"omp_pteam_mem_alloc", scan, &next)) {
3820 KMP_WARNING(OmpNoAllocator,
"omp_pteam_mem_alloc");
3822 traits[count].key = omp_atk_fb_data;
3823 traits[count].value = RCAST(omp_uintptr_t, omp_pteam_mem_alloc);
3825 }
else if (__kmp_match_str(
"omp_thread_mem_alloc", scan, &next)) {
3828 KMP_WARNING(OmpNoAllocator,
"omp_thread_mem_alloc");
3830 traits[count].key = omp_atk_fb_data;
3831 traits[count].value = RCAST(omp_uintptr_t, omp_thread_mem_alloc);
3841 __kmp_def_allocator = omp_default_mem_alloc;
3842 if (next == buf || *next !=
'\0') {
3844 KMP_WARNING(StgInvalidValue, name, value);
3849 if (count == ntraits)
3855 if (__kmp_match_str(
"omp_default_mem_space", scan, &next)) {
3857 ms = omp_default_mem_space;
3858 }
else if (__kmp_match_str(
"omp_large_cap_mem_space", scan, &next)) {
3860 ms = omp_large_cap_mem_space;
3861 }
else if (__kmp_match_str(
"omp_const_mem_space", scan, &next)) {
3863 ms = omp_const_mem_space;
3864 }
else if (__kmp_match_str(
"omp_high_bw_mem_space", scan, &next)) {
3866 ms = omp_high_bw_mem_space;
3867 }
else if (__kmp_match_str(
"omp_low_lat_mem_space", scan, &next)) {
3869 ms = omp_low_lat_mem_space;
3871 __kmp_def_allocator = omp_default_mem_alloc;
3872 if (next == buf || *next !=
'\0') {
3874 KMP_WARNING(StgInvalidValue, name, value);
3883 if (__kmp_match_str(
"sync_hint", scan, &next)) {
3885 traits[count].key = omp_atk_sync_hint;
3886 if (__kmp_match_str(
"contended", scan, &next)) {
3887 traits[count].value = omp_atv_contended;
3888 }
else if (__kmp_match_str(
"uncontended", scan, &next)) {
3889 traits[count].value = omp_atv_uncontended;
3890 }
else if (__kmp_match_str(
"serialized", scan, &next)) {
3891 traits[count].value = omp_atv_serialized;
3892 }
else if (__kmp_match_str(
"private", scan, &next)) {
3893 traits[count].value = omp_atv_private;
3899 }
else if (__kmp_match_str(
"alignment", scan, &next)) {
3901 if (!isdigit(*next)) {
3907 int n = __kmp_str_to_int(scan,
',');
3908 if (n < 0 || !IS_POWER_OF_TWO(n)) {
3913 traits[count].key = omp_atk_alignment;
3914 traits[count].value = n;
3915 }
else if (__kmp_match_str(
"access", scan, &next)) {
3917 traits[count].key = omp_atk_access;
3918 if (__kmp_match_str(
"all", scan, &next)) {
3919 traits[count].value = omp_atv_all;
3920 }
else if (__kmp_match_str(
"cgroup", scan, &next)) {
3921 traits[count].value = omp_atv_cgroup;
3922 }
else if (__kmp_match_str(
"pteam", scan, &next)) {
3923 traits[count].value = omp_atv_pteam;
3924 }
else if (__kmp_match_str(
"thread", scan, &next)) {
3925 traits[count].value = omp_atv_thread;
3931 }
else if (__kmp_match_str(
"pool_size", scan, &next)) {
3933 if (!isdigit(*next)) {
3939 int n = __kmp_str_to_int(scan,
',');
3945 traits[count].key = omp_atk_pool_size;
3946 traits[count].value = n;
3947 }
else if (__kmp_match_str(
"fallback", scan, &next)) {
3949 traits[count].key = omp_atk_fallback;
3950 if (__kmp_match_str(
"default_mem_fb", scan, &next)) {
3951 traits[count].value = omp_atv_default_mem_fb;
3952 }
else if (__kmp_match_str(
"null_fb", scan, &next)) {
3953 traits[count].value = omp_atv_null_fb;
3954 }
else if (__kmp_match_str(
"abort_fb", scan, &next)) {
3955 traits[count].value = omp_atv_abort_fb;
3956 }
else if (__kmp_match_str(
"allocator_fb", scan, &next)) {
3957 traits[count].value = omp_atv_allocator_fb;
3963 }
else if (__kmp_match_str(
"pinned", scan, &next)) {
3965 traits[count].key = omp_atk_pinned;
3966 if (__kmp_str_match_true(next)) {
3967 traits[count].value = omp_atv_true;
3968 }
else if (__kmp_str_match_false(next)) {
3969 traits[count].value = omp_atv_false;
3975 }
else if (__kmp_match_str(
"partition", scan, &next)) {
3977 traits[count].key = omp_atk_partition;
3978 if (__kmp_match_str(
"environment", scan, &next)) {
3979 traits[count].value = omp_atv_environment;
3980 }
else if (__kmp_match_str(
"nearest", scan, &next)) {
3981 traits[count].value = omp_atv_nearest;
3982 }
else if (__kmp_match_str(
"blocked", scan, &next)) {
3983 traits[count].value = omp_atv_blocked;
3984 }
else if (__kmp_match_str(
"interleaved", scan, &next)) {
3985 traits[count].value = omp_atv_interleaved;
3998 if (count == ntraits)
4004 al = __kmpc_init_allocator(__kmp_get_gtid(), ms, ntraits, traits);
4005 __kmp_def_allocator = (al == omp_null_allocator) ? omp_default_mem_alloc : al;
4008static void __kmp_stg_print_allocator(kmp_str_buf_t *buffer,
char const *name,
4010 if (__kmp_def_allocator == omp_default_mem_alloc) {
4011 __kmp_stg_print_str(buffer, name,
"omp_default_mem_alloc");
4012 }
else if (__kmp_def_allocator == omp_high_bw_mem_alloc) {
4013 __kmp_stg_print_str(buffer, name,
"omp_high_bw_mem_alloc");
4014 }
else if (__kmp_def_allocator == omp_large_cap_mem_alloc) {
4015 __kmp_stg_print_str(buffer, name,
"omp_large_cap_mem_alloc");
4016 }
else if (__kmp_def_allocator == omp_const_mem_alloc) {
4017 __kmp_stg_print_str(buffer, name,
"omp_const_mem_alloc");
4018 }
else if (__kmp_def_allocator == omp_low_lat_mem_alloc) {
4019 __kmp_stg_print_str(buffer, name,
"omp_low_lat_mem_alloc");
4020 }
else if (__kmp_def_allocator == omp_cgroup_mem_alloc) {
4021 __kmp_stg_print_str(buffer, name,
"omp_cgroup_mem_alloc");
4022 }
else if (__kmp_def_allocator == omp_pteam_mem_alloc) {
4023 __kmp_stg_print_str(buffer, name,
"omp_pteam_mem_alloc");
4024 }
else if (__kmp_def_allocator == omp_thread_mem_alloc) {
4025 __kmp_stg_print_str(buffer, name,
"omp_thread_mem_alloc");
4032static void __kmp_stg_parse_omp_dynamic(
char const *name,
char const *value,
4034 __kmp_stg_parse_bool(name, value, &(__kmp_global.g.g_dynamic));
4037static void __kmp_stg_print_omp_dynamic(kmp_str_buf_t *buffer,
char const *name,
4039 __kmp_stg_print_bool(buffer, name, __kmp_global.g.g_dynamic);
4042static void __kmp_stg_parse_kmp_dynamic_mode(
char const *name,
4043 char const *value,
void *data) {
4044 if (TCR_4(__kmp_init_parallel)) {
4045 KMP_WARNING(EnvParallelWarn, name);
4046 __kmp_env_toPrint(name, 0);
4049#ifdef USE_LOAD_BALANCE
4050 else if (__kmp_str_match(
"load balance", 2, value) ||
4051 __kmp_str_match(
"load_balance", 2, value) ||
4052 __kmp_str_match(
"load-balance", 2, value) ||
4053 __kmp_str_match(
"loadbalance", 2, value) ||
4054 __kmp_str_match(
"balance", 1, value)) {
4055 __kmp_global.g.g_dynamic_mode = dynamic_load_balance;
4058 else if (__kmp_str_match(
"thread limit", 1, value) ||
4059 __kmp_str_match(
"thread_limit", 1, value) ||
4060 __kmp_str_match(
"thread-limit", 1, value) ||
4061 __kmp_str_match(
"threadlimit", 1, value) ||
4062 __kmp_str_match(
"limit", 2, value)) {
4063 __kmp_global.g.g_dynamic_mode = dynamic_thread_limit;
4064 }
else if (__kmp_str_match(
"random", 1, value)) {
4065 __kmp_global.g.g_dynamic_mode = dynamic_random;
4067 KMP_WARNING(StgInvalidValue, name, value);
4071static void __kmp_stg_print_kmp_dynamic_mode(kmp_str_buf_t *buffer,
4072 char const *name,
void *data) {
4074 if (__kmp_global.g.g_dynamic_mode == dynamic_default) {
4075 __kmp_str_buf_print(buffer,
" %s: %s \n", name, KMP_I18N_STR(NotDefined));
4077#ifdef USE_LOAD_BALANCE
4078 else if (__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
4079 __kmp_stg_print_str(buffer, name,
"load balance");
4082 else if (__kmp_global.g.g_dynamic_mode == dynamic_thread_limit) {
4083 __kmp_stg_print_str(buffer, name,
"thread limit");
4084 }
else if (__kmp_global.g.g_dynamic_mode == dynamic_random) {
4085 __kmp_stg_print_str(buffer, name,
"random");
4092#ifdef USE_LOAD_BALANCE
4097static void __kmp_stg_parse_ld_balance_interval(
char const *name,
4098 char const *value,
void *data) {
4099 double interval = __kmp_convert_to_double(value);
4100 if (interval >= 0) {
4101 __kmp_load_balance_interval = interval;
4103 KMP_WARNING(StgInvalidValue, name, value);
4107static void __kmp_stg_print_ld_balance_interval(kmp_str_buf_t *buffer,
4108 char const *name,
void *data) {
4110 __kmp_str_buf_print(buffer,
" %s=%8.6f\n", name,
4111 __kmp_load_balance_interval);
4120static void __kmp_stg_parse_init_at_fork(
char const *name,
char const *value,
4122 __kmp_stg_parse_bool(name, value, &__kmp_need_register_atfork);
4123 if (__kmp_need_register_atfork) {
4124 __kmp_need_register_atfork_specified = TRUE;
4128static void __kmp_stg_print_init_at_fork(kmp_str_buf_t *buffer,
4129 char const *name,
void *data) {
4130 __kmp_stg_print_bool(buffer, name, __kmp_need_register_atfork_specified);
4136static void __kmp_stg_parse_schedule(
char const *name,
char const *value,
4139 if (value != NULL) {
4140 size_t length = KMP_STRLEN(value);
4141 if (length > INT_MAX) {
4142 KMP_WARNING(LongValue, name);
4144 const char *semicolon;
4145 if (value[length - 1] ==
'"' || value[length - 1] ==
'\'')
4146 KMP_WARNING(UnbalancedQuotes, name);
4150 semicolon = strchr(value,
';');
4151 if (*value && semicolon != value) {
4152 const char *comma = strchr(value,
',');
4159 if (!__kmp_strcasecmp_with_sentinel(
"static", value, sentinel)) {
4160 if (!__kmp_strcasecmp_with_sentinel(
"greedy", comma,
';')) {
4161 __kmp_static = kmp_sch_static_greedy;
4163 }
else if (!__kmp_strcasecmp_with_sentinel(
"balanced", comma,
4165 __kmp_static = kmp_sch_static_balanced;
4168 }
else if (!__kmp_strcasecmp_with_sentinel(
"guided", value,
4170 if (!__kmp_strcasecmp_with_sentinel(
"iterative", comma,
';')) {
4171 __kmp_guided = kmp_sch_guided_iterative_chunked;
4173 }
else if (!__kmp_strcasecmp_with_sentinel(
"analytical", comma,
4176 __kmp_guided = kmp_sch_guided_analytical_chunked;
4180 KMP_WARNING(InvalidClause, name, value);
4182 KMP_WARNING(EmptyClause, name);
4183 }
while ((value = semicolon ? semicolon + 1 : NULL));
4189static void __kmp_stg_print_schedule(kmp_str_buf_t *buffer,
char const *name,
4191 if (__kmp_env_format) {
4192 KMP_STR_BUF_PRINT_NAME_EX(name);
4194 __kmp_str_buf_print(buffer,
" %s='", name);
4196 if (__kmp_static == kmp_sch_static_greedy) {
4197 __kmp_str_buf_print(buffer,
"%s",
"static,greedy");
4198 }
else if (__kmp_static == kmp_sch_static_balanced) {
4199 __kmp_str_buf_print(buffer,
"%s",
"static,balanced");
4201 if (__kmp_guided == kmp_sch_guided_iterative_chunked) {
4202 __kmp_str_buf_print(buffer,
";%s'\n",
"guided,iterative");
4203 }
else if (__kmp_guided == kmp_sch_guided_analytical_chunked) {
4204 __kmp_str_buf_print(buffer,
";%s'\n",
"guided,analytical");
4211static inline void __kmp_omp_schedule_restore() {
4212#if KMP_USE_HIER_SCHED
4213 __kmp_hier_scheds.deallocate();
4223static const char *__kmp_parse_single_omp_schedule(
const char *name,
4225 bool parse_hier =
false) {
4227 const char *ptr = value;
4234 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4236#if KMP_USE_HIER_SCHED
4237 kmp_hier_layer_e layer = kmp_hier_layer_e::LAYER_THREAD;
4239 if (*delim ==
',') {
4240 if (!__kmp_strcasecmp_with_sentinel(
"L1", ptr,
',')) {
4241 layer = kmp_hier_layer_e::LAYER_L1;
4242 }
else if (!__kmp_strcasecmp_with_sentinel(
"L2", ptr,
',')) {
4243 layer = kmp_hier_layer_e::LAYER_L2;
4244 }
else if (!__kmp_strcasecmp_with_sentinel(
"L3", ptr,
',')) {
4245 layer = kmp_hier_layer_e::LAYER_L3;
4246 }
else if (!__kmp_strcasecmp_with_sentinel(
"NUMA", ptr,
',')) {
4247 layer = kmp_hier_layer_e::LAYER_NUMA;
4250 if (layer != kmp_hier_layer_e::LAYER_THREAD && *delim !=
',') {
4252 KMP_WARNING(StgInvalidValue, name, value);
4253 __kmp_omp_schedule_restore();
4255 }
else if (layer != kmp_hier_layer_e::LAYER_THREAD) {
4257 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4264 if (*delim ==
':') {
4265 if (!__kmp_strcasecmp_with_sentinel(
"monotonic", ptr, *delim)) {
4268 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4270 }
else if (!__kmp_strcasecmp_with_sentinel(
"nonmonotonic", ptr, *delim)) {
4273 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4275 }
else if (!parse_hier) {
4277 KMP_WARNING(StgInvalidValue, name, value);
4278 __kmp_omp_schedule_restore();
4283 if (!__kmp_strcasecmp_with_sentinel(
"dynamic", ptr, *delim))
4284 sched = kmp_sch_dynamic_chunked;
4285 else if (!__kmp_strcasecmp_with_sentinel(
"guided", ptr, *delim))
4288 else if (!__kmp_strcasecmp_with_sentinel(
"auto", ptr, *delim))
4290 else if (!__kmp_strcasecmp_with_sentinel(
"trapezoidal", ptr, *delim))
4291 sched = kmp_sch_trapezoidal;
4292 else if (!__kmp_strcasecmp_with_sentinel(
"static", ptr, *delim))
4294#if KMP_STATIC_STEAL_ENABLED
4295 else if (!__kmp_strcasecmp_with_sentinel(
"static_steal", ptr, *delim)) {
4297 sched = kmp_sch_dynamic_chunked;
4303 KMP_WARNING(StgInvalidValue, name, value);
4304 __kmp_omp_schedule_restore();
4309 if (*delim ==
',') {
4312 if (!isdigit(*ptr)) {
4314 KMP_WARNING(StgInvalidValue, name, value);
4315 __kmp_omp_schedule_restore();
4321 __kmp_msg(kmp_ms_warning, KMP_MSG(IgnoreChunk, name, delim),
4325 sched = kmp_sch_static_chunked;
4326 chunk = __kmp_str_to_int(delim + 1, *ptr);
4328 chunk = KMP_DEFAULT_CHUNK;
4329 __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidChunk, name, delim),
4331 KMP_INFORM(Using_int_Value, name, __kmp_chunk);
4340 }
else if (chunk > KMP_MAX_CHUNK) {
4341 chunk = KMP_MAX_CHUNK;
4342 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeChunk, name, delim),
4344 KMP_INFORM(Using_int_Value, name, chunk);
4351 SCHEDULE_SET_MODIFIERS(sched, sched_modifier);
4353#if KMP_USE_HIER_SCHED
4354 if (layer != kmp_hier_layer_e::LAYER_THREAD) {
4355 __kmp_hier_scheds.append(sched, chunk, layer);
4359 __kmp_chunk = chunk;
4360 __kmp_sched = sched;
4365static void __kmp_stg_parse_omp_schedule(
char const *name,
char const *value,
4368 const char *ptr = value;
4371 length = KMP_STRLEN(value);
4373 if (value[length - 1] ==
'"' || value[length - 1] ==
'\'')
4374 KMP_WARNING(UnbalancedQuotes, name);
4376#if KMP_USE_HIER_SCHED
4377 if (!__kmp_strcasecmp_with_sentinel(
"EXPERIMENTAL", ptr,
' ')) {
4380 while ((ptr = __kmp_parse_single_omp_schedule(name, ptr,
true))) {
4381 while (*ptr ==
' ' || *ptr ==
'\t' || *ptr ==
':')
4388 __kmp_parse_single_omp_schedule(name, ptr);
4390 KMP_WARNING(EmptyString, name);
4392#if KMP_USE_HIER_SCHED
4393 __kmp_hier_scheds.sort();
4395 K_DIAG(1, (
"__kmp_static == %d\n", __kmp_static))
4396 K_DIAG(1, (
"__kmp_guided == %d\n", __kmp_guided))
4397 K_DIAG(1, (
"__kmp_sched == %d\n", __kmp_sched))
4398 K_DIAG(1, (
"__kmp_chunk == %d\n", __kmp_chunk))
4401static void __kmp_stg_print_omp_schedule(kmp_str_buf_t *buffer,
4402 char const *name,
void *data) {
4403 if (__kmp_env_format) {
4404 KMP_STR_BUF_PRINT_NAME_EX(name);
4406 __kmp_str_buf_print(buffer,
" %s='", name);
4408 enum sched_type sched = SCHEDULE_WITHOUT_MODIFIERS(__kmp_sched);
4409 if (SCHEDULE_HAS_MONOTONIC(__kmp_sched)) {
4410 __kmp_str_buf_print(buffer,
"monotonic:");
4411 }
else if (SCHEDULE_HAS_NONMONOTONIC(__kmp_sched)) {
4412 __kmp_str_buf_print(buffer,
"nonmonotonic:");
4416 case kmp_sch_dynamic_chunked:
4417 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"dynamic", __kmp_chunk);
4419 case kmp_sch_guided_iterative_chunked:
4420 case kmp_sch_guided_analytical_chunked:
4421 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"guided", __kmp_chunk);
4423 case kmp_sch_trapezoidal:
4424 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"trapezoidal", __kmp_chunk);
4427 case kmp_sch_static_chunked:
4428 case kmp_sch_static_balanced:
4429 case kmp_sch_static_greedy:
4430 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"static", __kmp_chunk);
4432 case kmp_sch_static_steal:
4433 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"static_steal", __kmp_chunk);
4436 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"auto", __kmp_chunk);
4439 KMP_ASSERT2(
false,
"Unhandled sched_type enumeration");
4440 KMP_BUILTIN_UNREACHABLE;
4445 case kmp_sch_dynamic_chunked:
4446 __kmp_str_buf_print(buffer,
"%s'\n",
"dynamic");
4448 case kmp_sch_guided_iterative_chunked:
4449 case kmp_sch_guided_analytical_chunked:
4450 __kmp_str_buf_print(buffer,
"%s'\n",
"guided");
4452 case kmp_sch_trapezoidal:
4453 __kmp_str_buf_print(buffer,
"%s'\n",
"trapezoidal");
4456 case kmp_sch_static_chunked:
4457 case kmp_sch_static_balanced:
4458 case kmp_sch_static_greedy:
4459 __kmp_str_buf_print(buffer,
"%s'\n",
"static");
4461 case kmp_sch_static_steal:
4462 __kmp_str_buf_print(buffer,
"%s'\n",
"static_steal");
4465 __kmp_str_buf_print(buffer,
"%s'\n",
"auto");
4468 KMP_ASSERT2(
false,
"Unhandled sched_type enumeration");
4469 KMP_BUILTIN_UNREACHABLE;
4475#if KMP_USE_HIER_SCHED
4478static void __kmp_stg_parse_kmp_hand_thread(
char const *name,
char const *value,
4480 __kmp_stg_parse_bool(name, value, &(__kmp_dispatch_hand_threading));
4483static void __kmp_stg_print_kmp_hand_thread(kmp_str_buf_t *buffer,
4484 char const *name,
void *data) {
4485 __kmp_stg_print_bool(buffer, name, __kmp_dispatch_hand_threading);
4491static void __kmp_stg_parse_kmp_force_monotonic(
char const *name,
4492 char const *value,
void *data) {
4493 __kmp_stg_parse_bool(name, value, &(__kmp_force_monotonic));
4496static void __kmp_stg_print_kmp_force_monotonic(kmp_str_buf_t *buffer,
4497 char const *name,
void *data) {
4498 __kmp_stg_print_bool(buffer, name, __kmp_force_monotonic);
4504static void __kmp_stg_parse_atomic_mode(
char const *name,
char const *value,
4510#ifdef KMP_GOMP_COMPAT
4513 __kmp_stg_parse_int(name, value, 0, max, &mode);
4518 __kmp_atomic_mode = mode;
4522static void __kmp_stg_print_atomic_mode(kmp_str_buf_t *buffer,
char const *name,
4524 __kmp_stg_print_int(buffer, name, __kmp_atomic_mode);
4530static void __kmp_stg_parse_consistency_check(
char const *name,
4531 char const *value,
void *data) {
4532 if (TCR_4(__kmp_init_serial)) {
4533 KMP_WARNING(EnvSerialWarn, name);
4536 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
4542 __kmp_env_consistency_check = TRUE;
4543 }
else if (!__kmp_strcasecmp_with_sentinel(
"none", value, 0)) {
4544 __kmp_env_consistency_check = FALSE;
4546 KMP_WARNING(StgInvalidValue, name, value);
4550static void __kmp_stg_print_consistency_check(kmp_str_buf_t *buffer,
4551 char const *name,
void *data) {
4553 const char *value = NULL;
4555 if (__kmp_env_consistency_check) {
4561 if (value != NULL) {
4562 __kmp_stg_print_str(buffer, name, value);
4573static void __kmp_stg_parse_itt_prepare_delay(
char const *name,
4574 char const *value,
void *data) {
4578 __kmp_stg_parse_int(name, value, 0, INT_MAX, &delay);
4579 __kmp_itt_prepare_delay = delay;
4582static void __kmp_stg_print_itt_prepare_delay(kmp_str_buf_t *buffer,
4583 char const *name,
void *data) {
4584 __kmp_stg_print_uint64(buffer, name, __kmp_itt_prepare_delay);
4594static void __kmp_stg_parse_malloc_pool_incr(
char const *name,
4595 char const *value,
void *data) {
4596 __kmp_stg_parse_size(name, value, KMP_MIN_MALLOC_POOL_INCR,
4597 KMP_MAX_MALLOC_POOL_INCR, NULL, &__kmp_malloc_pool_incr,
4601static void __kmp_stg_print_malloc_pool_incr(kmp_str_buf_t *buffer,
4602 char const *name,
void *data) {
4603 __kmp_stg_print_size(buffer, name, __kmp_malloc_pool_incr);
4612static void __kmp_stg_parse_par_range_env(
char const *name,
char const *value,
4614 __kmp_stg_parse_par_range(name, value, &__kmp_par_range,
4615 __kmp_par_range_routine, __kmp_par_range_filename,
4616 &__kmp_par_range_lb, &__kmp_par_range_ub);
4619static void __kmp_stg_print_par_range_env(kmp_str_buf_t *buffer,
4620 char const *name,
void *data) {
4621 if (__kmp_par_range != 0) {
4622 __kmp_stg_print_str(buffer, name, par_range_to_print);
4631static void __kmp_stg_parse_gtid_mode(
char const *name,
char const *value,
4641#ifdef KMP_TDATA_GTID
4644 __kmp_stg_parse_int(name, value, 0, max, &mode);
4648 __kmp_adjust_gtid_mode = TRUE;
4650 __kmp_gtid_mode = mode;
4651 __kmp_adjust_gtid_mode = FALSE;
4655static void __kmp_stg_print_gtid_mode(kmp_str_buf_t *buffer,
char const *name,
4657 if (__kmp_adjust_gtid_mode) {
4658 __kmp_stg_print_int(buffer, name, 0);
4660 __kmp_stg_print_int(buffer, name, __kmp_gtid_mode);
4667static void __kmp_stg_parse_lock_block(
char const *name,
char const *value,
4669 __kmp_stg_parse_int(name, value, 0, KMP_INT_MAX, &__kmp_num_locks_in_block);
4672static void __kmp_stg_print_lock_block(kmp_str_buf_t *buffer,
char const *name,
4674 __kmp_stg_print_int(buffer, name, __kmp_num_locks_in_block);
4680#if KMP_USE_DYNAMIC_LOCK
4681#define KMP_STORE_LOCK_SEQ(a) (__kmp_user_lock_seq = lockseq_##a)
4683#define KMP_STORE_LOCK_SEQ(a)
4686static void __kmp_stg_parse_lock_kind(
char const *name,
char const *value,
4688 if (__kmp_init_user_locks) {
4689 KMP_WARNING(EnvLockWarn, name);
4693 if (__kmp_str_match(
"tas", 2, value) ||
4694 __kmp_str_match(
"test and set", 2, value) ||
4695 __kmp_str_match(
"test_and_set", 2, value) ||
4696 __kmp_str_match(
"test-and-set", 2, value) ||
4697 __kmp_str_match(
"test andset", 2, value) ||
4698 __kmp_str_match(
"test_andset", 2, value) ||
4699 __kmp_str_match(
"test-andset", 2, value) ||
4700 __kmp_str_match(
"testand set", 2, value) ||
4701 __kmp_str_match(
"testand_set", 2, value) ||
4702 __kmp_str_match(
"testand-set", 2, value) ||
4703 __kmp_str_match(
"testandset", 2, value)) {
4704 __kmp_user_lock_kind = lk_tas;
4705 KMP_STORE_LOCK_SEQ(tas);
4708 else if (__kmp_str_match(
"futex", 1, value)) {
4709 if (__kmp_futex_determine_capable()) {
4710 __kmp_user_lock_kind = lk_futex;
4711 KMP_STORE_LOCK_SEQ(futex);
4713 KMP_WARNING(FutexNotSupported, name, value);
4717 else if (__kmp_str_match(
"ticket", 2, value)) {
4718 __kmp_user_lock_kind = lk_ticket;
4719 KMP_STORE_LOCK_SEQ(ticket);
4720 }
else if (__kmp_str_match(
"queuing", 1, value) ||
4721 __kmp_str_match(
"queue", 1, value)) {
4722 __kmp_user_lock_kind = lk_queuing;
4723 KMP_STORE_LOCK_SEQ(queuing);
4724 }
else if (__kmp_str_match(
"drdpa ticket", 1, value) ||
4725 __kmp_str_match(
"drdpa_ticket", 1, value) ||
4726 __kmp_str_match(
"drdpa-ticket", 1, value) ||
4727 __kmp_str_match(
"drdpaticket", 1, value) ||
4728 __kmp_str_match(
"drdpa", 1, value)) {
4729 __kmp_user_lock_kind = lk_drdpa;
4730 KMP_STORE_LOCK_SEQ(drdpa);
4732#if KMP_USE_ADAPTIVE_LOCKS
4733 else if (__kmp_str_match(
"adaptive", 1, value)) {
4734 if (__kmp_cpuinfo.flags.rtm) {
4735 __kmp_user_lock_kind = lk_adaptive;
4736 KMP_STORE_LOCK_SEQ(adaptive);
4738 KMP_WARNING(AdaptiveNotSupported, name, value);
4739 __kmp_user_lock_kind = lk_queuing;
4740 KMP_STORE_LOCK_SEQ(queuing);
4744#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
4745 else if (__kmp_str_match(
"rtm_queuing", 1, value)) {
4746 if (__kmp_cpuinfo.flags.rtm) {
4747 __kmp_user_lock_kind = lk_rtm_queuing;
4748 KMP_STORE_LOCK_SEQ(rtm_queuing);
4750 KMP_WARNING(AdaptiveNotSupported, name, value);
4751 __kmp_user_lock_kind = lk_queuing;
4752 KMP_STORE_LOCK_SEQ(queuing);
4754 }
else if (__kmp_str_match(
"rtm_spin", 1, value)) {
4755 if (__kmp_cpuinfo.flags.rtm) {
4756 __kmp_user_lock_kind = lk_rtm_spin;
4757 KMP_STORE_LOCK_SEQ(rtm_spin);
4759 KMP_WARNING(AdaptiveNotSupported, name, value);
4760 __kmp_user_lock_kind = lk_tas;
4761 KMP_STORE_LOCK_SEQ(queuing);
4763 }
else if (__kmp_str_match(
"hle", 1, value)) {
4764 __kmp_user_lock_kind = lk_hle;
4765 KMP_STORE_LOCK_SEQ(hle);
4769 KMP_WARNING(StgInvalidValue, name, value);
4773static void __kmp_stg_print_lock_kind(kmp_str_buf_t *buffer,
char const *name,
4775 const char *value = NULL;
4777 switch (__kmp_user_lock_kind) {
4792#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
4793 case lk_rtm_queuing:
4794 value =
"rtm_queuing";
4817#if KMP_USE_ADAPTIVE_LOCKS
4824 if (value != NULL) {
4825 __kmp_stg_print_str(buffer, name, value);
4834static void __kmp_stg_parse_spin_backoff_params(
const char *name,
4835 const char *value,
void *data) {
4836 const char *next = value;
4839 int prev_comma = FALSE;
4842 kmp_uint32 max_backoff = __kmp_spin_backoff_params.max_backoff;
4843 kmp_uint32 min_tick = __kmp_spin_backoff_params.min_tick;
4847 for (i = 0; i < 3; i++) {
4850 if (*next ==
'\0') {
4855 if (((*next <
'0' || *next >
'9') && *next !=
',') || total > 2) {
4856 KMP_WARNING(EnvSyntaxError, name, value);
4862 if (total == 0 || prev_comma) {
4870 if (*next >=
'0' && *next <=
'9') {
4872 const char *buf = next;
4873 char const *msg = NULL;
4878 const char *tmp = next;
4880 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
4881 KMP_WARNING(EnvSpacesNotAllowed, name, value);
4885 num = __kmp_str_to_int(buf, *next);
4887 msg = KMP_I18N_STR(ValueTooSmall);
4892 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
4893 KMP_INFORM(Using_int_Value, name, num);
4897 }
else if (total == 2) {
4903 KMP_WARNING(EnvSyntaxError, name, value);
4906 __kmp_spin_backoff_params.max_backoff = max_backoff;
4907 __kmp_spin_backoff_params.min_tick = min_tick;
4910static void __kmp_stg_print_spin_backoff_params(kmp_str_buf_t *buffer,
4911 char const *name,
void *data) {
4912 if (__kmp_env_format) {
4913 KMP_STR_BUF_PRINT_NAME_EX(name);
4915 __kmp_str_buf_print(buffer,
" %s='", name);
4917 __kmp_str_buf_print(buffer,
"%d,%d'\n", __kmp_spin_backoff_params.max_backoff,
4918 __kmp_spin_backoff_params.min_tick);
4921#if KMP_USE_ADAPTIVE_LOCKS
4928static void __kmp_stg_parse_adaptive_lock_props(
const char *name,
4929 const char *value,
void *data) {
4930 int max_retries = 0;
4931 int max_badness = 0;
4933 const char *next = value;
4936 int prev_comma = FALSE;
4942 for (i = 0; i < 3; i++) {
4945 if (*next ==
'\0') {
4950 if (((*next <
'0' || *next >
'9') && *next !=
',') || total > 2) {
4951 KMP_WARNING(EnvSyntaxError, name, value);
4957 if (total == 0 || prev_comma) {
4965 if (*next >=
'0' && *next <=
'9') {
4967 const char *buf = next;
4968 char const *msg = NULL;
4973 const char *tmp = next;
4975 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
4976 KMP_WARNING(EnvSpacesNotAllowed, name, value);
4980 num = __kmp_str_to_int(buf, *next);
4982 msg = KMP_I18N_STR(ValueTooSmall);
4987 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
4988 KMP_INFORM(Using_int_Value, name, num);
4992 }
else if (total == 2) {
4998 KMP_WARNING(EnvSyntaxError, name, value);
5001 __kmp_adaptive_backoff_params.max_soft_retries = max_retries;
5002 __kmp_adaptive_backoff_params.max_badness = max_badness;
5005static void __kmp_stg_print_adaptive_lock_props(kmp_str_buf_t *buffer,
5006 char const *name,
void *data) {
5007 if (__kmp_env_format) {
5008 KMP_STR_BUF_PRINT_NAME_EX(name);
5010 __kmp_str_buf_print(buffer,
" %s='", name);
5012 __kmp_str_buf_print(buffer,
"%d,%d'\n",
5013 __kmp_adaptive_backoff_params.max_soft_retries,
5014 __kmp_adaptive_backoff_params.max_badness);
5017#if KMP_DEBUG_ADAPTIVE_LOCKS
5019static void __kmp_stg_parse_speculative_statsfile(
char const *name,
5022 __kmp_stg_parse_file(name, value,
"",
5023 CCAST(
char **, &__kmp_speculative_statsfile));
5026static void __kmp_stg_print_speculative_statsfile(kmp_str_buf_t *buffer,
5029 if (__kmp_str_match(
"-", 0, __kmp_speculative_statsfile)) {
5030 __kmp_stg_print_str(buffer, name,
"stdout");
5032 __kmp_stg_print_str(buffer, name, __kmp_speculative_statsfile);
5048static kmp_hw_t __kmp_hw_subset_break_tie(
const kmp_hw_t *possible,
5049 size_t num_possible) {
5050 for (
size_t i = 0; i < num_possible; ++i) {
5051 if (possible[i] == KMP_HW_THREAD)
5052 return KMP_HW_THREAD;
5053 else if (possible[i] == KMP_HW_CORE)
5055 else if (possible[i] == KMP_HW_SOCKET)
5056 return KMP_HW_SOCKET;
5058 return KMP_HW_UNKNOWN;
5065static kmp_hw_t __kmp_stg_parse_hw_subset_name(
char const *token) {
5066 size_t index, num_possible, token_length;
5067 kmp_hw_t possible[KMP_HW_LAST];
5073 while (isalnum(*end) || *end ==
'_') {
5080 KMP_FOREACH_HW_TYPE(type) { possible[num_possible++] = type; }
5087 while (num_possible > 1 && index < token_length) {
5088 size_t n = num_possible;
5089 char token_char = (char)toupper(token[index]);
5090 for (
size_t i = 0; i < n; ++i) {
5092 kmp_hw_t type = possible[i];
5093 s = __kmp_hw_get_keyword(type,
false);
5094 if (index < KMP_STRLEN(s)) {
5095 char c = (char)toupper(s[index]);
5097 if (c != token_char) {
5098 possible[i] = KMP_HW_UNKNOWN;
5105 for (
size_t i = 0; i < n; ++i) {
5106 if (possible[i] != KMP_HW_UNKNOWN) {
5107 kmp_hw_t temp = possible[i];
5108 possible[i] = possible[start];
5109 possible[start] = temp;
5113 KMP_ASSERT(start == num_possible);
5119 if (num_possible > 1)
5120 return __kmp_hw_subset_break_tie(possible, num_possible);
5121 if (num_possible == 1)
5123 return KMP_HW_UNKNOWN;
5128#define MAX_T_LEVEL KMP_HW_LAST
5129#define MAX_STR_LEN 512
5130static void __kmp_stg_parse_hw_subset(
char const *name,
char const *value,
5134 kmp_setting_t **rivals = (kmp_setting_t **)data;
5135 if (strcmp(name,
"KMP_PLACE_THREADS") == 0) {
5136 KMP_INFORM(EnvVarDeprecated, name,
"KMP_HW_SUBSET");
5138 if (__kmp_stg_check_rivals(name, value, rivals)) {
5142 char *components[MAX_T_LEVEL];
5143 char const *digits =
"0123456789";
5144 char input[MAX_STR_LEN];
5145 size_t len = 0, mlen = MAX_STR_LEN;
5147 bool absolute =
false;
5149 char *pos = CCAST(
char *, value);
5150 while (*pos && mlen) {
5152 if (len == 0 && *pos ==
':') {
5155 input[len] = (char)(toupper(*pos));
5156 if (input[len] ==
'X')
5158 if (input[len] ==
'O' && strchr(digits, *(pos + 1)))
5166 if (len == 0 || mlen == 0) {
5172 components[level++] = pos;
5173 while ((pos = strchr(pos,
','))) {
5174 if (level >= MAX_T_LEVEL)
5177 components[level++] = ++pos;
5180 __kmp_hw_subset = kmp_hw_subset_t::allocate();
5182 __kmp_hw_subset->set_absolute();
5185 for (
int i = 0; i < level; ++i) {
5187 char *core_components[MAX_T_LEVEL];
5189 pos = components[i];
5190 core_components[core_level++] = pos;
5191 while ((pos = strchr(pos,
'&'))) {
5192 if (core_level >= MAX_T_LEVEL)
5195 core_components[core_level++] = ++pos;
5198 for (
int j = 0; j < core_level; ++j) {
5205 if (isdigit(*core_components[j])) {
5206 num = atoi(core_components[j]);
5210 pos = core_components[j] + strspn(core_components[j], digits);
5211 }
else if (*core_components[j] ==
'*') {
5212 num = kmp_hw_subset_t::USE_ALL;
5213 pos = core_components[j] + 1;
5215 num = kmp_hw_subset_t::USE_ALL;
5216 pos = core_components[j];
5219 offset_ptr = strchr(core_components[j],
'@');
5220 attr_ptr = strchr(core_components[j],
':');
5223 offset = atoi(offset_ptr + 1);
5229#if KMP_ARCH_X86 || KMP_ARCH_X86_64
5230 if (__kmp_str_match(
"intel_core", -1, attr_ptr + 1)) {
5231 attr.set_core_type(KMP_HW_CORE_TYPE_CORE);
5232 }
else if (__kmp_str_match(
"intel_atom", -1, attr_ptr + 1)) {
5233 attr.set_core_type(KMP_HW_CORE_TYPE_ATOM);
5236 if (__kmp_str_match(
"eff", 3, attr_ptr + 1)) {
5237 const char *number = attr_ptr + 1;
5239 while (isalpha(*number))
5241 if (!isdigit(*number)) {
5244 int efficiency = atoi(number);
5245 attr.set_core_eff(efficiency);
5252 kmp_hw_t type = __kmp_stg_parse_hw_subset_name(pos);
5253 if (type == KMP_HW_UNKNOWN) {
5257 if (attr && type != KMP_HW_CORE)
5260 if (type != KMP_HW_CORE && __kmp_hw_subset->specified(type)) {
5263 __kmp_hw_subset->push_back(num, type, offset, attr);
5268 KMP_WARNING(AffHWSubsetInvalid, name, value);
5269 if (__kmp_hw_subset) {
5270 kmp_hw_subset_t::deallocate(__kmp_hw_subset);
5271 __kmp_hw_subset =
nullptr;
5276static void __kmp_stg_print_hw_subset(kmp_str_buf_t *buffer,
char const *name,
5280 if (!__kmp_hw_subset)
5282 __kmp_str_buf_init(&buf);
5283 if (__kmp_env_format)
5284 KMP_STR_BUF_PRINT_NAME_EX(name);
5286 __kmp_str_buf_print(buffer,
" %s='", name);
5288 depth = __kmp_hw_subset->get_depth();
5289 for (
int i = 0; i < depth; ++i) {
5290 const auto &item = __kmp_hw_subset->at(i);
5292 __kmp_str_buf_print(&buf,
"%c",
',');
5293 for (
int j = 0; j < item.num_attrs; ++j) {
5294 __kmp_str_buf_print(&buf,
"%s%d%s", (j > 0 ?
"&" :
""), item.num[j],
5295 __kmp_hw_get_keyword(item.type));
5296 if (item.attr[j].is_core_type_valid())
5297 __kmp_str_buf_print(
5299 __kmp_hw_get_core_type_keyword(item.attr[j].get_core_type()));
5300 if (item.attr[j].is_core_eff_valid())
5301 __kmp_str_buf_print(&buf,
":eff%d", item.attr[j].get_core_eff());
5303 __kmp_str_buf_print(&buf,
"@%d", item.offset[j]);
5306 __kmp_str_buf_print(buffer,
"%s'\n", buf.str);
5307 __kmp_str_buf_free(&buf);
5314static void __kmp_stg_parse_forkjoin_frames(
char const *name,
char const *value,
5316 __kmp_stg_parse_bool(name, value, &__kmp_forkjoin_frames);
5319static void __kmp_stg_print_forkjoin_frames(kmp_str_buf_t *buffer,
5320 char const *name,
void *data) {
5321 __kmp_stg_print_bool(buffer, name, __kmp_forkjoin_frames);
5327static void __kmp_stg_parse_forkjoin_frames_mode(
char const *name,
5330 __kmp_stg_parse_int(name, value, 0, 3, &__kmp_forkjoin_frames_mode);
5333static void __kmp_stg_print_forkjoin_frames_mode(kmp_str_buf_t *buffer,
5334 char const *name,
void *data) {
5335 __kmp_stg_print_int(buffer, name, __kmp_forkjoin_frames_mode);
5342static void __kmp_stg_parse_task_throttling(
char const *name,
char const *value,
5344 __kmp_stg_parse_bool(name, value, &__kmp_enable_task_throttling);
5347static void __kmp_stg_print_task_throttling(kmp_str_buf_t *buffer,
5348 char const *name,
void *data) {
5349 __kmp_stg_print_bool(buffer, name, __kmp_enable_task_throttling);
5352#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
5356static void __kmp_stg_parse_user_level_mwait(
char const *name,
5357 char const *value,
void *data) {
5358 __kmp_stg_parse_bool(name, value, &__kmp_user_level_mwait);
5361static void __kmp_stg_print_user_level_mwait(kmp_str_buf_t *buffer,
5362 char const *name,
void *data) {
5363 __kmp_stg_print_bool(buffer, name, __kmp_user_level_mwait);
5369static void __kmp_stg_parse_mwait_hints(
char const *name,
char const *value,
5371 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_mwait_hints);
5374static void __kmp_stg_print_mwait_hints(kmp_str_buf_t *buffer,
char const *name,
5376 __kmp_stg_print_int(buffer, name, __kmp_mwait_hints);
5386static void __kmp_stg_parse_tpause(
char const *name,
char const *value,
5388 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_tpause_state);
5389 if (__kmp_tpause_state != 0) {
5391 if (__kmp_tpause_state == 2)
5392 __kmp_tpause_hint = 0;
5396static void __kmp_stg_print_tpause(kmp_str_buf_t *buffer,
char const *name,
5398 __kmp_stg_print_int(buffer, name, __kmp_tpause_state);
5405static void __kmp_stg_parse_omp_display_env(
char const *name,
char const *value,
5407 if (__kmp_str_match(
"VERBOSE", 1, value)) {
5408 __kmp_display_env_verbose = TRUE;
5410 __kmp_stg_parse_bool(name, value, &__kmp_display_env);
5414static void __kmp_stg_print_omp_display_env(kmp_str_buf_t *buffer,
5415 char const *name,
void *data) {
5416 if (__kmp_display_env_verbose) {
5417 __kmp_stg_print_str(buffer, name,
"VERBOSE");
5419 __kmp_stg_print_bool(buffer, name, __kmp_display_env);
5423static void __kmp_stg_parse_omp_cancellation(
char const *name,
5424 char const *value,
void *data) {
5425 if (TCR_4(__kmp_init_parallel)) {
5426 KMP_WARNING(EnvParallelWarn, name);
5429 __kmp_stg_parse_bool(name, value, &__kmp_omp_cancellation);
5432static void __kmp_stg_print_omp_cancellation(kmp_str_buf_t *buffer,
5433 char const *name,
void *data) {
5434 __kmp_stg_print_bool(buffer, name, __kmp_omp_cancellation);
5440static void __kmp_stg_parse_omp_tool(
char const *name,
char const *value,
5442 __kmp_stg_parse_bool(name, value, &__kmp_tool);
5445static void __kmp_stg_print_omp_tool(kmp_str_buf_t *buffer,
char const *name,
5447 if (__kmp_env_format) {
5448 KMP_STR_BUF_PRINT_BOOL_EX(name, __kmp_tool,
"enabled",
"disabled");
5450 __kmp_str_buf_print(buffer,
" %s=%s\n", name,
5451 __kmp_tool ?
"enabled" :
"disabled");
5455char *__kmp_tool_libraries = NULL;
5457static void __kmp_stg_parse_omp_tool_libraries(
char const *name,
5458 char const *value,
void *data) {
5459 __kmp_stg_parse_str(name, value, &__kmp_tool_libraries);
5462static void __kmp_stg_print_omp_tool_libraries(kmp_str_buf_t *buffer,
5463 char const *name,
void *data) {
5464 if (__kmp_tool_libraries)
5465 __kmp_stg_print_str(buffer, name, __kmp_tool_libraries);
5467 if (__kmp_env_format) {
5468 KMP_STR_BUF_PRINT_NAME;
5470 __kmp_str_buf_print(buffer,
" %s", name);
5472 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
5476char *__kmp_tool_verbose_init = NULL;
5478static void __kmp_stg_parse_omp_tool_verbose_init(
char const *name,
5481 __kmp_stg_parse_str(name, value, &__kmp_tool_verbose_init);
5484static void __kmp_stg_print_omp_tool_verbose_init(kmp_str_buf_t *buffer,
5487 if (__kmp_tool_verbose_init)
5488 __kmp_stg_print_str(buffer, name, __kmp_tool_verbose_init);
5490 if (__kmp_env_format) {
5491 KMP_STR_BUF_PRINT_NAME;
5493 __kmp_str_buf_print(buffer,
" %s", name);
5495 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
5503static kmp_setting_t __kmp_stg_table[] = {
5505 {
"KMP_ALL_THREADS", __kmp_stg_parse_device_thread_limit, NULL, NULL, 0, 0},
5506 {
"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime,
5508 {
"KMP_USE_YIELD", __kmp_stg_parse_use_yield, __kmp_stg_print_use_yield,
5510 {
"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok,
5511 __kmp_stg_print_duplicate_lib_ok, NULL, 0, 0},
5512 {
"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy,
5514 {
"KMP_DEVICE_THREAD_LIMIT", __kmp_stg_parse_device_thread_limit,
5515 __kmp_stg_print_device_thread_limit, NULL, 0, 0},
5517 {
"KMP_MONITOR_STACKSIZE", __kmp_stg_parse_monitor_stacksize,
5518 __kmp_stg_print_monitor_stacksize, NULL, 0, 0},
5520 {
"KMP_SETTINGS", __kmp_stg_parse_settings, __kmp_stg_print_settings, NULL,
5522 {
"KMP_STACKOFFSET", __kmp_stg_parse_stackoffset,
5523 __kmp_stg_print_stackoffset, NULL, 0, 0},
5524 {
"KMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize,
5526 {
"KMP_STACKPAD", __kmp_stg_parse_stackpad, __kmp_stg_print_stackpad, NULL,
5528 {
"KMP_VERSION", __kmp_stg_parse_version, __kmp_stg_print_version, NULL, 0,
5530 {
"KMP_WARNINGS", __kmp_stg_parse_warnings, __kmp_stg_print_warnings, NULL,
5533 {
"KMP_NESTING_MODE", __kmp_stg_parse_nesting_mode,
5534 __kmp_stg_print_nesting_mode, NULL, 0, 0},
5535 {
"OMP_NESTED", __kmp_stg_parse_nested, __kmp_stg_print_nested, NULL, 0, 0},
5536 {
"OMP_NUM_THREADS", __kmp_stg_parse_num_threads,
5537 __kmp_stg_print_num_threads, NULL, 0, 0},
5538 {
"OMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize,
5541 {
"KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0,
5543 {
"KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing,
5544 __kmp_stg_print_task_stealing, NULL, 0, 0},
5545 {
"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels,
5546 __kmp_stg_print_max_active_levels, NULL, 0, 0},
5547 {
"OMP_DEFAULT_DEVICE", __kmp_stg_parse_default_device,
5548 __kmp_stg_print_default_device, NULL, 0, 0},
5549 {
"OMP_TARGET_OFFLOAD", __kmp_stg_parse_target_offload,
5550 __kmp_stg_print_target_offload, NULL, 0, 0},
5551 {
"OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority,
5552 __kmp_stg_print_max_task_priority, NULL, 0, 0},
5553 {
"KMP_TASKLOOP_MIN_TASKS", __kmp_stg_parse_taskloop_min_tasks,
5554 __kmp_stg_print_taskloop_min_tasks, NULL, 0, 0},
5555 {
"OMP_THREAD_LIMIT", __kmp_stg_parse_thread_limit,
5556 __kmp_stg_print_thread_limit, NULL, 0, 0},
5557 {
"KMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_thread_limit,
5558 __kmp_stg_print_teams_thread_limit, NULL, 0, 0},
5559 {
"OMP_NUM_TEAMS", __kmp_stg_parse_nteams, __kmp_stg_print_nteams, NULL, 0,
5561 {
"OMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_th_limit,
5562 __kmp_stg_print_teams_th_limit, NULL, 0, 0},
5563 {
"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy,
5564 __kmp_stg_print_wait_policy, NULL, 0, 0},
5565 {
"KMP_DISP_NUM_BUFFERS", __kmp_stg_parse_disp_buffers,
5566 __kmp_stg_print_disp_buffers, NULL, 0, 0},
5567 {
"KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level,
5568 __kmp_stg_print_hot_teams_level, NULL, 0, 0},
5569 {
"KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode,
5570 __kmp_stg_print_hot_teams_mode, NULL, 0, 0},
5572#if KMP_HANDLE_SIGNALS
5573 {
"KMP_HANDLE_SIGNALS", __kmp_stg_parse_handle_signals,
5574 __kmp_stg_print_handle_signals, NULL, 0, 0},
5577#if KMP_ARCH_X86 || KMP_ARCH_X86_64
5578 {
"KMP_INHERIT_FP_CONTROL", __kmp_stg_parse_inherit_fp_control,
5579 __kmp_stg_print_inherit_fp_control, NULL, 0, 0},
5582#ifdef KMP_GOMP_COMPAT
5583 {
"GOMP_STACKSIZE", __kmp_stg_parse_stacksize, NULL, NULL, 0, 0},
5587 {
"KMP_A_DEBUG", __kmp_stg_parse_a_debug, __kmp_stg_print_a_debug, NULL, 0,
5589 {
"KMP_B_DEBUG", __kmp_stg_parse_b_debug, __kmp_stg_print_b_debug, NULL, 0,
5591 {
"KMP_C_DEBUG", __kmp_stg_parse_c_debug, __kmp_stg_print_c_debug, NULL, 0,
5593 {
"KMP_D_DEBUG", __kmp_stg_parse_d_debug, __kmp_stg_print_d_debug, NULL, 0,
5595 {
"KMP_E_DEBUG", __kmp_stg_parse_e_debug, __kmp_stg_print_e_debug, NULL, 0,
5597 {
"KMP_F_DEBUG", __kmp_stg_parse_f_debug, __kmp_stg_print_f_debug, NULL, 0,
5599 {
"KMP_DEBUG", __kmp_stg_parse_debug, NULL, NULL, 0, 0},
5600 {
"KMP_DEBUG_BUF", __kmp_stg_parse_debug_buf, __kmp_stg_print_debug_buf,
5602 {
"KMP_DEBUG_BUF_ATOMIC", __kmp_stg_parse_debug_buf_atomic,
5603 __kmp_stg_print_debug_buf_atomic, NULL, 0, 0},
5604 {
"KMP_DEBUG_BUF_CHARS", __kmp_stg_parse_debug_buf_chars,
5605 __kmp_stg_print_debug_buf_chars, NULL, 0, 0},
5606 {
"KMP_DEBUG_BUF_LINES", __kmp_stg_parse_debug_buf_lines,
5607 __kmp_stg_print_debug_buf_lines, NULL, 0, 0},
5608 {
"KMP_DIAG", __kmp_stg_parse_diag, __kmp_stg_print_diag, NULL, 0, 0},
5610 {
"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env,
5611 __kmp_stg_print_par_range_env, NULL, 0, 0},
5614 {
"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc,
5615 __kmp_stg_print_align_alloc, NULL, 0, 0},
5617 {
"KMP_PLAIN_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5618 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5619 {
"KMP_PLAIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5620 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5621 {
"KMP_FORKJOIN_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5622 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5623 {
"KMP_FORKJOIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5624 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5625#if KMP_FAST_REDUCTION_BARRIER
5626 {
"KMP_REDUCTION_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5627 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5628 {
"KMP_REDUCTION_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5629 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5632 {
"KMP_ABORT_DELAY", __kmp_stg_parse_abort_delay,
5633 __kmp_stg_print_abort_delay, NULL, 0, 0},
5634 {
"KMP_CPUINFO_FILE", __kmp_stg_parse_cpuinfo_file,
5635 __kmp_stg_print_cpuinfo_file, NULL, 0, 0},
5636 {
"KMP_FORCE_REDUCTION", __kmp_stg_parse_force_reduction,
5637 __kmp_stg_print_force_reduction, NULL, 0, 0},
5638 {
"KMP_DETERMINISTIC_REDUCTION", __kmp_stg_parse_force_reduction,
5639 __kmp_stg_print_force_reduction, NULL, 0, 0},
5640 {
"KMP_STORAGE_MAP", __kmp_stg_parse_storage_map,
5641 __kmp_stg_print_storage_map, NULL, 0, 0},
5642 {
"KMP_ALL_THREADPRIVATE", __kmp_stg_parse_all_threadprivate,
5643 __kmp_stg_print_all_threadprivate, NULL, 0, 0},
5644 {
"KMP_FOREIGN_THREADS_THREADPRIVATE",
5645 __kmp_stg_parse_foreign_threads_threadprivate,
5646 __kmp_stg_print_foreign_threads_threadprivate, NULL, 0, 0},
5648#if KMP_AFFINITY_SUPPORTED
5649 {
"KMP_AFFINITY", __kmp_stg_parse_affinity, __kmp_stg_print_affinity, NULL,
5651 {
"KMP_HIDDEN_HELPER_AFFINITY", __kmp_stg_parse_hh_affinity,
5652 __kmp_stg_print_hh_affinity, NULL, 0, 0},
5653#ifdef KMP_GOMP_COMPAT
5654 {
"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL,
5657 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
5659 {
"KMP_TEAMS_PROC_BIND", __kmp_stg_parse_teams_proc_bind,
5660 __kmp_stg_print_teams_proc_bind, NULL, 0, 0},
5661 {
"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0},
5662 {
"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method,
5663 __kmp_stg_print_topology_method, NULL, 0, 0},
5669 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
5673 {
"OMP_DISPLAY_AFFINITY", __kmp_stg_parse_display_affinity,
5674 __kmp_stg_print_display_affinity, NULL, 0, 0},
5675 {
"OMP_AFFINITY_FORMAT", __kmp_stg_parse_affinity_format,
5676 __kmp_stg_print_affinity_format, NULL, 0, 0},
5677 {
"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork,
5678 __kmp_stg_print_init_at_fork, NULL, 0, 0},
5679 {
"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL,
5681 {
"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule,
5683#if KMP_USE_HIER_SCHED
5684 {
"KMP_DISP_HAND_THREAD", __kmp_stg_parse_kmp_hand_thread,
5685 __kmp_stg_print_kmp_hand_thread, NULL, 0, 0},
5687 {
"KMP_FORCE_MONOTONIC_DYNAMIC_SCHEDULE",
5688 __kmp_stg_parse_kmp_force_monotonic, __kmp_stg_print_kmp_force_monotonic,
5690 {
"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode,
5691 __kmp_stg_print_atomic_mode, NULL, 0, 0},
5692 {
"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check,
5693 __kmp_stg_print_consistency_check, NULL, 0, 0},
5695#if USE_ITT_BUILD && USE_ITT_NOTIFY
5696 {
"KMP_ITT_PREPARE_DELAY", __kmp_stg_parse_itt_prepare_delay,
5697 __kmp_stg_print_itt_prepare_delay, NULL, 0, 0},
5699 {
"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr,
5700 __kmp_stg_print_malloc_pool_incr, NULL, 0, 0},
5701 {
"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode,
5703 {
"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic,
5705 {
"KMP_DYNAMIC_MODE", __kmp_stg_parse_kmp_dynamic_mode,
5706 __kmp_stg_print_kmp_dynamic_mode, NULL, 0, 0},
5708#ifdef USE_LOAD_BALANCE
5709 {
"KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,
5710 __kmp_stg_print_ld_balance_interval, NULL, 0, 0},
5713 {
"KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block,
5714 __kmp_stg_print_lock_block, NULL, 0, 0},
5715 {
"KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind,
5717 {
"KMP_SPIN_BACKOFF_PARAMS", __kmp_stg_parse_spin_backoff_params,
5718 __kmp_stg_print_spin_backoff_params, NULL, 0, 0},
5719#if KMP_USE_ADAPTIVE_LOCKS
5720 {
"KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,
5721 __kmp_stg_print_adaptive_lock_props, NULL, 0, 0},
5722#if KMP_DEBUG_ADAPTIVE_LOCKS
5723 {
"KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,
5724 __kmp_stg_print_speculative_statsfile, NULL, 0, 0},
5727 {
"KMP_PLACE_THREADS", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset,
5729 {
"KMP_HW_SUBSET", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset,
5732 {
"KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames,
5733 __kmp_stg_print_forkjoin_frames, NULL, 0, 0},
5734 {
"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,
5735 __kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0},
5737 {
"KMP_ENABLE_TASK_THROTTLING", __kmp_stg_parse_task_throttling,
5738 __kmp_stg_print_task_throttling, NULL, 0, 0},
5740 {
"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env,
5741 __kmp_stg_print_omp_display_env, NULL, 0, 0},
5742 {
"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation,
5743 __kmp_stg_print_omp_cancellation, NULL, 0, 0},
5744 {
"OMP_ALLOCATOR", __kmp_stg_parse_allocator, __kmp_stg_print_allocator,
5746 {
"LIBOMP_USE_HIDDEN_HELPER_TASK", __kmp_stg_parse_use_hidden_helper,
5747 __kmp_stg_print_use_hidden_helper, NULL, 0, 0},
5748 {
"LIBOMP_NUM_HIDDEN_HELPER_THREADS",
5749 __kmp_stg_parse_num_hidden_helper_threads,
5750 __kmp_stg_print_num_hidden_helper_threads, NULL, 0, 0},
5751#if OMP_TASKGRAPH_EXPERIMENTAL
5752 {
"KMP_MAX_TDGS", __kmp_stg_parse_max_tdgs, __kmp_std_print_max_tdgs, NULL,
5754 {
"KMP_TDG_DOT", __kmp_stg_parse_tdg_dot, __kmp_stg_print_tdg_dot, NULL, 0,
5759 {
"OMP_TOOL", __kmp_stg_parse_omp_tool, __kmp_stg_print_omp_tool, NULL, 0,
5761 {
"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries,
5762 __kmp_stg_print_omp_tool_libraries, NULL, 0, 0},
5763 {
"OMP_TOOL_VERBOSE_INIT", __kmp_stg_parse_omp_tool_verbose_init,
5764 __kmp_stg_print_omp_tool_verbose_init, NULL, 0, 0},
5767#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
5768 {
"KMP_USER_LEVEL_MWAIT", __kmp_stg_parse_user_level_mwait,
5769 __kmp_stg_print_user_level_mwait, NULL, 0, 0},
5770 {
"KMP_MWAIT_HINTS", __kmp_stg_parse_mwait_hints,
5771 __kmp_stg_print_mwait_hints, NULL, 0, 0},
5775 {
"KMP_TPAUSE", __kmp_stg_parse_tpause, __kmp_stg_print_tpause, NULL, 0, 0},
5777 {
"", NULL, NULL, NULL, 0, 0}};
5779static int const __kmp_stg_count =
5780 sizeof(__kmp_stg_table) /
sizeof(kmp_setting_t);
5782static inline kmp_setting_t *__kmp_stg_find(
char const *name) {
5786 for (i = 0; i < __kmp_stg_count; ++i) {
5787 if (strcmp(__kmp_stg_table[i].name, name) == 0) {
5788 return &__kmp_stg_table[i];
5796static int __kmp_stg_cmp(
void const *_a,
void const *_b) {
5797 const kmp_setting_t *a = RCAST(
const kmp_setting_t *, _a);
5798 const kmp_setting_t *b = RCAST(
const kmp_setting_t *, _b);
5802 if (strcmp(a->name,
"KMP_AFFINITY") == 0) {
5803 if (strcmp(b->name,
"KMP_AFFINITY") == 0) {
5807 }
else if (strcmp(b->name,
"KMP_AFFINITY") == 0) {
5810 return strcmp(a->name, b->name);
5813static void __kmp_stg_init(
void) {
5815 static int initialized = 0;
5820 qsort(__kmp_stg_table, __kmp_stg_count - 1,
sizeof(kmp_setting_t),
5824 kmp_setting_t *kmp_stacksize =
5825 __kmp_stg_find(
"KMP_STACKSIZE");
5826#ifdef KMP_GOMP_COMPAT
5827 kmp_setting_t *gomp_stacksize =
5828 __kmp_stg_find(
"GOMP_STACKSIZE");
5830 kmp_setting_t *omp_stacksize =
5831 __kmp_stg_find(
"OMP_STACKSIZE");
5837 static kmp_setting_t *
volatile rivals[4];
5838 static kmp_stg_ss_data_t kmp_data = {1, CCAST(kmp_setting_t **, rivals)};
5839#ifdef KMP_GOMP_COMPAT
5840 static kmp_stg_ss_data_t gomp_data = {1024,
5841 CCAST(kmp_setting_t **, rivals)};
5843 static kmp_stg_ss_data_t omp_data = {1024,
5844 CCAST(kmp_setting_t **, rivals)};
5847 rivals[i++] = kmp_stacksize;
5848#ifdef KMP_GOMP_COMPAT
5849 if (gomp_stacksize != NULL) {
5850 rivals[i++] = gomp_stacksize;
5853 rivals[i++] = omp_stacksize;
5856 kmp_stacksize->data = &kmp_data;
5857#ifdef KMP_GOMP_COMPAT
5858 if (gomp_stacksize != NULL) {
5859 gomp_stacksize->data = &gomp_data;
5862 omp_stacksize->data = &omp_data;
5866 kmp_setting_t *kmp_library =
5867 __kmp_stg_find(
"KMP_LIBRARY");
5868 kmp_setting_t *omp_wait_policy =
5869 __kmp_stg_find(
"OMP_WAIT_POLICY");
5872 static kmp_setting_t *
volatile rivals[3];
5873 static kmp_stg_wp_data_t kmp_data = {0, CCAST(kmp_setting_t **, rivals)};
5874 static kmp_stg_wp_data_t omp_data = {1, CCAST(kmp_setting_t **, rivals)};
5877 rivals[i++] = kmp_library;
5878 if (omp_wait_policy != NULL) {
5879 rivals[i++] = omp_wait_policy;
5883 kmp_library->data = &kmp_data;
5884 if (omp_wait_policy != NULL) {
5885 omp_wait_policy->data = &omp_data;
5890 kmp_setting_t *kmp_device_thread_limit =
5891 __kmp_stg_find(
"KMP_DEVICE_THREAD_LIMIT");
5892 kmp_setting_t *kmp_all_threads =
5893 __kmp_stg_find(
"KMP_ALL_THREADS");
5896 static kmp_setting_t *
volatile rivals[3];
5899 rivals[i++] = kmp_device_thread_limit;
5900 rivals[i++] = kmp_all_threads;
5903 kmp_device_thread_limit->data = CCAST(kmp_setting_t **, rivals);
5904 kmp_all_threads->data = CCAST(kmp_setting_t **, rivals);
5909 kmp_setting_t *kmp_hw_subset = __kmp_stg_find(
"KMP_HW_SUBSET");
5911 kmp_setting_t *kmp_place_threads = __kmp_stg_find(
"KMP_PLACE_THREADS");
5914 static kmp_setting_t *
volatile rivals[3];
5917 rivals[i++] = kmp_hw_subset;
5918 rivals[i++] = kmp_place_threads;
5921 kmp_hw_subset->data = CCAST(kmp_setting_t **, rivals);
5922 kmp_place_threads->data = CCAST(kmp_setting_t **, rivals);
5925#if KMP_AFFINITY_SUPPORTED
5927 kmp_setting_t *kmp_affinity =
5928 __kmp_stg_find(
"KMP_AFFINITY");
5929 KMP_DEBUG_ASSERT(kmp_affinity != NULL);
5931#ifdef KMP_GOMP_COMPAT
5932 kmp_setting_t *gomp_cpu_affinity =
5933 __kmp_stg_find(
"GOMP_CPU_AFFINITY");
5934 KMP_DEBUG_ASSERT(gomp_cpu_affinity != NULL);
5937 kmp_setting_t *omp_proc_bind =
5938 __kmp_stg_find(
"OMP_PROC_BIND");
5939 KMP_DEBUG_ASSERT(omp_proc_bind != NULL);
5942 static kmp_setting_t *
volatile rivals[4];
5945 rivals[i++] = kmp_affinity;
5947#ifdef KMP_GOMP_COMPAT
5948 rivals[i++] = gomp_cpu_affinity;
5949 gomp_cpu_affinity->data = CCAST(kmp_setting_t **, rivals);
5952 rivals[i++] = omp_proc_bind;
5953 omp_proc_bind->data = CCAST(kmp_setting_t **, rivals);
5956 static kmp_setting_t *
volatile places_rivals[4];
5959 kmp_setting_t *omp_places = __kmp_stg_find(
"OMP_PLACES");
5960 KMP_DEBUG_ASSERT(omp_places != NULL);
5962 places_rivals[i++] = kmp_affinity;
5963#ifdef KMP_GOMP_COMPAT
5964 places_rivals[i++] = gomp_cpu_affinity;
5966 places_rivals[i++] = omp_places;
5967 omp_places->data = CCAST(kmp_setting_t **, places_rivals);
5968 places_rivals[i++] = NULL;
5976 kmp_setting_t *kmp_force_red =
5977 __kmp_stg_find(
"KMP_FORCE_REDUCTION");
5978 kmp_setting_t *kmp_determ_red =
5979 __kmp_stg_find(
"KMP_DETERMINISTIC_REDUCTION");
5982 static kmp_setting_t *
volatile rivals[3];
5983 static kmp_stg_fr_data_t force_data = {1,
5984 CCAST(kmp_setting_t **, rivals)};
5985 static kmp_stg_fr_data_t determ_data = {0,
5986 CCAST(kmp_setting_t **, rivals)};
5989 rivals[i++] = kmp_force_red;
5990 if (kmp_determ_red != NULL) {
5991 rivals[i++] = kmp_determ_red;
5995 kmp_force_red->data = &force_data;
5996 if (kmp_determ_red != NULL) {
5997 kmp_determ_red->data = &determ_data;
6006 for (i = 0; i < __kmp_stg_count; ++i) {
6007 __kmp_stg_table[i].set = 0;
6012static void __kmp_stg_parse(
char const *name,
char const *value) {
6020 if (value != NULL) {
6021 kmp_setting_t *setting = __kmp_stg_find(name);
6022 if (setting != NULL) {
6023 setting->parse(name, value, setting->data);
6024 setting->defined = 1;
6030static int __kmp_stg_check_rivals(
6033 kmp_setting_t **rivals
6036 if (rivals == NULL) {
6042 for (; strcmp(rivals[i]->name, name) != 0; i++) {
6043 KMP_DEBUG_ASSERT(rivals[i] != NULL);
6045#if KMP_AFFINITY_SUPPORTED
6046 if (rivals[i] == __kmp_affinity_notype) {
6053 if (rivals[i]->set) {
6054 KMP_WARNING(StgIgnored, name, rivals[i]->name);
6064static int __kmp_env_toPrint(
char const *name,
int flag) {
6066 kmp_setting_t *setting = __kmp_stg_find(name);
6067 if (setting != NULL) {
6068 rc = setting->defined;
6070 setting->defined = flag;
6076#if defined(KMP_DEBUG) && KMP_AFFINITY_SUPPORTED
6077static void __kmp_print_affinity_settings(
const kmp_affinity_t *affinity) {
6078 K_DIAG(1, (
"%s:\n", affinity->env_var));
6079 K_DIAG(1, (
" type : %d\n", affinity->type));
6080 K_DIAG(1, (
" compact : %d\n", affinity->compact));
6081 K_DIAG(1, (
" offset : %d\n", affinity->offset));
6082 K_DIAG(1, (
" verbose : %u\n", affinity->flags.verbose));
6083 K_DIAG(1, (
" warnings : %u\n", affinity->flags.warnings));
6084 K_DIAG(1, (
" respect : %u\n", affinity->flags.respect));
6085 K_DIAG(1, (
" reset : %u\n", affinity->flags.reset));
6086 K_DIAG(1, (
" dups : %u\n", affinity->flags.dups));
6087 K_DIAG(1, (
" gran : %d\n", (
int)affinity->gran));
6088 KMP_DEBUG_ASSERT(affinity->type != affinity_default);
6092static void __kmp_aux_env_initialize(kmp_env_blk_t *block) {
6097 value = __kmp_env_blk_var(block,
"OMP_NUM_THREADS");
6099 ompc_set_num_threads(__kmp_dflt_team_nth);
6103 value = __kmp_env_blk_var(block,
"KMP_BLOCKTIME");
6108 gtid = __kmp_entry_gtid();
6109 tid = __kmp_tid_from_gtid(gtid);
6110 thread = __kmp_thread_from_gtid(gtid);
6111 __kmp_aux_set_blocktime(__kmp_dflt_blocktime, thread, tid);
6115 value = __kmp_env_blk_var(block,
"OMP_NESTED");
6117 ompc_set_nested(__kmp_dflt_max_active_levels > 1);
6121 value = __kmp_env_blk_var(block,
"OMP_DYNAMIC");
6123 ompc_set_dynamic(__kmp_global.g.g_dynamic);
6127void __kmp_env_initialize(
char const *
string) {
6129 kmp_env_blk_t block;
6135 if (
string == NULL) {
6137 __kmp_threads_capacity =
6138 __kmp_initial_threads_capacity(__kmp_dflt_team_nth_ub);
6140 __kmp_env_blk_init(&block,
string);
6143 for (i = 0; i < block.count; ++i) {
6144 if ((block.vars[i].name == NULL) || (*block.vars[i].name ==
'\0')) {
6147 if (block.vars[i].value == NULL) {
6150 kmp_setting_t *setting = __kmp_stg_find(block.vars[i].name);
6151 if (setting != NULL) {
6158 blocktime_str = __kmp_env_blk_var(&block,
"KMP_BLOCKTIME");
6159 use_yield_str = __kmp_env_blk_var(&block,
"KMP_USE_YIELD");
6163 if (
string == NULL) {
6164 char const *name =
"KMP_WARNINGS";
6165 char const *value = __kmp_env_blk_var(&block, name);
6166 __kmp_stg_parse(name, value);
6169#if KMP_AFFINITY_SUPPORTED
6175 __kmp_affinity_notype = NULL;
6176 char const *aff_str = __kmp_env_blk_var(&block,
"KMP_AFFINITY");
6177 if (aff_str != NULL) {
6188#if KMP_OS_WINDOWS || KMP_OS_AIX
6191#define FIND strcasestr
6194 if ((FIND(aff_str,
"none") == NULL) &&
6195 (FIND(aff_str,
"physical") == NULL) &&
6196 (FIND(aff_str,
"logical") == NULL) &&
6197 (FIND(aff_str,
"compact") == NULL) &&
6198 (FIND(aff_str,
"scatter") == NULL) &&
6199 (FIND(aff_str,
"explicit") == NULL) &&
6200 (FIND(aff_str,
"balanced") == NULL) &&
6201 (FIND(aff_str,
"disabled") == NULL)) {
6202 __kmp_affinity_notype = __kmp_stg_find(
"KMP_AFFINITY");
6207 __kmp_affinity.type = affinity_default;
6208 __kmp_affinity.gran = KMP_HW_UNKNOWN;
6209 __kmp_affinity_top_method = affinity_top_method_default;
6210 __kmp_affinity.flags.respect = affinity_respect_mask_default;
6215 aff_str = __kmp_env_blk_var(&block,
"OMP_PROC_BIND");
6216 if (aff_str != NULL) {
6217 __kmp_affinity.type = affinity_default;
6218 __kmp_affinity.gran = KMP_HW_UNKNOWN;
6219 __kmp_affinity_top_method = affinity_top_method_default;
6220 __kmp_affinity.flags.respect = affinity_respect_mask_default;
6227 if (__kmp_nested_proc_bind.bind_types == NULL) {
6228 __kmp_nested_proc_bind.bind_types =
6229 (kmp_proc_bind_t *)KMP_INTERNAL_MALLOC(
sizeof(kmp_proc_bind_t));
6230 if (__kmp_nested_proc_bind.bind_types == NULL) {
6231 KMP_FATAL(MemoryAllocFailed);
6233 __kmp_nested_proc_bind.size = 1;
6234 __kmp_nested_proc_bind.used = 1;
6235#if KMP_AFFINITY_SUPPORTED
6236 __kmp_nested_proc_bind.bind_types[0] = proc_bind_default;
6239 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6246 __kmp_msg_format(kmp_i18n_msg_AffFormatDefault,
"%P",
"%i",
"%n",
"%A");
6247 KMP_DEBUG_ASSERT(KMP_STRLEN(m.str) < KMP_AFFINITY_FORMAT_SIZE);
6249 if (__kmp_affinity_format == NULL) {
6250 __kmp_affinity_format =
6251 (
char *)KMP_INTERNAL_MALLOC(
sizeof(
char) * KMP_AFFINITY_FORMAT_SIZE);
6253 KMP_STRCPY_S(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, m.str);
6254 __kmp_str_free(&m.str);
6257 for (i = 0; i < block.count; ++i) {
6258 __kmp_stg_parse(block.vars[i].name, block.vars[i].value);
6262 if (!__kmp_init_user_locks) {
6263 if (__kmp_user_lock_kind == lk_default) {
6264 __kmp_user_lock_kind = lk_queuing;
6266#if KMP_USE_DYNAMIC_LOCK
6267 __kmp_init_dynamic_user_locks();
6269 __kmp_set_user_lock_vptrs(__kmp_user_lock_kind);
6272 KMP_DEBUG_ASSERT(
string != NULL);
6273 KMP_DEBUG_ASSERT(__kmp_user_lock_kind != lk_default);
6278#if KMP_USE_DYNAMIC_LOCK
6279 __kmp_init_dynamic_user_locks();
6281 __kmp_set_user_lock_vptrs(__kmp_user_lock_kind);
6285#if KMP_AFFINITY_SUPPORTED
6287 if (!TCR_4(__kmp_init_middle)) {
6288#if KMP_HWLOC_ENABLED
6292 if (__kmp_hw_subset &&
6293 __kmp_affinity_top_method == affinity_top_method_default)
6294 if (__kmp_hw_subset->specified(KMP_HW_NUMA) ||
6295 __kmp_hw_subset->specified(KMP_HW_TILE) ||
6296 __kmp_affinity.gran == KMP_HW_TILE ||
6297 __kmp_affinity.gran == KMP_HW_NUMA)
6298 __kmp_affinity_top_method = affinity_top_method_hwloc;
6300 if (__kmp_affinity.gran == KMP_HW_NUMA ||
6301 __kmp_affinity.gran == KMP_HW_TILE)
6302 __kmp_affinity_top_method = affinity_top_method_hwloc;
6306 const char *var =
"KMP_AFFINITY";
6307 KMPAffinity::pick_api();
6308#if KMP_HWLOC_ENABLED
6312 if (__kmp_affinity_top_method == affinity_top_method_hwloc &&
6313 __kmp_affinity_dispatch->get_api_type() != KMPAffinity::HWLOC) {
6314 KMP_WARNING(AffIgnoringHwloc, var);
6315 __kmp_affinity_top_method = affinity_top_method_all;
6318 if (__kmp_affinity.type == affinity_disabled) {
6319 KMP_AFFINITY_DISABLE();
6320 }
else if (!KMP_AFFINITY_CAPABLE()) {
6321 __kmp_affinity_dispatch->determine_capable(var);
6322 if (!KMP_AFFINITY_CAPABLE()) {
6323 if (__kmp_affinity.flags.verbose ||
6324 (__kmp_affinity.flags.warnings &&
6325 (__kmp_affinity.type != affinity_default) &&
6326 (__kmp_affinity.type != affinity_none) &&
6327 (__kmp_affinity.type != affinity_disabled))) {
6328 KMP_WARNING(AffNotSupported, var);
6330 __kmp_affinity.type = affinity_disabled;
6331 __kmp_affinity.flags.respect = FALSE;
6332 __kmp_affinity.gran = KMP_HW_THREAD;
6336 if (__kmp_affinity.type == affinity_disabled) {
6337 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6338 }
else if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_true) {
6340 __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
6343 if (KMP_AFFINITY_CAPABLE()) {
6345#if KMP_GROUP_AFFINITY
6350 bool exactly_one_group =
false;
6351 if (__kmp_num_proc_groups > 1) {
6353 bool within_one_group;
6356 kmp_affin_mask_t *init_mask;
6357 KMP_CPU_ALLOC(init_mask);
6358 __kmp_get_system_affinity(init_mask, TRUE);
6359 group = __kmp_get_proc_group(init_mask);
6360 within_one_group = (group >= 0);
6363 if (within_one_group) {
6364 DWORD num_bits_in_group = __kmp_GetActiveProcessorCount(group);
6365 DWORD num_bits_in_mask = 0;
6366 for (
int bit = init_mask->begin(); bit != init_mask->end();
6367 bit = init_mask->next(bit))
6369 exactly_one_group = (num_bits_in_group == num_bits_in_mask);
6371 KMP_CPU_FREE(init_mask);
6377 if (__kmp_num_proc_groups > 1 &&
6378 __kmp_affinity.type == affinity_default &&
6379 __kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
6384 if (__kmp_affinity.flags.respect == affinity_respect_mask_default &&
6385 exactly_one_group) {
6386 __kmp_affinity.flags.respect = FALSE;
6390 if (__kmp_affinity.type == affinity_default) {
6391 __kmp_affinity.type = affinity_compact;
6392 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
6394 if (__kmp_hh_affinity.type == affinity_default)
6395 __kmp_hh_affinity.type = affinity_compact;
6396 if (__kmp_affinity_top_method == affinity_top_method_default)
6397 __kmp_affinity_top_method = affinity_top_method_all;
6398 if (__kmp_affinity.gran == KMP_HW_UNKNOWN)
6399 __kmp_affinity.gran = KMP_HW_PROC_GROUP;
6400 if (__kmp_hh_affinity.gran == KMP_HW_UNKNOWN)
6401 __kmp_hh_affinity.gran = KMP_HW_PROC_GROUP;
6407 if (__kmp_affinity.flags.respect == affinity_respect_mask_default) {
6408#if KMP_GROUP_AFFINITY
6409 if (__kmp_num_proc_groups > 1 && exactly_one_group) {
6410 __kmp_affinity.flags.respect = FALSE;
6414 __kmp_affinity.flags.respect = TRUE;
6417 if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
6418 (__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
6419 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)
6420 __kmp_affinity.type = affinity_none;
6421 if (__kmp_affinity.type == affinity_default) {
6422 __kmp_affinity.type = affinity_compact;
6423 __kmp_affinity.flags.dups = FALSE;
6425 }
else if (__kmp_affinity.type == affinity_default) {
6426#if KMP_MIC_SUPPORTED
6427 if (__kmp_mic_type != non_mic) {
6428 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
6432 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6434#if KMP_MIC_SUPPORTED
6435 if (__kmp_mic_type != non_mic) {
6436 __kmp_affinity.type = affinity_scatter;
6440 __kmp_affinity.type = affinity_none;
6443 if (__kmp_hh_affinity.type == affinity_default)
6444 __kmp_hh_affinity.type = affinity_none;
6445 if ((__kmp_affinity.gran == KMP_HW_UNKNOWN) &&
6446 (__kmp_affinity.gran_levels < 0)) {
6447#if KMP_MIC_SUPPORTED
6448 if (__kmp_mic_type != non_mic) {
6449 __kmp_affinity.gran = KMP_HW_THREAD;
6453 __kmp_affinity.gran = KMP_HW_CORE;
6456 if ((__kmp_hh_affinity.gran == KMP_HW_UNKNOWN) &&
6457 (__kmp_hh_affinity.gran_levels < 0)) {
6458#if KMP_MIC_SUPPORTED
6459 if (__kmp_mic_type != non_mic) {
6460 __kmp_hh_affinity.gran = KMP_HW_THREAD;
6464 __kmp_hh_affinity.gran = KMP_HW_CORE;
6467 if (__kmp_affinity_top_method == affinity_top_method_default) {
6468 __kmp_affinity_top_method = affinity_top_method_all;
6474 if (__kmp_affinity_top_method == affinity_top_method_default)
6475 __kmp_affinity_top_method = affinity_top_method_all;
6476 if (__kmp_affinity.type == affinity_default)
6477 __kmp_affinity.type = affinity_disabled;
6478 if (__kmp_hh_affinity.type == affinity_default)
6479 __kmp_hh_affinity.type = affinity_disabled;
6483 for (
const kmp_affinity_t *affinity : __kmp_affinities)
6484 __kmp_print_affinity_settings(affinity);
6485 KMP_DEBUG_ASSERT(__kmp_nested_proc_bind.bind_types[0] != proc_bind_default);
6486 K_DIAG(1, (
"__kmp_nested_proc_bind.bind_types[0] == %d\n",
6487 __kmp_nested_proc_bind.bind_types[0]));
6495 if (
string != NULL) {
6496 __kmp_aux_env_initialize(&block);
6499 __kmp_env_blk_free(&block);
6505void __kmp_env_print() {
6507 kmp_env_blk_t block;
6509 kmp_str_buf_t buffer;
6512 __kmp_str_buf_init(&buffer);
6514 __kmp_env_blk_init(&block, NULL);
6515 __kmp_env_blk_sort(&block);
6518 __kmp_str_buf_print(&buffer,
"\n%s\n\n", KMP_I18N_STR(UserSettings));
6519 for (i = 0; i < block.count; ++i) {
6520 char const *name = block.vars[i].name;
6521 char const *value = block.vars[i].value;
6522 if ((KMP_STRLEN(name) > 4 && strncmp(name,
"KMP_", 4) == 0) ||
6523 strncmp(name,
"OMP_", 4) == 0
6524#ifdef KMP_GOMP_COMPAT
6525 || strncmp(name,
"GOMP_", 5) == 0
6528 __kmp_str_buf_print(&buffer,
" %s=%s\n", name, value);
6531 __kmp_str_buf_print(&buffer,
"\n");
6534 __kmp_str_buf_print(&buffer,
"%s\n\n", KMP_I18N_STR(EffectiveSettings));
6535 for (
int i = 0; i < __kmp_stg_count; ++i) {
6536 if (__kmp_stg_table[i].print != NULL) {
6537 __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name,
6538 __kmp_stg_table[i].data);
6542 __kmp_printf(
"%s", buffer.str);
6544 __kmp_env_blk_free(&block);
6545 __kmp_str_buf_free(&buffer);
6551void __kmp_env_print_2() {
6552 __kmp_display_env_impl(__kmp_display_env, __kmp_display_env_verbose);
6555void __kmp_display_env_impl(
int display_env,
int display_env_verbose) {
6556 kmp_env_blk_t block;
6557 kmp_str_buf_t buffer;
6559 __kmp_env_format = 1;
6562 __kmp_str_buf_init(&buffer);
6564 __kmp_env_blk_init(&block, NULL);
6565 __kmp_env_blk_sort(&block);
6567 __kmp_str_buf_print(&buffer,
"\n%s\n", KMP_I18N_STR(DisplayEnvBegin));
6568 __kmp_str_buf_print(&buffer,
" _OPENMP='%d'\n", __kmp_openmp_version);
6570 for (
int i = 0; i < __kmp_stg_count; ++i) {
6571 if (__kmp_stg_table[i].print != NULL &&
6572 ((display_env && strncmp(__kmp_stg_table[i].name,
"OMP_", 4) == 0) ||
6573 display_env_verbose)) {
6574 __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name,
6575 __kmp_stg_table[i].data);
6579 __kmp_str_buf_print(&buffer,
"%s\n", KMP_I18N_STR(DisplayEnvEnd));
6580 __kmp_str_buf_print(&buffer,
"\n");
6582 __kmp_printf(
"%s", buffer.str);
6584 __kmp_env_blk_free(&block);
6585 __kmp_str_buf_free(&buffer);
6592void __kmp_env_dump() {
6594 kmp_env_blk_t block;
6595 kmp_str_buf_t buffer, env, notdefined;
6598 __kmp_str_buf_init(&buffer);
6599 __kmp_str_buf_init(&env);
6600 __kmp_str_buf_init(¬defined);
6602 __kmp_env_blk_init(&block, NULL);
6603 __kmp_env_blk_sort(&block);
6605 __kmp_str_buf_print(¬defined,
": %s", KMP_I18N_STR(NotDefined));
6607 for (
int i = 0; i < __kmp_stg_count; ++i) {
6608 if (__kmp_stg_table[i].print == NULL)
6610 __kmp_str_buf_clear(&env);
6611 __kmp_stg_table[i].print(&env, __kmp_stg_table[i].name,
6612 __kmp_stg_table[i].data);
6615 if (strstr(env.str, notdefined.str))
6617 __kmp_str_buf_print(&buffer,
"%s=undefined\n", __kmp_stg_table[i].name);
6619 __kmp_str_buf_cat(&buffer, env.str + 3, env.used - 3);
6622 ompd_env_block = (
char *)__kmp_allocate(buffer.used + 1);
6623 KMP_MEMCPY(ompd_env_block, buffer.str, buffer.used + 1);
6624 ompd_env_block_size = (ompd_size_t)KMP_STRLEN(ompd_env_block);
6626 __kmp_env_blk_free(&block);
6627 __kmp_str_buf_free(&buffer);
6628 __kmp_str_buf_free(&env);
6629 __kmp_str_buf_free(¬defined);
@ kmp_sch_modifier_monotonic
@ kmp_sch_modifier_nonmonotonic