36 #include "kmp_wrapper_getpid.h"
37 #include "kmp_environment.h"
38 #include "kmp_atomic.h"
41 #include "kmp_settings.h"
46 static int __kmp_env_isDefined(
char const * name );
47 static int __kmp_env_toPrint(
char const * name,
int flag );
49 bool __kmp_env_format = 0;
55 __kmp_convert_to_double(
char const * s )
59 if ( KMP_SSCANF( s,
"%lf", &result ) < 1 ) {
67 __kmp_readstr_with_sentinel(
char *dest,
char const * src,
size_t len,
char sentinel) {
69 for (i = 0; i < len; i++) {
70 if ((*src ==
'\0') || (*src == sentinel)) {
80 __kmp_match_with_sentinel(
char const * a,
char const * b,
size_t len,
char sentinel ) {
87 while(*a && *b && *b != sentinel) {
88 char ca = *a, cb = *b;
90 if(ca >=
'a' && ca <=
'z')
92 if(cb >=
'a' && cb <=
'z')
130 __kmp_match_str(
char const *token,
char const *buf,
const char **end) {
132 KMP_ASSERT(token != NULL);
133 KMP_ASSERT(buf != NULL);
134 KMP_ASSERT(end != NULL);
136 while (*token && *buf) {
137 char ct = *token, cb = *buf;
139 if(ct >=
'a' && ct <=
'z')
141 if(cb >=
'a' && cb <=
'z')
156 __kmp_strip_quotes(
char *target,
int len) {
157 char *end = target + len - 1;
159 while(*target ==
'"' || *target ==
'\'') {
160 if(end <= target || (*end !=
'"' && *end !=
'\''))
172 __kmp_round4k(
size_t size ) {
173 size_t _4k = 4 * 1024;
174 if ( size & ( _4k - 1 ) ) {
175 size &= ~ ( _4k - 1 );
176 if ( size <= KMP_SIZE_T_MAX - _4k ) {
185 __kmp_convert_to_seconds(
char const * data )
187 int nvalues, value, factor;
190 if (data == NULL)
return (0);
193 nvalues = KMP_SSCANF (data,
"%d%c%c", &value, &mult, &extra);
194 if (nvalues < 1)
return (0);
195 if (nvalues == 1) mult =
'\0';
196 if (nvalues == 3)
return (-1);
212 factor = 24 * 60 * 60;
218 if (value > (INT_MAX / factor))
233 __kmp_convert_to_milliseconds(
char const * data )
235 int ret, nvalues, factor;
239 if (data == NULL)
return (-1);
240 if ( __kmp_str_match(
"infinit", -1, data))
return (INT_MAX);
241 value = (double) 0.0;
243 nvalues = KMP_SSCANF (data,
"%lf%c%c", &value, &mult, &extra);
244 if (nvalues < 1)
return (-1);
245 if (nvalues == 1) mult =
'\0';
246 if (nvalues == 3)
return (-1);
248 if (value < 0)
return (-1);
262 factor = 1000 * 60 * 60;
265 factor = 1000 * 24 * 60 * 60;
271 if ( value >= ( (INT_MAX-1) / factor) )
274 ret = (int) (value * (
double) factor);
280 __kmp_convert_to_nanoseconds(
291 if ( str == NULL || str[ 0 ] == 0 ) {
294 rc = KMP_SSCANF( str,
"%lf%c%c", &value, &unit, &extra );
326 result = (kmp_uint64)( value * factor );
333 __kmp_strcasecmp_with_sentinel(
char const * a,
char const * b,
char sentinel ) {
338 while(*a && *b && *b != sentinel) {
339 char ca = *a, cb = *b;
341 if(ca >=
'a' && ca <=
'z')
343 if(cb >=
'a' && cb <=
'z')
346 return (
int)(
unsigned char)*a - (
int)(
unsigned char)*b;
351 (*b && *b != sentinel) ? (
int)(
unsigned char)*a - (
int)(
unsigned char)*b : 1 :
352 (*b && *b != sentinel) ? -1 : 0;
360 typedef struct __kmp_setting kmp_setting_t;
361 typedef struct __kmp_stg_ss_data kmp_stg_ss_data_t;
362 typedef struct __kmp_stg_wp_data kmp_stg_wp_data_t;
363 typedef struct __kmp_stg_fr_data kmp_stg_fr_data_t;
365 typedef void ( * kmp_stg_parse_func_t )(
char const * name,
char const * value,
void * data );
366 typedef void ( * kmp_stg_print_func_t )( kmp_str_buf_t * buffer,
char const * name,
void * data );
368 struct __kmp_setting {
370 kmp_stg_parse_func_t parse;
371 kmp_stg_print_func_t print;
378 struct __kmp_stg_ss_data {
380 kmp_setting_t * * rivals;
383 struct __kmp_stg_wp_data {
385 kmp_setting_t * * rivals;
388 struct __kmp_stg_fr_data {
390 kmp_setting_t * * rivals;
394 __kmp_stg_check_rivals(
397 kmp_setting_t * * rivals
406 __kmp_stg_parse_bool(
411 if ( __kmp_str_match_true( value ) ) {
413 }
else if (__kmp_str_match_false( value ) ) {
418 KMP_MSG( BadBoolValue, name, value ),
419 KMP_HNT( ValidBoolValues ),
426 __kmp_stg_parse_size(
435 char const * msg = NULL;
437 size_min = __kmp_round4k( size_min );
438 size_max = __kmp_round4k( size_max );
439 #endif // KMP_OS_DARWIN
441 if ( is_specified != NULL ) {
444 __kmp_str_to_size( value, out, factor, & msg );
446 if ( * out > size_max ) {
448 msg = KMP_I18N_STR( ValueTooLarge );
449 }
else if ( * out < size_min ) {
451 msg = KMP_I18N_STR( ValueTooSmall );
454 size_t round4k = __kmp_round4k( * out );
455 if ( * out != round4k ) {
457 msg = KMP_I18N_STR( NotMultiple4K );
463 if ( * out < size_min ) {
466 else if ( * out > size_max ) {
473 __kmp_str_buf_init( & buf );
474 __kmp_str_buf_print_size( & buf, * out );
475 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
476 KMP_INFORM( Using_str_Value, name, buf.str );
477 __kmp_str_buf_free( & buf );
488 KMP_INTERNAL_FREE( (
void *) * out );
489 * out = __kmp_str_format(
"%s", value );
501 char const * msg = NULL;
502 kmp_uint64 uint = * out;
503 __kmp_str_to_uint( value, & uint, & msg );
505 if ( uint < (
unsigned int)min ) {
506 msg = KMP_I18N_STR( ValueTooSmall );
508 }
else if ( uint > (
unsigned int)max ) {
509 msg = KMP_I18N_STR( ValueTooLarge );
515 if ( uint < (
unsigned int)min ) {
518 else if ( uint > (
unsigned int)max ) {
525 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
526 __kmp_str_buf_init( & buf );
527 __kmp_str_buf_print( &buf,
"%" KMP_UINT64_SPEC
"", uint );
528 KMP_INFORM( Using_uint64_Value, name, buf.str );
529 __kmp_str_buf_free( &buf );
536 __kmp_stg_parse_file(
545 KMP_INTERNAL_FREE( (
void *) * out );
546 t = (
char *) strrchr(value,
'.');
547 hasSuffix = t && __kmp_str_eqf( t, suffix );
548 t = __kmp_str_format(
"%s%s", value, hasSuffix ?
"" : suffix );
549 __kmp_expand_file_name( buffer,
sizeof(buffer), t);
550 KMP_INTERNAL_FREE(t);
551 * out = __kmp_str_format(
"%s", buffer );
555 static char * par_range_to_print = NULL;
558 __kmp_stg_parse_par_range(
567 size_t len = KMP_STRLEN( value + 1 );
568 par_range_to_print = (
char *) KMP_INTERNAL_MALLOC( len +1 );
569 KMP_STRNCPY_S( par_range_to_print, len + 1, value, len + 1);
570 __kmp_par_range = +1;
571 __kmp_par_range_lb = 0;
572 __kmp_par_range_ub = INT_MAX;
575 if (( value == NULL ) || ( *value ==
'\0' )) {
578 if ( ! __kmp_strcasecmp_with_sentinel(
"routine", value,
'=' )) {
579 value = strchr( value,
'=' ) + 1;
580 len = __kmp_readstr_with_sentinel( out_routine,
581 value, KMP_PAR_RANGE_ROUTINE_LEN - 1,
',' );
583 goto par_range_error;
585 value = strchr( value,
',' );
586 if ( value != NULL ) {
591 if ( ! __kmp_strcasecmp_with_sentinel(
"filename", value,
'=' )) {
592 value = strchr( value,
'=' ) + 1;
593 len = __kmp_readstr_with_sentinel( out_file,
594 value, KMP_PAR_RANGE_FILENAME_LEN - 1,
',' );
596 goto par_range_error;
598 value = strchr( value,
',' );
599 if ( value != NULL ) {
604 if (( ! __kmp_strcasecmp_with_sentinel(
"range", value,
'=' ))
605 || ( ! __kmp_strcasecmp_with_sentinel(
"incl_range", value,
'=' ))) {
606 value = strchr( value,
'=' ) + 1;
607 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub ) != 2 ) {
608 goto par_range_error;
611 value = strchr( value,
',' );
612 if ( value != NULL ) {
617 if ( ! __kmp_strcasecmp_with_sentinel(
"excl_range", value,
'=' )) {
618 value = strchr( value,
'=' ) + 1;
619 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub) != 2 ) {
620 goto par_range_error;
623 value = strchr( value,
',' );
624 if ( value != NULL ) {
630 KMP_WARNING( ParRangeSyntax, name );
638 __kmp_initial_threads_capacity(
int req_nproc )
643 if (nth < (4 * req_nproc))
644 nth = (4 * req_nproc);
645 if (nth < (4 * __kmp_xproc))
646 nth = (4 * __kmp_xproc);
648 if (nth > __kmp_max_nth)
656 __kmp_default_tp_capacity(
int req_nproc,
int max_nth,
int all_threads_specified) {
659 if(all_threads_specified)
662 if (nth < (4 * req_nproc))
663 nth = (4 * req_nproc);
664 if (nth < (4 * __kmp_xproc))
665 nth = (4 * __kmp_xproc);
667 if (nth > __kmp_max_nth)
679 __kmp_stg_print_bool( kmp_str_buf_t * buffer,
char const * name,
int value ) {
680 if( __kmp_env_format ) {
681 KMP_STR_BUF_PRINT_BOOL;
683 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value ?
"true" :
"false" );
688 __kmp_stg_print_int( kmp_str_buf_t * buffer,
char const * name,
int value ) {
689 if( __kmp_env_format ) {
690 KMP_STR_BUF_PRINT_INT;
692 __kmp_str_buf_print( buffer,
" %s=%d\n", name, value );
697 __kmp_stg_print_uint64( kmp_str_buf_t * buffer,
char const * name, kmp_uint64 value ) {
698 if( __kmp_env_format ) {
699 KMP_STR_BUF_PRINT_UINT64;
701 __kmp_str_buf_print( buffer,
" %s=%" KMP_UINT64_SPEC
"\n", name, value );
706 __kmp_stg_print_str( kmp_str_buf_t * buffer,
char const * name,
char const * value ) {
707 if( __kmp_env_format ) {
708 KMP_STR_BUF_PRINT_STR;
710 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value );
715 __kmp_stg_print_size( kmp_str_buf_t * buffer,
char const * name,
size_t value ) {
716 if( __kmp_env_format ) {
717 KMP_STR_BUF_PRINT_NAME_EX(name);
718 __kmp_str_buf_print_size( buffer, value );
719 __kmp_str_buf_print( buffer,
"'\n" );
721 __kmp_str_buf_print( buffer,
" %s=", name );
722 __kmp_str_buf_print_size( buffer, value );
723 __kmp_str_buf_print( buffer,
"\n" );
738 __kmp_stg_parse_all_threads(
char const * name,
char const * value,
void * data ) {
740 kmp_setting_t * * rivals = (kmp_setting_t * *) data;
742 rc = __kmp_stg_check_rivals( name, value, rivals );
746 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
747 __kmp_max_nth = __kmp_xproc;
748 __kmp_allThreadsSpecified = 1;
750 __kmp_stg_parse_int( name, value, 1, __kmp_sys_max_nth, & __kmp_max_nth );
751 __kmp_allThreadsSpecified = 0;
753 K_DIAG( 1, (
"__kmp_max_nth == %d\n", __kmp_max_nth ) );
758 __kmp_stg_print_all_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
759 __kmp_stg_print_int( buffer, name, __kmp_max_nth );
767 __kmp_stg_parse_blocktime(
char const * name,
char const * value,
void * data ) {
768 __kmp_dflt_blocktime = __kmp_convert_to_milliseconds( value );
769 if ( __kmp_dflt_blocktime < 0 ) {
770 __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
771 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidValue, name, value ), __kmp_msg_null );
772 KMP_INFORM( Using_int_Value, name, __kmp_dflt_blocktime );
773 __kmp_env_blocktime = FALSE;
775 if ( __kmp_dflt_blocktime < KMP_MIN_BLOCKTIME ) {
776 __kmp_dflt_blocktime = KMP_MIN_BLOCKTIME;
777 __kmp_msg( kmp_ms_warning, KMP_MSG( SmallValue, name, value ), __kmp_msg_null );
778 KMP_INFORM( MinValueUsing, name, __kmp_dflt_blocktime );
779 }
else if ( __kmp_dflt_blocktime > KMP_MAX_BLOCKTIME ) {
780 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
781 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeValue, name, value ), __kmp_msg_null );
782 KMP_INFORM( MaxValueUsing, name, __kmp_dflt_blocktime );
784 __kmp_env_blocktime = TRUE;
787 __kmp_monitor_wakeups = KMP_WAKEUPS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
788 __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
789 K_DIAG( 1, (
"__kmp_env_blocktime == %d\n", __kmp_env_blocktime ) );
790 if ( __kmp_env_blocktime ) {
791 K_DIAG( 1, (
"__kmp_dflt_blocktime == %d\n", __kmp_dflt_blocktime ) );
796 __kmp_stg_print_blocktime( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
797 __kmp_stg_print_int( buffer, name, __kmp_dflt_blocktime );
805 __kmp_stg_parse_duplicate_lib_ok(
char const * name,
char const * value,
void * data ) {
808 __kmp_stg_parse_bool( name, value, & __kmp_duplicate_library_ok );
812 __kmp_stg_print_duplicate_lib_ok( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
813 __kmp_stg_print_bool( buffer, name, __kmp_duplicate_library_ok );
820 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
823 __kmp_stg_parse_inherit_fp_control(
char const * name,
char const * value,
void * data ) {
824 __kmp_stg_parse_bool( name, value, & __kmp_inherit_fp_control );
828 __kmp_stg_print_inherit_fp_control( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
830 __kmp_stg_print_bool( buffer, name, __kmp_inherit_fp_control );
841 __kmp_stg_parse_wait_policy(
char const * name,
char const * value,
void * data ) {
843 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
846 rc = __kmp_stg_check_rivals( name, value, wait->rivals );
852 if ( __kmp_str_match(
"ACTIVE", 1, value ) ) {
853 __kmp_library = library_turnaround;
854 }
else if ( __kmp_str_match(
"PASSIVE", 1, value ) ) {
855 __kmp_library = library_throughput;
857 KMP_WARNING( StgInvalidValue, name, value );
860 if ( __kmp_str_match(
"serial", 1, value ) ) {
861 __kmp_library = library_serial;
862 }
else if ( __kmp_str_match(
"throughput", 2, value ) ) {
863 __kmp_library = library_throughput;
864 }
else if ( __kmp_str_match(
"turnaround", 2, value ) ) {
865 __kmp_library = library_turnaround;
866 }
else if ( __kmp_str_match(
"dedicated", 1, value ) ) {
867 __kmp_library = library_turnaround;
868 }
else if ( __kmp_str_match(
"multiuser", 1, value ) ) {
869 __kmp_library = library_throughput;
871 KMP_WARNING( StgInvalidValue, name, value );
874 __kmp_aux_set_library( __kmp_library );
879 __kmp_stg_print_wait_policy( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
881 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
882 char const * value = NULL;
885 switch ( __kmp_library ) {
886 case library_turnaround : {
889 case library_throughput : {
894 switch ( __kmp_library ) {
895 case library_serial : {
898 case library_turnaround : {
899 value =
"turnaround";
901 case library_throughput : {
902 value =
"throughput";
906 if ( value != NULL ) {
907 __kmp_stg_print_str( buffer, name, value );
917 __kmp_stg_parse_monitor_stacksize(
char const * name,
char const * value,
void * data ) {
918 __kmp_stg_parse_size(
921 __kmp_sys_min_stksize,
924 & __kmp_monitor_stksize,
930 __kmp_stg_print_monitor_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
931 if( __kmp_env_format ) {
932 if ( __kmp_monitor_stksize > 0 )
933 KMP_STR_BUF_PRINT_NAME_EX(name);
935 KMP_STR_BUF_PRINT_NAME;
937 __kmp_str_buf_print( buffer,
" %s", name );
939 if ( __kmp_monitor_stksize > 0 ) {
940 __kmp_str_buf_print_size( buffer, __kmp_monitor_stksize );
942 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
944 if( __kmp_env_format && __kmp_monitor_stksize ) {
945 __kmp_str_buf_print( buffer,
"'\n");
955 __kmp_stg_parse_settings(
char const * name,
char const * value,
void * data ) {
956 __kmp_stg_parse_bool( name, value, & __kmp_settings );
960 __kmp_stg_print_settings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
961 __kmp_stg_print_bool( buffer, name, __kmp_settings );
969 __kmp_stg_parse_stackpad(
char const * name,
char const * value,
void * data ) {
980 __kmp_stg_print_stackpad( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
981 __kmp_stg_print_int( buffer, name, __kmp_stkpadding );
989 __kmp_stg_parse_stackoffset(
char const * name,
char const * value,
void * data ) {
990 __kmp_stg_parse_size(
1002 __kmp_stg_print_stackoffset( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1003 __kmp_stg_print_size( buffer, name, __kmp_stkoffset );
1011 __kmp_stg_parse_stacksize(
char const * name,
char const * value,
void * data ) {
1013 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
1016 rc = __kmp_stg_check_rivals( name, value, stacksize->rivals );
1020 __kmp_stg_parse_size(
1023 __kmp_sys_min_stksize,
1025 & __kmp_env_stksize,
1036 __kmp_stg_print_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1037 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
1038 if( __kmp_env_format ) {
1039 KMP_STR_BUF_PRINT_NAME_EX(name);
1040 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
1041 __kmp_str_buf_print( buffer,
"'\n" );
1043 __kmp_str_buf_print( buffer,
" %s=", name );
1044 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
1045 __kmp_str_buf_print( buffer,
"\n" );
1054 __kmp_stg_parse_version(
char const * name,
char const * value,
void * data ) {
1055 __kmp_stg_parse_bool( name, value, & __kmp_version );
1059 __kmp_stg_print_version( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1060 __kmp_stg_print_bool( buffer, name, __kmp_version );
1068 __kmp_stg_parse_warnings(
char const * name,
char const * value,
void * data ) {
1069 __kmp_stg_parse_bool( name, value, & __kmp_generate_warnings );
1070 if (__kmp_generate_warnings != kmp_warnings_off) {
1071 __kmp_generate_warnings = kmp_warnings_explicit;
1076 __kmp_stg_print_warnings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1077 __kmp_stg_print_bool( buffer, name, __kmp_generate_warnings );
1085 __kmp_stg_parse_nested(
char const * name,
char const * value,
void * data ) {
1086 __kmp_stg_parse_bool( name, value, & __kmp_dflt_nested );
1090 __kmp_stg_print_nested( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1091 __kmp_stg_print_bool( buffer, name, __kmp_dflt_nested );
1095 __kmp_parse_nested_num_threads(
const char *var,
const char *env, kmp_nested_nthreads_t *nth_array )
1097 const char *next = env;
1098 const char *scan = next;
1101 int prev_comma = FALSE;
1107 if ( *next ==
'\0' ) {
1111 if ( ( ( *next <
'0' ) || ( *next >
'9' ) ) && ( *next !=
',') ) {
1112 KMP_WARNING( NthSyntaxError, var, env );
1116 if ( *next ==
',' ) {
1118 if ( total == 0 || prev_comma ) {
1126 if ( *next >=
'0' && *next <=
'9' ) {
1128 SKIP_DIGITS( next );
1130 const char *tmp = next;
1132 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
1133 KMP_WARNING( NthSpacesNotAllowed, var, env );
1138 KMP_DEBUG_ASSERT( total > 0 );
1140 KMP_WARNING( NthSyntaxError, var, env );
1145 if ( ! nth_array->nth ) {
1147 nth_array->nth = (
int * )KMP_INTERNAL_MALLOC(
sizeof(
int ) * total * 2 );
1148 if ( nth_array->nth == NULL ) {
1149 KMP_FATAL( MemoryAllocFailed );
1151 nth_array->size = total * 2;
1153 if ( nth_array->size < total ) {
1156 nth_array->size *= 2;
1157 }
while ( nth_array->size < total );
1159 nth_array->nth = (
int *) KMP_INTERNAL_REALLOC(
1160 nth_array->nth,
sizeof(
int ) * nth_array->size );
1161 if ( nth_array->nth == NULL ) {
1162 KMP_FATAL( MemoryAllocFailed );
1166 nth_array->used = total;
1174 if ( *scan ==
'\0' ) {
1178 if ( *scan ==
',' ) {
1183 nth_array->nth[i++] = 0;
1185 }
else if ( prev_comma ) {
1187 nth_array->nth[i] = nth_array->nth[i - 1];
1196 if ( *scan >=
'0' && *scan <=
'9' ) {
1198 const char *buf = scan;
1199 char const * msg = NULL;
1201 SKIP_DIGITS( scan );
1204 num = __kmp_str_to_int( buf, *scan );
1205 if ( num < KMP_MIN_NTH ) {
1206 msg = KMP_I18N_STR( ValueTooSmall );
1208 }
else if ( num > __kmp_sys_max_nth ) {
1209 msg = KMP_I18N_STR( ValueTooLarge );
1210 num = __kmp_sys_max_nth;
1212 if ( msg != NULL ) {
1214 KMP_WARNING( ParseSizeIntWarn, var, env, msg );
1215 KMP_INFORM( Using_int_Value, var, num );
1217 nth_array->nth[i++] = num;
1223 __kmp_stg_parse_num_threads(
char const * name,
char const * value,
void * data ) {
1225 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
1227 __kmp_nested_nth.nth = (
int* )KMP_INTERNAL_MALLOC(
sizeof(
int ) );
1228 __kmp_nested_nth.size = __kmp_nested_nth.used = 1;
1229 __kmp_nested_nth.nth[0] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub = __kmp_xproc;
1231 __kmp_parse_nested_num_threads( name, value, & __kmp_nested_nth );
1232 if ( __kmp_nested_nth.nth ) {
1233 __kmp_dflt_team_nth = __kmp_nested_nth.nth[0];
1234 if ( __kmp_dflt_team_nth_ub < __kmp_dflt_team_nth ) {
1235 __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth;
1239 K_DIAG( 1, (
"__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth ) );
1243 __kmp_stg_print_num_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1244 if( __kmp_env_format ) {
1245 KMP_STR_BUF_PRINT_NAME;
1247 __kmp_str_buf_print( buffer,
" %s", name );
1249 if ( __kmp_nested_nth.used ) {
1251 __kmp_str_buf_init( &buf );
1252 for (
int i = 0; i < __kmp_nested_nth.used; i++) {
1253 __kmp_str_buf_print( &buf,
"%d", __kmp_nested_nth.nth[i] );
1254 if ( i < __kmp_nested_nth.used - 1 ) {
1255 __kmp_str_buf_print( &buf,
"," );
1258 __kmp_str_buf_print( buffer,
"='%s'\n", buf.str );
1259 __kmp_str_buf_free(&buf);
1261 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1270 __kmp_stg_parse_tasking(
char const * name,
char const * value,
void * data ) {
1271 __kmp_stg_parse_int( name, value, 0, (
int)tskm_max, (
int *)&__kmp_tasking_mode );
1275 __kmp_stg_print_tasking( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1276 __kmp_stg_print_int( buffer, name, __kmp_tasking_mode );
1280 __kmp_stg_parse_task_stealing(
char const * name,
char const * value,
void * data ) {
1281 __kmp_stg_parse_int( name, value, 0, 1, (
int *)&__kmp_task_stealing_constraint );
1285 __kmp_stg_print_task_stealing( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1286 __kmp_stg_print_int( buffer, name, __kmp_task_stealing_constraint );
1290 __kmp_stg_parse_max_active_levels(
char const * name,
char const * value,
void * data ) {
1291 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_dflt_max_active_levels );
1295 __kmp_stg_print_max_active_levels( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1296 __kmp_stg_print_int( buffer, name, __kmp_dflt_max_active_levels );
1299 #if KMP_NESTED_HOT_TEAMS
1305 __kmp_stg_parse_hot_teams_level(
char const * name,
char const * value,
void * data ) {
1306 if ( TCR_4(__kmp_init_parallel) ) {
1307 KMP_WARNING( EnvParallelWarn, name );
1310 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_max_level );
1314 __kmp_stg_print_hot_teams_level( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1315 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_max_level );
1319 __kmp_stg_parse_hot_teams_mode(
char const * name,
char const * value,
void * data ) {
1320 if ( TCR_4(__kmp_init_parallel) ) {
1321 KMP_WARNING( EnvParallelWarn, name );
1324 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_mode );
1328 __kmp_stg_print_hot_teams_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1329 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_mode );
1332 #endif // KMP_NESTED_HOT_TEAMS
1338 #if KMP_HANDLE_SIGNALS
1341 __kmp_stg_parse_handle_signals(
char const * name,
char const * value,
void * data ) {
1342 __kmp_stg_parse_bool( name, value, & __kmp_handle_signals );
1346 __kmp_stg_print_handle_signals( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1347 __kmp_stg_print_bool( buffer, name, __kmp_handle_signals );
1350 #endif // KMP_HANDLE_SIGNALS
1358 #define KMP_STG_X_DEBUG( x ) \
1359 static void __kmp_stg_parse_##x##_debug( char const * name, char const * value, void * data ) { \
1360 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_##x##_debug ); \
1362 static void __kmp_stg_print_##x##_debug( kmp_str_buf_t * buffer, char const * name, void * data ) { \
1363 __kmp_stg_print_int( buffer, name, kmp_##x##_debug ); \
1366 KMP_STG_X_DEBUG( a )
1367 KMP_STG_X_DEBUG( b )
1368 KMP_STG_X_DEBUG( c )
1369 KMP_STG_X_DEBUG( d )
1370 KMP_STG_X_DEBUG( e )
1371 KMP_STG_X_DEBUG( f )
1373 #undef KMP_STG_X_DEBUG
1376 __kmp_stg_parse_debug(
char const * name,
char const * value,
void * data ) {
1378 __kmp_stg_parse_int( name, value, 0, INT_MAX, & debug );
1379 if ( kmp_a_debug < debug ) {
1380 kmp_a_debug = debug;
1382 if ( kmp_b_debug < debug ) {
1383 kmp_b_debug = debug;
1385 if ( kmp_c_debug < debug ) {
1386 kmp_c_debug = debug;
1388 if ( kmp_d_debug < debug ) {
1389 kmp_d_debug = debug;
1391 if ( kmp_e_debug < debug ) {
1392 kmp_e_debug = debug;
1394 if ( kmp_f_debug < debug ) {
1395 kmp_f_debug = debug;
1400 __kmp_stg_parse_debug_buf(
char const * name,
char const * value,
void * data ) {
1401 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf );
1404 if ( __kmp_debug_buf ) {
1406 int elements = __kmp_debug_buf_lines * __kmp_debug_buf_chars;
1409 __kmp_debug_buffer = (
char *) __kmp_page_allocate( elements *
sizeof(
char ) );
1410 for ( i = 0; i < elements; i += __kmp_debug_buf_chars )
1411 __kmp_debug_buffer[i] =
'\0';
1413 __kmp_debug_count = 0;
1415 K_DIAG( 1, (
"__kmp_debug_buf = %d\n", __kmp_debug_buf ) );
1419 __kmp_stg_print_debug_buf( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1420 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf );
1424 __kmp_stg_parse_debug_buf_atomic(
char const * name,
char const * value,
void * data ) {
1425 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf_atomic );
1429 __kmp_stg_print_debug_buf_atomic( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1430 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf_atomic );
1434 __kmp_stg_parse_debug_buf_chars(
char const * name,
char const * value,
void * data ) {
1435 __kmp_stg_parse_int(
1438 KMP_DEBUG_BUF_CHARS_MIN,
1440 & __kmp_debug_buf_chars
1445 __kmp_stg_print_debug_buf_chars( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1446 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_chars );
1450 __kmp_stg_parse_debug_buf_lines(
char const * name,
char const * value,
void * data ) {
1451 __kmp_stg_parse_int(
1454 KMP_DEBUG_BUF_LINES_MIN,
1456 & __kmp_debug_buf_lines
1461 __kmp_stg_print_debug_buf_lines( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1462 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_lines );
1466 __kmp_stg_parse_diag(
char const * name,
char const * value,
void * data ) {
1467 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_diag );
1471 __kmp_stg_print_diag( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1472 __kmp_stg_print_int( buffer, name, kmp_diag );
1482 __kmp_stg_parse_align_alloc(
char const * name,
char const * value,
void * data ) {
1483 __kmp_stg_parse_size(
1489 & __kmp_align_alloc,
1495 __kmp_stg_print_align_alloc( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1496 __kmp_stg_print_size( buffer, name, __kmp_align_alloc );
1507 __kmp_stg_parse_barrier_branch_bit(
char const * name,
char const * value,
void * data ) {
1511 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1512 var = __kmp_barrier_branch_bit_env_name[ i ];
1513 if ( ( strcmp( var, name) == 0 ) && ( value != 0 ) ) {
1516 comma = (
char *) strchr( value,
',' );
1517 __kmp_barrier_gather_branch_bits[ i ] = ( kmp_uint32 ) __kmp_str_to_int( value,
',' );
1519 if ( comma == NULL ) {
1520 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1522 __kmp_barrier_release_branch_bits[ i ] = (kmp_uint32) __kmp_str_to_int( comma + 1, 0 );
1524 if ( __kmp_barrier_release_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1525 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1526 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1529 if ( __kmp_barrier_gather_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1530 KMP_WARNING( BarrGatherValueInvalid, name, value );
1531 KMP_INFORM( Using_uint_Value, name, __kmp_barrier_gather_bb_dflt );
1532 __kmp_barrier_gather_branch_bits[ i ] = __kmp_barrier_gather_bb_dflt;
1535 K_DIAG(1, (
"%s == %d,%d\n", __kmp_barrier_branch_bit_env_name[ i ], \
1536 __kmp_barrier_gather_branch_bits [ i ], \
1537 __kmp_barrier_release_branch_bits [ i ]))
1542 __kmp_stg_print_barrier_branch_bit( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1544 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1545 var = __kmp_barrier_branch_bit_env_name[ i ];
1546 if ( strcmp( var, name) == 0 ) {
1547 if( __kmp_env_format ) {
1548 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_branch_bit_env_name[ i ]);
1550 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_branch_bit_env_name[ i ] );
1552 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_barrier_gather_branch_bits [ i ], __kmp_barrier_release_branch_bits [ i ]);
1566 __kmp_stg_parse_barrier_pattern(
char const * name,
char const * value,
void * data ) {
1570 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1571 var = __kmp_barrier_pattern_env_name[ i ];
1573 if ( ( strcmp ( var, name ) == 0 ) && ( value != 0 ) ) {
1575 char *comma = (
char *) strchr( value,
',' );
1578 for ( j = bp_linear_bar; j<bp_last_bar; j++ ) {
1579 if (__kmp_match_with_sentinel( __kmp_barrier_pattern_name[j], value, 1,
',' )) {
1580 __kmp_barrier_gather_pattern[ i ] = (kmp_bar_pat_e) j;
1584 if ( j == bp_last_bar ) {
1585 KMP_WARNING( BarrGatherValueInvalid, name, value );
1586 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1590 if ( comma != NULL ) {
1591 for ( j = bp_linear_bar; j < bp_last_bar; j++ ) {
1592 if ( __kmp_str_match( __kmp_barrier_pattern_name[j], 1, comma + 1 ) ) {
1593 __kmp_barrier_release_pattern[ i ] = (kmp_bar_pat_e) j;
1597 if (j == bp_last_bar) {
1598 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1599 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1607 __kmp_stg_print_barrier_pattern( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1609 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1610 var = __kmp_barrier_pattern_env_name[ i ];
1611 if ( strcmp ( var, name ) == 0 ) {
1612 int j = __kmp_barrier_gather_pattern [ i ];
1613 int k = __kmp_barrier_release_pattern [ i ];
1614 if( __kmp_env_format ) {
1615 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_pattern_env_name[ i ]);
1617 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_pattern_env_name[ i ] );
1619 __kmp_str_buf_print( buffer,
"%s,%s'\n", __kmp_barrier_pattern_name [ j ], __kmp_barrier_pattern_name [ k ]);
1629 __kmp_stg_parse_abort_delay(
char const * name,
char const * value,
void * data ) {
1631 int delay = __kmp_abort_delay / 1000;
1632 __kmp_stg_parse_int( name, value, 0, INT_MAX / 1000, & delay );
1633 __kmp_abort_delay = delay * 1000;
1637 __kmp_stg_print_abort_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1638 __kmp_stg_print_int( buffer, name, __kmp_abort_delay );
1646 __kmp_stg_parse_cpuinfo_file(
char const * name,
char const * value,
void * data ) {
1647 #if KMP_AFFINITY_SUPPORTED
1648 __kmp_stg_parse_str( name, value, & __kmp_cpuinfo_file );
1649 K_DIAG( 1, (
"__kmp_cpuinfo_file == %s\n", __kmp_cpuinfo_file ) );
1654 __kmp_stg_print_cpuinfo_file( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1655 #if KMP_AFFINITY_SUPPORTED
1656 if( __kmp_env_format ) {
1657 KMP_STR_BUF_PRINT_NAME;
1659 __kmp_str_buf_print( buffer,
" %s", name );
1661 if ( __kmp_cpuinfo_file ) {
1662 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_cpuinfo_file );
1664 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1674 __kmp_stg_parse_force_reduction(
char const * name,
char const * value,
void * data )
1676 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1679 rc = __kmp_stg_check_rivals( name, value, reduction->rivals );
1683 if ( reduction->force ) {
1685 if( __kmp_str_match(
"critical", 0, value ) )
1686 __kmp_force_reduction_method = critical_reduce_block;
1687 else if( __kmp_str_match(
"atomic", 0, value ) )
1688 __kmp_force_reduction_method = atomic_reduce_block;
1689 else if( __kmp_str_match(
"tree", 0, value ) )
1690 __kmp_force_reduction_method = tree_reduce_block;
1692 KMP_FATAL( UnknownForceReduction, name, value );
1696 __kmp_stg_parse_bool( name, value, & __kmp_determ_red );
1697 if( __kmp_determ_red ) {
1698 __kmp_force_reduction_method = tree_reduce_block;
1700 __kmp_force_reduction_method = reduction_method_not_defined;
1703 K_DIAG( 1, (
"__kmp_force_reduction_method == %d\n", __kmp_force_reduction_method ) );
1707 __kmp_stg_print_force_reduction( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1709 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1710 char const * value = NULL;
1711 if ( reduction->force ) {
1712 if( __kmp_force_reduction_method == critical_reduce_block) {
1713 __kmp_stg_print_str( buffer, name,
"critical");
1714 }
else if ( __kmp_force_reduction_method == atomic_reduce_block ) {
1715 __kmp_stg_print_str( buffer, name,
"atomic");
1716 }
else if ( __kmp_force_reduction_method == tree_reduce_block ) {
1717 __kmp_stg_print_str( buffer, name,
"tree");
1719 if( __kmp_env_format ) {
1720 KMP_STR_BUF_PRINT_NAME;
1722 __kmp_str_buf_print( buffer,
" %s", name );
1724 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1727 __kmp_stg_print_bool( buffer, name, __kmp_determ_red );
1738 __kmp_stg_parse_storage_map(
char const * name,
char const * value,
void * data ) {
1739 if ( __kmp_str_match(
"verbose", 1, value ) ) {
1740 __kmp_storage_map = TRUE;
1741 __kmp_storage_map_verbose = TRUE;
1742 __kmp_storage_map_verbose_specified = TRUE;
1745 __kmp_storage_map_verbose = FALSE;
1746 __kmp_stg_parse_bool( name, value, & __kmp_storage_map );
1751 __kmp_stg_print_storage_map( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1752 if ( __kmp_storage_map_verbose || __kmp_storage_map_verbose_specified ) {
1753 __kmp_stg_print_str( buffer, name,
"verbose" );
1755 __kmp_stg_print_bool( buffer, name, __kmp_storage_map );
1764 __kmp_stg_parse_all_threadprivate(
char const * name,
char const * value,
void * data ) {
1765 __kmp_stg_parse_int( name, value, __kmp_allThreadsSpecified ? __kmp_max_nth : 1, __kmp_max_nth,
1766 & __kmp_tp_capacity );
1770 __kmp_stg_print_all_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1771 __kmp_stg_print_int( buffer, name, __kmp_tp_capacity );
1780 __kmp_stg_parse_foreign_threads_threadprivate(
char const * name,
char const * value,
void * data ) {
1781 __kmp_stg_parse_bool( name, value, & __kmp_foreign_tp );
1785 __kmp_stg_print_foreign_threads_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1786 __kmp_stg_print_bool( buffer, name, __kmp_foreign_tp );
1794 #if KMP_AFFINITY_SUPPORTED
1799 __kmp_parse_affinity_proc_id_list(
const char *var,
const char *env,
1800 const char **nextEnv,
char **proclist )
1802 const char *scan = env;
1803 const char *next = scan;
1809 int start, end, stride;
1813 if (*next ==
'\0') {
1826 if ((*next <
'0') || (*next >
'9')) {
1827 KMP_WARNING( AffSyntaxError, var );
1831 num = __kmp_str_to_int(scan, *next);
1832 KMP_ASSERT(num >= 0);
1856 if ((*next <
'0') || (*next >
'9')) {
1857 KMP_WARNING( AffSyntaxError, var );
1862 num = __kmp_str_to_int(scan, *next);
1863 KMP_ASSERT(num >= 0);
1878 if ((*next <
'0') || (*next >
'9')) {
1880 KMP_WARNING( AffSyntaxError, var );
1890 start = __kmp_str_to_int(scan, *next);
1891 KMP_ASSERT(start >= 0);
1916 if ((*next <
'0') || (*next >
'9')) {
1917 KMP_WARNING( AffSyntaxError, var );
1921 end = __kmp_str_to_int(scan, *next);
1922 KMP_ASSERT(end >= 0);
1943 if ((*next <
'0') || (*next >
'9')) {
1944 KMP_WARNING( AffSyntaxError, var );
1948 stride = __kmp_str_to_int(scan, *next);
1949 KMP_ASSERT(stride >= 0);
1957 KMP_WARNING( AffZeroStride, var );
1962 KMP_WARNING( AffStartGreaterEnd, var, start, end );
1968 KMP_WARNING( AffStrideLessZero, var, start, end );
1972 if ((end - start) / stride > 65536 ) {
1973 KMP_WARNING( AffRangeTooBig, var, end, start, stride );
1992 int len = next - env;
1993 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
1994 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
1995 retlist[len] =
'\0';
1996 *proclist = retlist;
2006 static kmp_setting_t *__kmp_affinity_notype = NULL;
2009 __kmp_parse_affinity_env(
char const * name,
char const * value,
2010 enum affinity_type * out_type,
2011 char ** out_proclist,
2015 enum affinity_gran * out_gran,
2016 int * out_gran_levels,
2022 char * buffer = NULL;
2032 int max_proclist = 0;
2039 KMP_ASSERT( value != NULL );
2041 if ( TCR_4(__kmp_init_middle) ) {
2042 KMP_WARNING( EnvMiddleWarn, name );
2043 __kmp_env_toPrint( name, 0 );
2046 __kmp_env_toPrint( name, 1 );
2048 buffer = __kmp_str_format(
"%s", value );
2060 #define EMIT_WARN(skip,errlist) \
2064 SKIP_TO(next, ','); \
2068 KMP_WARNING errlist; \
2071 if (ch == ',') next++; \
2076 #define _set_param(_guard,_var,_val) \
2078 if ( _guard == 0 ) { \
2081 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \
2086 #define set_type(val) _set_param( type, *out_type, val )
2087 #define set_verbose(val) _set_param( verbose, *out_verbose, val )
2088 #define set_warnings(val) _set_param( warnings, *out_warn, val )
2089 #define set_respect(val) _set_param( respect, *out_respect, val )
2090 #define set_dups(val) _set_param( dups, *out_dups, val )
2091 #define set_proclist(val) _set_param( proclist, *out_proclist, val )
2093 #define set_gran(val,levels) \
2095 if ( gran == 0 ) { \
2097 *out_gran_levels = levels; \
2099 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \
2105 KMP_DEBUG_ASSERT( ( __kmp_nested_proc_bind.bind_types != NULL )
2106 && ( __kmp_nested_proc_bind.used > 0 ) );
2109 while ( *buf !=
'\0' ) {
2112 if (__kmp_match_str(
"none", buf, (
const char **)&next)) {
2113 set_type( affinity_none );
2115 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2118 }
else if (__kmp_match_str(
"scatter", buf, (
const char **)&next)) {
2119 set_type( affinity_scatter );
2121 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2124 }
else if (__kmp_match_str(
"compact", buf, (
const char **)&next)) {
2125 set_type( affinity_compact );
2127 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2130 }
else if (__kmp_match_str(
"logical", buf, (
const char **)&next)) {
2131 set_type( affinity_logical );
2133 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2136 }
else if (__kmp_match_str(
"physical", buf, (
const char **)&next)) {
2137 set_type( affinity_physical );
2139 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2142 }
else if (__kmp_match_str(
"explicit", buf, (
const char **)&next)) {
2143 set_type( affinity_explicit );
2145 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2148 }
else if (__kmp_match_str(
"balanced", buf, (
const char **)&next)) {
2149 set_type( affinity_balanced );
2151 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2154 }
else if (__kmp_match_str(
"disabled", buf, (
const char **)&next)) {
2155 set_type( affinity_disabled );
2157 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2160 }
else if (__kmp_match_str(
"verbose", buf, (
const char **)&next)) {
2161 set_verbose( TRUE );
2163 }
else if (__kmp_match_str(
"noverbose", buf, (
const char **)&next)) {
2164 set_verbose( FALSE );
2166 }
else if (__kmp_match_str(
"warnings", buf, (
const char **)&next)) {
2167 set_warnings( TRUE );
2169 }
else if (__kmp_match_str(
"nowarnings", buf, (
const char **)&next)) {
2170 set_warnings( FALSE );
2172 }
else if (__kmp_match_str(
"respect", buf, (
const char **)&next)) {
2173 set_respect( TRUE );
2175 }
else if (__kmp_match_str(
"norespect", buf, (
const char **)&next)) {
2176 set_respect( FALSE );
2178 }
else if (__kmp_match_str(
"duplicates", buf, (
const char **)&next)
2179 || __kmp_match_str(
"dups", buf, (
const char **)&next)) {
2182 }
else if (__kmp_match_str(
"noduplicates", buf, (
const char **)&next)
2183 || __kmp_match_str(
"nodups", buf, (
const char **)&next)) {
2186 }
else if (__kmp_match_str(
"granularity", buf, (
const char **)&next)
2187 || __kmp_match_str(
"gran", buf, (
const char **)&next)) {
2190 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2197 if (__kmp_match_str(
"fine", buf, (
const char **)&next)) {
2198 set_gran( affinity_gran_fine, -1 );
2200 }
else if (__kmp_match_str(
"thread", buf, (
const char **)&next)) {
2201 set_gran( affinity_gran_thread, -1 );
2203 }
else if (__kmp_match_str(
"core", buf, (
const char **)&next)) {
2204 set_gran( affinity_gran_core, -1 );
2206 }
else if (__kmp_match_str(
"package", buf, (
const char **)&next)) {
2207 set_gran( affinity_gran_package, -1 );
2209 }
else if (__kmp_match_str(
"node", buf, (
const char **)&next)) {
2210 set_gran( affinity_gran_node, -1 );
2212 # if KMP_GROUP_AFFINITY
2213 }
else if (__kmp_match_str(
"group", buf, (
const char **)&next)) {
2214 set_gran( affinity_gran_group, -1 );
2217 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2221 n = __kmp_str_to_int( buf, *next );
2224 set_gran( affinity_gran_default, n );
2226 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2229 }
else if (__kmp_match_str(
"proclist", buf, (
const char **)&next)) {
2230 char *temp_proclist;
2234 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2240 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2245 if (! __kmp_parse_affinity_proc_id_list(name, buf,
2246 (
const char **)&next, &temp_proclist)) {
2251 if (*next ==
']') next++;
2253 if (*next ==
',') next++;
2258 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2262 set_proclist( temp_proclist );
2263 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2268 n = __kmp_str_to_int( buf, *next );
2272 number[ count ] = n;
2274 KMP_WARNING( AffManyParams, name, start );
2278 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2287 else if (*next !=
'\0') {
2288 const char *temp = next;
2289 EMIT_WARN( TRUE, ( ParseExtraCharsWarn, name, temp ) );
2301 #undef set_granularity
2303 KMP_INTERNAL_FREE( buffer );
2307 KMP_WARNING( AffProcListNoType, name );
2308 __kmp_affinity_type = affinity_explicit;
2310 else if ( __kmp_affinity_type != affinity_explicit ) {
2311 KMP_WARNING( AffProcListNotExplicit, name );
2312 KMP_ASSERT( *out_proclist != NULL );
2313 KMP_INTERNAL_FREE( *out_proclist );
2314 *out_proclist = NULL;
2317 switch ( *out_type ) {
2318 case affinity_logical:
2319 case affinity_physical: {
2321 *out_offset = number[ 0 ];
2324 KMP_WARNING( AffManyParamsForLogic, name, number[ 1 ] );
2327 case affinity_balanced: {
2329 *out_compact = number[ 0 ];
2332 *out_offset = number[ 1 ];
2335 if ( __kmp_affinity_gran == affinity_gran_default ) {
2336 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
2337 if( __kmp_mic_type != non_mic ) {
2338 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2339 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"fine" );
2341 __kmp_affinity_gran = affinity_gran_fine;
2345 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2346 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"core" );
2348 __kmp_affinity_gran = affinity_gran_core;
2352 case affinity_scatter:
2353 case affinity_compact: {
2355 *out_compact = number[ 0 ];
2358 *out_offset = number[ 1 ];
2361 case affinity_explicit: {
2362 if ( *out_proclist == NULL ) {
2363 KMP_WARNING( AffNoProcList, name );
2364 __kmp_affinity_type = affinity_none;
2367 KMP_WARNING( AffNoParam, name,
"explicit" );
2370 case affinity_none: {
2372 KMP_WARNING( AffNoParam, name,
"none" );
2375 case affinity_disabled: {
2377 KMP_WARNING( AffNoParam, name,
"disabled" );
2380 case affinity_default: {
2382 KMP_WARNING( AffNoParam, name,
"default" );
2392 __kmp_stg_parse_affinity(
char const * name,
char const * value,
void * data )
2394 kmp_setting_t **rivals = (kmp_setting_t **) data;
2397 rc = __kmp_stg_check_rivals( name, value, rivals );
2402 __kmp_parse_affinity_env( name, value, & __kmp_affinity_type,
2403 & __kmp_affinity_proclist, & __kmp_affinity_verbose,
2404 & __kmp_affinity_warnings, & __kmp_affinity_respect_mask,
2405 & __kmp_affinity_gran, & __kmp_affinity_gran_levels,
2406 & __kmp_affinity_dups, & __kmp_affinity_compact,
2407 & __kmp_affinity_offset );
2412 __kmp_stg_print_affinity( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
2413 if( __kmp_env_format ) {
2414 KMP_STR_BUF_PRINT_NAME_EX(name);
2416 __kmp_str_buf_print( buffer,
" %s='", name );
2418 if ( __kmp_affinity_verbose ) {
2419 __kmp_str_buf_print( buffer,
"%s,",
"verbose");
2421 __kmp_str_buf_print( buffer,
"%s,",
"noverbose");
2423 if ( __kmp_affinity_warnings ) {
2424 __kmp_str_buf_print( buffer,
"%s,",
"warnings");
2426 __kmp_str_buf_print( buffer,
"%s,",
"nowarnings");
2428 if ( KMP_AFFINITY_CAPABLE() ) {
2429 if ( __kmp_affinity_respect_mask ) {
2430 __kmp_str_buf_print( buffer,
"%s,",
"respect");
2432 __kmp_str_buf_print( buffer,
"%s,",
"norespect");
2434 switch ( __kmp_affinity_gran ) {
2435 case affinity_gran_default:
2436 __kmp_str_buf_print( buffer,
"%s",
"granularity=default,");
2438 case affinity_gran_fine:
2439 __kmp_str_buf_print( buffer,
"%s",
"granularity=fine,");
2441 case affinity_gran_thread:
2442 __kmp_str_buf_print( buffer,
"%s",
"granularity=thread,");
2444 case affinity_gran_core:
2445 __kmp_str_buf_print( buffer,
"%s",
"granularity=core,");
2447 case affinity_gran_package:
2448 __kmp_str_buf_print( buffer,
"%s",
"granularity=package,");
2450 case affinity_gran_node:
2451 __kmp_str_buf_print( buffer,
"%s",
"granularity=node,");
2453 # if KMP_GROUP_AFFINITY
2454 case affinity_gran_group:
2455 __kmp_str_buf_print( buffer,
"%s",
"granularity=group,");
2459 if ( __kmp_affinity_dups ) {
2460 __kmp_str_buf_print( buffer,
"%s,",
"duplicates");
2462 __kmp_str_buf_print( buffer,
"%s,",
"noduplicates");
2465 if ( ! KMP_AFFINITY_CAPABLE() ) {
2466 __kmp_str_buf_print( buffer,
"%s",
"disabled" );
2468 else switch ( __kmp_affinity_type ){
2470 __kmp_str_buf_print( buffer,
"%s",
"none");
2472 case affinity_physical:
2473 __kmp_str_buf_print( buffer,
"%s,%d",
"physical",
2474 __kmp_affinity_offset );
2476 case affinity_logical:
2477 __kmp_str_buf_print( buffer,
"%s,%d",
"logical",
2478 __kmp_affinity_offset );
2480 case affinity_compact:
2481 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"compact",
2482 __kmp_affinity_compact, __kmp_affinity_offset );
2484 case affinity_scatter:
2485 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"scatter",
2486 __kmp_affinity_compact, __kmp_affinity_offset );
2488 case affinity_explicit:
2489 __kmp_str_buf_print( buffer,
"%s=[%s],%s",
"proclist",
2490 __kmp_affinity_proclist,
"explicit" );
2492 case affinity_balanced:
2493 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"balanced",
2494 __kmp_affinity_compact, __kmp_affinity_offset );
2496 case affinity_disabled:
2497 __kmp_str_buf_print( buffer,
"%s",
"disabled");
2499 case affinity_default:
2500 __kmp_str_buf_print( buffer,
"%s",
"default");
2503 __kmp_str_buf_print( buffer,
"%s",
"<unknown>");
2506 __kmp_str_buf_print( buffer,
"'\n" );
2509 # ifdef KMP_GOMP_COMPAT
2512 __kmp_stg_parse_gomp_cpu_affinity(
char const * name,
char const * value,
void * data )
2514 const char * next = NULL;
2515 char * temp_proclist;
2516 kmp_setting_t **rivals = (kmp_setting_t **) data;
2519 rc = __kmp_stg_check_rivals( name, value, rivals );
2524 if ( TCR_4(__kmp_init_middle) ) {
2525 KMP_WARNING( EnvMiddleWarn, name );
2526 __kmp_env_toPrint( name, 0 );
2530 __kmp_env_toPrint( name, 1 );
2532 if ( __kmp_parse_affinity_proc_id_list( name, value, &next,
2535 if (*next ==
'\0') {
2539 __kmp_affinity_proclist = temp_proclist;
2540 __kmp_affinity_type = affinity_explicit;
2541 __kmp_affinity_gran = affinity_gran_fine;
2543 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2547 KMP_WARNING( AffSyntaxError, name );
2548 if (temp_proclist != NULL) {
2549 KMP_INTERNAL_FREE((
void *)temp_proclist);
2557 __kmp_affinity_type = affinity_none;
2559 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2592 __kmp_parse_subplace_list(
const char *var,
const char **scan )
2597 int start, count, stride;
2603 if ((**scan <
'0') || (**scan >
'9')) {
2604 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2609 start = __kmp_str_to_int(*scan, *next);
2610 KMP_ASSERT(start >= 0);
2617 if (**scan ==
'}') {
2620 if (**scan ==
',') {
2624 if (**scan !=
':') {
2625 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2634 if ((**scan <
'0') || (**scan >
'9')) {
2635 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2640 count = __kmp_str_to_int(*scan, *next);
2641 KMP_ASSERT(count >= 0);
2648 if (**scan ==
'}') {
2651 if (**scan ==
',') {
2655 if (**scan !=
':') {
2656 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2667 if (**scan ==
'+') {
2671 if (**scan ==
'-') {
2679 if ((**scan <
'0') || (**scan >
'9')) {
2680 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2685 stride = __kmp_str_to_int(*scan, *next);
2686 KMP_ASSERT(stride >= 0);
2694 if (**scan ==
'}') {
2697 if (**scan ==
',') {
2702 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2709 __kmp_parse_place(
const char *var,
const char ** scan )
2717 if (**scan ==
'{') {
2719 if (! __kmp_parse_subplace_list(var, scan)) {
2722 if (**scan !=
'}') {
2723 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2728 else if (**scan ==
'!') {
2730 return __kmp_parse_place(var, scan);
2732 else if ((**scan >=
'0') && (**scan <=
'9')) {
2735 int proc = __kmp_str_to_int(*scan, *next);
2736 KMP_ASSERT(proc >= 0);
2740 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2747 __kmp_parse_place_list(
const char *var,
const char *env,
char **place_list )
2749 const char *scan = env;
2750 const char *next = scan;
2753 int start, count, stride;
2755 if (! __kmp_parse_place(var, &scan)) {
2763 if (*scan ==
'\0') {
2771 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2780 if ((*scan <
'0') || (*scan >
'9')) {
2781 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2786 count = __kmp_str_to_int(scan, *next);
2787 KMP_ASSERT(count >= 0);
2794 if (*scan ==
'\0') {
2802 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2825 if ((*scan <
'0') || (*scan >
'9')) {
2826 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2831 stride = __kmp_str_to_int(scan, *next);
2832 KMP_ASSERT(stride >= 0);
2840 if (*scan ==
'\0') {
2848 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2853 int len = scan - env;
2854 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
2855 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
2856 retlist[len] =
'\0';
2857 *place_list = retlist;
2863 __kmp_stg_parse_places(
char const * name,
char const * value,
void * data )
2866 const char *scan = value;
2867 const char *next = scan;
2868 const char *kind =
"\"threads\"";
2869 kmp_setting_t **rivals = (kmp_setting_t **) data;
2872 rc = __kmp_stg_check_rivals( name, value, rivals );
2881 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2882 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2887 if ( __kmp_match_str(
"threads", scan, &next ) ) {
2889 __kmp_affinity_type = affinity_compact;
2890 __kmp_affinity_gran = affinity_gran_thread;
2891 __kmp_affinity_dups = FALSE;
2892 kind =
"\"threads\"";
2894 else if ( __kmp_match_str(
"cores", scan, &next ) ) {
2896 __kmp_affinity_type = affinity_compact;
2897 __kmp_affinity_gran = affinity_gran_core;
2898 __kmp_affinity_dups = FALSE;
2901 else if ( __kmp_match_str(
"sockets", scan, &next ) ) {
2903 __kmp_affinity_type = affinity_compact;
2904 __kmp_affinity_gran = affinity_gran_package;
2905 __kmp_affinity_dups = FALSE;
2906 kind =
"\"sockets\"";
2909 if ( __kmp_affinity_proclist != NULL ) {
2910 KMP_INTERNAL_FREE( (
void *)__kmp_affinity_proclist );
2911 __kmp_affinity_proclist = NULL;
2913 if ( __kmp_parse_place_list( name, value, &__kmp_affinity_proclist ) ) {
2914 __kmp_affinity_type = affinity_explicit;
2915 __kmp_affinity_gran = affinity_gran_fine;
2916 __kmp_affinity_dups = FALSE;
2917 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2918 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2924 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2925 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2929 if ( *scan ==
'\0' ) {
2936 if ( *scan !=
'(' ) {
2937 KMP_WARNING( SyntaxErrorUsing, name, kind );
2945 count = __kmp_str_to_int(scan, *next);
2946 KMP_ASSERT(count >= 0);
2950 if ( *scan !=
')' ) {
2951 KMP_WARNING( SyntaxErrorUsing, name, kind );
2957 if ( *scan !=
'\0' ) {
2958 KMP_WARNING( ParseExtraCharsWarn, name, scan );
2960 __kmp_affinity_num_places = count;
2964 __kmp_stg_print_places( kmp_str_buf_t * buffer,
char const * name,
2967 if( __kmp_env_format ) {
2968 KMP_STR_BUF_PRINT_NAME;
2970 __kmp_str_buf_print( buffer,
" %s", name );
2972 if ( ( __kmp_nested_proc_bind.used == 0 )
2973 || ( __kmp_nested_proc_bind.bind_types == NULL )
2974 || ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_false ) ) {
2975 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2977 else if ( __kmp_affinity_type == affinity_explicit ) {
2978 if ( __kmp_affinity_proclist != NULL ) {
2979 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_affinity_proclist );
2982 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2985 else if ( __kmp_affinity_type == affinity_compact ) {
2987 if ( __kmp_affinity_num_masks > 0 ) {
2988 num = __kmp_affinity_num_masks;
2990 else if ( __kmp_affinity_num_places > 0 ) {
2991 num = __kmp_affinity_num_places;
2996 if ( __kmp_affinity_gran == affinity_gran_thread ) {
2998 __kmp_str_buf_print( buffer,
"='threads(%d)'\n", num );
3001 __kmp_str_buf_print( buffer,
"='threads'\n" );
3004 else if ( __kmp_affinity_gran == affinity_gran_core ) {
3006 __kmp_str_buf_print( buffer,
"='cores(%d)' \n", num );
3009 __kmp_str_buf_print( buffer,
"='cores'\n" );
3012 else if ( __kmp_affinity_gran == affinity_gran_package ) {
3014 __kmp_str_buf_print( buffer,
"='sockets(%d)'\n", num );
3017 __kmp_str_buf_print( buffer,
"='sockets'\n" );
3021 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
3025 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
3031 # if (! OMP_40_ENABLED)
3034 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
3037 kmp_setting_t **rivals = (kmp_setting_t **) data;
3040 rc = __kmp_stg_check_rivals( name, value, rivals );
3048 __kmp_stg_parse_bool( name, value, & enabled );
3054 __kmp_affinity_type = affinity_scatter;
3055 if( __kmp_mic_type != non_mic ) {
3056 __kmp_affinity_gran = affinity_gran_fine;
3058 __kmp_affinity_gran = affinity_gran_core;
3062 __kmp_affinity_type = affinity_none;
3070 __kmp_stg_parse_topology_method(
char const * name,
char const * value,
3072 if ( __kmp_str_match(
"all", 1, value ) ) {
3073 __kmp_affinity_top_method = affinity_top_method_all;
3075 # if KMP_ARCH_X86 || KMP_ARCH_X86_64
3076 else if ( __kmp_str_match(
"x2apic id", 9, value )
3077 || __kmp_str_match(
"x2apic_id", 9, value )
3078 || __kmp_str_match(
"x2apic-id", 9, value )
3079 || __kmp_str_match(
"x2apicid", 8, value )
3080 || __kmp_str_match(
"cpuid leaf 11", 13, value )
3081 || __kmp_str_match(
"cpuid_leaf_11", 13, value )
3082 || __kmp_str_match(
"cpuid-leaf-11", 13, value )
3083 || __kmp_str_match(
"cpuid leaf11", 12, value )
3084 || __kmp_str_match(
"cpuid_leaf11", 12, value )
3085 || __kmp_str_match(
"cpuid-leaf11", 12, value )
3086 || __kmp_str_match(
"cpuidleaf 11", 12, value )
3087 || __kmp_str_match(
"cpuidleaf_11", 12, value )
3088 || __kmp_str_match(
"cpuidleaf-11", 12, value )
3089 || __kmp_str_match(
"cpuidleaf11", 11, value )
3090 || __kmp_str_match(
"cpuid 11", 8, value )
3091 || __kmp_str_match(
"cpuid_11", 8, value )
3092 || __kmp_str_match(
"cpuid-11", 8, value )
3093 || __kmp_str_match(
"cpuid11", 7, value )
3094 || __kmp_str_match(
"leaf 11", 7, value )
3095 || __kmp_str_match(
"leaf_11", 7, value )
3096 || __kmp_str_match(
"leaf-11", 7, value )
3097 || __kmp_str_match(
"leaf11", 6, value ) ) {
3098 __kmp_affinity_top_method = affinity_top_method_x2apicid;
3100 else if ( __kmp_str_match(
"apic id", 7, value )
3101 || __kmp_str_match(
"apic_id", 7, value )
3102 || __kmp_str_match(
"apic-id", 7, value )
3103 || __kmp_str_match(
"apicid", 6, value )
3104 || __kmp_str_match(
"cpuid leaf 4", 12, value )
3105 || __kmp_str_match(
"cpuid_leaf_4", 12, value )
3106 || __kmp_str_match(
"cpuid-leaf-4", 12, value )
3107 || __kmp_str_match(
"cpuid leaf4", 11, value )
3108 || __kmp_str_match(
"cpuid_leaf4", 11, value )
3109 || __kmp_str_match(
"cpuid-leaf4", 11, value )
3110 || __kmp_str_match(
"cpuidleaf 4", 11, value )
3111 || __kmp_str_match(
"cpuidleaf_4", 11, value )
3112 || __kmp_str_match(
"cpuidleaf-4", 11, value )
3113 || __kmp_str_match(
"cpuidleaf4", 10, value )
3114 || __kmp_str_match(
"cpuid 4", 7, value )
3115 || __kmp_str_match(
"cpuid_4", 7, value )
3116 || __kmp_str_match(
"cpuid-4", 7, value )
3117 || __kmp_str_match(
"cpuid4", 6, value )
3118 || __kmp_str_match(
"leaf 4", 6, value )
3119 || __kmp_str_match(
"leaf_4", 6, value )
3120 || __kmp_str_match(
"leaf-4", 6, value )
3121 || __kmp_str_match(
"leaf4", 5, value ) ) {
3122 __kmp_affinity_top_method = affinity_top_method_apicid;
3125 else if ( __kmp_str_match(
"/proc/cpuinfo", 2, value )
3126 || __kmp_str_match(
"cpuinfo", 5, value )) {
3127 __kmp_affinity_top_method = affinity_top_method_cpuinfo;
3129 # if KMP_GROUP_AFFINITY
3130 else if ( __kmp_str_match(
"group", 1, value ) ) {
3131 __kmp_affinity_top_method = affinity_top_method_group;
3134 else if ( __kmp_str_match(
"flat", 1, value ) ) {
3135 __kmp_affinity_top_method = affinity_top_method_flat;
3138 KMP_WARNING( StgInvalidValue, name, value );
3143 __kmp_stg_print_topology_method( kmp_str_buf_t * buffer,
char const * name,
3146 char const * value = NULL;
3148 switch ( __kmp_affinity_top_method ) {
3149 case affinity_top_method_default:
3153 case affinity_top_method_all:
3157 # if KMP_ARCH_X86 || KMP_ARCH_X86_64
3158 case affinity_top_method_x2apicid:
3159 value =
"x2APIC id";
3162 case affinity_top_method_apicid:
3167 case affinity_top_method_cpuinfo:
3171 # if KMP_GROUP_AFFINITY
3172 case affinity_top_method_group:
3177 case affinity_top_method_flat:
3182 if ( value != NULL ) {
3183 __kmp_stg_print_str( buffer, name, value );
3198 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
3200 kmp_setting_t **rivals = (kmp_setting_t **) data;
3203 rc = __kmp_stg_check_rivals( name, value, rivals );
3211 KMP_DEBUG_ASSERT( (__kmp_nested_proc_bind.bind_types != NULL)
3212 && ( __kmp_nested_proc_bind.used > 0 ) );
3214 const char *buf = value;
3218 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3220 SKIP_DIGITS( next );
3221 num = __kmp_str_to_int( buf, *next );
3222 KMP_ASSERT( num >= 0 );
3231 if ( __kmp_match_str(
"disabled", buf, &next ) ) {
3234 # if KMP_AFFINITY_SUPPORTED
3235 __kmp_affinity_type = affinity_disabled;
3237 __kmp_nested_proc_bind.used = 1;
3238 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3240 else if ( ( num == (
int)proc_bind_false )
3241 || __kmp_match_str(
"false", buf, &next ) ) {
3244 # if KMP_AFFINITY_SUPPORTED
3245 __kmp_affinity_type = affinity_none;
3247 __kmp_nested_proc_bind.used = 1;
3248 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3250 else if ( ( num == (
int)proc_bind_true )
3251 || __kmp_match_str(
"true", buf, &next ) ) {
3254 __kmp_nested_proc_bind.used = 1;
3255 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3263 for ( scan = buf; *scan !=
'\0'; scan++ ) {
3264 if ( *scan ==
',' ) {
3272 if ( __kmp_nested_proc_bind.size < nelem ) {
3273 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
3274 KMP_INTERNAL_REALLOC( __kmp_nested_proc_bind.bind_types,
3275 sizeof(kmp_proc_bind_t) * nelem );
3276 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
3277 KMP_FATAL( MemoryAllocFailed );
3279 __kmp_nested_proc_bind.size = nelem;
3281 __kmp_nested_proc_bind.used = nelem;
3288 enum kmp_proc_bind_t bind;
3290 if ( ( num == (
int)proc_bind_master )
3291 || __kmp_match_str(
"master", buf, &next ) ) {
3294 bind = proc_bind_master;
3296 else if ( ( num == (
int)proc_bind_close )
3297 || __kmp_match_str(
"close", buf, &next ) ) {
3300 bind = proc_bind_close;
3302 else if ( ( num == (
int)proc_bind_spread )
3303 || __kmp_match_str(
"spread", buf, &next ) ) {
3306 bind = proc_bind_spread;
3309 KMP_WARNING( StgInvalidValue, name, value );
3310 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3311 __kmp_nested_proc_bind.used = 1;
3315 __kmp_nested_proc_bind.bind_types[i++] = bind;
3319 KMP_DEBUG_ASSERT( *buf ==
',' );
3326 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3328 SKIP_DIGITS( next );
3329 num = __kmp_str_to_int( buf, *next );
3330 KMP_ASSERT( num >= 0 );
3340 if ( *buf !=
'\0' ) {
3341 KMP_WARNING( ParseExtraCharsWarn, name, buf );
3347 __kmp_stg_print_proc_bind( kmp_str_buf_t * buffer,
char const * name,
3350 int nelem = __kmp_nested_proc_bind.used;
3351 if( __kmp_env_format ) {
3352 KMP_STR_BUF_PRINT_NAME;
3354 __kmp_str_buf_print( buffer,
" %s", name );
3357 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
3361 __kmp_str_buf_print( buffer,
"='", name );
3362 for ( i = 0; i < nelem; i++ ) {
3363 switch ( __kmp_nested_proc_bind.bind_types[i] ) {
3364 case proc_bind_false:
3365 __kmp_str_buf_print( buffer,
"false" );
3368 case proc_bind_true:
3369 __kmp_str_buf_print( buffer,
"true" );
3372 case proc_bind_master:
3373 __kmp_str_buf_print( buffer,
"master" );
3376 case proc_bind_close:
3377 __kmp_str_buf_print( buffer,
"close" );
3380 case proc_bind_spread:
3381 __kmp_str_buf_print( buffer,
"spread" );
3384 case proc_bind_intel:
3385 __kmp_str_buf_print( buffer,
"intel" );
3388 case proc_bind_default:
3389 __kmp_str_buf_print( buffer,
"default" );
3392 if ( i < nelem - 1 ) {
3393 __kmp_str_buf_print( buffer,
"," );
3396 __kmp_str_buf_print( buffer,
"'\n" );
3408 __kmp_stg_parse_omp_dynamic(
char const * name,
char const * value,
void * data )
3410 __kmp_stg_parse_bool( name, value, & (__kmp_global.g.g_dynamic) );
3414 __kmp_stg_print_omp_dynamic( kmp_str_buf_t * buffer,
char const * name,
void * data )
3416 __kmp_stg_print_bool( buffer, name, __kmp_global.g.g_dynamic );
3420 __kmp_stg_parse_kmp_dynamic_mode(
char const * name,
char const * value,
void * data )
3422 if ( TCR_4(__kmp_init_parallel) ) {
3423 KMP_WARNING( EnvParallelWarn, name );
3424 __kmp_env_toPrint( name, 0 );
3427 #ifdef USE_LOAD_BALANCE
3428 else if ( __kmp_str_match(
"load balance", 2, value )
3429 || __kmp_str_match(
"load_balance", 2, value )
3430 || __kmp_str_match(
"load-balance", 2, value )
3431 || __kmp_str_match(
"loadbalance", 2, value )
3432 || __kmp_str_match(
"balance", 1, value ) ) {
3433 __kmp_global.g.g_dynamic_mode = dynamic_load_balance;
3436 else if ( __kmp_str_match(
"thread limit", 1, value )
3437 || __kmp_str_match(
"thread_limit", 1, value )
3438 || __kmp_str_match(
"thread-limit", 1, value )
3439 || __kmp_str_match(
"threadlimit", 1, value )
3440 || __kmp_str_match(
"limit", 2, value ) ) {
3441 __kmp_global.g.g_dynamic_mode = dynamic_thread_limit;
3443 else if ( __kmp_str_match(
"random", 1, value ) ) {
3444 __kmp_global.g.g_dynamic_mode = dynamic_random;
3447 KMP_WARNING( StgInvalidValue, name, value );
3452 __kmp_stg_print_kmp_dynamic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data )
3455 if ( __kmp_global.g.g_dynamic_mode == dynamic_default ) {
3456 __kmp_str_buf_print( buffer,
" %s: %s \n", name, KMP_I18N_STR( NotDefined ) );
3458 # ifdef USE_LOAD_BALANCE
3459 else if ( __kmp_global.g.g_dynamic_mode == dynamic_load_balance ) {
3460 __kmp_stg_print_str( buffer, name,
"load balance" );
3463 else if ( __kmp_global.g.g_dynamic_mode == dynamic_thread_limit ) {
3464 __kmp_stg_print_str( buffer, name,
"thread limit" );
3466 else if ( __kmp_global.g.g_dynamic_mode == dynamic_random ) {
3467 __kmp_stg_print_str( buffer, name,
"random" );
3476 #ifdef USE_LOAD_BALANCE
3483 __kmp_stg_parse_ld_balance_interval(
char const * name,
char const * value,
void * data )
3485 double interval = __kmp_convert_to_double( value );
3486 if ( interval >= 0 ) {
3487 __kmp_load_balance_interval = interval;
3489 KMP_WARNING( StgInvalidValue, name, value );
3494 __kmp_stg_print_ld_balance_interval( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3496 __kmp_str_buf_print( buffer,
" %s=%8.6f\n", name, __kmp_load_balance_interval );
3509 __kmp_stg_parse_init_at_fork(
char const * name,
char const * value,
void * data ) {
3510 __kmp_stg_parse_bool( name, value, & __kmp_need_register_atfork );
3511 if ( __kmp_need_register_atfork ) {
3512 __kmp_need_register_atfork_specified = TRUE;
3517 __kmp_stg_print_init_at_fork( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3518 __kmp_stg_print_bool( buffer, name, __kmp_need_register_atfork_specified );
3526 __kmp_stg_parse_schedule(
char const * name,
char const * value,
void * data ) {
3528 if ( value != NULL ) {
3529 size_t length = KMP_STRLEN( value );
3530 if ( length > INT_MAX ) {
3531 KMP_WARNING( LongValue, name );
3534 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'' )
3535 KMP_WARNING( UnbalancedQuotes, name );
3539 semicolon = (
char *) strchr( value,
';' );
3540 if( *value && semicolon != value ) {
3541 char *comma = (
char *) strchr( value,
',' );
3548 if ( !__kmp_strcasecmp_with_sentinel(
"static", value, sentinel ) ) {
3549 if( !__kmp_strcasecmp_with_sentinel(
"greedy", comma,
';' ) ) {
3550 __kmp_static = kmp_sch_static_greedy;
3552 }
else if( !__kmp_strcasecmp_with_sentinel(
"balanced", comma,
';' ) ) {
3553 __kmp_static = kmp_sch_static_balanced;
3556 }
else if ( !__kmp_strcasecmp_with_sentinel(
"guided", value, sentinel ) ) {
3557 if ( !__kmp_strcasecmp_with_sentinel(
"iterative", comma,
';' ) ) {
3558 __kmp_guided = kmp_sch_guided_iterative_chunked;
3560 }
else if ( !__kmp_strcasecmp_with_sentinel(
"analytical", comma,
';' ) ) {
3562 __kmp_guided = kmp_sch_guided_analytical_chunked;
3566 KMP_WARNING( InvalidClause, name, value );
3568 KMP_WARNING( EmptyClause, name );
3569 }
while ( (value = semicolon ? semicolon + 1 : NULL) );
3576 __kmp_stg_print_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3577 if( __kmp_env_format ) {
3578 KMP_STR_BUF_PRINT_NAME_EX(name);
3580 __kmp_str_buf_print( buffer,
" %s='", name );
3582 if ( __kmp_static == kmp_sch_static_greedy ) {
3583 __kmp_str_buf_print( buffer,
"%s",
"static,greedy");
3584 }
else if ( __kmp_static == kmp_sch_static_balanced ) {
3585 __kmp_str_buf_print ( buffer,
"%s",
"static,balanced");
3587 if ( __kmp_guided == kmp_sch_guided_iterative_chunked ) {
3588 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,iterative");
3589 }
else if ( __kmp_guided == kmp_sch_guided_analytical_chunked ) {
3590 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,analytical");
3599 __kmp_stg_parse_omp_schedule(
char const * name,
char const * value,
void * data )
3603 length = KMP_STRLEN( value );
3605 char *comma = (
char *) strchr( value,
',' );
3606 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'')
3607 KMP_WARNING( UnbalancedQuotes, name );
3609 if (!__kmp_strcasecmp_with_sentinel(
"dynamic", value,
','))
3610 __kmp_sched = kmp_sch_dynamic_chunked;
3611 else if (!__kmp_strcasecmp_with_sentinel(
"guided", value,
','))
3614 else if (!__kmp_strcasecmp_with_sentinel(
"auto", value,
',')) {
3617 __kmp_msg( kmp_ms_warning, KMP_MSG( IgnoreChunk, name, comma ), __kmp_msg_null );
3621 else if (!__kmp_strcasecmp_with_sentinel(
"trapezoidal", value,
','))
3622 __kmp_sched = kmp_sch_trapezoidal;
3623 else if (!__kmp_strcasecmp_with_sentinel(
"static", value,
','))
3625 #ifdef KMP_STATIC_STEAL_ENABLED
3626 else if (KMP_ARCH_X86_64 &&
3627 !__kmp_strcasecmp_with_sentinel(
"static_steal", value,
','))
3631 KMP_WARNING( StgInvalidValue, name, value );
3634 if( value && comma ) {
3635 __kmp_env_chunk = TRUE;
3638 __kmp_sched = kmp_sch_static_chunked;
3640 __kmp_chunk = __kmp_str_to_int( comma, 0 );
3641 if ( __kmp_chunk < 1 ) {
3642 __kmp_chunk = KMP_DEFAULT_CHUNK;
3643 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidChunk, name, comma ), __kmp_msg_null );
3644 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3650 }
else if ( __kmp_chunk > KMP_MAX_CHUNK ) {
3651 __kmp_chunk = KMP_MAX_CHUNK;
3652 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeChunk, name, comma ), __kmp_msg_null );
3653 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3656 __kmp_env_chunk = FALSE;
3658 KMP_WARNING( EmptyString, name );
3660 K_DIAG(1, (
"__kmp_static == %d\n", __kmp_static))
3661 K_DIAG(1, ("__kmp_guided == %d\n", __kmp_guided))
3662 K_DIAG(1, ("__kmp_sched == %d\n", __kmp_sched))
3663 K_DIAG(1, ("__kmp_chunk == %d\n", __kmp_chunk))
3667 __kmp_stg_print_omp_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3668 if( __kmp_env_format ) {
3669 KMP_STR_BUF_PRINT_NAME_EX(name);
3671 __kmp_str_buf_print( buffer,
" %s='", name );
3673 if ( __kmp_chunk ) {
3674 switch ( __kmp_sched ) {
3675 case kmp_sch_dynamic_chunked:
3676 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"dynamic", __kmp_chunk);
3678 case kmp_sch_guided_iterative_chunked:
3679 case kmp_sch_guided_analytical_chunked:
3680 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"guided", __kmp_chunk);
3682 case kmp_sch_trapezoidal:
3683 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"trapezoidal", __kmp_chunk);
3686 case kmp_sch_static_chunked:
3687 case kmp_sch_static_balanced:
3688 case kmp_sch_static_greedy:
3689 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static", __kmp_chunk);
3692 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static_steal", __kmp_chunk);
3695 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"auto", __kmp_chunk);
3699 switch ( __kmp_sched ) {
3700 case kmp_sch_dynamic_chunked:
3701 __kmp_str_buf_print( buffer,
"%s'\n",
"dynamic");
3703 case kmp_sch_guided_iterative_chunked:
3704 case kmp_sch_guided_analytical_chunked:
3705 __kmp_str_buf_print( buffer,
"%s'\n",
"guided");
3707 case kmp_sch_trapezoidal:
3708 __kmp_str_buf_print( buffer,
"%s'\n",
"trapezoidal");
3711 case kmp_sch_static_chunked:
3712 case kmp_sch_static_balanced:
3713 case kmp_sch_static_greedy:
3714 __kmp_str_buf_print( buffer,
"%s'\n",
"static");
3717 __kmp_str_buf_print( buffer,
"%s'\n",
"static_steal");
3720 __kmp_str_buf_print( buffer,
"%s'\n",
"auto");
3731 __kmp_stg_parse_atomic_mode(
char const * name,
char const * value,
void * data ) {
3735 #ifdef KMP_GOMP_COMPAT
3738 __kmp_stg_parse_int( name, value, 0, max, & mode );
3742 __kmp_atomic_mode = mode;
3747 __kmp_stg_print_atomic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3748 __kmp_stg_print_int( buffer, name, __kmp_atomic_mode );
3757 __kmp_stg_parse_consistency_check(
char const * name,
char const * value,
void * data ) {
3758 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
3762 __kmp_env_consistency_check = TRUE;
3763 }
else if ( ! __kmp_strcasecmp_with_sentinel(
"none", value, 0 ) ) {
3764 __kmp_env_consistency_check = FALSE;
3766 KMP_WARNING( StgInvalidValue, name, value );
3771 __kmp_stg_print_consistency_check( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3773 const char *value = NULL;
3775 if ( __kmp_env_consistency_check ) {
3781 if ( value != NULL ) {
3782 __kmp_stg_print_str( buffer, name, value );
3796 __kmp_stg_parse_itt_prepare_delay(
char const * name,
char const * value,
void * data )
3800 __kmp_stg_parse_int( name, value, 0, INT_MAX, & delay );
3801 __kmp_itt_prepare_delay = delay;
3805 __kmp_stg_print_itt_prepare_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3806 __kmp_stg_print_uint64( buffer, name, __kmp_itt_prepare_delay );
3810 #endif // USE_ITT_NOTIFY
3818 __kmp_stg_parse_malloc_pool_incr(
char const * name,
char const * value,
void * data ) {
3819 __kmp_stg_parse_size(
3822 KMP_MIN_MALLOC_POOL_INCR,
3823 KMP_MAX_MALLOC_POOL_INCR,
3825 & __kmp_malloc_pool_incr,
3831 __kmp_stg_print_malloc_pool_incr( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3832 __kmp_stg_print_size( buffer, name, __kmp_malloc_pool_incr );
3844 __kmp_stg_parse_par_range_env(
char const * name,
char const * value,
void * data ) {
3845 __kmp_stg_parse_par_range(
3849 __kmp_par_range_routine,
3850 __kmp_par_range_filename,
3851 & __kmp_par_range_lb,
3852 & __kmp_par_range_ub
3857 __kmp_stg_print_par_range_env( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3858 if (__kmp_par_range != 0) {
3859 __kmp_stg_print_str( buffer, name, par_range_to_print );
3868 __kmp_stg_parse_yield_cycle(
char const * name,
char const * value,
void * data ) {
3869 int flag = __kmp_yield_cycle;
3870 __kmp_stg_parse_bool( name, value, & flag );
3871 __kmp_yield_cycle = flag;
3875 __kmp_stg_print_yield_cycle( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3876 __kmp_stg_print_bool( buffer, name, __kmp_yield_cycle );
3880 __kmp_stg_parse_yield_on(
char const * name,
char const * value,
void * data ) {
3881 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_on_count );
3885 __kmp_stg_print_yield_on( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3886 __kmp_stg_print_int( buffer, name, __kmp_yield_on_count );
3890 __kmp_stg_parse_yield_off(
char const * name,
char const * value,
void * data ) {
3891 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_off_count );
3895 __kmp_stg_print_yield_off( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3896 __kmp_stg_print_int( buffer, name, __kmp_yield_off_count );
3906 __kmp_stg_parse_init_wait(
char const * name,
char const * value,
void * data ) {
3908 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3909 wait = __kmp_init_wait / 2;
3910 __kmp_stg_parse_int( name, value, KMP_MIN_INIT_WAIT, KMP_MAX_INIT_WAIT, & wait );
3911 __kmp_init_wait = wait * 2;
3912 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3913 __kmp_yield_init = __kmp_init_wait;
3917 __kmp_stg_print_init_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3918 __kmp_stg_print_int( buffer, name, __kmp_init_wait );
3922 __kmp_stg_parse_next_wait(
char const * name,
char const * value,
void * data ) {
3924 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3925 wait = __kmp_next_wait / 2;
3926 __kmp_stg_parse_int( name, value, KMP_MIN_NEXT_WAIT, KMP_MAX_NEXT_WAIT, & wait );
3927 __kmp_next_wait = wait * 2;
3928 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3929 __kmp_yield_next = __kmp_next_wait;
3933 __kmp_stg_print_next_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3934 __kmp_stg_print_int( buffer, name, __kmp_next_wait );
3943 __kmp_stg_parse_gtid_mode(
char const * name,
char const * value,
void * data ) {
3954 #ifdef KMP_TDATA_GTID
3957 __kmp_stg_parse_int( name, value, 0, max, & mode );
3961 __kmp_adjust_gtid_mode = TRUE;
3964 __kmp_gtid_mode = mode;
3965 __kmp_adjust_gtid_mode = FALSE;
3970 __kmp_stg_print_gtid_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3971 if ( __kmp_adjust_gtid_mode ) {
3972 __kmp_stg_print_int( buffer, name, 0 );
3975 __kmp_stg_print_int( buffer, name, __kmp_gtid_mode );
3985 __kmp_stg_parse_lock_block(
char const * name,
char const * value,
void * data ) {
3986 __kmp_stg_parse_int( name, value, 0, KMP_INT_MAX, & __kmp_num_locks_in_block );
3990 __kmp_stg_print_lock_block( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3991 __kmp_stg_print_int( buffer, name, __kmp_num_locks_in_block );
3999 __kmp_stg_parse_lock_kind(
char const * name,
char const * value,
void * data ) {
4000 if ( __kmp_init_user_locks ) {
4001 KMP_WARNING( EnvLockWarn, name );
4005 if ( __kmp_str_match(
"tas", 2, value )
4006 || __kmp_str_match(
"test and set", 2, value )
4007 || __kmp_str_match(
"test_and_set", 2, value )
4008 || __kmp_str_match(
"test-and-set", 2, value )
4009 || __kmp_str_match(
"test andset", 2, value )
4010 || __kmp_str_match(
"test_andset", 2, value )
4011 || __kmp_str_match(
"test-andset", 2, value )
4012 || __kmp_str_match(
"testand set", 2, value )
4013 || __kmp_str_match(
"testand_set", 2, value )
4014 || __kmp_str_match(
"testand-set", 2, value )
4015 || __kmp_str_match(
"testandset", 2, value ) ) {
4016 __kmp_user_lock_kind = lk_tas;
4017 DYNA_STORE_LOCK_SEQ(tas);
4019 #if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM)
4020 else if ( __kmp_str_match(
"futex", 1, value ) ) {
4021 if ( __kmp_futex_determine_capable() ) {
4022 __kmp_user_lock_kind = lk_futex;
4023 DYNA_STORE_LOCK_SEQ(futex);
4026 KMP_WARNING( FutexNotSupported, name, value );
4030 else if ( __kmp_str_match(
"ticket", 2, value ) ) {
4031 __kmp_user_lock_kind = lk_ticket;
4032 DYNA_STORE_LOCK_SEQ(ticket);
4034 else if ( __kmp_str_match(
"queuing", 1, value )
4035 || __kmp_str_match(
"queue", 1, value ) ) {
4036 __kmp_user_lock_kind = lk_queuing;
4037 DYNA_STORE_LOCK_SEQ(queuing);
4039 else if ( __kmp_str_match(
"drdpa ticket", 1, value )
4040 || __kmp_str_match(
"drdpa_ticket", 1, value )
4041 || __kmp_str_match(
"drdpa-ticket", 1, value )
4042 || __kmp_str_match(
"drdpaticket", 1, value )
4043 || __kmp_str_match(
"drdpa", 1, value ) ) {
4044 __kmp_user_lock_kind = lk_drdpa;
4045 DYNA_STORE_LOCK_SEQ(drdpa);
4047 #if KMP_USE_ADAPTIVE_LOCKS
4048 else if ( __kmp_str_match(
"adaptive", 1, value ) ) {
4049 if( __kmp_cpuinfo.rtm ) {
4050 __kmp_user_lock_kind = lk_adaptive;
4051 DYNA_STORE_LOCK_SEQ(adaptive);
4053 KMP_WARNING( AdaptiveNotSupported, name, value );
4054 __kmp_user_lock_kind = lk_queuing;
4055 DYNA_STORE_LOCK_SEQ(queuing);
4058 #endif // KMP_USE_ADAPTIVE_LOCKS
4059 #if KMP_USE_DYNAMIC_LOCK
4060 else if ( __kmp_str_match(
"hle", 1, value) ) {
4061 DYNA_STORE_LOCK_SEQ(hle);
4065 KMP_WARNING( StgInvalidValue, name, value );
4070 __kmp_stg_print_lock_kind( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4071 const char *value = NULL;
4073 switch ( __kmp_user_lock_kind ) {
4082 #if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
4099 #if KMP_USE_ADAPTIVE_LOCKS
4106 if ( value != NULL ) {
4107 __kmp_stg_print_str( buffer, name, value );
4111 #if KMP_USE_ADAPTIVE_LOCKS
4120 __kmp_stg_parse_adaptive_lock_props(
const char *name,
const char *value,
void *data )
4122 int max_retries = 0;
4123 int max_badness = 0;
4125 const char *next = value;
4126 const char *scan = next;
4129 int prev_comma = FALSE;
4134 for ( i = 0; i < 3 ; i++) {
4137 if ( *next ==
'\0' ) {
4141 if ( ( ( *next < '0' || *next >
'9' ) && *next !=
',' ) || total > 2 ) {
4142 KMP_WARNING( EnvSyntaxError, name, value );
4146 if ( *next ==
',' ) {
4148 if ( total == 0 || prev_comma ) {
4156 if ( *next >=
'0' && *next <=
'9' ) {
4158 const char *buf = next;
4159 char const * msg = NULL;
4161 SKIP_DIGITS( next );
4164 const char *tmp = next;
4166 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
4167 KMP_WARNING( EnvSpacesNotAllowed, name, value );
4171 num = __kmp_str_to_int( buf, *next );
4173 msg = KMP_I18N_STR( ValueTooSmall );
4175 }
else if ( num > KMP_INT_MAX ) {
4176 msg = KMP_I18N_STR( ValueTooLarge );
4179 if ( msg != NULL ) {
4181 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
4182 KMP_INFORM( Using_int_Value, name, num );
4186 }
else if( total == 2 ) {
4191 KMP_DEBUG_ASSERT( total > 0 );
4193 KMP_WARNING( EnvSyntaxError, name, value );
4196 if( max_retries != 0 ) {
4197 __kmp_adaptive_backoff_params.max_soft_retries = max_retries;
4199 if( max_badness != 0 ) {
4200 __kmp_adaptive_backoff_params.max_badness = max_badness;
4206 __kmp_stg_print_adaptive_lock_props(kmp_str_buf_t * buffer,
char const * name,
void * data )
4208 if( __kmp_env_format ) {
4209 KMP_STR_BUF_PRINT_NAME_EX(name);
4211 __kmp_str_buf_print( buffer,
" %s='", name );
4213 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_adaptive_backoff_params.max_soft_retries,
4214 __kmp_adaptive_backoff_params.max_badness );
4217 #if KMP_DEBUG_ADAPTIVE_LOCKS
4220 __kmp_stg_parse_speculative_statsfile(
char const * name,
char const * value,
void * data ) {
4221 __kmp_stg_parse_file( name, value,
"", & __kmp_speculative_statsfile );
4225 __kmp_stg_print_speculative_statsfile( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4226 if ( __kmp_str_match(
"-", 0, __kmp_speculative_statsfile ) ) {
4227 __kmp_stg_print_str( buffer, name,
"stdout" );
4229 __kmp_stg_print_str( buffer, name, __kmp_speculative_statsfile );
4234 #endif // KMP_DEBUG_ADAPTIVE_LOCKS
4236 #endif // KMP_USE_ADAPTIVE_LOCKS
4243 __kmp_stg_parse_place_threads(
char const * name,
char const * value,
void * data ) {
4249 const char *next = value;
4253 if ( *next ==
'\0' ) {
4258 if ( *next >=
'0' && *next <=
'9' ) {
4260 SKIP_DIGITS( next );
4261 num = __kmp_str_to_int( prev, *next );
4263 if ( *next ==
'C' || *next ==
'c' ) {
4264 __kmp_place_num_cores = num;
4266 }
else if ( *next ==
',' || *next ==
'x' ) {
4267 __kmp_place_num_cores = num;
4270 }
else if ( *next ==
'T' || *next ==
't' ) {
4271 __kmp_place_num_threads_per_core = num;
4273 }
else if ( *next ==
'\0' ) {
4274 __kmp_place_num_cores = num;
4277 KMP_WARNING( AffThrPlaceInvalid, name, value );
4280 }
else if ( *next ==
',' || *next ==
'x' ) {
4285 KMP_WARNING( AffThrPlaceInvalid, name, value );
4289 if ( *next ==
'\0' ) {
4292 if ( ( *next ==
',' || *next ==
'x' ) && !prev_delim ) {
4299 if ( *next >=
'0' && *next <=
'9' ) {
4302 SKIP_DIGITS( next );
4303 num = __kmp_str_to_int( prev, *next );
4305 if ( *next ==
'T' || *next ==
't' ) {
4306 __kmp_place_num_threads_per_core = num;
4308 }
else if ( *next ==
',' || *next ==
'x' ) {
4309 __kmp_place_num_threads_per_core = num;
4312 }
else if ( *next ==
'O' || *next ==
'o' ) {
4313 __kmp_place_core_offset = num;
4315 }
else if ( *next ==
'\0' ) {
4316 __kmp_place_num_threads_per_core = num;
4319 KMP_WARNING( AffThrPlaceInvalid, name, value );
4322 }
else if ( *next ==
',' || *next ==
'x' ) {
4323 if ( prev_delim == 2 ) {
4326 KMP_DEBUG_ASSERT( prev_delim == 1 );
4329 KMP_WARNING( AffThrPlaceInvalid, name, value );
4333 if ( *next ==
'\0' ) {
4336 if ( ( *next ==
',' || *next ==
'x' ) && !prev_delim ) {
4344 if ( *next >=
'0' && *next <=
'9' ) {
4346 SKIP_DIGITS( next );
4347 num = __kmp_str_to_int( prev, *next );
4348 __kmp_place_core_offset = num;
4353 __kmp_stg_print_place_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4354 if ( __kmp_place_num_cores + __kmp_place_num_threads_per_core ) {
4356 __kmp_str_buf_init( &buf );
4357 if( __kmp_env_format ) {
4358 KMP_STR_BUF_PRINT_NAME_EX(name);
4360 __kmp_str_buf_print( buffer,
" %s='", name );
4362 __kmp_str_buf_print( &buf,
"%dC", __kmp_place_num_cores );
4363 __kmp_str_buf_print( &buf,
"x%dT", __kmp_place_num_threads_per_core );
4364 if ( __kmp_place_core_offset ) {
4365 __kmp_str_buf_print( &buf,
",%dO", __kmp_place_core_offset );
4367 __kmp_str_buf_print(buffer,
"%s'\n", buf.str );
4368 __kmp_str_buf_free(&buf);
4382 __kmp_stg_parse_forkjoin_frames(
char const * name,
char const * value,
void * data ) {
4383 __kmp_stg_parse_bool( name, value, & __kmp_forkjoin_frames );
4387 __kmp_stg_print_forkjoin_frames( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4388 __kmp_stg_print_bool( buffer, name, __kmp_forkjoin_frames );
4396 __kmp_stg_parse_forkjoin_frames_mode(
char const * name,
char const * value,
void * data ) {
4397 __kmp_stg_parse_int( name, value, 0, 3, & __kmp_forkjoin_frames_mode );
4401 __kmp_stg_print_forkjoin_frames_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4402 __kmp_stg_print_int( buffer, name, __kmp_forkjoin_frames_mode );
4413 __kmp_stg_parse_omp_display_env(
char const * name,
char const * value,
void * data )
4415 if ( __kmp_str_match(
"VERBOSE", 1, value ) )
4417 __kmp_display_env_verbose = TRUE;
4419 __kmp_stg_parse_bool( name, value, & __kmp_display_env );
4425 __kmp_stg_print_omp_display_env( kmp_str_buf_t * buffer,
char const * name,
void * data )
4427 if ( __kmp_display_env_verbose )
4429 __kmp_stg_print_str( buffer, name,
"VERBOSE" );
4431 __kmp_stg_print_bool( buffer, name, __kmp_display_env );
4436 __kmp_stg_parse_omp_cancellation(
char const * name,
char const * value,
void * data ) {
4437 if ( TCR_4(__kmp_init_parallel) ) {
4438 KMP_WARNING( EnvParallelWarn, name );
4441 __kmp_stg_parse_bool( name, value, & __kmp_omp_cancellation );
4445 __kmp_stg_print_omp_cancellation( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4446 __kmp_stg_print_bool( buffer, name, __kmp_omp_cancellation );
4456 static kmp_setting_t __kmp_stg_table[] = {
4458 {
"KMP_ALL_THREADS", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4459 {
"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime, NULL, 0, 0 },
4460 {
"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok, __kmp_stg_print_duplicate_lib_ok, NULL, 0, 0 },
4461 {
"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4462 {
"KMP_MAX_THREADS", __kmp_stg_parse_all_threads, NULL, NULL, 0, 0 },
4463 {
"KMP_MONITOR_STACKSIZE", __kmp_stg_parse_monitor_stacksize, __kmp_stg_print_monitor_stacksize, NULL, 0, 0 },
4464 {
"KMP_SETTINGS", __kmp_stg_parse_settings, __kmp_stg_print_settings, NULL, 0, 0 },
4465 {
"KMP_STACKOFFSET", __kmp_stg_parse_stackoffset, __kmp_stg_print_stackoffset, NULL, 0, 0 },
4466 {
"KMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4467 {
"KMP_STACKPAD", __kmp_stg_parse_stackpad, __kmp_stg_print_stackpad, NULL, 0, 0 },
4468 {
"KMP_VERSION", __kmp_stg_parse_version, __kmp_stg_print_version, NULL, 0, 0 },
4469 {
"KMP_WARNINGS", __kmp_stg_parse_warnings, __kmp_stg_print_warnings, NULL, 0, 0 },
4471 {
"OMP_NESTED", __kmp_stg_parse_nested, __kmp_stg_print_nested, NULL, 0, 0 },
4472 {
"OMP_NUM_THREADS", __kmp_stg_parse_num_threads, __kmp_stg_print_num_threads, NULL, 0, 0 },
4473 {
"OMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4475 {
"KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0, 0 },
4476 {
"KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing, __kmp_stg_print_task_stealing, NULL, 0, 0 },
4477 {
"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels, __kmp_stg_print_max_active_levels, NULL, 0, 0 },
4478 {
"OMP_THREAD_LIMIT", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4479 {
"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4480 #if KMP_NESTED_HOT_TEAMS
4481 {
"KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level, __kmp_stg_print_hot_teams_level, NULL, 0, 0 },
4482 {
"KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode, __kmp_stg_print_hot_teams_mode, NULL, 0, 0 },
4483 #endif // KMP_NESTED_HOT_TEAMS
4485 #if KMP_HANDLE_SIGNALS
4486 {
"KMP_HANDLE_SIGNALS", __kmp_stg_parse_handle_signals, __kmp_stg_print_handle_signals, NULL, 0, 0 },
4489 #if KMP_ARCH_X86 || KMP_ARCH_X86_64
4490 {
"KMP_INHERIT_FP_CONTROL", __kmp_stg_parse_inherit_fp_control, __kmp_stg_print_inherit_fp_control, NULL, 0, 0 },
4493 #ifdef KMP_GOMP_COMPAT
4494 {
"GOMP_STACKSIZE", __kmp_stg_parse_stacksize, NULL, NULL, 0, 0 },
4498 {
"KMP_A_DEBUG", __kmp_stg_parse_a_debug, __kmp_stg_print_a_debug, NULL, 0, 0 },
4499 {
"KMP_B_DEBUG", __kmp_stg_parse_b_debug, __kmp_stg_print_b_debug, NULL, 0, 0 },
4500 {
"KMP_C_DEBUG", __kmp_stg_parse_c_debug, __kmp_stg_print_c_debug, NULL, 0, 0 },
4501 {
"KMP_D_DEBUG", __kmp_stg_parse_d_debug, __kmp_stg_print_d_debug, NULL, 0, 0 },
4502 {
"KMP_E_DEBUG", __kmp_stg_parse_e_debug, __kmp_stg_print_e_debug, NULL, 0, 0 },
4503 {
"KMP_F_DEBUG", __kmp_stg_parse_f_debug, __kmp_stg_print_f_debug, NULL, 0, 0 },
4504 {
"KMP_DEBUG", __kmp_stg_parse_debug, NULL, NULL, 0, 0 },
4505 {
"KMP_DEBUG_BUF", __kmp_stg_parse_debug_buf, __kmp_stg_print_debug_buf, NULL, 0, 0 },
4506 {
"KMP_DEBUG_BUF_ATOMIC", __kmp_stg_parse_debug_buf_atomic, __kmp_stg_print_debug_buf_atomic, NULL, 0, 0 },
4507 {
"KMP_DEBUG_BUF_CHARS", __kmp_stg_parse_debug_buf_chars, __kmp_stg_print_debug_buf_chars, NULL, 0, 0 },
4508 {
"KMP_DEBUG_BUF_LINES", __kmp_stg_parse_debug_buf_lines, __kmp_stg_print_debug_buf_lines, NULL, 0, 0 },
4509 {
"KMP_DIAG", __kmp_stg_parse_diag, __kmp_stg_print_diag, NULL, 0, 0 },
4511 {
"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env, __kmp_stg_print_par_range_env, NULL, 0, 0 },
4512 {
"KMP_YIELD_CYCLE", __kmp_stg_parse_yield_cycle, __kmp_stg_print_yield_cycle, NULL, 0, 0 },
4513 {
"KMP_YIELD_ON", __kmp_stg_parse_yield_on, __kmp_stg_print_yield_on, NULL, 0, 0 },
4514 {
"KMP_YIELD_OFF", __kmp_stg_parse_yield_off, __kmp_stg_print_yield_off, NULL, 0, 0 },
4517 {
"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc, __kmp_stg_print_align_alloc, NULL, 0, 0 },
4519 {
"KMP_PLAIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4520 {
"KMP_PLAIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4521 {
"KMP_FORKJOIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4522 {
"KMP_FORKJOIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4523 #if KMP_FAST_REDUCTION_BARRIER
4524 {
"KMP_REDUCTION_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4525 {
"KMP_REDUCTION_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4528 {
"KMP_ABORT_DELAY", __kmp_stg_parse_abort_delay, __kmp_stg_print_abort_delay, NULL, 0, 0 },
4529 {
"KMP_CPUINFO_FILE", __kmp_stg_parse_cpuinfo_file, __kmp_stg_print_cpuinfo_file, NULL, 0, 0 },
4530 {
"KMP_FORCE_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4531 {
"KMP_DETERMINISTIC_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4532 {
"KMP_STORAGE_MAP", __kmp_stg_parse_storage_map, __kmp_stg_print_storage_map, NULL, 0, 0 },
4533 {
"KMP_ALL_THREADPRIVATE", __kmp_stg_parse_all_threadprivate, __kmp_stg_print_all_threadprivate, NULL, 0, 0 },
4534 {
"KMP_FOREIGN_THREADS_THREADPRIVATE", __kmp_stg_parse_foreign_threads_threadprivate, __kmp_stg_print_foreign_threads_threadprivate, NULL, 0, 0 },
4536 #if KMP_AFFINITY_SUPPORTED
4537 {
"KMP_AFFINITY", __kmp_stg_parse_affinity, __kmp_stg_print_affinity, NULL, 0, 0 },
4538 # ifdef KMP_GOMP_COMPAT
4539 {
"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL, NULL, 0, 0 },
4542 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4543 {
"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0 },
4545 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, NULL, NULL, 0, 0 },
4548 {
"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method, __kmp_stg_print_topology_method, NULL, 0, 0 },
4557 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4560 #endif // KMP_AFFINITY_SUPPORTED
4562 {
"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork, __kmp_stg_print_init_at_fork, NULL, 0, 0 },
4563 {
"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL, 0, 0 },
4564 {
"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule, NULL, 0, 0 },
4565 {
"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode, __kmp_stg_print_atomic_mode, NULL, 0, 0 },
4566 {
"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check, __kmp_stg_print_consistency_check, NULL, 0, 0 },
4568 #if USE_ITT_BUILD && USE_ITT_NOTIFY
4569 {
"KMP_ITT_PREPARE_DELAY", __kmp_stg_parse_itt_prepare_delay, __kmp_stg_print_itt_prepare_delay, NULL, 0, 0 },
4571 {
"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr, __kmp_stg_print_malloc_pool_incr, NULL, 0, 0 },
4572 {
"KMP_INIT_WAIT", __kmp_stg_parse_init_wait, __kmp_stg_print_init_wait, NULL, 0, 0 },
4573 {
"KMP_NEXT_WAIT", __kmp_stg_parse_next_wait, __kmp_stg_print_next_wait, NULL, 0, 0 },
4574 {
"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode, NULL, 0, 0 },
4575 {
"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic, NULL, 0, 0 },
4576 {
"KMP_DYNAMIC_MODE", __kmp_stg_parse_kmp_dynamic_mode, __kmp_stg_print_kmp_dynamic_mode, NULL, 0, 0 },
4578 #ifdef USE_LOAD_BALANCE
4579 {
"KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,__kmp_stg_print_ld_balance_interval,NULL, 0, 0 },
4584 {
"KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block, __kmp_stg_print_lock_block, NULL, 0, 0 },
4585 {
"KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind, NULL, 0, 0 },
4586 #if KMP_USE_ADAPTIVE_LOCKS
4587 {
"KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,__kmp_stg_print_adaptive_lock_props, NULL, 0, 0 },
4588 #if KMP_DEBUG_ADAPTIVE_LOCKS
4589 {
"KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,__kmp_stg_print_speculative_statsfile, NULL, 0, 0 },
4591 #endif // KMP_USE_ADAPTIVE_LOCKS
4592 {
"KMP_PLACE_THREADS", __kmp_stg_parse_place_threads, __kmp_stg_print_place_threads, NULL, 0, 0 },
4594 {
"KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames, __kmp_stg_print_forkjoin_frames, NULL, 0, 0 },
4595 {
"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,__kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0 },
4599 {
"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env, __kmp_stg_print_omp_display_env, NULL, 0, 0 },
4600 {
"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation, __kmp_stg_print_omp_cancellation, NULL, 0, 0 },
4602 {
"", NULL, NULL, NULL, 0, 0 }
4605 static int const __kmp_stg_count =
sizeof( __kmp_stg_table ) /
sizeof( kmp_setting_t );
4609 __kmp_stg_find(
char const * name ) {
4612 if ( name != NULL ) {
4613 for ( i = 0; i < __kmp_stg_count; ++ i ) {
4614 if ( strcmp( __kmp_stg_table[ i ].name, name ) == 0 ) {
4615 return & __kmp_stg_table[ i ];
4625 __kmp_stg_cmp(
void const * _a,
void const * _b ) {
4626 kmp_setting_t * a = (kmp_setting_t *) _a;
4627 kmp_setting_t * b = (kmp_setting_t *) _b;
4633 if ( strcmp( a->name,
"KMP_AFFINITY" ) == 0 ) {
4634 if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4639 else if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4642 return strcmp( a->name, b->name );
4647 __kmp_stg_init(
void
4650 static int initialized = 0;
4652 if ( ! initialized ) {
4655 qsort( __kmp_stg_table, __kmp_stg_count - 1,
sizeof( kmp_setting_t ), __kmp_stg_cmp );
4659 kmp_setting_t * kmp_stacksize = __kmp_stg_find(
"KMP_STACKSIZE" );
4660 #ifdef KMP_GOMP_COMPAT
4661 kmp_setting_t * gomp_stacksize = __kmp_stg_find(
"GOMP_STACKSIZE" );
4663 kmp_setting_t * omp_stacksize = __kmp_stg_find(
"OMP_STACKSIZE" );
4668 static kmp_setting_t *
volatile rivals[ 4 ];
4669 static kmp_stg_ss_data_t kmp_data = { 1, (kmp_setting_t **)rivals };
4670 #ifdef KMP_GOMP_COMPAT
4671 static kmp_stg_ss_data_t gomp_data = { 1024, (kmp_setting_t **)rivals };
4673 static kmp_stg_ss_data_t omp_data = { 1024, (kmp_setting_t **)rivals };
4676 rivals[ i ++ ] = kmp_stacksize;
4677 #ifdef KMP_GOMP_COMPAT
4678 if ( gomp_stacksize != NULL ) {
4679 rivals[ i ++ ] = gomp_stacksize;
4682 rivals[ i ++ ] = omp_stacksize;
4683 rivals[ i ++ ] = NULL;
4685 kmp_stacksize->data = & kmp_data;
4686 #ifdef KMP_GOMP_COMPAT
4687 if ( gomp_stacksize != NULL ) {
4688 gomp_stacksize->data = & gomp_data;
4691 omp_stacksize->data = & omp_data;
4697 kmp_setting_t * kmp_library = __kmp_stg_find(
"KMP_LIBRARY" );
4698 kmp_setting_t * omp_wait_policy = __kmp_stg_find(
"OMP_WAIT_POLICY" );
4701 static kmp_setting_t *
volatile rivals[ 3 ];
4702 static kmp_stg_wp_data_t kmp_data = { 0, (kmp_setting_t **)rivals };
4703 static kmp_stg_wp_data_t omp_data = { 1, (kmp_setting_t **)rivals };
4706 rivals[ i ++ ] = kmp_library;
4707 if ( omp_wait_policy != NULL ) {
4708 rivals[ i ++ ] = omp_wait_policy;
4710 rivals[ i ++ ] = NULL;
4712 kmp_library->data = & kmp_data;
4713 if ( omp_wait_policy != NULL ) {
4714 omp_wait_policy->data = & omp_data;
4721 kmp_setting_t * kmp_all_threads = __kmp_stg_find(
"KMP_ALL_THREADS" );
4722 kmp_setting_t * kmp_max_threads = __kmp_stg_find(
"KMP_MAX_THREADS" );
4723 kmp_setting_t * omp_thread_limit = __kmp_stg_find(
"OMP_THREAD_LIMIT" );
4726 static kmp_setting_t *
volatile rivals[ 4 ];
4729 rivals[ i ++ ] = kmp_all_threads;
4730 rivals[ i ++ ] = kmp_max_threads;
4731 if ( omp_thread_limit != NULL ) {
4732 rivals[ i ++ ] = omp_thread_limit;
4734 rivals[ i ++ ] = NULL;
4736 kmp_all_threads->data = (
void*)& rivals;
4737 kmp_max_threads->data = (
void*)& rivals;
4738 if ( omp_thread_limit != NULL ) {
4739 omp_thread_limit->data = (
void*)& rivals;
4744 #if KMP_AFFINITY_SUPPORTED
4747 kmp_setting_t * kmp_affinity = __kmp_stg_find(
"KMP_AFFINITY" );
4748 KMP_DEBUG_ASSERT( kmp_affinity != NULL );
4750 # ifdef KMP_GOMP_COMPAT
4751 kmp_setting_t * gomp_cpu_affinity = __kmp_stg_find(
"GOMP_CPU_AFFINITY" );
4752 KMP_DEBUG_ASSERT( gomp_cpu_affinity != NULL );
4755 kmp_setting_t * omp_proc_bind = __kmp_stg_find(
"OMP_PROC_BIND" );
4756 KMP_DEBUG_ASSERT( omp_proc_bind != NULL );
4759 static kmp_setting_t *
volatile rivals[ 4 ];
4762 rivals[ i ++ ] = kmp_affinity;
4764 # ifdef KMP_GOMP_COMPAT
4765 rivals[ i ++ ] = gomp_cpu_affinity;
4766 gomp_cpu_affinity->data = (
void*)& rivals;
4769 rivals[ i ++ ] = omp_proc_bind;
4770 omp_proc_bind->data = (
void*)& rivals;
4771 rivals[ i ++ ] = NULL;
4774 static kmp_setting_t *
volatile places_rivals[ 4 ];
4777 kmp_setting_t * omp_places = __kmp_stg_find(
"OMP_PLACES" );
4778 KMP_DEBUG_ASSERT( omp_places != NULL );
4780 places_rivals[ i ++ ] = kmp_affinity;
4781 # ifdef KMP_GOMP_COMPAT
4782 places_rivals[ i ++ ] = gomp_cpu_affinity;
4784 places_rivals[ i ++ ] = omp_places;
4785 omp_places->data = (
void*)& places_rivals;
4786 places_rivals[ i ++ ] = NULL;
4792 #endif // KMP_AFFINITY_SUPPORTED
4796 kmp_setting_t * kmp_force_red = __kmp_stg_find(
"KMP_FORCE_REDUCTION" );
4797 kmp_setting_t * kmp_determ_red = __kmp_stg_find(
"KMP_DETERMINISTIC_REDUCTION" );
4800 static kmp_setting_t *
volatile rivals[ 3 ];
4801 static kmp_stg_fr_data_t force_data = { 1, (kmp_setting_t **)rivals };
4802 static kmp_stg_fr_data_t determ_data = { 0, (kmp_setting_t **)rivals };
4805 rivals[ i ++ ] = kmp_force_red;
4806 if ( kmp_determ_red != NULL ) {
4807 rivals[ i ++ ] = kmp_determ_red;
4809 rivals[ i ++ ] = NULL;
4811 kmp_force_red->data = & force_data;
4812 if ( kmp_determ_red != NULL ) {
4813 kmp_determ_red->data = & determ_data;
4823 for ( i = 0; i < __kmp_stg_count; ++ i ) {
4824 __kmp_stg_table[ i ].set = 0;
4838 if ( name[ 0 ] == 0 ) {
4842 if ( value != NULL ) {
4843 kmp_setting_t * setting = __kmp_stg_find( name );
4844 if ( setting != NULL ) {
4845 setting->parse( name, value, setting->data );
4846 setting->defined = 1;
4854 __kmp_stg_check_rivals(
4857 kmp_setting_t * * rivals
4860 if ( rivals == NULL ) {
4866 for ( ; strcmp( rivals[ i ]->name, name ) != 0; i++ ) {
4867 KMP_DEBUG_ASSERT( rivals[ i ] != NULL );
4869 #if KMP_AFFINITY_SUPPORTED
4870 if ( rivals[ i ] == __kmp_affinity_notype ) {
4879 if ( rivals[ i ]->set ) {
4880 KMP_WARNING( StgIgnored, name, rivals[ i ]->name );
4893 __kmp_env_isDefined(
char const * name ) {
4895 kmp_setting_t * setting = __kmp_stg_find( name );
4896 if ( setting != NULL ) {
4903 __kmp_env_toPrint(
char const * name,
int flag ) {
4905 kmp_setting_t * setting = __kmp_stg_find( name );
4906 if ( setting != NULL ) {
4907 rc = setting->defined;
4909 setting->defined = flag;
4917 __kmp_aux_env_initialize( kmp_env_blk_t* block ) {
4922 value = __kmp_env_blk_var( block,
"OMP_NUM_THREADS" );
4924 ompc_set_num_threads( __kmp_dflt_team_nth );
4928 value = __kmp_env_blk_var( block,
"KMP_BLOCKTIME" );
4930 kmpc_set_blocktime( __kmp_dflt_blocktime );
4934 value = __kmp_env_blk_var( block,
"OMP_NESTED" );
4936 ompc_set_nested( __kmp_dflt_nested );
4940 value = __kmp_env_blk_var( block,
"OMP_DYNAMIC" );
4942 ompc_set_dynamic( __kmp_global.g.g_dynamic );
4948 __kmp_env_initialize(
char const *
string ) {
4950 kmp_env_blk_t block;
4956 if (
string == NULL ) {
4958 __kmp_threads_capacity = __kmp_initial_threads_capacity( __kmp_dflt_team_nth_ub );
4960 __kmp_env_blk_init( & block,
string );
4965 for ( i = 0; i < block.count; ++ i ) {
4966 if (( block.vars[ i ].name == NULL )
4967 || ( *block.vars[ i ].name ==
'\0')) {
4970 if ( block.vars[ i ].value == NULL ) {
4973 kmp_setting_t * setting = __kmp_stg_find( block.vars[ i ].name );
4974 if ( setting != NULL ) {
4980 if (
string == NULL ) {
4981 char const * name =
"KMP_WARNINGS";
4982 char const * value = __kmp_env_blk_var( & block, name );
4983 __kmp_stg_parse( name, value );
4986 #if KMP_AFFINITY_SUPPORTED
4994 __kmp_affinity_notype = NULL;
4995 char const *aff_str = __kmp_env_blk_var( & block,
"KMP_AFFINITY" );
4996 if ( aff_str != NULL ) {
5010 # define FIND strstr
5012 # define FIND strcasestr
5015 if ( ( FIND( aff_str,
"none" ) == NULL )
5016 && ( FIND( aff_str,
"physical" ) == NULL )
5017 && ( FIND( aff_str,
"logical" ) == NULL )
5018 && ( FIND( aff_str,
"compact" ) == NULL )
5019 && ( FIND( aff_str,
"scatter" ) == NULL )
5020 && ( FIND( aff_str,
"explicit" ) == NULL )
5021 && ( FIND( aff_str,
"balanced" ) == NULL )
5022 && ( FIND( aff_str,
"disabled" ) == NULL ) ) {
5023 __kmp_affinity_notype = __kmp_stg_find(
"KMP_AFFINITY" );
5031 __kmp_affinity_type = affinity_default;
5032 __kmp_affinity_gran = affinity_gran_default;
5033 __kmp_affinity_top_method = affinity_top_method_default;
5034 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5042 aff_str = __kmp_env_blk_var( & block,
"OMP_PROC_BIND" );
5043 if ( aff_str != NULL ) {
5044 __kmp_affinity_type = affinity_default;
5045 __kmp_affinity_gran = affinity_gran_default;
5046 __kmp_affinity_top_method = affinity_top_method_default;
5047 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5058 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5059 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
5060 KMP_INTERNAL_MALLOC(
sizeof(kmp_proc_bind_t) );
5061 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5062 KMP_FATAL( MemoryAllocFailed );
5064 __kmp_nested_proc_bind.size = 1;
5065 __kmp_nested_proc_bind.used = 1;
5066 # if KMP_AFFINITY_SUPPORTED
5067 __kmp_nested_proc_bind.bind_types[0] = proc_bind_default;
5070 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5079 for ( i = 0; i < block.count; ++ i ) {
5080 __kmp_stg_parse( block.vars[ i ].name, block.vars[ i ].value );
5086 if ( ! __kmp_init_user_locks ) {
5087 if ( __kmp_user_lock_kind == lk_default ) {
5088 __kmp_user_lock_kind = lk_queuing;
5090 #if KMP_USE_DYNAMIC_LOCK
5091 __kmp_init_dynamic_user_locks();
5093 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5097 KMP_DEBUG_ASSERT(
string != NULL);
5098 KMP_DEBUG_ASSERT( __kmp_user_lock_kind != lk_default );
5103 #if KMP_USE_DYNAMIC_LOCK
5104 __kmp_init_dynamic_user_locks();
5106 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5110 #if KMP_AFFINITY_SUPPORTED
5112 if ( ! TCR_4(__kmp_init_middle) ) {
5117 const char *var =
"KMP_AFFINITY";
5118 if ( __kmp_affinity_type == affinity_disabled ) {
5119 KMP_AFFINITY_DISABLE();
5121 else if ( ! KMP_AFFINITY_CAPABLE() ) {
5122 __kmp_affinity_determine_capable( var );
5123 if ( ! KMP_AFFINITY_CAPABLE() ) {
5124 if ( __kmp_affinity_verbose || ( __kmp_affinity_warnings
5125 && ( __kmp_affinity_type != affinity_default )
5126 && ( __kmp_affinity_type != affinity_none )
5127 && ( __kmp_affinity_type != affinity_disabled ) ) ) {
5128 KMP_WARNING( AffNotSupported, var );
5130 __kmp_affinity_type = affinity_disabled;
5131 __kmp_affinity_respect_mask = 0;
5132 __kmp_affinity_gran = affinity_gran_fine;
5137 if ( __kmp_affinity_type == affinity_disabled ) {
5138 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5140 else if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_true ) {
5144 __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
5148 if ( KMP_AFFINITY_CAPABLE() ) {
5150 # if KMP_GROUP_AFFINITY
5157 if ( ( ( __kmp_num_proc_groups > 1 )
5158 && ( __kmp_affinity_type == affinity_default )
5160 && ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) )
5162 || ( __kmp_affinity_top_method == affinity_top_method_group ) ) {
5163 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5164 __kmp_affinity_respect_mask = FALSE;
5166 if ( __kmp_affinity_type == affinity_default ) {
5167 __kmp_affinity_type = affinity_compact;
5169 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5172 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5173 if ( __kmp_affinity_gran == affinity_gran_default ) {
5174 __kmp_affinity_top_method = affinity_top_method_group;
5175 __kmp_affinity_gran = affinity_gran_group;
5177 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5178 __kmp_affinity_top_method = affinity_top_method_group;
5181 __kmp_affinity_top_method = affinity_top_method_all;
5184 else if ( __kmp_affinity_top_method == affinity_top_method_group ) {
5185 if ( __kmp_affinity_gran == affinity_gran_default ) {
5186 __kmp_affinity_gran = affinity_gran_group;
5188 else if ( ( __kmp_affinity_gran != affinity_gran_group )
5189 && ( __kmp_affinity_gran != affinity_gran_fine )
5190 && ( __kmp_affinity_gran != affinity_gran_thread ) ) {
5192 switch ( __kmp_affinity_gran ) {
5193 case affinity_gran_core: str =
"core";
break;
5194 case affinity_gran_package: str =
"package";
break;
5195 case affinity_gran_node: str =
"node";
break;
5196 default: KMP_DEBUG_ASSERT( 0 );
5198 KMP_WARNING( AffGranTopGroup, var, str );
5199 __kmp_affinity_gran = affinity_gran_fine;
5203 if ( __kmp_affinity_gran == affinity_gran_default ) {
5204 __kmp_affinity_gran = affinity_gran_core;
5206 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5208 switch ( __kmp_affinity_type ) {
5209 case affinity_physical: str =
"physical";
break;
5210 case affinity_logical: str =
"logical";
break;
5211 case affinity_compact: str =
"compact";
break;
5212 case affinity_scatter: str =
"scatter";
break;
5213 case affinity_explicit: str =
"explicit";
break;
5215 default: KMP_DEBUG_ASSERT( 0 );
5217 KMP_WARNING( AffGranGroupType, var, str );
5218 __kmp_affinity_gran = affinity_gran_core;
5227 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5228 # if KMP_GROUP_AFFINITY
5229 if ( __kmp_num_proc_groups > 1 ) {
5230 __kmp_affinity_respect_mask = FALSE;
5235 __kmp_affinity_respect_mask = TRUE;
5239 if ( ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_intel )
5240 && ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default ) ) {
5241 if ( __kmp_affinity_type == affinity_default ) {
5242 __kmp_affinity_type = affinity_compact;
5243 __kmp_affinity_dups = FALSE;
5248 if ( __kmp_affinity_type == affinity_default ) {
5250 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
5251 if( __kmp_mic_type != non_mic ) {
5252 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5256 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5259 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
5260 if( __kmp_mic_type != non_mic ) {
5261 __kmp_affinity_type = affinity_scatter;
5265 __kmp_affinity_type = affinity_none;
5269 if ( ( __kmp_affinity_gran == affinity_gran_default )
5270 && ( __kmp_affinity_gran_levels < 0 ) ) {
5271 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS)
5272 if( __kmp_mic_type != non_mic ) {
5273 __kmp_affinity_gran = affinity_gran_fine;
5277 __kmp_affinity_gran = affinity_gran_core;
5280 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5281 __kmp_affinity_top_method = affinity_top_method_all;
5286 K_DIAG( 1, (
"__kmp_affinity_type == %d\n", __kmp_affinity_type ) );
5287 K_DIAG( 1, (
"__kmp_affinity_compact == %d\n", __kmp_affinity_compact ) );
5288 K_DIAG( 1, (
"__kmp_affinity_offset == %d\n", __kmp_affinity_offset ) );
5289 K_DIAG( 1, (
"__kmp_affinity_verbose == %d\n", __kmp_affinity_verbose ) );
5290 K_DIAG( 1, (
"__kmp_affinity_warnings == %d\n", __kmp_affinity_warnings ) );
5291 K_DIAG( 1, (
"__kmp_affinity_respect_mask == %d\n", __kmp_affinity_respect_mask ) );
5292 K_DIAG( 1, (
"__kmp_affinity_gran == %d\n", __kmp_affinity_gran ) );
5294 KMP_DEBUG_ASSERT( __kmp_affinity_type != affinity_default);
5296 KMP_DEBUG_ASSERT( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default );
5302 if ( __kmp_version ) {
5303 __kmp_print_version_1();
5307 if (
string != NULL) {
5308 __kmp_aux_env_initialize( &block );
5311 __kmp_env_blk_free( & block );
5321 kmp_env_blk_t block;
5323 kmp_str_buf_t buffer;
5326 __kmp_str_buf_init( & buffer );
5328 __kmp_env_blk_init( & block, NULL );
5329 __kmp_env_blk_sort( & block );
5332 __kmp_str_buf_print( & buffer,
"\n%s\n\n", KMP_I18N_STR( UserSettings ) );
5333 for ( i = 0; i < block.count; ++ i ) {
5334 char const * name = block.vars[ i ].name;
5335 char const * value = block.vars[ i ].value;
5337 ( KMP_STRLEN( name ) > 4 && strncmp( name,
"KMP_", 4 ) == 0 )
5338 || strncmp( name,
"OMP_", 4 ) == 0
5339 #ifdef KMP_GOMP_COMPAT
5340 || strncmp( name,
"GOMP_", 5 ) == 0
5343 __kmp_str_buf_print( & buffer,
" %s=%s\n", name, value );
5346 __kmp_str_buf_print( & buffer,
"\n" );
5349 __kmp_str_buf_print( & buffer,
"%s\n\n", KMP_I18N_STR( EffectiveSettings ) );
5350 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5351 if ( __kmp_stg_table[ i ].print != NULL ) {
5352 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5356 __kmp_printf(
"%s", buffer.str );
5358 __kmp_env_blk_free( & block );
5359 __kmp_str_buf_free( & buffer );
5368 __kmp_env_print_2() {
5370 kmp_env_blk_t block;
5372 kmp_str_buf_t buffer;
5374 __kmp_env_format = 1;
5377 __kmp_str_buf_init( & buffer );
5379 __kmp_env_blk_init( & block, NULL );
5380 __kmp_env_blk_sort( & block );
5382 __kmp_str_buf_print( & buffer,
"\n%s\n", KMP_I18N_STR( DisplayEnvBegin ) );
5383 __kmp_str_buf_print( & buffer,
" _OPENMP='%d'\n", __kmp_openmp_version );
5385 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5386 if ( __kmp_stg_table[ i ].print != NULL &&
5387 ( ( __kmp_display_env && strncmp( __kmp_stg_table[ i ].name,
"OMP_", 4 ) == 0 ) || __kmp_display_env_verbose ) ) {
5388 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5392 __kmp_str_buf_print( & buffer,
"%s\n", KMP_I18N_STR( DisplayEnvEnd ) );
5393 __kmp_str_buf_print( & buffer,
"\n" );
5395 __kmp_printf(
"%s", buffer.str );
5397 __kmp_env_blk_free( & block );
5398 __kmp_str_buf_free( & buffer );
5403 #endif // OMP_40_ENABLED