14#include "kmp_affinity.h"
15#include "kmp_atomic.h"
17#include "kmp_dispatch_hier.h"
19#include "kmp_device_env.h"
20#include "kmp_environment.h"
25#include "kmp_settings.h"
27#include "kmp_traits.h"
28#include "kmp_wrapper_getpid.h"
31#include "ompd-specific.h"
34static int __kmp_env_toPrint(
char const *name,
int flag);
36bool __kmp_env_format = 0;
41#ifdef USE_LOAD_BALANCE
42static double __kmp_convert_to_double(
char const *s) {
45 if (KMP_SSCANF(s,
"%lf", &result) < 1) {
54static unsigned int __kmp_readstr_with_sentinel(
char *dest,
char const *src,
55 size_t len,
char sentinel) {
57 for (i = 0; i < len; i++) {
58 if ((*src ==
'\0') || (*src == sentinel)) {
68static int __kmp_match_with_sentinel(
char const *a,
char const *b,
size_t len,
76 while (*a && *b && *b != sentinel) {
77 char ca = *a, cb = *b;
79 if (ca >=
'a' && ca <=
'z')
81 if (cb >=
'a' && cb <=
'z')
115static int __kmp_match_str(
char const *token,
char const *buf,
118 KMP_ASSERT(token != NULL);
119 KMP_ASSERT(buf != NULL);
120 KMP_ASSERT(end != NULL);
122 while (*token && *buf) {
123 char ct = *token, cb = *buf;
125 if (ct >=
'a' && ct <=
'z')
127 if (cb >=
'a' && cb <=
'z')
142static size_t __kmp_round4k(
size_t size) {
143 size_t _4k = 4 * 1024;
144 if (size & (_4k - 1)) {
146 if (size <= KMP_SIZE_T_MAX - _4k) {
154static int __kmp_strcasecmp_with_sentinel(
char const *a,
char const *b,
160 while (*a && *b && *b != sentinel) {
161 char ca = *a, cb = *b;
163 if (ca >=
'a' && ca <=
'z')
165 if (cb >=
'a' && cb <=
'z')
168 return (
int)(
unsigned char)*a - (
int)(
unsigned char)*b;
172 return *a ? (*b && *b != sentinel)
173 ? (
int)(
unsigned char)*a - (
int)(
unsigned char)*b
175 : (*b && *b != sentinel) ? -1
182typedef struct __kmp_setting kmp_setting_t;
183typedef struct __kmp_stg_ss_data kmp_stg_ss_data_t;
184typedef struct __kmp_stg_wp_data kmp_stg_wp_data_t;
185typedef struct __kmp_stg_fr_data kmp_stg_fr_data_t;
187typedef void (*kmp_stg_parse_func_t)(
char const *name,
char const *value,
189typedef void (*kmp_stg_print_func_t)(kmp_str_buf_t *buffer,
char const *name,
192struct __kmp_setting {
194 kmp_stg_parse_func_t parse;
195 kmp_stg_print_func_t print;
202struct __kmp_stg_ss_data {
204 kmp_setting_t **rivals;
207struct __kmp_stg_wp_data {
209 kmp_setting_t **rivals;
212struct __kmp_stg_fr_data {
214 kmp_setting_t **rivals;
217static int __kmp_stg_check_rivals(
220 kmp_setting_t **rivals
224struct kmp_trimmed_str_t {
226 kmp_trimmed_str_t(
const char *str) {
227 __kmp_str_buf_init(&buf);
228 size_t len = KMP_STRLEN(str);
231 const char *begin = str;
232 const char *end = str + KMP_STRLEN(str) - 1;
234 while (begin < end && *end ==
' ')
236 __kmp_str_buf_cat(&buf, begin, end - begin + 1);
238 ~kmp_trimmed_str_t() { __kmp_str_buf_free(&buf); }
239 const char *get() {
return buf.str; }
245static void __kmp_stg_parse_bool(
char const *name,
char const *value,
247 if (__kmp_str_match_true(value)) {
249 }
else if (__kmp_str_match_false(value)) {
252 __kmp_msg(kmp_ms_warning, KMP_MSG(BadBoolValue, name, value),
253 KMP_HNT(ValidBoolValues), __kmp_msg_null);
258void __kmp_check_stksize(
size_t *val) {
261 if (*val > KMP_DEFAULT_STKSIZE * 2)
262 *val = KMP_DEFAULT_STKSIZE * 2;
264 if (*val > KMP_DEFAULT_STKSIZE * 16)
265 *val = KMP_DEFAULT_STKSIZE * 16;
267 if (*val < __kmp_sys_min_stksize)
268 *val = __kmp_sys_min_stksize;
269 if (*val > KMP_MAX_STKSIZE)
270 *val = KMP_MAX_STKSIZE;
272 *val = __kmp_round4k(*val);
276static void __kmp_stg_parse_size(
char const *name,
char const *value,
277 size_t size_min,
size_t size_max,
278 int *is_specified,
size_t *out,
280 char const *msg = NULL;
282 size_min = __kmp_round4k(size_min);
283 size_max = __kmp_round4k(size_max);
286 if (is_specified != NULL) {
289 __kmp_str_to_size(value, out, factor, &msg);
291 if (*out > size_max) {
293 msg = KMP_I18N_STR(ValueTooLarge);
294 }
else if (*out < size_min) {
296 msg = KMP_I18N_STR(ValueTooSmall);
299 size_t round4k = __kmp_round4k(*out);
300 if (*out != round4k) {
302 msg = KMP_I18N_STR(NotMultiple4K);
309 if (*out < size_min) {
311 }
else if (*out > size_max) {
318 __kmp_str_buf_init(&buf);
319 __kmp_str_buf_print_size(&buf, *out);
320 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
321 KMP_INFORM(Using_str_Value, name, buf.str);
322 __kmp_str_buf_free(&buf);
327static void __kmp_stg_parse_str(
char const *name,
char const *value,
330 *out = __kmp_str_format(
"%s", value);
333static void __kmp_stg_parse_int(
341 char const *msg = NULL;
342 kmp_uint64 uint = *out;
343 __kmp_str_to_uint(value, &uint, &msg);
345 if (uint < (
unsigned int)min) {
346 msg = KMP_I18N_STR(ValueTooSmall);
348 }
else if (uint > (
unsigned int)max) {
349 msg = KMP_I18N_STR(ValueTooLarge);
355 if (uint < (
unsigned int)min) {
357 }
else if (uint > (
unsigned int)max) {
364 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
365 __kmp_str_buf_init(&buf);
366 __kmp_str_buf_print(&buf,
"%" KMP_UINT64_SPEC
"", uint);
367 KMP_INFORM(Using_uint64_Value, name, buf.str);
368 __kmp_str_buf_free(&buf);
370 __kmp_type_convert(uint, out);
373#if KMP_DEBUG_ADAPTIVE_LOCKS
374static void __kmp_stg_parse_file(
char const *name,
char const *value,
375 const char *suffix,
char **out) {
380 t = (
char *)strrchr(value,
'.');
381 hasSuffix = t && __kmp_str_eqf(t, suffix);
382 t = __kmp_str_format(
"%s%s", value, hasSuffix ?
"" : suffix);
383 __kmp_expand_file_name(buffer,
sizeof(buffer), t);
385 *out = __kmp_str_format(
"%s", buffer);
390static char *par_range_to_print = NULL;
392static void __kmp_stg_parse_par_range(
char const *name,
char const *value,
393 int *out_range,
char *out_routine,
394 char *out_file,
int *out_lb,
396 const char *par_range_value;
397 size_t len = KMP_STRLEN(value) + 1;
398 par_range_to_print = (
char *)KMP_INTERNAL_MALLOC(len + 1);
399 KMP_STRNCPY_S(par_range_to_print, len + 1, value, len + 1);
400 __kmp_par_range = +1;
401 __kmp_par_range_lb = 0;
402 __kmp_par_range_ub = INT_MAX;
405 if (!value || *value ==
'\0') {
408 if (!__kmp_strcasecmp_with_sentinel(
"routine", value,
'=')) {
409 par_range_value = strchr(value,
'=') + 1;
410 if (!par_range_value)
411 goto par_range_error;
412 value = par_range_value;
413 len = __kmp_readstr_with_sentinel(out_routine, value,
414 KMP_PAR_RANGE_ROUTINE_LEN - 1,
',');
416 goto par_range_error;
418 value = strchr(value,
',');
424 if (!__kmp_strcasecmp_with_sentinel(
"filename", value,
'=')) {
425 par_range_value = strchr(value,
'=') + 1;
426 if (!par_range_value)
427 goto par_range_error;
428 value = par_range_value;
429 len = __kmp_readstr_with_sentinel(out_file, value,
430 KMP_PAR_RANGE_FILENAME_LEN - 1,
',');
432 goto par_range_error;
434 value = strchr(value,
',');
440 if ((!__kmp_strcasecmp_with_sentinel(
"range", value,
'=')) ||
441 (!__kmp_strcasecmp_with_sentinel(
"incl_range", value,
'='))) {
442 par_range_value = strchr(value,
'=') + 1;
443 if (!par_range_value)
444 goto par_range_error;
445 value = par_range_value;
446 if (KMP_SSCANF(value,
"%d:%d", out_lb, out_ub) != 2) {
447 goto par_range_error;
450 value = strchr(value,
',');
456 if (!__kmp_strcasecmp_with_sentinel(
"excl_range", value,
'=')) {
457 par_range_value = strchr(value,
'=') + 1;
458 if (!par_range_value)
459 goto par_range_error;
460 value = par_range_value;
461 if (KMP_SSCANF(value,
"%d:%d", out_lb, out_ub) != 2) {
462 goto par_range_error;
465 value = strchr(value,
',');
472 KMP_WARNING(ParRangeSyntax, name);
479int __kmp_initial_threads_capacity(
int req_nproc) {
484 if (nth < (4 * req_nproc))
485 nth = (4 * req_nproc);
486 if (nth < (4 * __kmp_xproc))
487 nth = (4 * __kmp_xproc);
491 if (__kmp_enable_hidden_helper) {
492 nth += __kmp_hidden_helper_threads_num;
495 if (nth > __kmp_max_nth)
501int __kmp_default_tp_capacity(
int req_nproc,
int max_nth,
502 int all_threads_specified) {
505 if (all_threads_specified)
509 if (nth < (4 * req_nproc))
510 nth = (4 * req_nproc);
511 if (nth < (4 * __kmp_xproc))
512 nth = (4 * __kmp_xproc);
514 if (nth > __kmp_max_nth)
523static void __kmp_stg_print_bool(kmp_str_buf_t *buffer,
char const *name,
525 if (__kmp_env_format) {
526 KMP_STR_BUF_PRINT_BOOL;
528 __kmp_str_buf_print(buffer,
" %s=%s\n", name, value ?
"true" :
"false");
532static void __kmp_stg_print_int(kmp_str_buf_t *buffer,
char const *name,
534 if (__kmp_env_format) {
535 KMP_STR_BUF_PRINT_INT;
537 __kmp_str_buf_print(buffer,
" %s=%d\n", name, value);
541static void __kmp_stg_print_uint64(kmp_str_buf_t *buffer,
char const *name,
543 if (__kmp_env_format) {
544 KMP_STR_BUF_PRINT_UINT64;
546 __kmp_str_buf_print(buffer,
" %s=%" KMP_UINT64_SPEC
"\n", name, value);
550static void __kmp_stg_print_str(kmp_str_buf_t *buffer,
char const *name,
552 if (__kmp_env_format) {
553 KMP_STR_BUF_PRINT_STR;
555 __kmp_str_buf_print(buffer,
" %s=%s\n", name, value);
559static void __kmp_stg_print_size(kmp_str_buf_t *buffer,
char const *name,
561 if (__kmp_env_format) {
562 KMP_STR_BUF_PRINT_NAME_EX(name);
563 __kmp_str_buf_print_size(buffer, value);
564 __kmp_str_buf_print(buffer,
"'\n");
566 __kmp_str_buf_print(buffer,
" %s=", name);
567 __kmp_str_buf_print_size(buffer, value);
568 __kmp_str_buf_print(buffer,
"\n");
579static void __kmp_stg_parse_device_thread_limit(
char const *name,
580 char const *value,
void *data) {
581 kmp_setting_t **rivals = (kmp_setting_t **)data;
583 if (strcmp(name,
"KMP_ALL_THREADS") == 0) {
584 KMP_INFORM(EnvVarDeprecated, name,
"KMP_DEVICE_THREAD_LIMIT");
586 rc = __kmp_stg_check_rivals(name, value, rivals);
590 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
591 __kmp_max_nth = __kmp_xproc;
592 __kmp_allThreadsSpecified = 1;
594 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_max_nth);
595 __kmp_allThreadsSpecified = 0;
597 K_DIAG(1, (
"__kmp_max_nth == %d\n", __kmp_max_nth));
601static void __kmp_stg_print_device_thread_limit(kmp_str_buf_t *buffer,
602 char const *name,
void *data) {
603 __kmp_stg_print_int(buffer, name, __kmp_max_nth);
608static void __kmp_stg_parse_thread_limit(
char const *name,
char const *value,
610 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_cg_max_nth);
611 K_DIAG(1, (
"__kmp_cg_max_nth == %d\n", __kmp_cg_max_nth));
615static void __kmp_stg_print_thread_limit(kmp_str_buf_t *buffer,
616 char const *name,
void *data) {
617 __kmp_stg_print_int(buffer, name, __kmp_cg_max_nth);
622static void __kmp_stg_parse_nteams(
char const *name,
char const *value,
624 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_nteams);
625 K_DIAG(1, (
"__kmp_nteams == %d\n", __kmp_nteams));
628static void __kmp_stg_print_nteams(kmp_str_buf_t *buffer,
char const *name,
630 __kmp_stg_print_int(buffer, name, __kmp_nteams);
635static void __kmp_stg_parse_teams_th_limit(
char const *name,
char const *value,
637 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth,
638 &__kmp_teams_thread_limit);
639 K_DIAG(1, (
"__kmp_teams_thread_limit == %d\n", __kmp_teams_thread_limit));
642static void __kmp_stg_print_teams_th_limit(kmp_str_buf_t *buffer,
643 char const *name,
void *data) {
644 __kmp_stg_print_int(buffer, name, __kmp_teams_thread_limit);
649static void __kmp_stg_parse_teams_thread_limit(
char const *name,
650 char const *value,
void *data) {
651 __kmp_stg_parse_int(name, value, 1, __kmp_sys_max_nth, &__kmp_teams_max_nth);
654static void __kmp_stg_print_teams_thread_limit(kmp_str_buf_t *buffer,
655 char const *name,
void *data) {
656 __kmp_stg_print_int(buffer, name, __kmp_teams_max_nth);
661static void __kmp_stg_parse_use_yield(
char const *name,
char const *value,
663 __kmp_stg_parse_int(name, value, 0, 2, &__kmp_use_yield);
664 __kmp_use_yield_exp_set = 1;
667static void __kmp_stg_print_use_yield(kmp_str_buf_t *buffer,
char const *name,
669 __kmp_stg_print_int(buffer, name, __kmp_use_yield);
675static void __kmp_stg_parse_blocktime(
char const *name,
char const *value,
677 const char *buf = value;
679 const int ms_mult = 1000;
685 if ((*buf >=
'0') && (*buf <=
'9')) {
688 num = __kmp_basic_str_to_int(buf);
689 KMP_ASSERT(num >= 0);
698 if (*buf ==
'\0' || __kmp_match_str(
"ms", buf, &next)) {
700 __kmp_dflt_blocktime = ms_mult * num;
701 __kmp_blocktime_units =
'm';
702 multiplier = ms_mult;
703 }
else if (__kmp_match_str(
"us", buf, &next)) {
705 __kmp_dflt_blocktime = num;
706 __kmp_blocktime_units =
'u';
707 }
else if (__kmp_match_str(
"infinite", buf, &next) ||
708 __kmp_match_str(
"infinity", buf, &next)) {
710 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
711 __kmp_blocktime_units =
'm';
712 multiplier = ms_mult;
714 KMP_WARNING(StgInvalidValue, name, value);
716 __kmp_dflt_blocktime = ms_mult * num;
717 __kmp_blocktime_units =
'm';
718 multiplier = ms_mult;
721 if (num < 0 && __kmp_dflt_blocktime < 0) {
722 __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
723 __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidValue, name, value),
726 KMP_INFORM(Using_int_Value, name, __kmp_dflt_blocktime / multiplier);
727 __kmp_env_blocktime = FALSE;
728 }
else if (num > 0 && __kmp_dflt_blocktime < 0) {
729 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
730 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeValue, name, value), __kmp_msg_null);
731 KMP_INFORM(MaxValueUsing, name, __kmp_dflt_blocktime / multiplier);
732 __kmp_env_blocktime = TRUE;
734 if (__kmp_dflt_blocktime < KMP_MIN_BLOCKTIME) {
735 __kmp_dflt_blocktime = KMP_MIN_BLOCKTIME;
736 __kmp_msg(kmp_ms_warning, KMP_MSG(SmallValue, name, value),
738 KMP_INFORM(MinValueUsing, name, __kmp_dflt_blocktime / multiplier);
739 }
else if (__kmp_dflt_blocktime > KMP_MAX_BLOCKTIME) {
740 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
741 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeValue, name, value),
743 KMP_INFORM(MaxValueUsing, name, __kmp_dflt_blocktime / multiplier);
745 __kmp_env_blocktime = TRUE;
750 __kmp_monitor_wakeups =
751 KMP_WAKEUPS_FROM_BLOCKTIME(__kmp_dflt_blocktime, __kmp_monitor_wakeups);
753 KMP_INTERVALS_FROM_BLOCKTIME(__kmp_dflt_blocktime, __kmp_monitor_wakeups);
755 K_DIAG(1, (
"__kmp_env_blocktime == %d\n", __kmp_env_blocktime));
756 if (__kmp_env_blocktime) {
757 K_DIAG(1, (
"__kmp_dflt_blocktime == %d\n", __kmp_dflt_blocktime));
761static void __kmp_stg_print_blocktime(kmp_str_buf_t *buffer,
char const *name,
763 int num = __kmp_dflt_blocktime;
764 if (__kmp_blocktime_units ==
'm') {
767 if (__kmp_env_format) {
768 KMP_STR_BUF_PRINT_NAME_EX(name);
770 __kmp_str_buf_print(buffer,
" %s=", name);
772 __kmp_str_buf_print(buffer,
"%d", num);
773 __kmp_str_buf_print(buffer,
"%cs\n", __kmp_blocktime_units);
779static void __kmp_stg_parse_duplicate_lib_ok(
char const *name,
780 char const *value,
void *data) {
783 __kmp_stg_parse_bool(name, value, &__kmp_duplicate_library_ok);
786static void __kmp_stg_print_duplicate_lib_ok(kmp_str_buf_t *buffer,
787 char const *name,
void *data) {
788 __kmp_stg_print_bool(buffer, name, __kmp_duplicate_library_ok);
794#if KMP_ARCH_X86 || KMP_ARCH_X86_64
796static void __kmp_stg_parse_inherit_fp_control(
char const *name,
797 char const *value,
void *data) {
798 __kmp_stg_parse_bool(name, value, &__kmp_inherit_fp_control);
801static void __kmp_stg_print_inherit_fp_control(kmp_str_buf_t *buffer,
802 char const *name,
void *data) {
804 __kmp_stg_print_bool(buffer, name, __kmp_inherit_fp_control);
811static char const *blocktime_str = NULL;
812static char const *use_yield_str = NULL;
817static void __kmp_stg_parse_wait_policy(
char const *name,
char const *value,
820 kmp_stg_wp_data_t *wait = (kmp_stg_wp_data_t *)data;
823 rc = __kmp_stg_check_rivals(name, value, wait->rivals);
829 if (__kmp_str_match(
"ACTIVE", 1, value)) {
830 __kmp_library = library_turnaround;
831 if (blocktime_str == NULL) {
833 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
835 if (use_yield_str == NULL) {
839 }
else if (__kmp_str_match(
"PASSIVE", 1, value)) {
840 __kmp_library = library_throughput;
841 __kmp_wpolicy_passive =
true;
842 if (blocktime_str == NULL) {
844 __kmp_dflt_blocktime = 0;
847 KMP_WARNING(StgInvalidValue, name, value);
850 if (__kmp_str_match(
"serial", 1, value)) {
851 __kmp_library = library_serial;
852 }
else if (__kmp_str_match(
"throughput", 2, value)) {
853 __kmp_library = library_throughput;
854 if (blocktime_str == NULL) {
856 __kmp_dflt_blocktime = 0;
858 }
else if (__kmp_str_match(
"turnaround", 2, value)) {
859 __kmp_library = library_turnaround;
860 }
else if (__kmp_str_match(
"dedicated", 1, value)) {
861 __kmp_library = library_turnaround;
862 }
else if (__kmp_str_match(
"multiuser", 1, value)) {
863 __kmp_library = library_throughput;
864 if (blocktime_str == NULL) {
866 __kmp_dflt_blocktime = 0;
869 KMP_WARNING(StgInvalidValue, name, value);
874static void __kmp_stg_print_wait_policy(kmp_str_buf_t *buffer,
char const *name,
877 kmp_stg_wp_data_t *wait = (kmp_stg_wp_data_t *)data;
878 char const *value = NULL;
881 switch (__kmp_library) {
882 case library_turnaround: {
885 case library_throughput: {
889 case library_serial: {
894 switch (__kmp_library) {
895 case library_serial: {
898 case library_turnaround: {
899 value =
"turnaround";
901 case library_throughput: {
902 value =
"throughput";
910 __kmp_stg_print_str(buffer, name, value);
919static void __kmp_stg_parse_monitor_stacksize(
char const *name,
920 char const *value,
void *data) {
921 __kmp_stg_parse_size(name, value, __kmp_sys_min_stksize, KMP_MAX_STKSIZE,
922 NULL, &__kmp_monitor_stksize, 1);
925static void __kmp_stg_print_monitor_stacksize(kmp_str_buf_t *buffer,
926 char const *name,
void *data) {
927 if (__kmp_env_format) {
928 if (__kmp_monitor_stksize > 0)
929 KMP_STR_BUF_PRINT_NAME_EX(name);
931 KMP_STR_BUF_PRINT_NAME;
933 __kmp_str_buf_print(buffer,
" %s", name);
935 if (__kmp_monitor_stksize > 0) {
936 __kmp_str_buf_print_size(buffer, __kmp_monitor_stksize);
938 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
940 if (__kmp_env_format && __kmp_monitor_stksize) {
941 __kmp_str_buf_print(buffer,
"'\n");
949static void __kmp_stg_parse_settings(
char const *name,
char const *value,
951 __kmp_stg_parse_bool(name, value, &__kmp_settings);
954static void __kmp_stg_print_settings(kmp_str_buf_t *buffer,
char const *name,
956 __kmp_stg_print_bool(buffer, name, __kmp_settings);
962static void __kmp_stg_parse_stackpad(
char const *name,
char const *value,
964 __kmp_stg_parse_int(name,
972static void __kmp_stg_print_stackpad(kmp_str_buf_t *buffer,
char const *name,
974 __kmp_stg_print_int(buffer, name, __kmp_stkpadding);
980static void __kmp_stg_parse_stackoffset(
char const *name,
char const *value,
982 __kmp_stg_parse_size(name,
991static void __kmp_stg_print_stackoffset(kmp_str_buf_t *buffer,
char const *name,
993 __kmp_stg_print_size(buffer, name, __kmp_stkoffset);
999static void __kmp_stg_parse_stacksize(
char const *name,
char const *value,
1002 kmp_stg_ss_data_t *stacksize = (kmp_stg_ss_data_t *)data;
1005 rc = __kmp_stg_check_rivals(name, value, stacksize->rivals);
1009 __kmp_stg_parse_size(name,
1011 __kmp_sys_min_stksize,
1023static void __kmp_stg_print_stacksize(kmp_str_buf_t *buffer,
char const *name,
1025 kmp_stg_ss_data_t *stacksize = (kmp_stg_ss_data_t *)data;
1026 if (__kmp_env_format) {
1027 KMP_STR_BUF_PRINT_NAME_EX(name);
1028 __kmp_str_buf_print_size(buffer, (__kmp_stksize % 1024)
1029 ? __kmp_stksize / stacksize->factor
1031 __kmp_str_buf_print(buffer,
"'\n");
1033 __kmp_str_buf_print(buffer,
" %s=", name);
1034 __kmp_str_buf_print_size(buffer, (__kmp_stksize % 1024)
1035 ? __kmp_stksize / stacksize->factor
1037 __kmp_str_buf_print(buffer,
"\n");
1044static void __kmp_stg_parse_version(
char const *name,
char const *value,
1046 __kmp_stg_parse_bool(name, value, &__kmp_version);
1049static void __kmp_stg_print_version(kmp_str_buf_t *buffer,
char const *name,
1051 __kmp_stg_print_bool(buffer, name, __kmp_version);
1057static void __kmp_stg_parse_warnings(
char const *name,
char const *value,
1059 __kmp_stg_parse_bool(name, value, &__kmp_generate_warnings);
1060 if (__kmp_generate_warnings != kmp_warnings_off) {
1063 __kmp_generate_warnings = kmp_warnings_explicit;
1067static void __kmp_stg_print_warnings(kmp_str_buf_t *buffer,
char const *name,
1070 __kmp_stg_print_bool(buffer, name, __kmp_generate_warnings);
1076static void __kmp_stg_parse_nesting_mode(
char const *name,
char const *value,
1078 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_nesting_mode);
1079#if KMP_HWLOC_ENABLED
1080 if (__kmp_nesting_mode > 0)
1081 __kmp_affinity_top_method = affinity_top_method_hwloc;
1085static void __kmp_stg_print_nesting_mode(kmp_str_buf_t *buffer,
1086 char const *name,
void *data) {
1087 if (__kmp_env_format) {
1088 KMP_STR_BUF_PRINT_NAME;
1090 __kmp_str_buf_print(buffer,
" %s", name);
1092 __kmp_str_buf_print(buffer,
"=%d\n", __kmp_nesting_mode);
1098static void __kmp_stg_parse_nested(
char const *name,
char const *value,
1101 KMP_INFORM(EnvVarDeprecated, name,
"OMP_MAX_ACTIVE_LEVELS");
1102 __kmp_stg_parse_bool(name, value, &nested);
1104 if (!__kmp_dflt_max_active_levels_set)
1105 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
1107 __kmp_dflt_max_active_levels = 1;
1108 __kmp_dflt_max_active_levels_set =
true;
1112static void __kmp_stg_print_nested(kmp_str_buf_t *buffer,
char const *name,
1114 if (__kmp_env_format) {
1115 KMP_STR_BUF_PRINT_NAME;
1117 __kmp_str_buf_print(buffer,
" %s", name);
1119 __kmp_str_buf_print(buffer,
": deprecated; max-active-levels-var=%d\n",
1120 __kmp_dflt_max_active_levels);
1123static void __kmp_parse_nested_num_threads(
const char *var,
const char *env,
1124 kmp_nested_nthreads_t *nth_array) {
1125 const char *next = env;
1126 const char *scan = next;
1129 int prev_comma = FALSE;
1135 if (*next ==
'\0') {
1139 if (((*next <
'0') || (*next >
'9')) && (*next !=
',')) {
1140 KMP_WARNING(NthSyntaxError, var, env);
1146 if (total == 0 || prev_comma) {
1154 if (*next >=
'0' && *next <=
'9') {
1158 const char *tmp = next;
1160 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
1161 KMP_WARNING(NthSpacesNotAllowed, var, env);
1166 if (!__kmp_dflt_max_active_levels_set && total > 1)
1167 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
1169 KMP_WARNING(NthSyntaxError, var, env);
1174 if (!nth_array->nth) {
1176 nth_array->nth = (
int *)KMP_INTERNAL_MALLOC(
sizeof(
int) * total * 2);
1177 if (nth_array->nth == NULL) {
1178 KMP_FATAL(MemoryAllocFailed);
1180 nth_array->size = total * 2;
1182 if (nth_array->size < total) {
1185 nth_array->size *= 2;
1186 }
while (nth_array->size < total);
1188 nth_array->nth = (
int *)KMP_INTERNAL_REALLOC(
1189 nth_array->nth,
sizeof(
int) * nth_array->size);
1190 if (nth_array->nth == NULL) {
1191 KMP_FATAL(MemoryAllocFailed);
1195 nth_array->used = total;
1203 if (*scan ==
'\0') {
1213 nth_array->nth[i++] = 0;
1215 }
else if (prev_comma) {
1217 nth_array->nth[i] = nth_array->nth[i - 1];
1226 if (*scan >=
'0' && *scan <=
'9') {
1228 const char *buf = scan;
1229 char const *msg = NULL;
1234 num = __kmp_str_to_int(buf, *scan);
1235 if (num < KMP_MIN_NTH) {
1236 msg = KMP_I18N_STR(ValueTooSmall);
1238 }
else if (num > __kmp_sys_max_nth) {
1239 msg = KMP_I18N_STR(ValueTooLarge);
1240 num = __kmp_sys_max_nth;
1244 KMP_WARNING(ParseSizeIntWarn, var, env, msg);
1245 KMP_INFORM(Using_int_Value, var, num);
1247 nth_array->nth[i++] = num;
1252static void __kmp_stg_parse_num_threads(
char const *name,
char const *value,
1255 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
1257 if (!__kmp_nested_nth.nth) {
1258 __kmp_nested_nth.nth = (
int *)KMP_INTERNAL_MALLOC(
sizeof(
int));
1259 __kmp_nested_nth.size = 1;
1261 __kmp_nested_nth.used = 1;
1262 __kmp_nested_nth.nth[0] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub =
1265 __kmp_parse_nested_num_threads(name, value, &__kmp_nested_nth);
1266 if (__kmp_nested_nth.nth) {
1267 __kmp_dflt_team_nth = __kmp_nested_nth.nth[0];
1268 if (__kmp_dflt_team_nth_ub < __kmp_dflt_team_nth) {
1269 __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth;
1273 K_DIAG(1, (
"__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth));
1276static void __kmp_stg_parse_num_hidden_helper_threads(
char const *name,
1279 __kmp_stg_parse_int(name, value, 0, 16, &__kmp_hidden_helper_threads_num);
1282 if (__kmp_hidden_helper_threads_num == 0) {
1283 __kmp_enable_hidden_helper = FALSE;
1288 __kmp_hidden_helper_threads_num++;
1292static void __kmp_stg_print_num_hidden_helper_threads(kmp_str_buf_t *buffer,
1295 if (__kmp_hidden_helper_threads_num == 0) {
1296 __kmp_stg_print_int(buffer, name, __kmp_hidden_helper_threads_num);
1298 KMP_DEBUG_ASSERT(__kmp_hidden_helper_threads_num > 1);
1301 __kmp_stg_print_int(buffer, name, __kmp_hidden_helper_threads_num - 1);
1305static void __kmp_stg_parse_use_hidden_helper(
char const *name,
1306 char const *value,
void *data) {
1307 __kmp_stg_parse_bool(name, value, &__kmp_enable_hidden_helper);
1309 __kmp_enable_hidden_helper = FALSE;
1311 (
"__kmp_stg_parse_use_hidden_helper: Disable hidden helper task on "
1312 "non-Linux platform although it is enabled by user explicitly.\n"));
1316static void __kmp_stg_print_use_hidden_helper(kmp_str_buf_t *buffer,
1317 char const *name,
void *data) {
1318 __kmp_stg_print_bool(buffer, name, __kmp_enable_hidden_helper);
1321static void __kmp_stg_print_num_threads(kmp_str_buf_t *buffer,
char const *name,
1323 if (__kmp_env_format) {
1324 KMP_STR_BUF_PRINT_NAME;
1326 __kmp_str_buf_print(buffer,
" %s", name);
1328 if (__kmp_nested_nth.used) {
1330 __kmp_str_buf_init(&buf);
1331 for (
int i = 0; i < __kmp_nested_nth.used; i++) {
1332 __kmp_str_buf_print(&buf,
"%d", __kmp_nested_nth.nth[i]);
1333 if (i < __kmp_nested_nth.used - 1) {
1334 __kmp_str_buf_print(&buf,
",");
1337 __kmp_str_buf_print(buffer,
"='%s'\n", buf.str);
1338 __kmp_str_buf_free(&buf);
1340 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1347static void __kmp_stg_parse_tasking(
char const *name,
char const *value,
1349 __kmp_stg_parse_int(name, value, 0, (
int)tskm_max,
1350 (
int *)&__kmp_tasking_mode);
1352 if (__kmp_tasking_mode == tskm_extra_barrier) {
1353 KMP_WARNING(StgInvalidValue, name, value);
1354 __kmp_tasking_mode = tskm_task_teams;
1358static void __kmp_stg_print_tasking(kmp_str_buf_t *buffer,
char const *name,
1360 __kmp_stg_print_int(buffer, name, __kmp_tasking_mode);
1363static void __kmp_stg_parse_task_stealing(
char const *name,
char const *value,
1365 __kmp_stg_parse_int(name, value, 0, 1,
1366 (
int *)&__kmp_task_stealing_constraint);
1369static void __kmp_stg_print_task_stealing(kmp_str_buf_t *buffer,
1370 char const *name,
void *data) {
1371 __kmp_stg_print_int(buffer, name, __kmp_task_stealing_constraint);
1374static void __kmp_stg_parse_max_active_levels(
char const *name,
1375 char const *value,
void *data) {
1376 kmp_uint64 tmp_dflt = 0;
1377 char const *msg = NULL;
1378 if (!__kmp_dflt_max_active_levels_set) {
1380 __kmp_str_to_uint(value, &tmp_dflt, &msg);
1382 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
1383 }
else if (tmp_dflt > KMP_MAX_ACTIVE_LEVELS_LIMIT) {
1385 msg = KMP_I18N_STR(ValueTooLarge);
1386 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
1388 __kmp_type_convert(tmp_dflt, &(__kmp_dflt_max_active_levels));
1389 __kmp_dflt_max_active_levels_set =
true;
1394static void __kmp_stg_print_max_active_levels(kmp_str_buf_t *buffer,
1395 char const *name,
void *data) {
1396 __kmp_stg_print_int(buffer, name, __kmp_dflt_max_active_levels);
1401static void __kmp_stg_parse_default_device(
char const *name,
char const *value,
1403 __kmp_default_device = kmp_trait_context::parse_single_device(
1404 value, 0, KMP_MAX_DEFAULT_DEVICE_LIMIT, name);
1407static void __kmp_stg_print_default_device(kmp_str_buf_t *buffer,
1408 char const *name,
void *data) {
1409 __kmp_stg_print_int(buffer, name, __kmp_default_device);
1414static void __kmp_stg_parse_target_offload(
char const *name,
char const *value,
1416 kmp_trimmed_str_t value_str(value);
1417 const char *scan = value_str.get();
1418 __kmp_target_offload = tgt_default;
1423 if (!__kmp_strcasecmp_with_sentinel(
"mandatory", scan, 0)) {
1424 __kmp_target_offload = tgt_mandatory;
1425 }
else if (!__kmp_strcasecmp_with_sentinel(
"disabled", scan, 0)) {
1426 __kmp_target_offload = tgt_disabled;
1427 }
else if (!__kmp_strcasecmp_with_sentinel(
"default", scan, 0)) {
1428 __kmp_target_offload = tgt_default;
1430 KMP_WARNING(SyntaxErrorUsing, name,
"DEFAULT");
1434static void __kmp_stg_print_target_offload(kmp_str_buf_t *buffer,
1435 char const *name,
void *data) {
1436 const char *value = NULL;
1437 if (__kmp_target_offload == tgt_default)
1439 else if (__kmp_target_offload == tgt_mandatory)
1440 value =
"MANDATORY";
1441 else if (__kmp_target_offload == tgt_disabled)
1443 KMP_DEBUG_ASSERT(value);
1444 if (__kmp_env_format) {
1445 KMP_STR_BUF_PRINT_NAME;
1447 __kmp_str_buf_print(buffer,
" %s", name);
1449 __kmp_str_buf_print(buffer,
"=%s\n", value);
1454static void __kmp_stg_parse_max_task_priority(
char const *name,
1455 char const *value,
void *data) {
1456 __kmp_stg_parse_int(name, value, 0, KMP_MAX_TASK_PRIORITY_LIMIT,
1457 &__kmp_max_task_priority);
1460static void __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer,
1461 char const *name,
void *data) {
1462 __kmp_stg_print_int(buffer, name, __kmp_max_task_priority);
1467static void __kmp_stg_parse_taskloop_min_tasks(
char const *name,
1468 char const *value,
void *data) {
1470 __kmp_stg_parse_int(name, value, 0, INT_MAX, &tmp);
1471 __kmp_taskloop_min_tasks = tmp;
1474static void __kmp_stg_print_taskloop_min_tasks(kmp_str_buf_t *buffer,
1475 char const *name,
void *data) {
1476 __kmp_stg_print_uint64(buffer, name, __kmp_taskloop_min_tasks);
1481static void __kmp_stg_parse_disp_buffers(
char const *name,
char const *value,
1483 if (TCR_4(__kmp_init_serial)) {
1484 KMP_WARNING(EnvSerialWarn, name);
1487 __kmp_stg_parse_int(name, value, KMP_MIN_DISP_NUM_BUFF, KMP_MAX_DISP_NUM_BUFF,
1488 &__kmp_dispatch_num_buffers);
1491static void __kmp_stg_print_disp_buffers(kmp_str_buf_t *buffer,
1492 char const *name,
void *data) {
1493 __kmp_stg_print_int(buffer, name, __kmp_dispatch_num_buffers);
1499static void __kmp_stg_parse_hot_teams_level(
char const *name,
char const *value,
1501 if (TCR_4(__kmp_init_parallel)) {
1502 KMP_WARNING(EnvParallelWarn, name);
1505 __kmp_stg_parse_int(name, value, 0, 1024, &__kmp_hot_teams_max_level);
1509static void __kmp_stg_print_hot_teams_level(kmp_str_buf_t *buffer,
1510 char const *name,
void *data) {
1511 __kmp_stg_print_int(buffer, name, __kmp_hot_teams_max_level);
1514static void __kmp_stg_parse_hot_teams_mode(
char const *name,
char const *value,
1516 if (TCR_4(__kmp_init_parallel)) {
1517 KMP_WARNING(EnvParallelWarn, name);
1520 __kmp_stg_parse_int(name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT,
1521 &__kmp_hot_teams_mode);
1524static void __kmp_stg_print_hot_teams_mode(kmp_str_buf_t *buffer,
1525 char const *name,
void *data) {
1526 __kmp_stg_print_int(buffer, name, __kmp_hot_teams_mode);
1532#if KMP_HANDLE_SIGNALS
1534static void __kmp_stg_parse_handle_signals(
char const *name,
char const *value,
1536 __kmp_stg_parse_bool(name, value, &__kmp_handle_signals);
1539static void __kmp_stg_print_handle_signals(kmp_str_buf_t *buffer,
1540 char const *name,
void *data) {
1541 __kmp_stg_print_bool(buffer, name, __kmp_handle_signals);
1551#define KMP_STG_X_DEBUG(x) \
1552 static void __kmp_stg_parse_##x##_debug(char const *name, char const *value, \
1554 __kmp_stg_parse_int(name, value, 0, INT_MAX, &kmp_##x##_debug); \
1556 static void __kmp_stg_print_##x##_debug(kmp_str_buf_t *buffer, \
1557 char const *name, void *data) { \
1558 __kmp_stg_print_int(buffer, name, kmp_##x##_debug); \
1568#undef KMP_STG_X_DEBUG
1570static void __kmp_stg_parse_debug(
char const *name,
char const *value,
1573 __kmp_stg_parse_int(name, value, 0, INT_MAX, &debug);
1574 if (kmp_a_debug < debug) {
1575 kmp_a_debug = debug;
1577 if (kmp_b_debug < debug) {
1578 kmp_b_debug = debug;
1580 if (kmp_c_debug < debug) {
1581 kmp_c_debug = debug;
1583 if (kmp_d_debug < debug) {
1584 kmp_d_debug = debug;
1586 if (kmp_e_debug < debug) {
1587 kmp_e_debug = debug;
1589 if (kmp_f_debug < debug) {
1590 kmp_f_debug = debug;
1594static void __kmp_stg_parse_debug_buf(
char const *name,
char const *value,
1596 __kmp_stg_parse_bool(name, value, &__kmp_debug_buf);
1600 if (__kmp_debug_buf) {
1602 int elements = __kmp_debug_buf_lines * __kmp_debug_buf_chars;
1605 __kmp_debug_buffer = (
char *)__kmp_page_allocate(elements *
sizeof(
char));
1606 for (i = 0; i < elements; i += __kmp_debug_buf_chars)
1607 __kmp_debug_buffer[i] =
'\0';
1609 __kmp_debug_count = 0;
1611 K_DIAG(1, (
"__kmp_debug_buf = %d\n", __kmp_debug_buf));
1614static void __kmp_stg_print_debug_buf(kmp_str_buf_t *buffer,
char const *name,
1616 __kmp_stg_print_bool(buffer, name, __kmp_debug_buf);
1619static void __kmp_stg_parse_debug_buf_atomic(
char const *name,
1620 char const *value,
void *data) {
1621 __kmp_stg_parse_bool(name, value, &__kmp_debug_buf_atomic);
1624static void __kmp_stg_print_debug_buf_atomic(kmp_str_buf_t *buffer,
1625 char const *name,
void *data) {
1626 __kmp_stg_print_bool(buffer, name, __kmp_debug_buf_atomic);
1629static void __kmp_stg_parse_debug_buf_chars(
char const *name,
char const *value,
1631 __kmp_stg_parse_int(name, value, KMP_DEBUG_BUF_CHARS_MIN, INT_MAX,
1632 &__kmp_debug_buf_chars);
1635static void __kmp_stg_print_debug_buf_chars(kmp_str_buf_t *buffer,
1636 char const *name,
void *data) {
1637 __kmp_stg_print_int(buffer, name, __kmp_debug_buf_chars);
1640static void __kmp_stg_parse_debug_buf_lines(
char const *name,
char const *value,
1642 __kmp_stg_parse_int(name, value, KMP_DEBUG_BUF_LINES_MIN, INT_MAX,
1643 &__kmp_debug_buf_lines);
1646static void __kmp_stg_print_debug_buf_lines(kmp_str_buf_t *buffer,
1647 char const *name,
void *data) {
1648 __kmp_stg_print_int(buffer, name, __kmp_debug_buf_lines);
1651static void __kmp_stg_parse_diag(
char const *name,
char const *value,
1653 __kmp_stg_parse_int(name, value, 0, INT_MAX, &kmp_diag);
1656static void __kmp_stg_print_diag(kmp_str_buf_t *buffer,
char const *name,
1658 __kmp_stg_print_int(buffer, name, kmp_diag);
1666static void __kmp_stg_parse_align_alloc(
char const *name,
char const *value,
1668 __kmp_stg_parse_size(name, value, CACHE_LINE, INT_MAX, NULL,
1669 &__kmp_align_alloc, 1);
1671 if (__kmp_align_alloc == 0 || ((__kmp_align_alloc - 1) & __kmp_align_alloc)) {
1672 KMP_WARNING(StgInvalidValue, name, value);
1673 __kmp_align_alloc = CACHE_LINE;
1677static void __kmp_stg_print_align_alloc(kmp_str_buf_t *buffer,
char const *name,
1679 __kmp_stg_print_size(buffer, name, __kmp_align_alloc);
1688static void __kmp_stg_parse_barrier_branch_bit(
char const *name,
1689 char const *value,
void *data) {
1693 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1694 var = __kmp_barrier_branch_bit_env_name[i];
1695 if ((strcmp(var, name) == 0) && (value != 0)) {
1698 comma = CCAST(
char *, strchr(value,
','));
1699 __kmp_barrier_gather_branch_bits[i] =
1700 (kmp_uint32)__kmp_str_to_int(value,
',');
1702 if (comma == NULL) {
1703 __kmp_barrier_release_branch_bits[i] = __kmp_barrier_release_bb_dflt;
1705 __kmp_barrier_release_branch_bits[i] =
1706 (kmp_uint32)__kmp_str_to_int(comma + 1, 0);
1707 if (__kmp_barrier_release_branch_bits[i] == 0 ||
1708 __kmp_barrier_release_branch_bits[i] > KMP_MAX_BRANCH_BITS) {
1709 __kmp_msg(kmp_ms_warning,
1710 KMP_MSG(BarrReleaseValueInvalid, name, comma + 1),
1712 __kmp_barrier_release_branch_bits[i] = __kmp_barrier_release_bb_dflt;
1715 if (__kmp_barrier_gather_branch_bits[i] == 0 ||
1716 __kmp_barrier_gather_branch_bits[i] > KMP_MAX_BRANCH_BITS) {
1717 KMP_WARNING(BarrGatherValueInvalid, name, value);
1718 KMP_INFORM(Using_uint_Value, name, __kmp_barrier_gather_bb_dflt);
1719 __kmp_barrier_gather_branch_bits[i] = __kmp_barrier_gather_bb_dflt;
1722 K_DIAG(1, (
"%s == %d,%d\n", __kmp_barrier_branch_bit_env_name[i],
1723 __kmp_barrier_gather_branch_bits[i],
1724 __kmp_barrier_release_branch_bits[i]))
1728static void __kmp_stg_print_barrier_branch_bit(kmp_str_buf_t *buffer,
1729 char const *name,
void *data) {
1731 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1732 var = __kmp_barrier_branch_bit_env_name[i];
1733 if (strcmp(var, name) == 0) {
1734 if (__kmp_env_format) {
1735 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_branch_bit_env_name[i]);
1737 __kmp_str_buf_print(buffer,
" %s='",
1738 __kmp_barrier_branch_bit_env_name[i]);
1740 __kmp_str_buf_print(buffer,
"%d,%d'\n",
1741 __kmp_barrier_gather_branch_bits[i],
1742 __kmp_barrier_release_branch_bits[i]);
1754static void __kmp_stg_parse_barrier_pattern(
char const *name,
char const *value,
1759 static int dist_req = 0, non_dist_req = 0;
1760 static bool warn = 1;
1761 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1762 var = __kmp_barrier_pattern_env_name[i];
1764 if ((strcmp(var, name) == 0) && (value != 0)) {
1766 char *comma = CCAST(
char *, strchr(value,
','));
1769 for (j = bp_linear_bar; j < bp_last_bar; j++) {
1770 if (__kmp_match_with_sentinel(__kmp_barrier_pattern_name[j], value, 1,
1772 if (j == bp_dist_bar) {
1777 __kmp_barrier_gather_pattern[i] = (kmp_bar_pat_e)j;
1781 if (j == bp_last_bar) {
1782 KMP_WARNING(BarrGatherValueInvalid, name, value);
1783 KMP_INFORM(Using_str_Value, name,
1784 __kmp_barrier_pattern_name[bp_linear_bar]);
1788 if (comma != NULL) {
1789 for (j = bp_linear_bar; j < bp_last_bar; j++) {
1790 if (__kmp_str_match(__kmp_barrier_pattern_name[j], 1, comma + 1)) {
1791 if (j == bp_dist_bar) {
1796 __kmp_barrier_release_pattern[i] = (kmp_bar_pat_e)j;
1800 if (j == bp_last_bar) {
1801 __kmp_msg(kmp_ms_warning,
1802 KMP_MSG(BarrReleaseValueInvalid, name, comma + 1),
1804 KMP_INFORM(Using_str_Value, name,
1805 __kmp_barrier_pattern_name[bp_linear_bar]);
1810 if (dist_req != 0) {
1812 if ((non_dist_req != 0) && warn) {
1813 KMP_INFORM(BarrierPatternOverride, name,
1814 __kmp_barrier_pattern_name[bp_dist_bar]);
1817 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1818 if (__kmp_barrier_release_pattern[i] != bp_dist_bar)
1819 __kmp_barrier_release_pattern[i] = bp_dist_bar;
1820 if (__kmp_barrier_gather_pattern[i] != bp_dist_bar)
1821 __kmp_barrier_gather_pattern[i] = bp_dist_bar;
1826static void __kmp_stg_print_barrier_pattern(kmp_str_buf_t *buffer,
1827 char const *name,
void *data) {
1829 for (
int i = bs_plain_barrier; i < bs_last_barrier; i++) {
1830 var = __kmp_barrier_pattern_env_name[i];
1831 if (strcmp(var, name) == 0) {
1832 int j = __kmp_barrier_gather_pattern[i];
1833 int k = __kmp_barrier_release_pattern[i];
1834 if (__kmp_env_format) {
1835 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_pattern_env_name[i]);
1837 __kmp_str_buf_print(buffer,
" %s='",
1838 __kmp_barrier_pattern_env_name[i]);
1840 KMP_DEBUG_ASSERT(j < bp_last_bar && k < bp_last_bar);
1841 __kmp_str_buf_print(buffer,
"%s,%s'\n", __kmp_barrier_pattern_name[j],
1842 __kmp_barrier_pattern_name[k]);
1850static void __kmp_stg_parse_abort_delay(
char const *name,
char const *value,
1854 int delay = __kmp_abort_delay / 1000;
1855 __kmp_stg_parse_int(name, value, 0, INT_MAX / 1000, &delay);
1856 __kmp_abort_delay = delay * 1000;
1859static void __kmp_stg_print_abort_delay(kmp_str_buf_t *buffer,
char const *name,
1861 __kmp_stg_print_int(buffer, name, __kmp_abort_delay);
1867static void __kmp_stg_parse_cpuinfo_file(
char const *name,
char const *value,
1869#if KMP_AFFINITY_SUPPORTED
1870 __kmp_stg_parse_str(name, value, &__kmp_cpuinfo_file);
1871 K_DIAG(1, (
"__kmp_cpuinfo_file == %s\n", __kmp_cpuinfo_file));
1875static void __kmp_stg_print_cpuinfo_file(kmp_str_buf_t *buffer,
1876 char const *name,
void *data) {
1877#if KMP_AFFINITY_SUPPORTED
1878 if (__kmp_env_format) {
1879 KMP_STR_BUF_PRINT_NAME;
1881 __kmp_str_buf_print(buffer,
" %s", name);
1883 if (__kmp_cpuinfo_file) {
1884 __kmp_str_buf_print(buffer,
"='%s'\n", __kmp_cpuinfo_file);
1886 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1894static void __kmp_stg_parse_force_reduction(
char const *name,
char const *value,
1896 kmp_stg_fr_data_t *reduction = (kmp_stg_fr_data_t *)data;
1899 rc = __kmp_stg_check_rivals(name, value, reduction->rivals);
1903 if (reduction->force) {
1905 if (__kmp_str_match(
"critical", 0, value))
1906 __kmp_force_reduction_method = critical_reduce_block;
1907 else if (__kmp_str_match(
"atomic", 0, value))
1908 __kmp_force_reduction_method = atomic_reduce_block;
1909 else if (__kmp_str_match(
"tree", 0, value))
1910 __kmp_force_reduction_method = tree_reduce_block;
1912 KMP_FATAL(UnknownForceReduction, name, value);
1916 __kmp_stg_parse_bool(name, value, &__kmp_determ_red);
1917 if (__kmp_determ_red) {
1918 __kmp_force_reduction_method = tree_reduce_block;
1920 __kmp_force_reduction_method = reduction_method_not_defined;
1923 K_DIAG(1, (
"__kmp_force_reduction_method == %d\n",
1924 __kmp_force_reduction_method));
1927static void __kmp_stg_print_force_reduction(kmp_str_buf_t *buffer,
1928 char const *name,
void *data) {
1930 kmp_stg_fr_data_t *reduction = (kmp_stg_fr_data_t *)data;
1931 if (reduction->force) {
1932 if (__kmp_force_reduction_method == critical_reduce_block) {
1933 __kmp_stg_print_str(buffer, name,
"critical");
1934 }
else if (__kmp_force_reduction_method == atomic_reduce_block) {
1935 __kmp_stg_print_str(buffer, name,
"atomic");
1936 }
else if (__kmp_force_reduction_method == tree_reduce_block) {
1937 __kmp_stg_print_str(buffer, name,
"tree");
1939 if (__kmp_env_format) {
1940 KMP_STR_BUF_PRINT_NAME;
1942 __kmp_str_buf_print(buffer,
" %s", name);
1944 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
1947 __kmp_stg_print_bool(buffer, name, __kmp_determ_red);
1955static void __kmp_stg_parse_storage_map(
char const *name,
char const *value,
1957 if (__kmp_str_match(
"verbose", 1, value)) {
1958 __kmp_storage_map = TRUE;
1959 __kmp_storage_map_verbose = TRUE;
1960 __kmp_storage_map_verbose_specified = TRUE;
1963 __kmp_storage_map_verbose = FALSE;
1964 __kmp_stg_parse_bool(name, value, &__kmp_storage_map);
1968static void __kmp_stg_print_storage_map(kmp_str_buf_t *buffer,
char const *name,
1970 if (__kmp_storage_map_verbose || __kmp_storage_map_verbose_specified) {
1971 __kmp_stg_print_str(buffer, name,
"verbose");
1973 __kmp_stg_print_bool(buffer, name, __kmp_storage_map);
1980static void __kmp_stg_parse_all_threadprivate(
char const *name,
1981 char const *value,
void *data) {
1982 __kmp_stg_parse_int(name, value,
1983 __kmp_allThreadsSpecified ? __kmp_max_nth : 1,
1984 __kmp_max_nth, &__kmp_tp_capacity);
1987static void __kmp_stg_print_all_threadprivate(kmp_str_buf_t *buffer,
1988 char const *name,
void *data) {
1989 __kmp_stg_print_int(buffer, name, __kmp_tp_capacity);
1995static void __kmp_stg_parse_foreign_threads_threadprivate(
char const *name,
1998 __kmp_stg_parse_bool(name, value, &__kmp_foreign_tp);
2001static void __kmp_stg_print_foreign_threads_threadprivate(kmp_str_buf_t *buffer,
2004 __kmp_stg_print_bool(buffer, name, __kmp_foreign_tp);
2010static inline const char *
2011__kmp_hw_get_core_type_keyword(kmp_hw_core_type_t type) {
2013 case KMP_HW_CORE_TYPE_UNKNOWN:
2014 case KMP_HW_MAX_NUM_CORE_TYPES:
2016#if KMP_ARCH_X86 || KMP_ARCH_X86_64
2017 case KMP_HW_CORE_TYPE_ATOM:
2018 return "intel_atom";
2019 case KMP_HW_CORE_TYPE_CORE:
2020 return "intel_core";
2023 KMP_ASSERT2(
false,
"Unhandled kmp_hw_core_type_t enumeration");
2024 KMP_BUILTIN_UNREACHABLE;
2027#if KMP_AFFINITY_SUPPORTED
2029static int __kmp_parse_affinity_proc_id_list(
const char *var,
const char *env,
2030 const char **nextEnv,
2032 const char *scan = env;
2033 const char *next = scan;
2039 int start, end, stride;
2043 if (*next ==
'\0') {
2054 if ((*next <
'0') || (*next >
'9')) {
2055 KMP_WARNING(AffSyntaxError, var);
2059 num = __kmp_str_to_int(scan, *next);
2060 KMP_ASSERT(num >= 0);
2078 if ((*next <
'0') || (*next >
'9')) {
2079 KMP_WARNING(AffSyntaxError, var);
2084 num = __kmp_str_to_int(scan, *next);
2085 KMP_ASSERT(num >= 0);
2098 if ((*next <
'0') || (*next >
'9')) {
2100 KMP_WARNING(AffSyntaxError, var);
2108 start = __kmp_str_to_int(scan, *next);
2109 KMP_ASSERT(start >= 0);
2128 if ((*next <
'0') || (*next >
'9')) {
2129 KMP_WARNING(AffSyntaxError, var);
2133 end = __kmp_str_to_int(scan, *next);
2134 KMP_ASSERT(end >= 0);
2151 if ((*next <
'0') || (*next >
'9')) {
2152 KMP_WARNING(AffSyntaxError, var);
2156 stride = __kmp_str_to_int(scan, *next);
2157 KMP_ASSERT(stride >= 0);
2163 KMP_WARNING(AffZeroStride, var);
2168 KMP_WARNING(AffStartGreaterEnd, var, start, end);
2173 KMP_WARNING(AffStrideLessZero, var, start, end);
2177 if ((end - start) / stride > 65536) {
2178 KMP_WARNING(AffRangeTooBig, var, end, start, stride);
2195 ptrdiff_t len = next - env;
2196 char *retlist = (
char *)KMP_INTERNAL_MALLOC((len + 1) *
sizeof(char));
2197 KMP_MEMCPY_S(retlist, (len + 1) *
sizeof(
char), env, len *
sizeof(
char));
2198 retlist[len] =
'\0';
2199 *proclist = retlist;
2206static kmp_setting_t *__kmp_affinity_notype = NULL;
2208static void __kmp_parse_affinity_env(
char const *name,
char const *value,
2209 kmp_affinity_t *out_affinity) {
2210 char *buffer = NULL;
2228 KMP_ASSERT(value != NULL);
2230 if (TCR_4(__kmp_init_middle)) {
2231 KMP_WARNING(EnvMiddleWarn, name);
2232 __kmp_env_toPrint(name, 0);
2235 __kmp_env_toPrint(name, 1);
2238 __kmp_str_format(
"%s", value);
2248#define EMIT_WARN(skip, errlist) \
2252 SKIP_TO(next, ','); \
2256 KMP_WARNING errlist; \
2265#define _set_param(_guard, _var, _val) \
2267 if (_guard == 0) { \
2270 EMIT_WARN(FALSE, (AffParamDefined, name, start)); \
2275#define set_type(val) _set_param(type, out_affinity->type, val)
2276#define set_verbose(val) _set_param(verbose, out_affinity->flags.verbose, val)
2277#define set_warnings(val) \
2278 _set_param(warnings, out_affinity->flags.warnings, val)
2279#define set_respect(val) _set_param(respect, out_affinity->flags.respect, val)
2280#define set_dups(val) _set_param(dups, out_affinity->flags.dups, val)
2281#define set_proclist(val) _set_param(proclist, out_affinity->proclist, val)
2282#define set_reset(val) _set_param(reset, out_affinity->flags.reset, val)
2284#define set_gran(val, levels) \
2287 out_affinity->gran = val; \
2288 out_affinity->gran_levels = levels; \
2290 EMIT_WARN(FALSE, (AffParamDefined, name, start)); \
2295 KMP_DEBUG_ASSERT((__kmp_nested_proc_bind.bind_types != NULL) &&
2296 (__kmp_nested_proc_bind.used > 0));
2298 while (*buf !=
'\0') {
2301 if (__kmp_match_str(
"none", buf, CCAST(
const char **, &next))) {
2302 set_type(affinity_none);
2303 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2305 }
else if (__kmp_match_str(
"scatter", buf, CCAST(
const char **, &next))) {
2306 set_type(affinity_scatter);
2307 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2309 }
else if (__kmp_match_str(
"compact", buf, CCAST(
const char **, &next))) {
2310 set_type(affinity_compact);
2311 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2313 }
else if (__kmp_match_str(
"logical", buf, CCAST(
const char **, &next))) {
2314 set_type(affinity_logical);
2315 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2317 }
else if (__kmp_match_str(
"physical", buf, CCAST(
const char **, &next))) {
2318 set_type(affinity_physical);
2319 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2321 }
else if (__kmp_match_str(
"explicit", buf, CCAST(
const char **, &next))) {
2322 set_type(affinity_explicit);
2323 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2325 }
else if (__kmp_match_str(
"balanced", buf, CCAST(
const char **, &next))) {
2326 set_type(affinity_balanced);
2327 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2329 }
else if (__kmp_match_str(
"disabled", buf, CCAST(
const char **, &next))) {
2330 set_type(affinity_disabled);
2331 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2333 }
else if (__kmp_match_str(
"verbose", buf, CCAST(
const char **, &next))) {
2336 }
else if (__kmp_match_str(
"noverbose", buf, CCAST(
const char **, &next))) {
2339 }
else if (__kmp_match_str(
"warnings", buf, CCAST(
const char **, &next))) {
2342 }
else if (__kmp_match_str(
"nowarnings", buf,
2343 CCAST(
const char **, &next))) {
2344 set_warnings(FALSE);
2346 }
else if (__kmp_match_str(
"respect", buf, CCAST(
const char **, &next))) {
2349 }
else if (__kmp_match_str(
"norespect", buf, CCAST(
const char **, &next))) {
2352 }
else if (__kmp_match_str(
"reset", buf, CCAST(
const char **, &next))) {
2355 }
else if (__kmp_match_str(
"noreset", buf, CCAST(
const char **, &next))) {
2358 }
else if (__kmp_match_str(
"duplicates", buf,
2359 CCAST(
const char **, &next)) ||
2360 __kmp_match_str(
"dups", buf, CCAST(
const char **, &next))) {
2363 }
else if (__kmp_match_str(
"noduplicates", buf,
2364 CCAST(
const char **, &next)) ||
2365 __kmp_match_str(
"nodups", buf, CCAST(
const char **, &next))) {
2368 }
else if (__kmp_match_str(
"granularity", buf,
2369 CCAST(
const char **, &next)) ||
2370 __kmp_match_str(
"gran", buf, CCAST(
const char **, &next))) {
2373 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2383 if (__kmp_match_str(
"core_type", buf, CCAST(
const char **, &next))) {
2384 set_gran(KMP_HW_CORE, -1);
2385 out_affinity->flags.core_types_gran = 1;
2388 }
else if (__kmp_match_str(
"core_efficiency", buf,
2389 CCAST(
const char **, &next)) ||
2390 __kmp_match_str(
"core_eff", buf,
2391 CCAST(
const char **, &next))) {
2392 set_gran(KMP_HW_CORE, -1);
2393 out_affinity->flags.core_effs_gran = 1;
2399 KMP_FOREACH_HW_TYPE(type) {
2400 const char *name = __kmp_hw_get_keyword(type);
2401 if (__kmp_match_str(name, buf, CCAST(
const char **, &next))) {
2411 if (__kmp_match_str(
"fine", buf, CCAST(
const char **, &next))) {
2412 set_gran(KMP_HW_THREAD, -1);
2415 }
else if (__kmp_match_str(
"package", buf,
2416 CCAST(
const char **, &next))) {
2417 set_gran(KMP_HW_SOCKET, -1);
2420 }
else if (__kmp_match_str(
"node", buf, CCAST(
const char **, &next))) {
2421 set_gran(KMP_HW_NUMA, -1);
2424#if KMP_GROUP_AFFINITY
2425 }
else if (__kmp_match_str(
"group", buf, CCAST(
const char **, &next))) {
2426 set_gran(KMP_HW_PROC_GROUP, -1);
2430 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2434 n = __kmp_str_to_int(buf, *next);
2437 set_gran(KMP_HW_UNKNOWN, n);
2440 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2444 }
else if (__kmp_match_str(
"proclist", buf, CCAST(
const char **, &next))) {
2445 char *temp_proclist;
2449 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2455 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2460 if (!__kmp_parse_affinity_proc_id_list(
2461 name, buf, CCAST(
const char **, &next), &temp_proclist)) {
2473 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2477 set_proclist(temp_proclist);
2478 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2483 n = __kmp_str_to_int(buf, *next);
2489 KMP_WARNING(AffManyParams, name, start);
2493 EMIT_WARN(TRUE, (AffInvalidParam, name, start));
2501 }
else if (*next !=
'\0') {
2502 const char *temp = next;
2503 EMIT_WARN(TRUE, (ParseExtraCharsWarn, name, temp));
2515#undef set_granularity
2518 __kmp_str_free(&buffer);
2522 KMP_WARNING(AffProcListNoType, name);
2523 out_affinity->type = affinity_explicit;
2524 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2525 }
else if (out_affinity->type != affinity_explicit) {
2526 KMP_WARNING(AffProcListNotExplicit, name);
2527 KMP_ASSERT(out_affinity->proclist != NULL);
2528 KMP_INTERNAL_FREE(out_affinity->proclist);
2529 out_affinity->proclist = NULL;
2532 switch (out_affinity->type) {
2533 case affinity_logical:
2534 case affinity_physical: {
2536 out_affinity->offset = number[0];
2539 KMP_WARNING(AffManyParamsForLogic, name, number[1]);
2542 case affinity_balanced: {
2544 out_affinity->compact = number[0];
2547 out_affinity->offset = number[1];
2550 if (__kmp_affinity.gran == KMP_HW_UNKNOWN) {
2551 int verbose = out_affinity->flags.verbose;
2552 int warnings = out_affinity->flags.warnings;
2553#if KMP_MIC_SUPPORTED
2554 if (__kmp_mic_type != non_mic) {
2555 if (verbose || warnings) {
2556 KMP_WARNING(AffGranUsing, out_affinity->env_var,
"fine");
2558 out_affinity->gran = KMP_HW_THREAD;
2562 if (verbose || warnings) {
2563 KMP_WARNING(AffGranUsing, out_affinity->env_var,
"core");
2565 out_affinity->gran = KMP_HW_CORE;
2569 case affinity_scatter:
2570 case affinity_compact: {
2572 out_affinity->compact = number[0];
2575 out_affinity->offset = number[1];
2578 case affinity_explicit: {
2579 if (out_affinity->proclist == NULL) {
2580 KMP_WARNING(AffNoProcList, name);
2581 out_affinity->type = affinity_none;
2584 KMP_WARNING(AffNoParam, name,
"explicit");
2587 case affinity_none: {
2589 KMP_WARNING(AffNoParam, name,
"none");
2592 case affinity_disabled: {
2594 KMP_WARNING(AffNoParam, name,
"disabled");
2597 case affinity_default: {
2599 KMP_WARNING(AffNoParam, name,
"default");
2608static void __kmp_stg_parse_affinity(
char const *name,
char const *value,
2610 kmp_setting_t **rivals = (kmp_setting_t **)data;
2613 rc = __kmp_stg_check_rivals(name, value, rivals);
2618 __kmp_parse_affinity_env(name, value, &__kmp_affinity);
2621static void __kmp_stg_parse_hh_affinity(
char const *name,
char const *value,
2623 __kmp_parse_affinity_env(name, value, &__kmp_hh_affinity);
2625 if (__kmp_hh_affinity.flags.reset) {
2626 KMP_WARNING(AffInvalidParam, name,
"reset");
2628 if (__kmp_hh_affinity.flags.respect != affinity_respect_mask_default) {
2629 KMP_WARNING(AffInvalidParam, name,
"respect");
2633static void __kmp_print_affinity_env(kmp_str_buf_t *buffer,
char const *name,
2634 const kmp_affinity_t &affinity) {
2635 bool is_hh_affinity = (&affinity == &__kmp_hh_affinity);
2636 if (__kmp_env_format) {
2637 KMP_STR_BUF_PRINT_NAME_EX(name);
2639 __kmp_str_buf_print(buffer,
" %s='", name);
2641 if (affinity.flags.verbose) {
2642 __kmp_str_buf_print(buffer,
"%s,",
"verbose");
2644 __kmp_str_buf_print(buffer,
"%s,",
"noverbose");
2646 if (affinity.flags.warnings) {
2647 __kmp_str_buf_print(buffer,
"%s,",
"warnings");
2649 __kmp_str_buf_print(buffer,
"%s,",
"nowarnings");
2651 if (KMP_AFFINITY_CAPABLE()) {
2654 if (!is_hh_affinity) {
2655 if (affinity.flags.respect) {
2656 __kmp_str_buf_print(buffer,
"%s,",
"respect");
2658 __kmp_str_buf_print(buffer,
"%s,",
"norespect");
2660 if (affinity.flags.reset) {
2661 __kmp_str_buf_print(buffer,
"%s,",
"reset");
2663 __kmp_str_buf_print(buffer,
"%s,",
"noreset");
2666 __kmp_str_buf_print(buffer,
"granularity=");
2667 if (affinity.flags.core_types_gran)
2668 __kmp_str_buf_print(buffer,
"core_type,");
2669 else if (affinity.flags.core_effs_gran) {
2670 __kmp_str_buf_print(buffer,
"core_eff,");
2672 __kmp_str_buf_print(
2673 buffer,
"%s,", __kmp_hw_get_keyword(affinity.gran,
false));
2676 if (!KMP_AFFINITY_CAPABLE()) {
2677 __kmp_str_buf_print(buffer,
"%s",
"disabled");
2679 int compact = affinity.compact;
2680 int offset = affinity.offset;
2681 switch (affinity.type) {
2683 __kmp_str_buf_print(buffer,
"%s",
"none");
2685 case affinity_physical:
2686 __kmp_str_buf_print(buffer,
"%s,%d",
"physical", offset);
2688 case affinity_logical:
2689 __kmp_str_buf_print(buffer,
"%s,%d",
"logical", offset);
2691 case affinity_compact:
2692 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"compact", compact, offset);
2694 case affinity_scatter:
2695 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"scatter", compact, offset);
2697 case affinity_explicit:
2698 __kmp_str_buf_print(buffer,
"%s=[%s],%s",
"proclist", affinity.proclist,
2701 case affinity_balanced:
2702 __kmp_str_buf_print(buffer,
"%s,%d,%d",
"balanced", compact, offset);
2704 case affinity_disabled:
2705 __kmp_str_buf_print(buffer,
"%s",
"disabled");
2707 case affinity_default:
2708 __kmp_str_buf_print(buffer,
"%s",
"default");
2711 __kmp_str_buf_print(buffer,
"%s",
"<unknown>");
2715 __kmp_str_buf_print(buffer,
"'\n");
2718static void __kmp_stg_print_affinity(kmp_str_buf_t *buffer,
char const *name,
2720 __kmp_print_affinity_env(buffer, name, __kmp_affinity);
2722static void __kmp_stg_print_hh_affinity(kmp_str_buf_t *buffer,
char const *name,
2724 __kmp_print_affinity_env(buffer, name, __kmp_hh_affinity);
2727#ifdef KMP_GOMP_COMPAT
2729static void __kmp_stg_parse_gomp_cpu_affinity(
char const *name,
2730 char const *value,
void *data) {
2731 const char *next = NULL;
2732 char *temp_proclist;
2733 kmp_setting_t **rivals = (kmp_setting_t **)data;
2736 rc = __kmp_stg_check_rivals(name, value, rivals);
2741 if (TCR_4(__kmp_init_middle)) {
2742 KMP_WARNING(EnvMiddleWarn, name);
2743 __kmp_env_toPrint(name, 0);
2747 __kmp_env_toPrint(name, 1);
2749 if (__kmp_parse_affinity_proc_id_list(name, value, &next, &temp_proclist)) {
2751 if (*next ==
'\0') {
2753 __kmp_affinity.proclist = temp_proclist;
2754 __kmp_affinity.type = affinity_explicit;
2755 __kmp_affinity.gran = KMP_HW_THREAD;
2756 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2758 KMP_WARNING(AffSyntaxError, name);
2759 if (temp_proclist != NULL) {
2760 KMP_INTERNAL_FREE((
void *)temp_proclist);
2765 __kmp_affinity.type = affinity_none;
2766 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2793static int __kmp_parse_subplace_list(
const char *var,
const char **scan) {
2797 int start, count, stride;
2803 if ((**scan <
'0') || (**scan >
'9')) {
2808 start = __kmp_str_to_int(*scan, *next);
2809 KMP_ASSERT(start >= 0);
2814 if (**scan ==
'}') {
2817 if (**scan ==
',') {
2821 if (**scan !=
':') {
2828 if ((**scan <
'0') || (**scan >
'9')) {
2833 count = __kmp_str_to_int(*scan, *next);
2834 KMP_ASSERT(count >= 0);
2839 if (**scan ==
'}') {
2842 if (**scan ==
',') {
2846 if (**scan !=
':') {
2855 if (**scan ==
'+') {
2859 if (**scan ==
'-') {
2867 if ((**scan <
'0') || (**scan >
'9')) {
2872 stride = __kmp_str_to_int(*scan, *next);
2873 KMP_ASSERT(stride >= 0);
2879 if (**scan ==
'}') {
2882 if (**scan ==
',') {
2892static int __kmp_parse_place(
const char *var,
const char **scan) {
2897 if (**scan ==
'{') {
2899 if (!__kmp_parse_subplace_list(var, scan)) {
2902 if (**scan !=
'}') {
2906 }
else if (**scan ==
'!') {
2908 return __kmp_parse_place(var, scan);
2909 }
else if ((**scan >=
'0') && (**scan <=
'9')) {
2912 int proc = __kmp_str_to_int(*scan, *next);
2913 KMP_ASSERT(proc >= 0);
2922static int __kmp_parse_place_list(
const char *var,
const char *env,
2923 char **place_list) {
2924 const char *scan = env;
2925 const char *next = scan;
2930 if (!__kmp_parse_place(var, &scan)) {
2936 if (*scan ==
'\0') {
2950 if ((*scan <
'0') || (*scan >
'9')) {
2955 count = __kmp_str_to_int(scan, *next);
2956 KMP_ASSERT(count >= 0);
2961 if (*scan ==
'\0') {
2989 if ((*scan <
'0') || (*scan >
'9')) {
2994 stride = __kmp_str_to_int(scan, *next);
2995 KMP_ASSERT(stride >= 0);
3001 if (*scan ==
'\0') {
3013 ptrdiff_t len = scan - env;
3014 char *retlist = (
char *)KMP_INTERNAL_MALLOC((len + 1) *
sizeof(char));
3015 KMP_MEMCPY_S(retlist, (len + 1) *
sizeof(
char), env, len *
sizeof(
char));
3016 retlist[len] =
'\0';
3017 *place_list = retlist;
3022static inline void __kmp_places_set(
enum affinity_type type, kmp_hw_t kind) {
3023 __kmp_affinity.type = type;
3024 __kmp_affinity.gran = kind;
3025 __kmp_affinity.flags.dups = FALSE;
3026 __kmp_affinity.flags.omp_places = TRUE;
3029static void __kmp_places_syntax_error_fallback(
char const *name,
3031 const char *str = __kmp_hw_get_catalog_string(kind,
true);
3032 KMP_WARNING(SyntaxErrorUsing, name, str);
3033 __kmp_places_set(affinity_compact, kind);
3034 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default)
3035 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3038static void __kmp_stg_parse_places(
char const *name,
char const *value,
3040 struct kmp_place_t {
3046 const char *scan = value;
3047 const char *next = scan;
3048 kmp_place_t std_places[] = {{
"threads", KMP_HW_THREAD},
3049 {
"cores", KMP_HW_CORE},
3050 {
"numa_domains", KMP_HW_NUMA},
3051 {
"ll_caches", KMP_HW_LLC},
3052 {
"sockets", KMP_HW_SOCKET}};
3053 kmp_setting_t **rivals = (kmp_setting_t **)data;
3056 rc = __kmp_stg_check_rivals(name, value, rivals);
3062 for (
size_t i = 0; i <
sizeof(std_places) /
sizeof(std_places[0]); ++i) {
3063 const kmp_place_t &place = std_places[i];
3064 if (__kmp_match_str(place.name, scan, &next)) {
3066 __kmp_places_set(affinity_compact, place.type);
3069 if (KMP_HW_MAX_NUM_CORE_TYPES > 1) {
3072 if (place.type != KMP_HW_CORE) {
3073 __kmp_places_syntax_error_fallback(name, place.type);
3078#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3079 if (__kmp_match_str(
"intel_core", scan, &next)) {
3080 __kmp_affinity.core_attr_gran.core_type = KMP_HW_CORE_TYPE_CORE;
3081 __kmp_affinity.core_attr_gran.valid = 1;
3083 }
else if (__kmp_match_str(
"intel_atom", scan, &next)) {
3084 __kmp_affinity.core_attr_gran.core_type = KMP_HW_CORE_TYPE_ATOM;
3085 __kmp_affinity.core_attr_gran.valid = 1;
3089 if (__kmp_match_str(
"eff", scan, &next)) {
3091 if (!isdigit(*next)) {
3092 __kmp_places_syntax_error_fallback(name, place.type);
3097 eff = __kmp_str_to_int(scan, *next);
3099 __kmp_places_syntax_error_fallback(name, place.type);
3102 if (eff >= KMP_HW_MAX_NUM_CORE_EFFS)
3103 eff = KMP_HW_MAX_NUM_CORE_EFFS - 1;
3104 __kmp_affinity.core_attr_gran.core_eff = eff;
3105 __kmp_affinity.core_attr_gran.valid = 1;
3108 if (!__kmp_affinity.core_attr_gran.valid) {
3109 __kmp_places_syntax_error_fallback(name, place.type);
3119 KMP_FOREACH_HW_TYPE(type) {
3120 const char *name = __kmp_hw_get_keyword(type,
true);
3121 if (__kmp_match_str(
"unknowns", scan, &next))
3123 if (__kmp_match_str(name, scan, &next)) {
3125 __kmp_places_set(affinity_compact, type);
3133 if (__kmp_match_str(
"core_types", scan, &next)) {
3135 if (*scan !=
'\0') {
3136 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3138 __kmp_places_set(affinity_compact, KMP_HW_CORE);
3139 __kmp_affinity.flags.core_types_gran = 1;
3141 }
else if (__kmp_match_str(
"core_effs", scan, &next) ||
3142 __kmp_match_str(
"core_efficiencies", scan, &next)) {
3144 if (*scan !=
'\0') {
3145 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3147 __kmp_places_set(affinity_compact, KMP_HW_CORE);
3148 __kmp_affinity.flags.core_effs_gran = 1;
3154 if (__kmp_affinity.proclist != NULL) {
3155 KMP_INTERNAL_FREE((
void *)__kmp_affinity.proclist);
3156 __kmp_affinity.proclist = NULL;
3158 if (__kmp_parse_place_list(name, value, &__kmp_affinity.proclist)) {
3159 __kmp_places_set(affinity_explicit, KMP_HW_THREAD);
3162 __kmp_places_syntax_error_fallback(name, KMP_HW_CORE);
3164 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
3165 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3170 kmp_hw_t gran = __kmp_affinity.gran;
3171 if (__kmp_affinity.gran != KMP_HW_UNKNOWN) {
3172 gran = __kmp_affinity.gran;
3177 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
3178 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3182 if (*scan ==
'\0') {
3188 __kmp_places_syntax_error_fallback(name, gran);
3196 count = __kmp_str_to_int(scan, *next);
3197 KMP_ASSERT(count >= 0);
3202 __kmp_places_syntax_error_fallback(name, gran);
3208 if (*scan !=
'\0') {
3209 KMP_WARNING(ParseExtraCharsWarn, name, scan);
3211 __kmp_affinity_num_places = count;
3214static void __kmp_stg_print_places(kmp_str_buf_t *buffer,
char const *name,
3216 enum affinity_type type = __kmp_affinity.type;
3217 const char *proclist = __kmp_affinity.proclist;
3218 kmp_hw_t gran = __kmp_affinity.gran;
3220 if (__kmp_env_format) {
3221 KMP_STR_BUF_PRINT_NAME;
3223 __kmp_str_buf_print(buffer,
" %s", name);
3225 if ((__kmp_nested_proc_bind.used == 0) ||
3226 (__kmp_nested_proc_bind.bind_types == NULL) ||
3227 (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)) {
3228 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3229 }
else if (type == affinity_explicit) {
3230 if (proclist != NULL) {
3231 __kmp_str_buf_print(buffer,
"='%s'\n", proclist);
3233 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3235 }
else if (type == affinity_compact) {
3237 if (__kmp_affinity.num_masks > 0) {
3238 num = __kmp_affinity.num_masks;
3239 }
else if (__kmp_affinity_num_places > 0) {
3240 num = __kmp_affinity_num_places;
3244 if (gran != KMP_HW_UNKNOWN) {
3246 if (__kmp_affinity.flags.core_types_gran) {
3247 __kmp_str_buf_print(buffer,
"='%s'\n",
"core_types");
3250 if (__kmp_affinity.flags.core_effs_gran) {
3251 __kmp_str_buf_print(buffer,
"='%s'\n",
"core_effs");
3256 const char *name = __kmp_hw_get_keyword(gran,
true);
3257 __kmp_str_buf_print(buffer,
"='%s", name);
3260 if (__kmp_affinity.core_attr_gran.valid) {
3261 kmp_hw_core_type_t ct =
3262 (kmp_hw_core_type_t)__kmp_affinity.core_attr_gran.core_type;
3263 int eff = __kmp_affinity.core_attr_gran.core_eff;
3264 if (ct != KMP_HW_CORE_TYPE_UNKNOWN) {
3265 const char *ct_name = __kmp_hw_get_core_type_keyword(ct);
3266 __kmp_str_buf_print(buffer,
":%s", ct_name);
3267 }
else if (eff >= 0 && eff < KMP_HW_MAX_NUM_CORE_EFFS) {
3268 __kmp_str_buf_print(buffer,
":eff%d", eff);
3274 __kmp_str_buf_print(buffer,
"(%d)", num);
3275 __kmp_str_buf_print(buffer,
"'\n");
3277 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3280 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3284static void __kmp_stg_parse_topology_method(
char const *name,
char const *value,
3286 if (__kmp_str_match(
"all", 1, value)) {
3287 __kmp_affinity_top_method = affinity_top_method_all;
3289#if KMP_HWLOC_ENABLED
3290 else if (__kmp_str_match(
"hwloc", 1, value)) {
3291 __kmp_affinity_top_method = affinity_top_method_hwloc;
3294#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3295 else if (__kmp_str_match(
"cpuid_leaf31", 12, value) ||
3296 __kmp_str_match(
"cpuid 1f", 8, value) ||
3297 __kmp_str_match(
"cpuid 31", 8, value) ||
3298 __kmp_str_match(
"cpuid1f", 7, value) ||
3299 __kmp_str_match(
"cpuid31", 7, value) ||
3300 __kmp_str_match(
"leaf 1f", 7, value) ||
3301 __kmp_str_match(
"leaf 31", 7, value) ||
3302 __kmp_str_match(
"leaf1f", 6, value) ||
3303 __kmp_str_match(
"leaf31", 6, value)) {
3304 __kmp_affinity_top_method = affinity_top_method_x2apicid_1f;
3305 }
else if (__kmp_str_match(
"x2apic id", 9, value) ||
3306 __kmp_str_match(
"x2apic_id", 9, value) ||
3307 __kmp_str_match(
"x2apic-id", 9, value) ||
3308 __kmp_str_match(
"x2apicid", 8, value) ||
3309 __kmp_str_match(
"cpuid leaf 11", 13, value) ||
3310 __kmp_str_match(
"cpuid_leaf_11", 13, value) ||
3311 __kmp_str_match(
"cpuid-leaf-11", 13, value) ||
3312 __kmp_str_match(
"cpuid leaf11", 12, value) ||
3313 __kmp_str_match(
"cpuid_leaf11", 12, value) ||
3314 __kmp_str_match(
"cpuid-leaf11", 12, value) ||
3315 __kmp_str_match(
"cpuidleaf 11", 12, value) ||
3316 __kmp_str_match(
"cpuidleaf_11", 12, value) ||
3317 __kmp_str_match(
"cpuidleaf-11", 12, value) ||
3318 __kmp_str_match(
"cpuidleaf11", 11, value) ||
3319 __kmp_str_match(
"cpuid 11", 8, value) ||
3320 __kmp_str_match(
"cpuid_11", 8, value) ||
3321 __kmp_str_match(
"cpuid-11", 8, value) ||
3322 __kmp_str_match(
"cpuid11", 7, value) ||
3323 __kmp_str_match(
"leaf 11", 7, value) ||
3324 __kmp_str_match(
"leaf_11", 7, value) ||
3325 __kmp_str_match(
"leaf-11", 7, value) ||
3326 __kmp_str_match(
"leaf11", 6, value)) {
3327 __kmp_affinity_top_method = affinity_top_method_x2apicid;
3328 }
else if (__kmp_str_match(
"apic id", 7, value) ||
3329 __kmp_str_match(
"apic_id", 7, value) ||
3330 __kmp_str_match(
"apic-id", 7, value) ||
3331 __kmp_str_match(
"apicid", 6, value) ||
3332 __kmp_str_match(
"cpuid leaf 4", 12, value) ||
3333 __kmp_str_match(
"cpuid_leaf_4", 12, value) ||
3334 __kmp_str_match(
"cpuid-leaf-4", 12, value) ||
3335 __kmp_str_match(
"cpuid leaf4", 11, value) ||
3336 __kmp_str_match(
"cpuid_leaf4", 11, value) ||
3337 __kmp_str_match(
"cpuid-leaf4", 11, value) ||
3338 __kmp_str_match(
"cpuidleaf 4", 11, value) ||
3339 __kmp_str_match(
"cpuidleaf_4", 11, value) ||
3340 __kmp_str_match(
"cpuidleaf-4", 11, value) ||
3341 __kmp_str_match(
"cpuidleaf4", 10, value) ||
3342 __kmp_str_match(
"cpuid 4", 7, value) ||
3343 __kmp_str_match(
"cpuid_4", 7, value) ||
3344 __kmp_str_match(
"cpuid-4", 7, value) ||
3345 __kmp_str_match(
"cpuid4", 6, value) ||
3346 __kmp_str_match(
"leaf 4", 6, value) ||
3347 __kmp_str_match(
"leaf_4", 6, value) ||
3348 __kmp_str_match(
"leaf-4", 6, value) ||
3349 __kmp_str_match(
"leaf4", 5, value)) {
3350 __kmp_affinity_top_method = affinity_top_method_apicid;
3353 else if (__kmp_str_match(
"/proc/cpuinfo", 2, value) ||
3354 __kmp_str_match(
"cpuinfo", 5, value)) {
3355 __kmp_affinity_top_method = affinity_top_method_cpuinfo;
3357#if KMP_GROUP_AFFINITY
3358 else if (__kmp_str_match(
"group", 1, value)) {
3359 KMP_WARNING(StgDeprecatedValue, name, value,
"all");
3360 __kmp_affinity_top_method = affinity_top_method_group;
3363 else if (__kmp_str_match(
"flat", 1, value)) {
3364 __kmp_affinity_top_method = affinity_top_method_flat;
3366 KMP_WARNING(StgInvalidValue, name, value);
3370static void __kmp_stg_print_topology_method(kmp_str_buf_t *buffer,
3371 char const *name,
void *data) {
3372 char const *value = NULL;
3374 switch (__kmp_affinity_top_method) {
3375 case affinity_top_method_default:
3379 case affinity_top_method_all:
3383#if KMP_ARCH_X86 || KMP_ARCH_X86_64
3384 case affinity_top_method_x2apicid_1f:
3385 value =
"x2APIC id leaf 0x1f";
3388 case affinity_top_method_x2apicid:
3389 value =
"x2APIC id leaf 0xb";
3392 case affinity_top_method_apicid:
3397#if KMP_HWLOC_ENABLED
3398 case affinity_top_method_hwloc:
3403 case affinity_top_method_cpuinfo:
3407#if KMP_GROUP_AFFINITY
3408 case affinity_top_method_group:
3413 case affinity_top_method_flat:
3418 if (value != NULL) {
3419 __kmp_stg_print_str(buffer, name, value);
3424struct kmp_proc_bind_info_t {
3426 kmp_proc_bind_t proc_bind;
3428static kmp_proc_bind_info_t proc_bind_table[] = {
3429 {
"spread", proc_bind_spread},
3430 {
"true", proc_bind_spread},
3431 {
"close", proc_bind_close},
3433 {
"false", proc_bind_primary},
3434 {
"primary", proc_bind_primary}};
3435static void __kmp_stg_parse_teams_proc_bind(
char const *name,
char const *value,
3440 for (
size_t i = 0; i <
sizeof(proc_bind_table) /
sizeof(proc_bind_table[0]);
3442 if (__kmp_match_str(proc_bind_table[i].name, value, &end)) {
3443 __kmp_teams_proc_bind = proc_bind_table[i].proc_bind;
3449 KMP_WARNING(StgInvalidValue, name, value);
3452static void __kmp_stg_print_teams_proc_bind(kmp_str_buf_t *buffer,
3453 char const *name,
void *data) {
3454 const char *value = KMP_I18N_STR(NotDefined);
3455 for (
size_t i = 0; i <
sizeof(proc_bind_table) /
sizeof(proc_bind_table[0]);
3457 if (__kmp_teams_proc_bind == proc_bind_table[i].proc_bind) {
3458 value = proc_bind_table[i].name;
3462 __kmp_stg_print_str(buffer, name, value);
3468static void __kmp_stg_parse_proc_bind(
char const *name,
char const *value,
3470 kmp_setting_t **rivals = (kmp_setting_t **)data;
3473 rc = __kmp_stg_check_rivals(name, value, rivals);
3479 KMP_DEBUG_ASSERT((__kmp_nested_proc_bind.bind_types != NULL) &&
3480 (__kmp_nested_proc_bind.used > 0));
3482 const char *buf = value;
3488 if (__kmp_match_str(
"disabled", buf, &next)) {
3491#if KMP_AFFINITY_SUPPORTED
3492 __kmp_affinity.type = affinity_disabled;
3494 __kmp_nested_proc_bind.used = 1;
3495 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3496 }
else if (__kmp_match_str(
"false", buf, &next)) {
3499#if KMP_AFFINITY_SUPPORTED
3500 __kmp_affinity.type = affinity_none;
3502 __kmp_nested_proc_bind.used = 1;
3503 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3504 }
else if (__kmp_match_str(
"true", buf, &next)) {
3507 __kmp_nested_proc_bind.used = 1;
3508 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3513 for (scan = buf; *scan !=
'\0'; scan++) {
3520 if (__kmp_nested_proc_bind.size < nelem) {
3521 __kmp_nested_proc_bind.bind_types =
3522 (kmp_proc_bind_t *)KMP_INTERNAL_REALLOC(
3523 __kmp_nested_proc_bind.bind_types,
3524 sizeof(kmp_proc_bind_t) * nelem);
3525 if (__kmp_nested_proc_bind.bind_types == NULL) {
3526 KMP_FATAL(MemoryAllocFailed);
3528 __kmp_nested_proc_bind.size = nelem;
3530 __kmp_nested_proc_bind.used = nelem;
3532 if (nelem > 1 && !__kmp_dflt_max_active_levels_set)
3533 __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
3538 enum kmp_proc_bind_t bind;
3540 if (__kmp_match_str(
"master", buf, &next) ||
3541 __kmp_match_str(
"primary", buf, &next)) {
3544 bind = proc_bind_primary;
3545 }
else if (__kmp_match_str(
"close", buf, &next)) {
3548 bind = proc_bind_close;
3549 }
else if (__kmp_match_str(
"spread", buf, &next)) {
3552 bind = proc_bind_spread;
3554 KMP_WARNING(StgInvalidValue, name, value);
3555 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3556 __kmp_nested_proc_bind.used = 1;
3560 __kmp_nested_proc_bind.bind_types[i++] = bind;
3565 KMP_WARNING(ParseExtraCharsWarn, name, buf);
3575 KMP_WARNING(ParseExtraCharsWarn, name, buf);
3579static void __kmp_stg_print_proc_bind(kmp_str_buf_t *buffer,
char const *name,
3581 int nelem = __kmp_nested_proc_bind.used;
3582 if (__kmp_env_format) {
3583 KMP_STR_BUF_PRINT_NAME;
3585 __kmp_str_buf_print(buffer,
" %s", name);
3588 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
3591 __kmp_str_buf_print(buffer,
"='", name);
3592 for (i = 0; i < nelem; i++) {
3593 switch (__kmp_nested_proc_bind.bind_types[i]) {
3594 case proc_bind_false:
3595 __kmp_str_buf_print(buffer,
"false");
3598 case proc_bind_true:
3599 __kmp_str_buf_print(buffer,
"true");
3602 case proc_bind_primary:
3603 __kmp_str_buf_print(buffer,
"primary");
3606 case proc_bind_close:
3607 __kmp_str_buf_print(buffer,
"close");
3610 case proc_bind_spread:
3611 __kmp_str_buf_print(buffer,
"spread");
3614 case proc_bind_intel:
3615 __kmp_str_buf_print(buffer,
"intel");
3618 case proc_bind_default:
3619 __kmp_str_buf_print(buffer,
"default");
3622 if (i < nelem - 1) {
3623 __kmp_str_buf_print(buffer,
",");
3626 __kmp_str_buf_print(buffer,
"'\n");
3630static void __kmp_stg_parse_display_affinity(
char const *name,
3631 char const *value,
void *data) {
3632 __kmp_stg_parse_bool(name, value, &__kmp_display_affinity);
3634static void __kmp_stg_print_display_affinity(kmp_str_buf_t *buffer,
3635 char const *name,
void *data) {
3636 __kmp_stg_print_bool(buffer, name, __kmp_display_affinity);
3638static void __kmp_stg_parse_affinity_format(
char const *name,
char const *value,
3640 size_t length = KMP_STRLEN(value);
3641 __kmp_strncpy_truncate(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, value,
3644static void __kmp_stg_print_affinity_format(kmp_str_buf_t *buffer,
3645 char const *name,
void *data) {
3646 if (__kmp_env_format) {
3647 KMP_STR_BUF_PRINT_NAME_EX(name);
3649 __kmp_str_buf_print(buffer,
" %s='", name);
3651 __kmp_str_buf_print(buffer,
"%s'\n", __kmp_affinity_format);
3673static void __kmp_stg_parse_allocator(
char const *name,
char const *value,
3675 const char *buf = value;
3676 const char *next, *scan, *start;
3678 omp_allocator_handle_t al;
3679 omp_memspace_handle_t ms = omp_default_mem_space;
3680 bool is_memspace =
false;
3681 int ntraits = 0, count = 0;
3685 const char *delim = strchr(buf,
':');
3686 const char *predef_mem_space = strstr(buf,
"mem_space");
3688 bool is_memalloc = (!predef_mem_space && !delim) ?
true :
false;
3693 for (scan = buf; *scan !=
'\0'; scan++) {
3698 omp_alloctrait_t *traits =
3699 (omp_alloctrait_t *)KMP_ALLOCA(ntraits *
sizeof(omp_alloctrait_t));
3702#define IS_POWER_OF_TWO(n) (((n) & ((n)-1)) == 0)
3704#define GET_NEXT(sentinel) \
3707 if (*next == sentinel) \
3713#define SKIP_PAIR(key) \
3715 char const str_delimiter[] = {',', 0}; \
3716 char *value = __kmp_str_token(CCAST(char *, scan), str_delimiter, \
3717 CCAST(char **, &next)); \
3718 KMP_WARNING(StgInvalidValue, key, value); \
3726 char const str_delimiter[] = {'=', 0}; \
3727 key = __kmp_str_token(CCAST(char *, start), str_delimiter, \
3728 CCAST(char **, &next)); \
3733 while (*next !=
'\0') {
3735 __kmp_match_str(
"fb_data", scan, &next)) {
3739 if (__kmp_match_str(
"omp_high_bw_mem_alloc", scan, &next)) {
3742 if (__kmp_hwloc_available || __kmp_memkind_available) {
3743 __kmp_def_allocator = omp_high_bw_mem_alloc;
3746 KMP_WARNING(OmpNoAllocator,
"omp_high_bw_mem_alloc");
3749 traits[count].key = omp_atk_fb_data;
3750 traits[count].value = RCAST(omp_uintptr_t, omp_high_bw_mem_alloc);
3752 }
else if (__kmp_match_str(
"omp_large_cap_mem_alloc", scan, &next)) {
3755 if (__kmp_hwloc_available || __kmp_memkind_available) {
3756 __kmp_def_allocator = omp_large_cap_mem_alloc;
3759 KMP_WARNING(OmpNoAllocator,
"omp_large_cap_mem_alloc");
3762 traits[count].key = omp_atk_fb_data;
3763 traits[count].value = RCAST(omp_uintptr_t, omp_large_cap_mem_alloc);
3765 }
else if (__kmp_match_str(
"omp_default_mem_alloc", scan, &next)) {
3769 traits[count].key = omp_atk_fb_data;
3770 traits[count].value = RCAST(omp_uintptr_t, omp_default_mem_alloc);
3772 }
else if (__kmp_match_str(
"omp_const_mem_alloc", scan, &next)) {
3775 KMP_WARNING(OmpNoAllocator,
"omp_const_mem_alloc");
3777 traits[count].key = omp_atk_fb_data;
3778 traits[count].value = RCAST(omp_uintptr_t, omp_const_mem_alloc);
3780 }
else if (__kmp_match_str(
"omp_low_lat_mem_alloc", scan, &next)) {
3783 KMP_WARNING(OmpNoAllocator,
"omp_low_lat_mem_alloc");
3785 traits[count].key = omp_atk_fb_data;
3786 traits[count].value = RCAST(omp_uintptr_t, omp_low_lat_mem_alloc);
3788 }
else if (__kmp_match_str(
"omp_cgroup_mem_alloc", scan, &next)) {
3791 KMP_WARNING(OmpNoAllocator,
"omp_cgroup_mem_alloc");
3793 traits[count].key = omp_atk_fb_data;
3794 traits[count].value = RCAST(omp_uintptr_t, omp_cgroup_mem_alloc);
3796 }
else if (__kmp_match_str(
"omp_pteam_mem_alloc", scan, &next)) {
3799 KMP_WARNING(OmpNoAllocator,
"omp_pteam_mem_alloc");
3801 traits[count].key = omp_atk_fb_data;
3802 traits[count].value = RCAST(omp_uintptr_t, omp_pteam_mem_alloc);
3804 }
else if (__kmp_match_str(
"omp_thread_mem_alloc", scan, &next)) {
3807 KMP_WARNING(OmpNoAllocator,
"omp_thread_mem_alloc");
3809 traits[count].key = omp_atk_fb_data;
3810 traits[count].value = RCAST(omp_uintptr_t, omp_thread_mem_alloc);
3820 __kmp_def_allocator = omp_default_mem_alloc;
3821 if (next == buf || *next !=
'\0') {
3823 KMP_WARNING(StgInvalidValue, name, value);
3828 if (count == ntraits)
3834 if (__kmp_match_str(
"omp_default_mem_space", scan, &next)) {
3836 ms = omp_default_mem_space;
3837 }
else if (__kmp_match_str(
"omp_large_cap_mem_space", scan, &next)) {
3839 ms = omp_large_cap_mem_space;
3840 }
else if (__kmp_match_str(
"omp_const_mem_space", scan, &next)) {
3842 ms = omp_const_mem_space;
3843 }
else if (__kmp_match_str(
"omp_high_bw_mem_space", scan, &next)) {
3845 ms = omp_high_bw_mem_space;
3846 }
else if (__kmp_match_str(
"omp_low_lat_mem_space", scan, &next)) {
3848 ms = omp_low_lat_mem_space;
3850 __kmp_def_allocator = omp_default_mem_alloc;
3851 if (next == buf || *next !=
'\0') {
3853 KMP_WARNING(StgInvalidValue, name, value);
3862 if (__kmp_match_str(
"sync_hint", scan, &next)) {
3864 traits[count].key = omp_atk_sync_hint;
3865 if (__kmp_match_str(
"contended", scan, &next)) {
3866 traits[count].value = omp_atv_contended;
3867 }
else if (__kmp_match_str(
"uncontended", scan, &next)) {
3868 traits[count].value = omp_atv_uncontended;
3869 }
else if (__kmp_match_str(
"serialized", scan, &next)) {
3870 traits[count].value = omp_atv_serialized;
3871 }
else if (__kmp_match_str(
"private", scan, &next)) {
3872 traits[count].value = omp_atv_private;
3878 }
else if (__kmp_match_str(
"alignment", scan, &next)) {
3880 if (!isdigit(*next)) {
3886 int n = __kmp_str_to_int(scan,
',');
3887 if (n < 0 || !IS_POWER_OF_TWO(n)) {
3892 traits[count].key = omp_atk_alignment;
3893 traits[count].value = n;
3894 }
else if (__kmp_match_str(
"access", scan, &next)) {
3896 traits[count].key = omp_atk_access;
3897 if (__kmp_match_str(
"all", scan, &next)) {
3898 traits[count].value = omp_atv_all;
3899 }
else if (__kmp_match_str(
"cgroup", scan, &next)) {
3900 traits[count].value = omp_atv_cgroup;
3901 }
else if (__kmp_match_str(
"pteam", scan, &next)) {
3902 traits[count].value = omp_atv_pteam;
3903 }
else if (__kmp_match_str(
"thread", scan, &next)) {
3904 traits[count].value = omp_atv_thread;
3910 }
else if (__kmp_match_str(
"pool_size", scan, &next)) {
3912 if (!isdigit(*next)) {
3918 int n = __kmp_str_to_int(scan,
',');
3924 traits[count].key = omp_atk_pool_size;
3925 traits[count].value = n;
3926 }
else if (__kmp_match_str(
"fallback", scan, &next)) {
3928 traits[count].key = omp_atk_fallback;
3929 if (__kmp_match_str(
"default_mem_fb", scan, &next)) {
3930 traits[count].value = omp_atv_default_mem_fb;
3931 }
else if (__kmp_match_str(
"null_fb", scan, &next)) {
3932 traits[count].value = omp_atv_null_fb;
3933 }
else if (__kmp_match_str(
"abort_fb", scan, &next)) {
3934 traits[count].value = omp_atv_abort_fb;
3935 }
else if (__kmp_match_str(
"allocator_fb", scan, &next)) {
3936 traits[count].value = omp_atv_allocator_fb;
3942 }
else if (__kmp_match_str(
"pinned", scan, &next)) {
3944 traits[count].key = omp_atk_pinned;
3945 if (__kmp_str_match_true(next)) {
3946 traits[count].value = omp_atv_true;
3947 }
else if (__kmp_str_match_false(next)) {
3948 traits[count].value = omp_atv_false;
3954 }
else if (__kmp_match_str(
"partition", scan, &next)) {
3956 traits[count].key = omp_atk_partition;
3957 if (__kmp_match_str(
"environment", scan, &next)) {
3958 traits[count].value = omp_atv_environment;
3959 }
else if (__kmp_match_str(
"nearest", scan, &next)) {
3960 traits[count].value = omp_atv_nearest;
3961 }
else if (__kmp_match_str(
"blocked", scan, &next)) {
3962 traits[count].value = omp_atv_blocked;
3963 }
else if (__kmp_match_str(
"interleaved", scan, &next)) {
3964 traits[count].value = omp_atv_interleaved;
3977 if (count == ntraits)
3983 al = __kmpc_init_allocator(__kmp_get_gtid(), ms, ntraits, traits);
3984 __kmp_def_allocator = (al == omp_null_allocator) ? omp_default_mem_alloc : al;
3987static void __kmp_stg_print_allocator(kmp_str_buf_t *buffer,
char const *name,
3989 if (__kmp_def_allocator == omp_default_mem_alloc) {
3990 __kmp_stg_print_str(buffer, name,
"omp_default_mem_alloc");
3991 }
else if (__kmp_def_allocator == omp_high_bw_mem_alloc) {
3992 __kmp_stg_print_str(buffer, name,
"omp_high_bw_mem_alloc");
3993 }
else if (__kmp_def_allocator == omp_large_cap_mem_alloc) {
3994 __kmp_stg_print_str(buffer, name,
"omp_large_cap_mem_alloc");
3995 }
else if (__kmp_def_allocator == omp_const_mem_alloc) {
3996 __kmp_stg_print_str(buffer, name,
"omp_const_mem_alloc");
3997 }
else if (__kmp_def_allocator == omp_low_lat_mem_alloc) {
3998 __kmp_stg_print_str(buffer, name,
"omp_low_lat_mem_alloc");
3999 }
else if (__kmp_def_allocator == omp_cgroup_mem_alloc) {
4000 __kmp_stg_print_str(buffer, name,
"omp_cgroup_mem_alloc");
4001 }
else if (__kmp_def_allocator == omp_pteam_mem_alloc) {
4002 __kmp_stg_print_str(buffer, name,
"omp_pteam_mem_alloc");
4003 }
else if (__kmp_def_allocator == omp_thread_mem_alloc) {
4004 __kmp_stg_print_str(buffer, name,
"omp_thread_mem_alloc");
4011static void __kmp_stg_parse_omp_dynamic(
char const *name,
char const *value,
4013 __kmp_stg_parse_bool(name, value, &(__kmp_global.g.g_dynamic));
4016static void __kmp_stg_print_omp_dynamic(kmp_str_buf_t *buffer,
char const *name,
4018 __kmp_stg_print_bool(buffer, name, __kmp_global.g.g_dynamic);
4021static void __kmp_stg_parse_kmp_dynamic_mode(
char const *name,
4022 char const *value,
void *data) {
4023 if (TCR_4(__kmp_init_parallel)) {
4024 KMP_WARNING(EnvParallelWarn, name);
4025 __kmp_env_toPrint(name, 0);
4028#ifdef USE_LOAD_BALANCE
4029 else if (__kmp_str_match(
"load balance", 2, value) ||
4030 __kmp_str_match(
"load_balance", 2, value) ||
4031 __kmp_str_match(
"load-balance", 2, value) ||
4032 __kmp_str_match(
"loadbalance", 2, value) ||
4033 __kmp_str_match(
"balance", 1, value)) {
4034 __kmp_global.g.g_dynamic_mode = dynamic_load_balance;
4037 else if (__kmp_str_match(
"thread limit", 1, value) ||
4038 __kmp_str_match(
"thread_limit", 1, value) ||
4039 __kmp_str_match(
"thread-limit", 1, value) ||
4040 __kmp_str_match(
"threadlimit", 1, value) ||
4041 __kmp_str_match(
"limit", 2, value)) {
4042 __kmp_global.g.g_dynamic_mode = dynamic_thread_limit;
4043 }
else if (__kmp_str_match(
"random", 1, value)) {
4044 __kmp_global.g.g_dynamic_mode = dynamic_random;
4046 KMP_WARNING(StgInvalidValue, name, value);
4050static void __kmp_stg_print_kmp_dynamic_mode(kmp_str_buf_t *buffer,
4051 char const *name,
void *data) {
4053 if (__kmp_global.g.g_dynamic_mode == dynamic_default) {
4054 __kmp_str_buf_print(buffer,
" %s: %s \n", name, KMP_I18N_STR(NotDefined));
4056#ifdef USE_LOAD_BALANCE
4057 else if (__kmp_global.g.g_dynamic_mode == dynamic_load_balance) {
4058 __kmp_stg_print_str(buffer, name,
"load balance");
4061 else if (__kmp_global.g.g_dynamic_mode == dynamic_thread_limit) {
4062 __kmp_stg_print_str(buffer, name,
"thread limit");
4063 }
else if (__kmp_global.g.g_dynamic_mode == dynamic_random) {
4064 __kmp_stg_print_str(buffer, name,
"random");
4071#ifdef USE_LOAD_BALANCE
4076static void __kmp_stg_parse_ld_balance_interval(
char const *name,
4077 char const *value,
void *data) {
4078 double interval = __kmp_convert_to_double(value);
4079 if (interval >= 0) {
4080 __kmp_load_balance_interval = interval;
4082 KMP_WARNING(StgInvalidValue, name, value);
4086static void __kmp_stg_print_ld_balance_interval(kmp_str_buf_t *buffer,
4087 char const *name,
void *data) {
4089 __kmp_str_buf_print(buffer,
" %s=%8.6f\n", name,
4090 __kmp_load_balance_interval);
4099static void __kmp_stg_parse_init_at_fork(
char const *name,
char const *value,
4101 __kmp_stg_parse_bool(name, value, &__kmp_need_register_atfork);
4102 if (__kmp_need_register_atfork) {
4103 __kmp_need_register_atfork_specified = TRUE;
4107static void __kmp_stg_print_init_at_fork(kmp_str_buf_t *buffer,
4108 char const *name,
void *data) {
4109 __kmp_stg_print_bool(buffer, name, __kmp_need_register_atfork_specified);
4115static void __kmp_stg_parse_schedule(
char const *name,
char const *value,
4118 if (value != NULL) {
4119 size_t length = KMP_STRLEN(value);
4120 if (length > INT_MAX) {
4121 KMP_WARNING(LongValue, name);
4123 const char *semicolon;
4124 if (value[length - 1] ==
'"' || value[length - 1] ==
'\'')
4125 KMP_WARNING(UnbalancedQuotes, name);
4129 semicolon = strchr(value,
';');
4130 if (*value && semicolon != value) {
4131 const char *comma = strchr(value,
',');
4138 if (!__kmp_strcasecmp_with_sentinel(
"static", value, sentinel)) {
4139 if (!__kmp_strcasecmp_with_sentinel(
"greedy", comma,
';')) {
4140 __kmp_static = kmp_sch_static_greedy;
4142 }
else if (!__kmp_strcasecmp_with_sentinel(
"balanced", comma,
4144 __kmp_static = kmp_sch_static_balanced;
4147 }
else if (!__kmp_strcasecmp_with_sentinel(
"guided", value,
4149 if (!__kmp_strcasecmp_with_sentinel(
"iterative", comma,
';')) {
4150 __kmp_guided = kmp_sch_guided_iterative_chunked;
4152 }
else if (!__kmp_strcasecmp_with_sentinel(
"analytical", comma,
4155 __kmp_guided = kmp_sch_guided_analytical_chunked;
4159 KMP_WARNING(InvalidClause, name, value);
4161 KMP_WARNING(EmptyClause, name);
4162 }
while ((value = semicolon ? semicolon + 1 : NULL));
4168static void __kmp_stg_print_schedule(kmp_str_buf_t *buffer,
char const *name,
4170 if (__kmp_env_format) {
4171 KMP_STR_BUF_PRINT_NAME_EX(name);
4173 __kmp_str_buf_print(buffer,
" %s='", name);
4175 if (__kmp_static == kmp_sch_static_greedy) {
4176 __kmp_str_buf_print(buffer,
"%s",
"static,greedy");
4177 }
else if (__kmp_static == kmp_sch_static_balanced) {
4178 __kmp_str_buf_print(buffer,
"%s",
"static,balanced");
4180 if (__kmp_guided == kmp_sch_guided_iterative_chunked) {
4181 __kmp_str_buf_print(buffer,
";%s'\n",
"guided,iterative");
4182 }
else if (__kmp_guided == kmp_sch_guided_analytical_chunked) {
4183 __kmp_str_buf_print(buffer,
";%s'\n",
"guided,analytical");
4190static inline void __kmp_omp_schedule_restore() {
4191#if KMP_USE_HIER_SCHED
4192 __kmp_hier_scheds.deallocate();
4202static const char *__kmp_parse_single_omp_schedule(
const char *name,
4204 bool parse_hier =
false) {
4206 const char *ptr = value;
4213 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4215#if KMP_USE_HIER_SCHED
4216 kmp_hier_layer_e layer = kmp_hier_layer_e::LAYER_THREAD;
4218 if (*delim ==
',') {
4219 if (!__kmp_strcasecmp_with_sentinel(
"L1", ptr,
',')) {
4220 layer = kmp_hier_layer_e::LAYER_L1;
4221 }
else if (!__kmp_strcasecmp_with_sentinel(
"L2", ptr,
',')) {
4222 layer = kmp_hier_layer_e::LAYER_L2;
4223 }
else if (!__kmp_strcasecmp_with_sentinel(
"L3", ptr,
',')) {
4224 layer = kmp_hier_layer_e::LAYER_L3;
4225 }
else if (!__kmp_strcasecmp_with_sentinel(
"NUMA", ptr,
',')) {
4226 layer = kmp_hier_layer_e::LAYER_NUMA;
4229 if (layer != kmp_hier_layer_e::LAYER_THREAD && *delim !=
',') {
4231 KMP_WARNING(StgInvalidValue, name, value);
4232 __kmp_omp_schedule_restore();
4234 }
else if (layer != kmp_hier_layer_e::LAYER_THREAD) {
4236 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4243 if (*delim ==
':') {
4244 if (!__kmp_strcasecmp_with_sentinel(
"monotonic", ptr, *delim)) {
4247 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4249 }
else if (!__kmp_strcasecmp_with_sentinel(
"nonmonotonic", ptr, *delim)) {
4252 while (*delim !=
',' && *delim !=
':' && *delim !=
'\0')
4254 }
else if (!parse_hier) {
4256 KMP_WARNING(StgInvalidValue, name, value);
4257 __kmp_omp_schedule_restore();
4262 if (!__kmp_strcasecmp_with_sentinel(
"dynamic", ptr, *delim))
4263 sched = kmp_sch_dynamic_chunked;
4264 else if (!__kmp_strcasecmp_with_sentinel(
"guided", ptr, *delim))
4267 else if (!__kmp_strcasecmp_with_sentinel(
"auto", ptr, *delim))
4269 else if (!__kmp_strcasecmp_with_sentinel(
"trapezoidal", ptr, *delim))
4270 sched = kmp_sch_trapezoidal;
4271 else if (!__kmp_strcasecmp_with_sentinel(
"static", ptr, *delim))
4273#if KMP_STATIC_STEAL_ENABLED
4274 else if (!__kmp_strcasecmp_with_sentinel(
"static_steal", ptr, *delim)) {
4276 sched = kmp_sch_dynamic_chunked;
4282 KMP_WARNING(StgInvalidValue, name, value);
4283 __kmp_omp_schedule_restore();
4288 if (*delim ==
',') {
4291 if (!isdigit(*ptr)) {
4293 KMP_WARNING(StgInvalidValue, name, value);
4294 __kmp_omp_schedule_restore();
4300 __kmp_msg(kmp_ms_warning, KMP_MSG(IgnoreChunk, name, delim),
4304 sched = kmp_sch_static_chunked;
4305 chunk = __kmp_str_to_int(delim + 1, *ptr);
4307 chunk = KMP_DEFAULT_CHUNK;
4308 __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidChunk, name, delim),
4310 KMP_INFORM(Using_int_Value, name, __kmp_chunk);
4319 }
else if (chunk > KMP_MAX_CHUNK) {
4320 chunk = KMP_MAX_CHUNK;
4321 __kmp_msg(kmp_ms_warning, KMP_MSG(LargeChunk, name, delim),
4323 KMP_INFORM(Using_int_Value, name, chunk);
4330 SCHEDULE_SET_MODIFIERS(sched, sched_modifier);
4332#if KMP_USE_HIER_SCHED
4333 if (layer != kmp_hier_layer_e::LAYER_THREAD) {
4334 __kmp_hier_scheds.append(sched, chunk, layer);
4338 __kmp_chunk = chunk;
4339 __kmp_sched = sched;
4344static void __kmp_stg_parse_omp_schedule(
char const *name,
char const *value,
4347 const char *ptr = value;
4350 length = KMP_STRLEN(value);
4352 if (value[length - 1] ==
'"' || value[length - 1] ==
'\'')
4353 KMP_WARNING(UnbalancedQuotes, name);
4355#if KMP_USE_HIER_SCHED
4356 if (!__kmp_strcasecmp_with_sentinel(
"EXPERIMENTAL", ptr,
' ')) {
4359 while ((ptr = __kmp_parse_single_omp_schedule(name, ptr,
true))) {
4360 while (*ptr ==
' ' || *ptr ==
'\t' || *ptr ==
':')
4367 __kmp_parse_single_omp_schedule(name, ptr);
4369 KMP_WARNING(EmptyString, name);
4371#if KMP_USE_HIER_SCHED
4372 __kmp_hier_scheds.sort();
4374 K_DIAG(1, (
"__kmp_static == %d\n", __kmp_static))
4375 K_DIAG(1, (
"__kmp_guided == %d\n", __kmp_guided))
4376 K_DIAG(1, (
"__kmp_sched == %d\n", __kmp_sched))
4377 K_DIAG(1, (
"__kmp_chunk == %d\n", __kmp_chunk))
4380static void __kmp_stg_print_omp_schedule(kmp_str_buf_t *buffer,
4381 char const *name,
void *data) {
4382 if (__kmp_env_format) {
4383 KMP_STR_BUF_PRINT_NAME_EX(name);
4385 __kmp_str_buf_print(buffer,
" %s='", name);
4387 enum sched_type sched = SCHEDULE_WITHOUT_MODIFIERS(__kmp_sched);
4388 if (SCHEDULE_HAS_MONOTONIC(__kmp_sched)) {
4389 __kmp_str_buf_print(buffer,
"monotonic:");
4390 }
else if (SCHEDULE_HAS_NONMONOTONIC(__kmp_sched)) {
4391 __kmp_str_buf_print(buffer,
"nonmonotonic:");
4395 case kmp_sch_dynamic_chunked:
4396 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"dynamic", __kmp_chunk);
4398 case kmp_sch_guided_iterative_chunked:
4399 case kmp_sch_guided_analytical_chunked:
4400 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"guided", __kmp_chunk);
4402 case kmp_sch_trapezoidal:
4403 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"trapezoidal", __kmp_chunk);
4406 case kmp_sch_static_chunked:
4407 case kmp_sch_static_balanced:
4408 case kmp_sch_static_greedy:
4409 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"static", __kmp_chunk);
4411 case kmp_sch_static_steal:
4412 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"static_steal", __kmp_chunk);
4415 __kmp_str_buf_print(buffer,
"%s,%d'\n",
"auto", __kmp_chunk);
4418 KMP_ASSERT2(
false,
"Unhandled sched_type enumeration");
4419 KMP_BUILTIN_UNREACHABLE;
4424 case kmp_sch_dynamic_chunked:
4425 __kmp_str_buf_print(buffer,
"%s'\n",
"dynamic");
4427 case kmp_sch_guided_iterative_chunked:
4428 case kmp_sch_guided_analytical_chunked:
4429 __kmp_str_buf_print(buffer,
"%s'\n",
"guided");
4431 case kmp_sch_trapezoidal:
4432 __kmp_str_buf_print(buffer,
"%s'\n",
"trapezoidal");
4435 case kmp_sch_static_chunked:
4436 case kmp_sch_static_balanced:
4437 case kmp_sch_static_greedy:
4438 __kmp_str_buf_print(buffer,
"%s'\n",
"static");
4440 case kmp_sch_static_steal:
4441 __kmp_str_buf_print(buffer,
"%s'\n",
"static_steal");
4444 __kmp_str_buf_print(buffer,
"%s'\n",
"auto");
4447 KMP_ASSERT2(
false,
"Unhandled sched_type enumeration");
4448 KMP_BUILTIN_UNREACHABLE;
4454#if KMP_USE_HIER_SCHED
4457static void __kmp_stg_parse_kmp_hand_thread(
char const *name,
char const *value,
4459 __kmp_stg_parse_bool(name, value, &(__kmp_dispatch_hand_threading));
4462static void __kmp_stg_print_kmp_hand_thread(kmp_str_buf_t *buffer,
4463 char const *name,
void *data) {
4464 __kmp_stg_print_bool(buffer, name, __kmp_dispatch_hand_threading);
4470static void __kmp_stg_parse_kmp_force_monotonic(
char const *name,
4471 char const *value,
void *data) {
4472 __kmp_stg_parse_bool(name, value, &(__kmp_force_monotonic));
4475static void __kmp_stg_print_kmp_force_monotonic(kmp_str_buf_t *buffer,
4476 char const *name,
void *data) {
4477 __kmp_stg_print_bool(buffer, name, __kmp_force_monotonic);
4483static void __kmp_stg_parse_atomic_mode(
char const *name,
char const *value,
4489#ifdef KMP_GOMP_COMPAT
4492 __kmp_stg_parse_int(name, value, 0, max, &mode);
4497 __kmp_atomic_mode = mode;
4501static void __kmp_stg_print_atomic_mode(kmp_str_buf_t *buffer,
char const *name,
4503 __kmp_stg_print_int(buffer, name, __kmp_atomic_mode);
4509static void __kmp_stg_parse_consistency_check(
char const *name,
4510 char const *value,
void *data) {
4511 if (TCR_4(__kmp_init_serial)) {
4512 KMP_WARNING(EnvSerialWarn, name);
4515 if (!__kmp_strcasecmp_with_sentinel(
"all", value, 0)) {
4521 __kmp_env_consistency_check = TRUE;
4522 }
else if (!__kmp_strcasecmp_with_sentinel(
"none", value, 0)) {
4523 __kmp_env_consistency_check = FALSE;
4525 KMP_WARNING(StgInvalidValue, name, value);
4529static void __kmp_stg_print_consistency_check(kmp_str_buf_t *buffer,
4530 char const *name,
void *data) {
4532 const char *value = NULL;
4534 if (__kmp_env_consistency_check) {
4540 if (value != NULL) {
4541 __kmp_stg_print_str(buffer, name, value);
4552static void __kmp_stg_parse_itt_prepare_delay(
char const *name,
4553 char const *value,
void *data) {
4557 __kmp_stg_parse_int(name, value, 0, INT_MAX, &delay);
4558 __kmp_itt_prepare_delay = delay;
4561static void __kmp_stg_print_itt_prepare_delay(kmp_str_buf_t *buffer,
4562 char const *name,
void *data) {
4563 __kmp_stg_print_uint64(buffer, name, __kmp_itt_prepare_delay);
4573static void __kmp_stg_parse_malloc_pool_incr(
char const *name,
4574 char const *value,
void *data) {
4575 __kmp_stg_parse_size(name, value, KMP_MIN_MALLOC_POOL_INCR,
4576 KMP_MAX_MALLOC_POOL_INCR, NULL, &__kmp_malloc_pool_incr,
4580static void __kmp_stg_print_malloc_pool_incr(kmp_str_buf_t *buffer,
4581 char const *name,
void *data) {
4582 __kmp_stg_print_size(buffer, name, __kmp_malloc_pool_incr);
4591static void __kmp_stg_parse_par_range_env(
char const *name,
char const *value,
4593 __kmp_stg_parse_par_range(name, value, &__kmp_par_range,
4594 __kmp_par_range_routine, __kmp_par_range_filename,
4595 &__kmp_par_range_lb, &__kmp_par_range_ub);
4598static void __kmp_stg_print_par_range_env(kmp_str_buf_t *buffer,
4599 char const *name,
void *data) {
4600 if (__kmp_par_range != 0) {
4601 __kmp_stg_print_str(buffer, name, par_range_to_print);
4610static void __kmp_stg_parse_gtid_mode(
char const *name,
char const *value,
4620#ifdef KMP_TDATA_GTID
4623 __kmp_stg_parse_int(name, value, 0, max, &mode);
4627 __kmp_adjust_gtid_mode = TRUE;
4629 __kmp_gtid_mode = mode;
4630 __kmp_adjust_gtid_mode = FALSE;
4634static void __kmp_stg_print_gtid_mode(kmp_str_buf_t *buffer,
char const *name,
4636 if (__kmp_adjust_gtid_mode) {
4637 __kmp_stg_print_int(buffer, name, 0);
4639 __kmp_stg_print_int(buffer, name, __kmp_gtid_mode);
4646static void __kmp_stg_parse_lock_block(
char const *name,
char const *value,
4648 __kmp_stg_parse_int(name, value, 0, KMP_INT_MAX, &__kmp_num_locks_in_block);
4651static void __kmp_stg_print_lock_block(kmp_str_buf_t *buffer,
char const *name,
4653 __kmp_stg_print_int(buffer, name, __kmp_num_locks_in_block);
4659#if KMP_USE_DYNAMIC_LOCK
4660#define KMP_STORE_LOCK_SEQ(a) (__kmp_user_lock_seq = lockseq_##a)
4662#define KMP_STORE_LOCK_SEQ(a)
4665static void __kmp_stg_parse_lock_kind(
char const *name,
char const *value,
4667 if (__kmp_init_user_locks) {
4668 KMP_WARNING(EnvLockWarn, name);
4672 if (__kmp_str_match(
"tas", 2, value) ||
4673 __kmp_str_match(
"test and set", 2, value) ||
4674 __kmp_str_match(
"test_and_set", 2, value) ||
4675 __kmp_str_match(
"test-and-set", 2, value) ||
4676 __kmp_str_match(
"test andset", 2, value) ||
4677 __kmp_str_match(
"test_andset", 2, value) ||
4678 __kmp_str_match(
"test-andset", 2, value) ||
4679 __kmp_str_match(
"testand set", 2, value) ||
4680 __kmp_str_match(
"testand_set", 2, value) ||
4681 __kmp_str_match(
"testand-set", 2, value) ||
4682 __kmp_str_match(
"testandset", 2, value)) {
4683 __kmp_user_lock_kind = lk_tas;
4684 KMP_STORE_LOCK_SEQ(tas);
4687 else if (__kmp_str_match(
"futex", 1, value)) {
4688 if (__kmp_futex_determine_capable()) {
4689 __kmp_user_lock_kind = lk_futex;
4690 KMP_STORE_LOCK_SEQ(futex);
4692 KMP_WARNING(FutexNotSupported, name, value);
4696 else if (__kmp_str_match(
"ticket", 2, value)) {
4697 __kmp_user_lock_kind = lk_ticket;
4698 KMP_STORE_LOCK_SEQ(ticket);
4699 }
else if (__kmp_str_match(
"queuing", 1, value) ||
4700 __kmp_str_match(
"queue", 1, value)) {
4701 __kmp_user_lock_kind = lk_queuing;
4702 KMP_STORE_LOCK_SEQ(queuing);
4703 }
else if (__kmp_str_match(
"drdpa ticket", 1, value) ||
4704 __kmp_str_match(
"drdpa_ticket", 1, value) ||
4705 __kmp_str_match(
"drdpa-ticket", 1, value) ||
4706 __kmp_str_match(
"drdpaticket", 1, value) ||
4707 __kmp_str_match(
"drdpa", 1, value)) {
4708 __kmp_user_lock_kind = lk_drdpa;
4709 KMP_STORE_LOCK_SEQ(drdpa);
4711#if KMP_USE_ADAPTIVE_LOCKS
4712 else if (__kmp_str_match(
"adaptive", 1, value)) {
4713 if (__kmp_cpuinfo.flags.rtm) {
4714 __kmp_user_lock_kind = lk_adaptive;
4715 KMP_STORE_LOCK_SEQ(adaptive);
4717 KMP_WARNING(AdaptiveNotSupported, name, value);
4718 __kmp_user_lock_kind = lk_queuing;
4719 KMP_STORE_LOCK_SEQ(queuing);
4723#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
4724 else if (__kmp_str_match(
"rtm_queuing", 1, value)) {
4725 if (__kmp_cpuinfo.flags.rtm) {
4726 __kmp_user_lock_kind = lk_rtm_queuing;
4727 KMP_STORE_LOCK_SEQ(rtm_queuing);
4729 KMP_WARNING(AdaptiveNotSupported, name, value);
4730 __kmp_user_lock_kind = lk_queuing;
4731 KMP_STORE_LOCK_SEQ(queuing);
4733 }
else if (__kmp_str_match(
"rtm_spin", 1, value)) {
4734 if (__kmp_cpuinfo.flags.rtm) {
4735 __kmp_user_lock_kind = lk_rtm_spin;
4736 KMP_STORE_LOCK_SEQ(rtm_spin);
4738 KMP_WARNING(AdaptiveNotSupported, name, value);
4739 __kmp_user_lock_kind = lk_tas;
4740 KMP_STORE_LOCK_SEQ(queuing);
4742 }
else if (__kmp_str_match(
"hle", 1, value)) {
4743 __kmp_user_lock_kind = lk_hle;
4744 KMP_STORE_LOCK_SEQ(hle);
4748 KMP_WARNING(StgInvalidValue, name, value);
4752static void __kmp_stg_print_lock_kind(kmp_str_buf_t *buffer,
char const *name,
4754 const char *value = NULL;
4756 switch (__kmp_user_lock_kind) {
4771#if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX
4772 case lk_rtm_queuing:
4773 value =
"rtm_queuing";
4796#if KMP_USE_ADAPTIVE_LOCKS
4803 if (value != NULL) {
4804 __kmp_stg_print_str(buffer, name, value);
4813static void __kmp_stg_parse_spin_backoff_params(
const char *name,
4814 const char *value,
void *data) {
4815 const char *next = value;
4818 int prev_comma = FALSE;
4821 kmp_uint32 max_backoff = __kmp_spin_backoff_params.max_backoff;
4822 kmp_uint32 min_tick = __kmp_spin_backoff_params.min_tick;
4826 for (i = 0; i < 3; i++) {
4829 if (*next ==
'\0') {
4834 if (((*next < '0' || *next >
'9') && *next !=
',') || total > 2) {
4835 KMP_WARNING(EnvSyntaxError, name, value);
4841 if (total == 0 || prev_comma) {
4849 if (*next >=
'0' && *next <=
'9') {
4851 const char *buf = next;
4852 char const *msg = NULL;
4857 const char *tmp = next;
4859 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
4860 KMP_WARNING(EnvSpacesNotAllowed, name, value);
4864 num = __kmp_str_to_int(buf, *next);
4866 msg = KMP_I18N_STR(ValueTooSmall);
4871 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
4872 KMP_INFORM(Using_int_Value, name, num);
4876 }
else if (total == 2) {
4882 KMP_WARNING(EnvSyntaxError, name, value);
4885 __kmp_spin_backoff_params.max_backoff = max_backoff;
4886 __kmp_spin_backoff_params.min_tick = min_tick;
4889static void __kmp_stg_print_spin_backoff_params(kmp_str_buf_t *buffer,
4890 char const *name,
void *data) {
4891 if (__kmp_env_format) {
4892 KMP_STR_BUF_PRINT_NAME_EX(name);
4894 __kmp_str_buf_print(buffer,
" %s='", name);
4896 __kmp_str_buf_print(buffer,
"%d,%d'\n", __kmp_spin_backoff_params.max_backoff,
4897 __kmp_spin_backoff_params.min_tick);
4900#if KMP_USE_ADAPTIVE_LOCKS
4907static void __kmp_stg_parse_adaptive_lock_props(
const char *name,
4908 const char *value,
void *data) {
4909 int max_retries = 0;
4910 int max_badness = 0;
4912 const char *next = value;
4915 int prev_comma = FALSE;
4921 for (i = 0; i < 3; i++) {
4924 if (*next ==
'\0') {
4929 if (((*next < '0' || *next >
'9') && *next !=
',') || total > 2) {
4930 KMP_WARNING(EnvSyntaxError, name, value);
4936 if (total == 0 || prev_comma) {
4944 if (*next >=
'0' && *next <=
'9') {
4946 const char *buf = next;
4947 char const *msg = NULL;
4952 const char *tmp = next;
4954 if ((*next ==
' ' || *next ==
'\t') && (*tmp >=
'0' && *tmp <=
'9')) {
4955 KMP_WARNING(EnvSpacesNotAllowed, name, value);
4959 num = __kmp_str_to_int(buf, *next);
4961 msg = KMP_I18N_STR(ValueTooSmall);
4966 KMP_WARNING(ParseSizeIntWarn, name, value, msg);
4967 KMP_INFORM(Using_int_Value, name, num);
4971 }
else if (total == 2) {
4977 KMP_WARNING(EnvSyntaxError, name, value);
4980 __kmp_adaptive_backoff_params.max_soft_retries = max_retries;
4981 __kmp_adaptive_backoff_params.max_badness = max_badness;
4984static void __kmp_stg_print_adaptive_lock_props(kmp_str_buf_t *buffer,
4985 char const *name,
void *data) {
4986 if (__kmp_env_format) {
4987 KMP_STR_BUF_PRINT_NAME_EX(name);
4989 __kmp_str_buf_print(buffer,
" %s='", name);
4991 __kmp_str_buf_print(buffer,
"%d,%d'\n",
4992 __kmp_adaptive_backoff_params.max_soft_retries,
4993 __kmp_adaptive_backoff_params.max_badness);
4996#if KMP_DEBUG_ADAPTIVE_LOCKS
4998static void __kmp_stg_parse_speculative_statsfile(
char const *name,
5001 __kmp_stg_parse_file(name, value,
"",
5002 CCAST(
char **, &__kmp_speculative_statsfile));
5005static void __kmp_stg_print_speculative_statsfile(kmp_str_buf_t *buffer,
5008 if (__kmp_str_match(
"-", 0, __kmp_speculative_statsfile)) {
5009 __kmp_stg_print_str(buffer, name,
"stdout");
5011 __kmp_stg_print_str(buffer, name, __kmp_speculative_statsfile);
5027static kmp_hw_t __kmp_hw_subset_break_tie(
const kmp_hw_t *possible,
5028 size_t num_possible) {
5029 for (
size_t i = 0; i < num_possible; ++i) {
5030 if (possible[i] == KMP_HW_THREAD)
5031 return KMP_HW_THREAD;
5032 else if (possible[i] == KMP_HW_CORE)
5034 else if (possible[i] == KMP_HW_SOCKET)
5035 return KMP_HW_SOCKET;
5037 return KMP_HW_UNKNOWN;
5044static kmp_hw_t __kmp_stg_parse_hw_subset_name(
char const *token) {
5045 size_t index, num_possible, token_length;
5046 kmp_hw_t possible[KMP_HW_LAST];
5052 while (isalnum(*end) || *end ==
'_') {
5059 KMP_FOREACH_HW_TYPE(type) { possible[num_possible++] = type; }
5066 while (num_possible > 1 && index < token_length) {
5067 size_t n = num_possible;
5068 char token_char = (char)toupper(token[index]);
5069 for (
size_t i = 0; i < n; ++i) {
5071 kmp_hw_t type = possible[i];
5072 s = __kmp_hw_get_keyword(type,
false);
5073 if (index < KMP_STRLEN(s)) {
5074 char c = (char)toupper(s[index]);
5076 if (c != token_char) {
5077 possible[i] = KMP_HW_UNKNOWN;
5084 for (
size_t i = 0; i < n; ++i) {
5085 if (possible[i] != KMP_HW_UNKNOWN) {
5086 kmp_hw_t temp = possible[i];
5087 possible[i] = possible[start];
5088 possible[start] = temp;
5092 KMP_ASSERT(start == num_possible);
5098 if (num_possible > 1)
5099 return __kmp_hw_subset_break_tie(possible, num_possible);
5100 if (num_possible == 1)
5102 return KMP_HW_UNKNOWN;
5107#define MAX_T_LEVEL KMP_HW_LAST
5108#define MAX_STR_LEN 512
5109static void __kmp_stg_parse_hw_subset(
char const *name,
char const *value,
5113 kmp_setting_t **rivals = (kmp_setting_t **)data;
5114 if (strcmp(name,
"KMP_PLACE_THREADS") == 0) {
5115 KMP_INFORM(EnvVarDeprecated, name,
"KMP_HW_SUBSET");
5117 if (__kmp_stg_check_rivals(name, value, rivals)) {
5121 char *components[MAX_T_LEVEL];
5122 char const *digits =
"0123456789";
5123 char input[MAX_STR_LEN];
5124 size_t len = 0, mlen = MAX_STR_LEN;
5126 bool absolute =
false;
5128 char *pos = CCAST(
char *, value);
5129 while (*pos && mlen) {
5131 if (len == 0 && *pos ==
':') {
5134 input[len] = (char)(toupper(*pos));
5135 if (input[len] ==
'X')
5137 if (input[len] ==
'O' && strchr(digits, *(pos + 1)))
5145 if (len == 0 || mlen == 0) {
5151 components[level++] = pos;
5152 while ((pos = strchr(pos,
','))) {
5153 if (level >= MAX_T_LEVEL)
5156 components[level++] = ++pos;
5159 __kmp_hw_subset = kmp_hw_subset_t::allocate();
5161 __kmp_hw_subset->set_absolute();
5164 for (
int i = 0; i < level; ++i) {
5166 char *core_components[MAX_T_LEVEL];
5168 pos = components[i];
5169 core_components[core_level++] = pos;
5170 while ((pos = strchr(pos,
'&'))) {
5171 if (core_level >= MAX_T_LEVEL)
5174 core_components[core_level++] = ++pos;
5177 for (
int j = 0; j < core_level; ++j) {
5184 if (isdigit(*core_components[j])) {
5185 num = atoi(core_components[j]);
5189 pos = core_components[j] + strspn(core_components[j], digits);
5190 }
else if (*core_components[j] ==
'*') {
5191 num = kmp_hw_subset_t::USE_ALL;
5192 pos = core_components[j] + 1;
5194 num = kmp_hw_subset_t::USE_ALL;
5195 pos = core_components[j];
5198 offset_ptr = strchr(core_components[j],
'@');
5199 attr_ptr = strchr(core_components[j],
':');
5202 offset = atoi(offset_ptr + 1);
5208#if KMP_ARCH_X86 || KMP_ARCH_X86_64
5209 if (__kmp_str_match(
"intel_core", -1, attr_ptr + 1)) {
5210 attr.set_core_type(KMP_HW_CORE_TYPE_CORE);
5211 }
else if (__kmp_str_match(
"intel_atom", -1, attr_ptr + 1)) {
5212 attr.set_core_type(KMP_HW_CORE_TYPE_ATOM);
5215 if (__kmp_str_match(
"eff", 3, attr_ptr + 1)) {
5216 const char *number = attr_ptr + 1;
5218 while (isalpha(*number))
5220 if (!isdigit(*number)) {
5223 int efficiency = atoi(number);
5224 attr.set_core_eff(efficiency);
5231 kmp_hw_t type = __kmp_stg_parse_hw_subset_name(pos);
5232 if (type == KMP_HW_UNKNOWN) {
5236 if (attr && type != KMP_HW_CORE)
5239 if (type != KMP_HW_CORE && __kmp_hw_subset->specified(type)) {
5242 __kmp_hw_subset->push_back(num, type, offset, attr);
5247 KMP_WARNING(AffHWSubsetInvalid, name, value);
5248 if (__kmp_hw_subset) {
5249 kmp_hw_subset_t::deallocate(__kmp_hw_subset);
5250 __kmp_hw_subset =
nullptr;
5255static void __kmp_stg_print_hw_subset(kmp_str_buf_t *buffer,
char const *name,
5259 if (!__kmp_hw_subset)
5261 __kmp_str_buf_init(&buf);
5262 if (__kmp_env_format)
5263 KMP_STR_BUF_PRINT_NAME_EX(name);
5265 __kmp_str_buf_print(buffer,
" %s='", name);
5267 depth = __kmp_hw_subset->get_depth();
5268 for (
int i = 0; i < depth; ++i) {
5269 const auto &item = __kmp_hw_subset->at(i);
5271 __kmp_str_buf_print(&buf,
"%c",
',');
5272 for (
int j = 0; j < item.num_attrs; ++j) {
5273 __kmp_str_buf_print(&buf,
"%s%d%s", (j > 0 ?
"&" :
""), item.num[j],
5274 __kmp_hw_get_keyword(item.type));
5275 if (item.attr[j].is_core_type_valid())
5276 __kmp_str_buf_print(
5278 __kmp_hw_get_core_type_keyword(item.attr[j].get_core_type()));
5279 if (item.attr[j].is_core_eff_valid())
5280 __kmp_str_buf_print(&buf,
":eff%d", item.attr[j].get_core_eff());
5282 __kmp_str_buf_print(&buf,
"@%d", item.offset[j]);
5285 __kmp_str_buf_print(buffer,
"%s'\n", buf.str);
5286 __kmp_str_buf_free(&buf);
5293static void __kmp_stg_parse_forkjoin_frames(
char const *name,
char const *value,
5295 __kmp_stg_parse_bool(name, value, &__kmp_forkjoin_frames);
5298static void __kmp_stg_print_forkjoin_frames(kmp_str_buf_t *buffer,
5299 char const *name,
void *data) {
5300 __kmp_stg_print_bool(buffer, name, __kmp_forkjoin_frames);
5306static void __kmp_stg_parse_forkjoin_frames_mode(
char const *name,
5309 __kmp_stg_parse_int(name, value, 0, 3, &__kmp_forkjoin_frames_mode);
5312static void __kmp_stg_print_forkjoin_frames_mode(kmp_str_buf_t *buffer,
5313 char const *name,
void *data) {
5314 __kmp_stg_print_int(buffer, name, __kmp_forkjoin_frames_mode);
5321static void __kmp_stg_parse_task_throttling(
char const *name,
char const *value,
5323 __kmp_stg_parse_bool(name, value, &__kmp_enable_task_throttling);
5326static void __kmp_stg_print_task_throttling(kmp_str_buf_t *buffer,
5327 char const *name,
void *data) {
5328 __kmp_stg_print_bool(buffer, name, __kmp_enable_task_throttling);
5331#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
5335static void __kmp_stg_parse_user_level_mwait(
char const *name,
5336 char const *value,
void *data) {
5337 __kmp_stg_parse_bool(name, value, &__kmp_user_level_mwait);
5340static void __kmp_stg_print_user_level_mwait(kmp_str_buf_t *buffer,
5341 char const *name,
void *data) {
5342 __kmp_stg_print_bool(buffer, name, __kmp_user_level_mwait);
5348static void __kmp_stg_parse_mwait_hints(
char const *name,
char const *value,
5350 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_mwait_hints);
5353static void __kmp_stg_print_mwait_hints(kmp_str_buf_t *buffer,
char const *name,
5355 __kmp_stg_print_int(buffer, name, __kmp_mwait_hints);
5365static void __kmp_stg_parse_tpause(
char const *name,
char const *value,
5367 __kmp_stg_parse_int(name, value, 0, INT_MAX, &__kmp_tpause_state);
5368 if (__kmp_tpause_state != 0) {
5370 if (__kmp_tpause_state == 2)
5371 __kmp_tpause_hint = 0;
5375static void __kmp_stg_print_tpause(kmp_str_buf_t *buffer,
char const *name,
5377 __kmp_stg_print_int(buffer, name, __kmp_tpause_state);
5384static void __kmp_stg_parse_omp_display_env(
char const *name,
char const *value,
5386 if (__kmp_str_match(
"VERBOSE", 1, value)) {
5387 __kmp_display_env_verbose = TRUE;
5389 __kmp_stg_parse_bool(name, value, &__kmp_display_env);
5393static void __kmp_stg_print_omp_display_env(kmp_str_buf_t *buffer,
5394 char const *name,
void *data) {
5395 if (__kmp_display_env_verbose) {
5396 __kmp_stg_print_str(buffer, name,
"VERBOSE");
5398 __kmp_stg_print_bool(buffer, name, __kmp_display_env);
5402static void __kmp_stg_parse_omp_cancellation(
char const *name,
5403 char const *value,
void *data) {
5404 if (TCR_4(__kmp_init_parallel)) {
5405 KMP_WARNING(EnvParallelWarn, name);
5408 __kmp_stg_parse_bool(name, value, &__kmp_omp_cancellation);
5411static void __kmp_stg_print_omp_cancellation(kmp_str_buf_t *buffer,
5412 char const *name,
void *data) {
5413 __kmp_stg_print_bool(buffer, name, __kmp_omp_cancellation);
5419static void __kmp_stg_parse_omp_tool(
char const *name,
char const *value,
5421 __kmp_stg_parse_bool(name, value, &__kmp_tool);
5424static void __kmp_stg_print_omp_tool(kmp_str_buf_t *buffer,
char const *name,
5426 if (__kmp_env_format) {
5427 KMP_STR_BUF_PRINT_BOOL_EX(name, __kmp_tool,
"enabled",
"disabled");
5429 __kmp_str_buf_print(buffer,
" %s=%s\n", name,
5430 __kmp_tool ?
"enabled" :
"disabled");
5434char *__kmp_tool_libraries = NULL;
5436static void __kmp_stg_parse_omp_tool_libraries(
char const *name,
5437 char const *value,
void *data) {
5438 __kmp_stg_parse_str(name, value, &__kmp_tool_libraries);
5441static void __kmp_stg_print_omp_tool_libraries(kmp_str_buf_t *buffer,
5442 char const *name,
void *data) {
5443 if (__kmp_tool_libraries)
5444 __kmp_stg_print_str(buffer, name, __kmp_tool_libraries);
5446 if (__kmp_env_format) {
5447 KMP_STR_BUF_PRINT_NAME;
5449 __kmp_str_buf_print(buffer,
" %s", name);
5451 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
5455char *__kmp_tool_verbose_init = NULL;
5457static void __kmp_stg_parse_omp_tool_verbose_init(
char const *name,
5460 __kmp_stg_parse_str(name, value, &__kmp_tool_verbose_init);
5463static void __kmp_stg_print_omp_tool_verbose_init(kmp_str_buf_t *buffer,
5466 if (__kmp_tool_verbose_init)
5467 __kmp_stg_print_str(buffer, name, __kmp_tool_verbose_init);
5469 if (__kmp_env_format) {
5470 KMP_STR_BUF_PRINT_NAME;
5472 __kmp_str_buf_print(buffer,
" %s", name);
5474 __kmp_str_buf_print(buffer,
": %s\n", KMP_I18N_STR(NotDefined));
5482static kmp_setting_t __kmp_stg_table[] = {
5484 {
"KMP_ALL_THREADS", __kmp_stg_parse_device_thread_limit, NULL, NULL, 0, 0},
5485 {
"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime,
5487 {
"KMP_USE_YIELD", __kmp_stg_parse_use_yield, __kmp_stg_print_use_yield,
5489 {
"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok,
5490 __kmp_stg_print_duplicate_lib_ok, NULL, 0, 0},
5491 {
"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy,
5493 {
"KMP_DEVICE_THREAD_LIMIT", __kmp_stg_parse_device_thread_limit,
5494 __kmp_stg_print_device_thread_limit, NULL, 0, 0},
5496 {
"KMP_MONITOR_STACKSIZE", __kmp_stg_parse_monitor_stacksize,
5497 __kmp_stg_print_monitor_stacksize, NULL, 0, 0},
5499 {
"KMP_SETTINGS", __kmp_stg_parse_settings, __kmp_stg_print_settings, NULL,
5501 {
"KMP_STACKOFFSET", __kmp_stg_parse_stackoffset,
5502 __kmp_stg_print_stackoffset, NULL, 0, 0},
5503 {
"KMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize,
5505 {
"KMP_STACKPAD", __kmp_stg_parse_stackpad, __kmp_stg_print_stackpad, NULL,
5507 {
"KMP_VERSION", __kmp_stg_parse_version, __kmp_stg_print_version, NULL, 0,
5509 {
"KMP_WARNINGS", __kmp_stg_parse_warnings, __kmp_stg_print_warnings, NULL,
5512 {
"KMP_NESTING_MODE", __kmp_stg_parse_nesting_mode,
5513 __kmp_stg_print_nesting_mode, NULL, 0, 0},
5514 {
"OMP_NESTED", __kmp_stg_parse_nested, __kmp_stg_print_nested, NULL, 0, 0},
5515 {
"OMP_NUM_THREADS", __kmp_stg_parse_num_threads,
5516 __kmp_stg_print_num_threads, NULL, 0, 0},
5517 {
"OMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize,
5520 {
"KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0,
5522 {
"KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing,
5523 __kmp_stg_print_task_stealing, NULL, 0, 0},
5524 {
"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels,
5525 __kmp_stg_print_max_active_levels, NULL, 0, 0},
5526 {
"OMP_DEFAULT_DEVICE", __kmp_stg_parse_default_device,
5527 __kmp_stg_print_default_device, NULL, 0, 0},
5528 {
"OMP_TARGET_OFFLOAD", __kmp_stg_parse_target_offload,
5529 __kmp_stg_print_target_offload, NULL, 0, 0},
5530 {
"OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority,
5531 __kmp_stg_print_max_task_priority, NULL, 0, 0},
5532 {
"KMP_TASKLOOP_MIN_TASKS", __kmp_stg_parse_taskloop_min_tasks,
5533 __kmp_stg_print_taskloop_min_tasks, NULL, 0, 0},
5534 {
"OMP_THREAD_LIMIT", __kmp_stg_parse_thread_limit,
5535 __kmp_stg_print_thread_limit, NULL, 0, 0},
5536 {
"KMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_thread_limit,
5537 __kmp_stg_print_teams_thread_limit, NULL, 0, 0},
5538 {
"OMP_NUM_TEAMS", __kmp_stg_parse_nteams, __kmp_stg_print_nteams, NULL, 0,
5540 {
"OMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_th_limit,
5541 __kmp_stg_print_teams_th_limit, NULL, 0, 0},
5542 {
"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy,
5543 __kmp_stg_print_wait_policy, NULL, 0, 0},
5544 {
"KMP_DISP_NUM_BUFFERS", __kmp_stg_parse_disp_buffers,
5545 __kmp_stg_print_disp_buffers, NULL, 0, 0},
5546 {
"KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level,
5547 __kmp_stg_print_hot_teams_level, NULL, 0, 0},
5548 {
"KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode,
5549 __kmp_stg_print_hot_teams_mode, NULL, 0, 0},
5551#if KMP_HANDLE_SIGNALS
5552 {
"KMP_HANDLE_SIGNALS", __kmp_stg_parse_handle_signals,
5553 __kmp_stg_print_handle_signals, NULL, 0, 0},
5556#if KMP_ARCH_X86 || KMP_ARCH_X86_64
5557 {
"KMP_INHERIT_FP_CONTROL", __kmp_stg_parse_inherit_fp_control,
5558 __kmp_stg_print_inherit_fp_control, NULL, 0, 0},
5561#ifdef KMP_GOMP_COMPAT
5562 {
"GOMP_STACKSIZE", __kmp_stg_parse_stacksize, NULL, NULL, 0, 0},
5566 {
"KMP_A_DEBUG", __kmp_stg_parse_a_debug, __kmp_stg_print_a_debug, NULL, 0,
5568 {
"KMP_B_DEBUG", __kmp_stg_parse_b_debug, __kmp_stg_print_b_debug, NULL, 0,
5570 {
"KMP_C_DEBUG", __kmp_stg_parse_c_debug, __kmp_stg_print_c_debug, NULL, 0,
5572 {
"KMP_D_DEBUG", __kmp_stg_parse_d_debug, __kmp_stg_print_d_debug, NULL, 0,
5574 {
"KMP_E_DEBUG", __kmp_stg_parse_e_debug, __kmp_stg_print_e_debug, NULL, 0,
5576 {
"KMP_F_DEBUG", __kmp_stg_parse_f_debug, __kmp_stg_print_f_debug, NULL, 0,
5578 {
"KMP_DEBUG", __kmp_stg_parse_debug, NULL, NULL, 0, 0},
5579 {
"KMP_DEBUG_BUF", __kmp_stg_parse_debug_buf, __kmp_stg_print_debug_buf,
5581 {
"KMP_DEBUG_BUF_ATOMIC", __kmp_stg_parse_debug_buf_atomic,
5582 __kmp_stg_print_debug_buf_atomic, NULL, 0, 0},
5583 {
"KMP_DEBUG_BUF_CHARS", __kmp_stg_parse_debug_buf_chars,
5584 __kmp_stg_print_debug_buf_chars, NULL, 0, 0},
5585 {
"KMP_DEBUG_BUF_LINES", __kmp_stg_parse_debug_buf_lines,
5586 __kmp_stg_print_debug_buf_lines, NULL, 0, 0},
5587 {
"KMP_DIAG", __kmp_stg_parse_diag, __kmp_stg_print_diag, NULL, 0, 0},
5589 {
"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env,
5590 __kmp_stg_print_par_range_env, NULL, 0, 0},
5593 {
"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc,
5594 __kmp_stg_print_align_alloc, NULL, 0, 0},
5596 {
"KMP_PLAIN_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5597 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5598 {
"KMP_PLAIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5599 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5600 {
"KMP_FORKJOIN_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5601 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5602 {
"KMP_FORKJOIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5603 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5604#if KMP_FAST_REDUCTION_BARRIER
5605 {
"KMP_REDUCTION_BARRIER", __kmp_stg_parse_barrier_branch_bit,
5606 __kmp_stg_print_barrier_branch_bit, NULL, 0, 0},
5607 {
"KMP_REDUCTION_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern,
5608 __kmp_stg_print_barrier_pattern, NULL, 0, 0},
5611 {
"KMP_ABORT_DELAY", __kmp_stg_parse_abort_delay,
5612 __kmp_stg_print_abort_delay, NULL, 0, 0},
5613 {
"KMP_CPUINFO_FILE", __kmp_stg_parse_cpuinfo_file,
5614 __kmp_stg_print_cpuinfo_file, NULL, 0, 0},
5615 {
"KMP_FORCE_REDUCTION", __kmp_stg_parse_force_reduction,
5616 __kmp_stg_print_force_reduction, NULL, 0, 0},
5617 {
"KMP_DETERMINISTIC_REDUCTION", __kmp_stg_parse_force_reduction,
5618 __kmp_stg_print_force_reduction, NULL, 0, 0},
5619 {
"KMP_STORAGE_MAP", __kmp_stg_parse_storage_map,
5620 __kmp_stg_print_storage_map, NULL, 0, 0},
5621 {
"KMP_ALL_THREADPRIVATE", __kmp_stg_parse_all_threadprivate,
5622 __kmp_stg_print_all_threadprivate, NULL, 0, 0},
5623 {
"KMP_FOREIGN_THREADS_THREADPRIVATE",
5624 __kmp_stg_parse_foreign_threads_threadprivate,
5625 __kmp_stg_print_foreign_threads_threadprivate, NULL, 0, 0},
5627#if KMP_AFFINITY_SUPPORTED
5628 {
"KMP_AFFINITY", __kmp_stg_parse_affinity, __kmp_stg_print_affinity, NULL,
5630 {
"KMP_HIDDEN_HELPER_AFFINITY", __kmp_stg_parse_hh_affinity,
5631 __kmp_stg_print_hh_affinity, NULL, 0, 0},
5632#ifdef KMP_GOMP_COMPAT
5633 {
"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL,
5636 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
5638 {
"KMP_TEAMS_PROC_BIND", __kmp_stg_parse_teams_proc_bind,
5639 __kmp_stg_print_teams_proc_bind, NULL, 0, 0},
5640 {
"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0},
5641 {
"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method,
5642 __kmp_stg_print_topology_method, NULL, 0, 0},
5648 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
5652 {
"OMP_DISPLAY_AFFINITY", __kmp_stg_parse_display_affinity,
5653 __kmp_stg_print_display_affinity, NULL, 0, 0},
5654 {
"OMP_AFFINITY_FORMAT", __kmp_stg_parse_affinity_format,
5655 __kmp_stg_print_affinity_format, NULL, 0, 0},
5656 {
"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork,
5657 __kmp_stg_print_init_at_fork, NULL, 0, 0},
5658 {
"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL,
5660 {
"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule,
5662#if KMP_USE_HIER_SCHED
5663 {
"KMP_DISP_HAND_THREAD", __kmp_stg_parse_kmp_hand_thread,
5664 __kmp_stg_print_kmp_hand_thread, NULL, 0, 0},
5666 {
"KMP_FORCE_MONOTONIC_DYNAMIC_SCHEDULE",
5667 __kmp_stg_parse_kmp_force_monotonic, __kmp_stg_print_kmp_force_monotonic,
5669 {
"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode,
5670 __kmp_stg_print_atomic_mode, NULL, 0, 0},
5671 {
"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check,
5672 __kmp_stg_print_consistency_check, NULL, 0, 0},
5674#if USE_ITT_BUILD && USE_ITT_NOTIFY
5675 {
"KMP_ITT_PREPARE_DELAY", __kmp_stg_parse_itt_prepare_delay,
5676 __kmp_stg_print_itt_prepare_delay, NULL, 0, 0},
5678 {
"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr,
5679 __kmp_stg_print_malloc_pool_incr, NULL, 0, 0},
5680 {
"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode,
5682 {
"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic,
5684 {
"KMP_DYNAMIC_MODE", __kmp_stg_parse_kmp_dynamic_mode,
5685 __kmp_stg_print_kmp_dynamic_mode, NULL, 0, 0},
5687#ifdef USE_LOAD_BALANCE
5688 {
"KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,
5689 __kmp_stg_print_ld_balance_interval, NULL, 0, 0},
5692 {
"KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block,
5693 __kmp_stg_print_lock_block, NULL, 0, 0},
5694 {
"KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind,
5696 {
"KMP_SPIN_BACKOFF_PARAMS", __kmp_stg_parse_spin_backoff_params,
5697 __kmp_stg_print_spin_backoff_params, NULL, 0, 0},
5698#if KMP_USE_ADAPTIVE_LOCKS
5699 {
"KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,
5700 __kmp_stg_print_adaptive_lock_props, NULL, 0, 0},
5701#if KMP_DEBUG_ADAPTIVE_LOCKS
5702 {
"KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,
5703 __kmp_stg_print_speculative_statsfile, NULL, 0, 0},
5706 {
"KMP_PLACE_THREADS", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset,
5708 {
"KMP_HW_SUBSET", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset,
5711 {
"KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames,
5712 __kmp_stg_print_forkjoin_frames, NULL, 0, 0},
5713 {
"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,
5714 __kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0},
5716 {
"KMP_ENABLE_TASK_THROTTLING", __kmp_stg_parse_task_throttling,
5717 __kmp_stg_print_task_throttling, NULL, 0, 0},
5719 {
"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env,
5720 __kmp_stg_print_omp_display_env, NULL, 0, 0},
5721 {
"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation,
5722 __kmp_stg_print_omp_cancellation, NULL, 0, 0},
5723 {
"OMP_ALLOCATOR", __kmp_stg_parse_allocator, __kmp_stg_print_allocator,
5725 {
"LIBOMP_USE_HIDDEN_HELPER_TASK", __kmp_stg_parse_use_hidden_helper,
5726 __kmp_stg_print_use_hidden_helper, NULL, 0, 0},
5727 {
"LIBOMP_NUM_HIDDEN_HELPER_THREADS",
5728 __kmp_stg_parse_num_hidden_helper_threads,
5729 __kmp_stg_print_num_hidden_helper_threads, NULL, 0, 0},
5732 {
"OMP_TOOL", __kmp_stg_parse_omp_tool, __kmp_stg_print_omp_tool, NULL, 0,
5734 {
"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries,
5735 __kmp_stg_print_omp_tool_libraries, NULL, 0, 0},
5736 {
"OMP_TOOL_VERBOSE_INIT", __kmp_stg_parse_omp_tool_verbose_init,
5737 __kmp_stg_print_omp_tool_verbose_init, NULL, 0, 0},
5740#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
5741 {
"KMP_USER_LEVEL_MWAIT", __kmp_stg_parse_user_level_mwait,
5742 __kmp_stg_print_user_level_mwait, NULL, 0, 0},
5743 {
"KMP_MWAIT_HINTS", __kmp_stg_parse_mwait_hints,
5744 __kmp_stg_print_mwait_hints, NULL, 0, 0},
5748 {
"KMP_TPAUSE", __kmp_stg_parse_tpause, __kmp_stg_print_tpause, NULL, 0, 0},
5750 {
"", NULL, NULL, NULL, 0, 0}};
5752static int const __kmp_stg_count =
5753 sizeof(__kmp_stg_table) /
sizeof(kmp_setting_t);
5755static inline kmp_setting_t *__kmp_stg_find(
char const *name) {
5759 for (i = 0; i < __kmp_stg_count; ++i) {
5760 if (strcmp(__kmp_stg_table[i].name, name) == 0) {
5761 return &__kmp_stg_table[i];
5769static int __kmp_stg_cmp(
void const *_a,
void const *_b) {
5770 const kmp_setting_t *a = RCAST(
const kmp_setting_t *, _a);
5771 const kmp_setting_t *b = RCAST(
const kmp_setting_t *, _b);
5775 if (strcmp(a->name,
"KMP_AFFINITY") == 0) {
5776 if (strcmp(b->name,
"KMP_AFFINITY") == 0) {
5780 }
else if (strcmp(b->name,
"KMP_AFFINITY") == 0) {
5783 return strcmp(a->name, b->name);
5786static void __kmp_stg_init(
void) {
5788 static int initialized = 0;
5793 qsort(__kmp_stg_table, __kmp_stg_count - 1,
sizeof(kmp_setting_t),
5797 kmp_setting_t *kmp_stacksize =
5798 __kmp_stg_find(
"KMP_STACKSIZE");
5799#ifdef KMP_GOMP_COMPAT
5800 kmp_setting_t *gomp_stacksize =
5801 __kmp_stg_find(
"GOMP_STACKSIZE");
5803 kmp_setting_t *omp_stacksize =
5804 __kmp_stg_find(
"OMP_STACKSIZE");
5810 static kmp_setting_t *
volatile rivals[4];
5811 static kmp_stg_ss_data_t kmp_data = {1, CCAST(kmp_setting_t **, rivals)};
5812#ifdef KMP_GOMP_COMPAT
5813 static kmp_stg_ss_data_t gomp_data = {1024,
5814 CCAST(kmp_setting_t **, rivals)};
5816 static kmp_stg_ss_data_t omp_data = {1024,
5817 CCAST(kmp_setting_t **, rivals)};
5820 rivals[i++] = kmp_stacksize;
5821#ifdef KMP_GOMP_COMPAT
5822 if (gomp_stacksize != NULL) {
5823 rivals[i++] = gomp_stacksize;
5826 rivals[i++] = omp_stacksize;
5829 kmp_stacksize->data = &kmp_data;
5830#ifdef KMP_GOMP_COMPAT
5831 if (gomp_stacksize != NULL) {
5832 gomp_stacksize->data = &gomp_data;
5835 omp_stacksize->data = &omp_data;
5839 kmp_setting_t *kmp_library =
5840 __kmp_stg_find(
"KMP_LIBRARY");
5841 kmp_setting_t *omp_wait_policy =
5842 __kmp_stg_find(
"OMP_WAIT_POLICY");
5845 static kmp_setting_t *
volatile rivals[3];
5846 static kmp_stg_wp_data_t kmp_data = {0, CCAST(kmp_setting_t **, rivals)};
5847 static kmp_stg_wp_data_t omp_data = {1, CCAST(kmp_setting_t **, rivals)};
5850 rivals[i++] = kmp_library;
5851 if (omp_wait_policy != NULL) {
5852 rivals[i++] = omp_wait_policy;
5856 kmp_library->data = &kmp_data;
5857 if (omp_wait_policy != NULL) {
5858 omp_wait_policy->data = &omp_data;
5863 kmp_setting_t *kmp_device_thread_limit =
5864 __kmp_stg_find(
"KMP_DEVICE_THREAD_LIMIT");
5865 kmp_setting_t *kmp_all_threads =
5866 __kmp_stg_find(
"KMP_ALL_THREADS");
5869 static kmp_setting_t *
volatile rivals[3];
5872 rivals[i++] = kmp_device_thread_limit;
5873 rivals[i++] = kmp_all_threads;
5876 kmp_device_thread_limit->data = CCAST(kmp_setting_t **, rivals);
5877 kmp_all_threads->data = CCAST(kmp_setting_t **, rivals);
5882 kmp_setting_t *kmp_hw_subset = __kmp_stg_find(
"KMP_HW_SUBSET");
5884 kmp_setting_t *kmp_place_threads = __kmp_stg_find(
"KMP_PLACE_THREADS");
5887 static kmp_setting_t *
volatile rivals[3];
5890 rivals[i++] = kmp_hw_subset;
5891 rivals[i++] = kmp_place_threads;
5894 kmp_hw_subset->data = CCAST(kmp_setting_t **, rivals);
5895 kmp_place_threads->data = CCAST(kmp_setting_t **, rivals);
5898#if KMP_AFFINITY_SUPPORTED
5900 kmp_setting_t *kmp_affinity =
5901 __kmp_stg_find(
"KMP_AFFINITY");
5902 KMP_DEBUG_ASSERT(kmp_affinity != NULL);
5904#ifdef KMP_GOMP_COMPAT
5905 kmp_setting_t *gomp_cpu_affinity =
5906 __kmp_stg_find(
"GOMP_CPU_AFFINITY");
5907 KMP_DEBUG_ASSERT(gomp_cpu_affinity != NULL);
5910 kmp_setting_t *omp_proc_bind =
5911 __kmp_stg_find(
"OMP_PROC_BIND");
5912 KMP_DEBUG_ASSERT(omp_proc_bind != NULL);
5915 static kmp_setting_t *
volatile rivals[4];
5918 rivals[i++] = kmp_affinity;
5920#ifdef KMP_GOMP_COMPAT
5921 rivals[i++] = gomp_cpu_affinity;
5922 gomp_cpu_affinity->data = CCAST(kmp_setting_t **, rivals);
5925 rivals[i++] = omp_proc_bind;
5926 omp_proc_bind->data = CCAST(kmp_setting_t **, rivals);
5929 static kmp_setting_t *
volatile places_rivals[4];
5932 kmp_setting_t *omp_places = __kmp_stg_find(
"OMP_PLACES");
5933 KMP_DEBUG_ASSERT(omp_places != NULL);
5935 places_rivals[i++] = kmp_affinity;
5936#ifdef KMP_GOMP_COMPAT
5937 places_rivals[i++] = gomp_cpu_affinity;
5939 places_rivals[i++] = omp_places;
5940 omp_places->data = CCAST(kmp_setting_t **, places_rivals);
5941 places_rivals[i++] = NULL;
5949 kmp_setting_t *kmp_force_red =
5950 __kmp_stg_find(
"KMP_FORCE_REDUCTION");
5951 kmp_setting_t *kmp_determ_red =
5952 __kmp_stg_find(
"KMP_DETERMINISTIC_REDUCTION");
5955 static kmp_setting_t *
volatile rivals[3];
5956 static kmp_stg_fr_data_t force_data = {1,
5957 CCAST(kmp_setting_t **, rivals)};
5958 static kmp_stg_fr_data_t determ_data = {0,
5959 CCAST(kmp_setting_t **, rivals)};
5962 rivals[i++] = kmp_force_red;
5963 if (kmp_determ_red != NULL) {
5964 rivals[i++] = kmp_determ_red;
5968 kmp_force_red->data = &force_data;
5969 if (kmp_determ_red != NULL) {
5970 kmp_determ_red->data = &determ_data;
5979 for (i = 0; i < __kmp_stg_count; ++i) {
5980 __kmp_stg_table[i].set = 0;
5985static void __kmp_stg_parse(
char const *name,
char const *value) {
5993 if (value != NULL) {
5994 kmp_setting_t *setting = __kmp_stg_find(name);
5995 if (setting != NULL) {
5996 setting->parse(name, value, setting->data);
5997 setting->defined = 1;
6003static int __kmp_stg_check_rivals(
6006 kmp_setting_t **rivals
6009 if (rivals == NULL) {
6015 for (; strcmp(rivals[i]->name, name) != 0; i++) {
6016 KMP_DEBUG_ASSERT(rivals[i] != NULL);
6018#if KMP_AFFINITY_SUPPORTED
6019 if (rivals[i] == __kmp_affinity_notype) {
6026 if (rivals[i]->set) {
6027 KMP_WARNING(StgIgnored, name, rivals[i]->name);
6037static int __kmp_env_toPrint(
char const *name,
int flag) {
6039 kmp_setting_t *setting = __kmp_stg_find(name);
6040 if (setting != NULL) {
6041 rc = setting->defined;
6043 setting->defined = flag;
6049#if defined(KMP_DEBUG) && KMP_AFFINITY_SUPPORTED
6050static void __kmp_print_affinity_settings(
const kmp_affinity_t *affinity) {
6051 K_DIAG(1, (
"%s:\n", affinity->env_var));
6052 K_DIAG(1, (
" type : %d\n", affinity->type));
6053 K_DIAG(1, (
" compact : %d\n", affinity->compact));
6054 K_DIAG(1, (
" offset : %d\n", affinity->offset));
6055 K_DIAG(1, (
" verbose : %u\n", affinity->flags.verbose));
6056 K_DIAG(1, (
" warnings : %u\n", affinity->flags.warnings));
6057 K_DIAG(1, (
" respect : %u\n", affinity->flags.respect));
6058 K_DIAG(1, (
" reset : %u\n", affinity->flags.reset));
6059 K_DIAG(1, (
" dups : %u\n", affinity->flags.dups));
6060 K_DIAG(1, (
" gran : %d\n", (
int)affinity->gran));
6061 KMP_DEBUG_ASSERT(affinity->type != affinity_default);
6068static char const *__kmp_aux_env_blk_all_fallback(kmp_env_blk_t *block,
6069 char const *base_name) {
6070 for (
int e = 0;; ++e) {
6071 char const *base = __kmp_device_env_eligible_name(e);
6074 if (strcmp(base, base_name) != 0)
6076 char *all_name = __kmp_str_format(
"%s_ALL", base_name);
6077 char const *value = __kmp_env_blk_var(block, all_name);
6078 __kmp_str_free(&all_name);
6083static void __kmp_aux_env_initialize(kmp_env_blk_t *block) {
6088 value = __kmp_env_blk_var(block,
"OMP_NUM_THREADS");
6090 value = __kmp_aux_env_blk_all_fallback(block,
"OMP_NUM_THREADS");
6092 ompc_set_num_threads(__kmp_dflt_team_nth);
6096 value = __kmp_env_blk_var(block,
"KMP_BLOCKTIME");
6101 gtid = __kmp_entry_gtid();
6102 tid = __kmp_tid_from_gtid(gtid);
6103 thread = __kmp_thread_from_gtid(gtid);
6104 __kmp_aux_set_blocktime(__kmp_dflt_blocktime, thread, tid);
6108 value = __kmp_env_blk_var(block,
"OMP_NESTED");
6110 ompc_set_nested(__kmp_dflt_max_active_levels > 1);
6114 value = __kmp_env_blk_var(block,
"OMP_DYNAMIC");
6116 ompc_set_dynamic(__kmp_global.g.g_dynamic);
6120void __kmp_env_initialize(
char const *
string) {
6122 kmp_env_blk_t block;
6128 if (
string == NULL) {
6130 __kmp_threads_capacity =
6131 __kmp_initial_threads_capacity(__kmp_dflt_team_nth_ub);
6133 __kmp_env_blk_init(&block,
string);
6137 blocktime_str = __kmp_env_blk_var(&block,
"KMP_BLOCKTIME");
6138 use_yield_str = __kmp_env_blk_var(&block,
"KMP_USE_YIELD");
6142 if (
string == NULL) {
6143 char const *name =
"KMP_WARNINGS";
6144 char const *value = __kmp_env_blk_var(&block, name);
6145 __kmp_stg_parse(name, value);
6148#if KMP_AFFINITY_SUPPORTED
6154 __kmp_affinity_notype = NULL;
6155 char const *aff_str = __kmp_env_blk_var(&block,
"KMP_AFFINITY");
6156 if (aff_str != NULL) {
6167#if KMP_OS_WINDOWS || KMP_OS_AIX
6170#define FIND strcasestr
6173 if ((FIND(aff_str,
"none") == NULL) &&
6174 (FIND(aff_str,
"physical") == NULL) &&
6175 (FIND(aff_str,
"logical") == NULL) &&
6176 (FIND(aff_str,
"compact") == NULL) &&
6177 (FIND(aff_str,
"scatter") == NULL) &&
6178 (FIND(aff_str,
"explicit") == NULL) &&
6179 (FIND(aff_str,
"balanced") == NULL) &&
6180 (FIND(aff_str,
"disabled") == NULL)) {
6181 __kmp_affinity_notype = __kmp_stg_find(
"KMP_AFFINITY");
6186 __kmp_affinity.type = affinity_default;
6187 __kmp_affinity.gran = KMP_HW_UNKNOWN;
6188 __kmp_affinity_top_method = affinity_top_method_default;
6189 __kmp_affinity.flags.respect = affinity_respect_mask_default;
6194 aff_str = __kmp_env_blk_var(&block,
"OMP_PROC_BIND");
6195 if (aff_str != NULL) {
6196 __kmp_affinity.type = affinity_default;
6197 __kmp_affinity.gran = KMP_HW_UNKNOWN;
6198 __kmp_affinity_top_method = affinity_top_method_default;
6199 __kmp_affinity.flags.respect = affinity_respect_mask_default;
6208 for (i = 0; i < block.count; ++i) {
6209 if ((block.vars[i].name == NULL) || (*block.vars[i].name ==
'\0')) {
6212 if (block.vars[i].value == NULL) {
6215 if (__kmp_device_env_record(block.vars[i].name, block.vars[i].value))
6218 kmp_setting_t *setting = __kmp_stg_find(block.vars[i].name);
6219 if (setting != NULL) {
6225 if (__kmp_nested_proc_bind.bind_types == NULL) {
6226 __kmp_nested_proc_bind.bind_types =
6227 (kmp_proc_bind_t *)KMP_INTERNAL_MALLOC(
sizeof(kmp_proc_bind_t));
6228 if (__kmp_nested_proc_bind.bind_types == NULL) {
6229 KMP_FATAL(MemoryAllocFailed);
6231 __kmp_nested_proc_bind.size = 1;
6232 __kmp_nested_proc_bind.used = 1;
6233#if KMP_AFFINITY_SUPPORTED
6234 __kmp_nested_proc_bind.bind_types[0] = proc_bind_default;
6237 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6244 __kmp_msg_format(kmp_i18n_msg_AffFormatDefault,
"%P",
"%i",
"%n",
"%A");
6245 KMP_DEBUG_ASSERT(KMP_STRLEN(m.str) < KMP_AFFINITY_FORMAT_SIZE);
6247 if (__kmp_affinity_format == NULL) {
6248 __kmp_affinity_format =
6249 (
char *)KMP_INTERNAL_MALLOC(
sizeof(
char) * KMP_AFFINITY_FORMAT_SIZE);
6251 KMP_STRCPY_S(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, m.str);
6252 __kmp_str_free(&m.str);
6255 for (i = 0; i < block.count; ++i) {
6256 __kmp_stg_parse(block.vars[i].name, block.vars[i].value);
6263 for (
int e = 0;; ++e) {
6264 char const *base = __kmp_device_env_eligible_name(e);
6267 if (__kmp_env_blk_var(&block, base) != NULL)
6269 char *all_name = __kmp_str_format(
"%s_ALL", base);
6270 char const *all_v = __kmp_env_blk_var(&block, all_name);
6271 __kmp_str_free(&all_name);
6273 __kmp_stg_parse(base, all_v);
6277 if (!__kmp_init_user_locks) {
6278 if (__kmp_user_lock_kind == lk_default) {
6279 __kmp_user_lock_kind = lk_queuing;
6281#if KMP_USE_DYNAMIC_LOCK
6282 __kmp_init_dynamic_user_locks();
6284 __kmp_set_user_lock_vptrs(__kmp_user_lock_kind);
6287 KMP_DEBUG_ASSERT(
string != NULL);
6288 KMP_DEBUG_ASSERT(__kmp_user_lock_kind != lk_default);
6293#if KMP_USE_DYNAMIC_LOCK
6294 __kmp_init_dynamic_user_locks();
6296 __kmp_set_user_lock_vptrs(__kmp_user_lock_kind);
6300#if KMP_AFFINITY_SUPPORTED
6302 if (!TCR_4(__kmp_init_middle)) {
6303#if KMP_HWLOC_ENABLED
6307 if (__kmp_hw_subset &&
6308 __kmp_affinity_top_method == affinity_top_method_default)
6309 if (__kmp_hw_subset->specified(KMP_HW_NUMA) ||
6310 __kmp_hw_subset->specified(KMP_HW_TILE) ||
6311 __kmp_affinity.gran == KMP_HW_TILE ||
6312 __kmp_affinity.gran == KMP_HW_NUMA)
6313 __kmp_affinity_top_method = affinity_top_method_hwloc;
6315 if (__kmp_affinity.gran == KMP_HW_NUMA ||
6316 __kmp_affinity.gran == KMP_HW_TILE)
6317 __kmp_affinity_top_method = affinity_top_method_hwloc;
6321 const char *var =
"KMP_AFFINITY";
6322 KMPAffinity::pick_api();
6323#if KMP_HWLOC_ENABLED
6327 if (__kmp_affinity_top_method == affinity_top_method_hwloc &&
6328 __kmp_affinity_dispatch->get_api_type() != KMPAffinity::HWLOC) {
6329 KMP_WARNING(AffIgnoringHwloc, var);
6330 __kmp_affinity_top_method = affinity_top_method_all;
6333 if (__kmp_affinity.type == affinity_disabled) {
6334 KMP_AFFINITY_DISABLE();
6335 }
else if (!KMP_AFFINITY_CAPABLE()) {
6336 __kmp_affinity_dispatch->determine_capable(var);
6337 if (!KMP_AFFINITY_CAPABLE()) {
6338 if (__kmp_affinity.flags.verbose ||
6339 (__kmp_affinity.flags.warnings &&
6340 (__kmp_affinity.type != affinity_default) &&
6341 (__kmp_affinity.type != affinity_none) &&
6342 (__kmp_affinity.type != affinity_disabled))) {
6343 KMP_WARNING(AffNotSupported, var);
6345 __kmp_affinity.type = affinity_disabled;
6346 __kmp_affinity.flags.respect = FALSE;
6347 __kmp_affinity.gran = KMP_HW_THREAD;
6351 if (__kmp_affinity.type == affinity_disabled) {
6352 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6353 }
else if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_true) {
6355 __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
6358 if (KMP_AFFINITY_CAPABLE()) {
6360#if KMP_GROUP_AFFINITY
6365 bool exactly_one_group =
false;
6366 if (__kmp_num_proc_groups > 1) {
6368 bool within_one_group;
6371 kmp_affin_mask_t *init_mask;
6372 KMP_CPU_ALLOC(init_mask);
6373 __kmp_get_system_affinity(init_mask, TRUE);
6374 group = __kmp_get_proc_group(init_mask);
6375 within_one_group = (group >= 0);
6378 if (within_one_group) {
6379 DWORD num_bits_in_group = __kmp_GetActiveProcessorCount(group);
6380 DWORD num_bits_in_mask = 0;
6381 for (
int bit = init_mask->begin(); bit != init_mask->end();
6382 bit = init_mask->next(bit))
6384 exactly_one_group = (num_bits_in_group == num_bits_in_mask);
6386 KMP_CPU_FREE(init_mask);
6392 if (__kmp_num_proc_groups > 1 &&
6393 __kmp_affinity.type == affinity_default &&
6394 __kmp_nested_proc_bind.bind_types[0] == proc_bind_default) {
6399 if (__kmp_affinity.flags.respect == affinity_respect_mask_default &&
6400 exactly_one_group) {
6401 __kmp_affinity.flags.respect = FALSE;
6405 if (__kmp_affinity.type == affinity_default) {
6406 __kmp_affinity.type = affinity_compact;
6407 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
6409 if (__kmp_hh_affinity.type == affinity_default)
6410 __kmp_hh_affinity.type = affinity_compact;
6411 if (__kmp_affinity_top_method == affinity_top_method_default)
6412 __kmp_affinity_top_method = affinity_top_method_all;
6413 if (__kmp_affinity.gran == KMP_HW_UNKNOWN)
6414 __kmp_affinity.gran = KMP_HW_PROC_GROUP;
6415 if (__kmp_hh_affinity.gran == KMP_HW_UNKNOWN)
6416 __kmp_hh_affinity.gran = KMP_HW_PROC_GROUP;
6422 if (__kmp_affinity.flags.respect == affinity_respect_mask_default) {
6423#if KMP_GROUP_AFFINITY
6424 if (__kmp_num_proc_groups > 1 && exactly_one_group) {
6425 __kmp_affinity.flags.respect = FALSE;
6429 __kmp_affinity.flags.respect = TRUE;
6432 if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
6433 (__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
6434 if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)
6435 __kmp_affinity.type = affinity_none;
6436 if (__kmp_affinity.type == affinity_default) {
6437 __kmp_affinity.type = affinity_compact;
6438 __kmp_affinity.flags.dups = FALSE;
6440 }
else if (__kmp_affinity.type == affinity_default) {
6441#if KMP_MIC_SUPPORTED
6442 if (__kmp_mic_type != non_mic) {
6443 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
6447 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
6449#if KMP_MIC_SUPPORTED
6450 if (__kmp_mic_type != non_mic) {
6451 __kmp_affinity.type = affinity_scatter;
6455 __kmp_affinity.type = affinity_none;
6458 if (__kmp_hh_affinity.type == affinity_default)
6459 __kmp_hh_affinity.type = affinity_none;
6460 if ((__kmp_affinity.gran == KMP_HW_UNKNOWN) &&
6461 (__kmp_affinity.gran_levels < 0)) {
6462#if KMP_MIC_SUPPORTED
6463 if (__kmp_mic_type != non_mic) {
6464 __kmp_affinity.gran = KMP_HW_THREAD;
6468 __kmp_affinity.gran = KMP_HW_CORE;
6471 if ((__kmp_hh_affinity.gran == KMP_HW_UNKNOWN) &&
6472 (__kmp_hh_affinity.gran_levels < 0)) {
6473#if KMP_MIC_SUPPORTED
6474 if (__kmp_mic_type != non_mic) {
6475 __kmp_hh_affinity.gran = KMP_HW_THREAD;
6479 __kmp_hh_affinity.gran = KMP_HW_CORE;
6482 if (__kmp_affinity_top_method == affinity_top_method_default) {
6483 __kmp_affinity_top_method = affinity_top_method_all;
6489 if (__kmp_affinity_top_method == affinity_top_method_default)
6490 __kmp_affinity_top_method = affinity_top_method_all;
6491 if (__kmp_affinity.type == affinity_default)
6492 __kmp_affinity.type = affinity_disabled;
6493 if (__kmp_hh_affinity.type == affinity_default)
6494 __kmp_hh_affinity.type = affinity_disabled;
6498 for (
const kmp_affinity_t *affinity : __kmp_affinities)
6499 __kmp_print_affinity_settings(affinity);
6500 KMP_DEBUG_ASSERT(__kmp_nested_proc_bind.bind_types[0] != proc_bind_default);
6501 K_DIAG(1, (
"__kmp_nested_proc_bind.bind_types[0] == %d\n",
6502 __kmp_nested_proc_bind.bind_types[0]));
6510 if (
string != NULL) {
6511 __kmp_aux_env_initialize(&block);
6514 __kmp_env_blk_free(&block);
6520void __kmp_env_print() {
6522 kmp_env_blk_t block;
6524 kmp_str_buf_t buffer;
6527 __kmp_str_buf_init(&buffer);
6529 __kmp_env_blk_init(&block, NULL);
6530 __kmp_env_blk_sort(&block);
6533 __kmp_str_buf_print(&buffer,
"\n%s\n\n", KMP_I18N_STR(UserSettings));
6534 for (i = 0; i < block.count; ++i) {
6535 char const *name = block.vars[i].name;
6536 char const *value = block.vars[i].value;
6537 if ((KMP_STRLEN(name) > 4 && strncmp(name,
"KMP_", 4) == 0) ||
6538 strncmp(name,
"OMP_", 4) == 0
6539#ifdef KMP_GOMP_COMPAT
6540 || strncmp(name,
"GOMP_", 5) == 0
6543 __kmp_str_buf_print(&buffer,
" %s=%s\n", name, value);
6546 __kmp_str_buf_print(&buffer,
"\n");
6549 __kmp_str_buf_print(&buffer,
"%s\n\n", KMP_I18N_STR(EffectiveSettings));
6550 for (
int i = 0; i < __kmp_stg_count; ++i) {
6551 if (__kmp_stg_table[i].print != NULL) {
6552 __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name,
6553 __kmp_stg_table[i].data);
6557 __kmp_printf(
"%s", buffer.str);
6559 __kmp_env_blk_free(&block);
6560 __kmp_str_buf_free(&buffer);
6566void __kmp_env_print_2() {
6567 __kmp_display_env_impl(__kmp_display_env, __kmp_display_env_verbose);
6570void __kmp_display_env_impl(
int display_env,
int display_env_verbose) {
6571 kmp_env_blk_t block;
6572 kmp_str_buf_t buffer;
6574 __kmp_env_format = 1;
6577 __kmp_str_buf_init(&buffer);
6579 __kmp_env_blk_init(&block, NULL);
6580 __kmp_env_blk_sort(&block);
6582 __kmp_str_buf_print(&buffer,
"\n%s\n", KMP_I18N_STR(DisplayEnvBegin));
6583 __kmp_str_buf_print(&buffer,
" _OPENMP='%d'\n", __kmp_openmp_version);
6585 for (
int i = 0; i < __kmp_stg_count; ++i) {
6586 if (__kmp_stg_table[i].print != NULL &&
6587 ((display_env && strncmp(__kmp_stg_table[i].name,
"OMP_", 4) == 0) ||
6588 display_env_verbose)) {
6589 __kmp_stg_table[i].print(&buffer, __kmp_stg_table[i].name,
6590 __kmp_stg_table[i].data);
6594 __kmp_str_buf_print(&buffer,
"%s\n", KMP_I18N_STR(DisplayEnvEnd));
6595 __kmp_str_buf_print(&buffer,
"\n");
6597 __kmp_printf(
"%s", buffer.str);
6599 __kmp_env_blk_free(&block);
6600 __kmp_str_buf_free(&buffer);
6607void __kmp_env_dump() {
6609 kmp_env_blk_t block;
6610 kmp_str_buf_t buffer, env, notdefined;
6613 __kmp_str_buf_init(&buffer);
6614 __kmp_str_buf_init(&env);
6615 __kmp_str_buf_init(¬defined);
6617 __kmp_env_blk_init(&block, NULL);
6618 __kmp_env_blk_sort(&block);
6620 __kmp_str_buf_print(¬defined,
": %s", KMP_I18N_STR(NotDefined));
6622 for (
int i = 0; i < __kmp_stg_count; ++i) {
6623 if (__kmp_stg_table[i].print == NULL)
6625 __kmp_str_buf_clear(&env);
6626 __kmp_stg_table[i].print(&env, __kmp_stg_table[i].name,
6627 __kmp_stg_table[i].data);
6630 if (strstr(env.str, notdefined.str))
6632 __kmp_str_buf_print(&buffer,
"%s=undefined\n", __kmp_stg_table[i].name);
6634 __kmp_str_buf_cat(&buffer, env.str + 3, env.used - 3);
6637 ompd_env_block = (
char *)__kmp_allocate(buffer.used + 1);
6638 KMP_MEMCPY(ompd_env_block, buffer.str, buffer.used + 1);
6639 ompd_env_block_size = (ompd_size_t)KMP_STRLEN(ompd_env_block);
6641 __kmp_env_blk_free(&block);
6642 __kmp_str_buf_free(&buffer);
6643 __kmp_str_buf_free(&env);
6644 __kmp_str_buf_free(¬defined);
@ kmp_sch_modifier_monotonic
@ kmp_sch_modifier_nonmonotonic