17 #include "kmp_wrapper_getpid.h" 18 #include "kmp_environment.h" 19 #include "kmp_atomic.h" 22 #include "kmp_settings.h" 26 #include "kmp_affinity.h" 28 static int __kmp_env_toPrint(
char const * name,
int flag );
30 bool __kmp_env_format = 0;
36 __kmp_convert_to_double(
char const * s )
40 if ( KMP_SSCANF( s,
"%lf", &result ) < 1 ) {
49 __kmp_readstr_with_sentinel(
char *dest,
char const * src,
size_t len,
char sentinel) {
51 for (i = 0; i < len; i++) {
52 if ((*src ==
'\0') || (*src == sentinel)) {
63 __kmp_match_with_sentinel(
char const * a,
char const * b,
size_t len,
char sentinel ) {
70 while(*a && *b && *b != sentinel) {
71 char ca = *a, cb = *b;
73 if(ca >=
'a' && ca <=
'z')
75 if(cb >=
'a' && cb <=
'z')
113 __kmp_match_str(
char const *token,
char const *buf,
const char **end) {
115 KMP_ASSERT(token != NULL);
116 KMP_ASSERT(buf != NULL);
117 KMP_ASSERT(end != NULL);
119 while (*token && *buf) {
120 char ct = *token, cb = *buf;
122 if(ct >=
'a' && ct <=
'z')
124 if(cb >=
'a' && cb <=
'z')
140 __kmp_round4k(
size_t size ) {
141 size_t _4k = 4 * 1024;
142 if ( size & ( _4k - 1 ) ) {
143 size &= ~ ( _4k - 1 );
144 if ( size <= KMP_SIZE_T_MAX - _4k ) {
159 __kmp_convert_to_milliseconds(
char const * data )
161 int ret, nvalues, factor;
165 if (data == NULL)
return (-1);
166 if ( __kmp_str_match(
"infinit", -1, data))
return (INT_MAX);
167 value = (double) 0.0;
169 nvalues = KMP_SSCANF (data,
"%lf%c%c", &value, &mult, &extra);
170 if (nvalues < 1)
return (-1);
171 if (nvalues == 1) mult =
'\0';
172 if (nvalues == 3)
return (-1);
174 if (value < 0)
return (-1);
188 factor = 1000 * 60 * 60;
191 factor = 1000 * 24 * 60 * 60;
197 if ( value >= ( (INT_MAX-1) / factor) )
200 ret = (int) (value * (
double) factor);
207 __kmp_strcasecmp_with_sentinel(
char const * a,
char const * b,
char sentinel ) {
212 while(*a && *b && *b != sentinel) {
213 char ca = *a, cb = *b;
215 if(ca >=
'a' && ca <=
'z')
217 if(cb >=
'a' && cb <=
'z')
220 return (
int)(
unsigned char)*a - (
int)(
unsigned char)*b;
225 (*b && *b != sentinel) ? (
int)(
unsigned char)*a - (
int)(
unsigned char)*b : 1 :
226 (*b && *b != sentinel) ? -1 : 0;
234 typedef struct __kmp_setting kmp_setting_t;
235 typedef struct __kmp_stg_ss_data kmp_stg_ss_data_t;
236 typedef struct __kmp_stg_wp_data kmp_stg_wp_data_t;
237 typedef struct __kmp_stg_fr_data kmp_stg_fr_data_t;
239 typedef void ( * kmp_stg_parse_func_t )(
char const * name,
char const * value,
void * data );
240 typedef void ( * kmp_stg_print_func_t )( kmp_str_buf_t * buffer,
char const * name,
void * data );
242 struct __kmp_setting {
244 kmp_stg_parse_func_t parse;
245 kmp_stg_print_func_t print;
252 struct __kmp_stg_ss_data {
254 kmp_setting_t * * rivals;
257 struct __kmp_stg_wp_data {
259 kmp_setting_t * * rivals;
262 struct __kmp_stg_fr_data {
264 kmp_setting_t * * rivals;
268 __kmp_stg_check_rivals(
271 kmp_setting_t * * rivals
280 __kmp_stg_parse_bool(
285 if ( __kmp_str_match_true( value ) ) {
287 }
else if (__kmp_str_match_false( value ) ) {
292 KMP_MSG( BadBoolValue, name, value ),
293 KMP_HNT( ValidBoolValues ),
300 __kmp_stg_parse_size(
309 char const * msg = NULL;
311 size_min = __kmp_round4k( size_min );
312 size_max = __kmp_round4k( size_max );
313 #endif // KMP_OS_DARWIN 315 if ( is_specified != NULL ) {
318 __kmp_str_to_size( value, out, factor, & msg );
320 if ( * out > size_max ) {
322 msg = KMP_I18N_STR( ValueTooLarge );
323 }
else if ( * out < size_min ) {
325 msg = KMP_I18N_STR( ValueTooSmall );
328 size_t round4k = __kmp_round4k( * out );
329 if ( * out != round4k ) {
331 msg = KMP_I18N_STR( NotMultiple4K );
337 if ( * out < size_min ) {
340 else if ( * out > size_max ) {
347 __kmp_str_buf_init( & buf );
348 __kmp_str_buf_print_size( & buf, * out );
349 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
350 KMP_INFORM( Using_str_Value, name, buf.str );
351 __kmp_str_buf_free( & buf );
356 #if KMP_AFFINITY_SUPPORTED 364 * out = __kmp_str_format(
"%s", value );
376 char const * msg = NULL;
377 kmp_uint64 uint = * out;
378 __kmp_str_to_uint( value, & uint, & msg );
380 if ( uint < (
unsigned int)min ) {
381 msg = KMP_I18N_STR( ValueTooSmall );
383 }
else if ( uint > (
unsigned int)max ) {
384 msg = KMP_I18N_STR( ValueTooLarge );
390 if ( uint < (
unsigned int)min ) {
393 else if ( uint > (
unsigned int)max ) {
400 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
401 __kmp_str_buf_init( & buf );
402 __kmp_str_buf_print( &buf,
"%" KMP_UINT64_SPEC
"", uint );
403 KMP_INFORM( Using_uint64_Value, name, buf.str );
404 __kmp_str_buf_free( &buf );
410 #if KMP_DEBUG_ADAPTIVE_LOCKS 412 __kmp_stg_parse_file(
422 t = (
char *) strrchr(value,
'.');
423 hasSuffix = t && __kmp_str_eqf( t, suffix );
424 t = __kmp_str_format(
"%s%s", value, hasSuffix ?
"" : suffix );
425 __kmp_expand_file_name( buffer,
sizeof(buffer), t);
427 * out = __kmp_str_format(
"%s", buffer );
432 static char * par_range_to_print = NULL;
435 __kmp_stg_parse_par_range(
444 size_t len = KMP_STRLEN( value + 1 );
445 par_range_to_print = (
char *) KMP_INTERNAL_MALLOC( len +1 );
446 KMP_STRNCPY_S( par_range_to_print, len + 1, value, len + 1);
447 __kmp_par_range = +1;
448 __kmp_par_range_lb = 0;
449 __kmp_par_range_ub = INT_MAX;
452 if (( value == NULL ) || ( *value ==
'\0' )) {
455 if ( ! __kmp_strcasecmp_with_sentinel(
"routine", value,
'=' )) {
456 value = strchr( value,
'=' ) + 1;
457 len = __kmp_readstr_with_sentinel( out_routine,
458 value, KMP_PAR_RANGE_ROUTINE_LEN - 1,
',' );
460 goto par_range_error;
462 value = strchr( value,
',' );
463 if ( value != NULL ) {
468 if ( ! __kmp_strcasecmp_with_sentinel(
"filename", value,
'=' )) {
469 value = strchr( value,
'=' ) + 1;
470 len = __kmp_readstr_with_sentinel( out_file,
471 value, KMP_PAR_RANGE_FILENAME_LEN - 1,
',' );
473 goto par_range_error;
475 value = strchr( value,
',' );
476 if ( value != NULL ) {
481 if (( ! __kmp_strcasecmp_with_sentinel(
"range", value,
'=' ))
482 || ( ! __kmp_strcasecmp_with_sentinel(
"incl_range", value,
'=' ))) {
483 value = strchr( value,
'=' ) + 1;
484 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub ) != 2 ) {
485 goto par_range_error;
488 value = strchr( value,
',' );
489 if ( value != NULL ) {
494 if ( ! __kmp_strcasecmp_with_sentinel(
"excl_range", value,
'=' )) {
495 value = strchr( value,
'=' ) + 1;
496 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub) != 2 ) {
497 goto par_range_error;
500 value = strchr( value,
',' );
501 if ( value != NULL ) {
507 KMP_WARNING( ParRangeSyntax, name );
515 __kmp_initial_threads_capacity(
int req_nproc )
520 if (nth < (4 * req_nproc))
521 nth = (4 * req_nproc);
522 if (nth < (4 * __kmp_xproc))
523 nth = (4 * __kmp_xproc);
525 if (nth > __kmp_max_nth)
533 __kmp_default_tp_capacity(
int req_nproc,
int max_nth,
int all_threads_specified) {
536 if(all_threads_specified)
539 if (nth < (4 * req_nproc))
540 nth = (4 * req_nproc);
541 if (nth < (4 * __kmp_xproc))
542 nth = (4 * __kmp_xproc);
544 if (nth > __kmp_max_nth)
556 __kmp_stg_print_bool( kmp_str_buf_t * buffer,
char const * name,
int value ) {
557 if( __kmp_env_format ) {
558 KMP_STR_BUF_PRINT_BOOL;
560 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value ?
"true" :
"false" );
565 __kmp_stg_print_int( kmp_str_buf_t * buffer,
char const * name,
int value ) {
566 if( __kmp_env_format ) {
567 KMP_STR_BUF_PRINT_INT;
569 __kmp_str_buf_print( buffer,
" %s=%d\n", name, value );
574 __kmp_stg_print_uint64( kmp_str_buf_t * buffer,
char const * name, kmp_uint64 value ) {
575 if( __kmp_env_format ) {
576 KMP_STR_BUF_PRINT_UINT64;
578 __kmp_str_buf_print( buffer,
" %s=%" KMP_UINT64_SPEC
"\n", name, value );
583 __kmp_stg_print_str( kmp_str_buf_t * buffer,
char const * name,
char const * value ) {
584 if( __kmp_env_format ) {
585 KMP_STR_BUF_PRINT_STR;
587 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value );
592 __kmp_stg_print_size( kmp_str_buf_t * buffer,
char const * name,
size_t value ) {
593 if( __kmp_env_format ) {
594 KMP_STR_BUF_PRINT_NAME_EX(name);
595 __kmp_str_buf_print_size( buffer, value );
596 __kmp_str_buf_print( buffer,
"'\n" );
598 __kmp_str_buf_print( buffer,
" %s=", name );
599 __kmp_str_buf_print_size( buffer, value );
600 __kmp_str_buf_print( buffer,
"\n" );
615 __kmp_stg_parse_all_threads(
char const * name,
char const * value,
void * data ) {
617 kmp_setting_t * * rivals = (kmp_setting_t * *) data;
619 rc = __kmp_stg_check_rivals( name, value, rivals );
623 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
624 __kmp_max_nth = __kmp_xproc;
625 __kmp_allThreadsSpecified = 1;
627 __kmp_stg_parse_int( name, value, 1, __kmp_sys_max_nth, & __kmp_max_nth );
628 __kmp_allThreadsSpecified = 0;
630 K_DIAG( 1, (
"__kmp_max_nth == %d\n", __kmp_max_nth ) );
635 __kmp_stg_print_all_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
636 __kmp_stg_print_int( buffer, name, __kmp_max_nth );
644 __kmp_stg_parse_blocktime(
char const * name,
char const * value,
void * data ) {
645 __kmp_dflt_blocktime = __kmp_convert_to_milliseconds( value );
646 if ( __kmp_dflt_blocktime < 0 ) {
647 __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
648 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidValue, name, value ), __kmp_msg_null );
649 KMP_INFORM( Using_int_Value, name, __kmp_dflt_blocktime );
650 __kmp_env_blocktime = FALSE;
652 if ( __kmp_dflt_blocktime < KMP_MIN_BLOCKTIME ) {
653 __kmp_dflt_blocktime = KMP_MIN_BLOCKTIME;
654 __kmp_msg( kmp_ms_warning, KMP_MSG( SmallValue, name, value ), __kmp_msg_null );
655 KMP_INFORM( MinValueUsing, name, __kmp_dflt_blocktime );
656 }
else if ( __kmp_dflt_blocktime > KMP_MAX_BLOCKTIME ) {
657 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
658 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeValue, name, value ), __kmp_msg_null );
659 KMP_INFORM( MaxValueUsing, name, __kmp_dflt_blocktime );
661 __kmp_env_blocktime = TRUE;
665 __kmp_monitor_wakeups = KMP_WAKEUPS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
666 __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
668 K_DIAG( 1, (
"__kmp_env_blocktime == %d\n", __kmp_env_blocktime ) );
669 if ( __kmp_env_blocktime ) {
670 K_DIAG( 1, (
"__kmp_dflt_blocktime == %d\n", __kmp_dflt_blocktime ) );
675 __kmp_stg_print_blocktime( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
676 __kmp_stg_print_int( buffer, name, __kmp_dflt_blocktime );
684 __kmp_stg_parse_duplicate_lib_ok(
char const * name,
char const * value,
void * data ) {
687 __kmp_stg_parse_bool( name, value, & __kmp_duplicate_library_ok );
691 __kmp_stg_print_duplicate_lib_ok( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
692 __kmp_stg_print_bool( buffer, name, __kmp_duplicate_library_ok );
699 #if KMP_ARCH_X86 || KMP_ARCH_X86_64 702 __kmp_stg_parse_inherit_fp_control(
char const * name,
char const * value,
void * data ) {
703 __kmp_stg_parse_bool( name, value, & __kmp_inherit_fp_control );
707 __kmp_stg_print_inherit_fp_control( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
709 __kmp_stg_print_bool( buffer, name, __kmp_inherit_fp_control );
719 static char const *blocktime_str = NULL;
722 __kmp_stg_parse_wait_policy(
char const * name,
char const * value,
void * data ) {
724 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
727 rc = __kmp_stg_check_rivals( name, value, wait->rivals );
733 if ( __kmp_str_match(
"ACTIVE", 1, value ) ) {
734 __kmp_library = library_turnaround;
735 if ( blocktime_str == NULL ) {
737 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
739 }
else if ( __kmp_str_match(
"PASSIVE", 1, value ) ) {
740 __kmp_library = library_throughput;
741 if ( blocktime_str == NULL ) {
743 __kmp_dflt_blocktime = 0;
746 KMP_WARNING( StgInvalidValue, name, value );
749 if ( __kmp_str_match(
"serial", 1, value ) ) {
750 __kmp_library = library_serial;
751 }
else if ( __kmp_str_match(
"throughput", 2, value ) ) {
752 __kmp_library = library_throughput;
753 }
else if ( __kmp_str_match(
"turnaround", 2, value ) ) {
754 __kmp_library = library_turnaround;
755 }
else if ( __kmp_str_match(
"dedicated", 1, value ) ) {
756 __kmp_library = library_turnaround;
757 }
else if ( __kmp_str_match(
"multiuser", 1, value ) ) {
758 __kmp_library = library_throughput;
760 KMP_WARNING( StgInvalidValue, name, value );
763 __kmp_aux_set_library( __kmp_library );
768 __kmp_stg_print_wait_policy( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
770 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
771 char const * value = NULL;
774 switch ( __kmp_library ) {
775 case library_turnaround : {
778 case library_throughput : {
783 switch ( __kmp_library ) {
784 case library_serial : {
787 case library_turnaround : {
788 value =
"turnaround";
790 case library_throughput : {
791 value =
"throughput";
795 if ( value != NULL ) {
796 __kmp_stg_print_str( buffer, name, value );
807 __kmp_stg_parse_monitor_stacksize(
char const * name,
char const * value,
void * data ) {
808 __kmp_stg_parse_size(
811 __kmp_sys_min_stksize,
814 & __kmp_monitor_stksize,
820 __kmp_stg_print_monitor_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
821 if( __kmp_env_format ) {
822 if ( __kmp_monitor_stksize > 0 )
823 KMP_STR_BUF_PRINT_NAME_EX(name);
825 KMP_STR_BUF_PRINT_NAME;
827 __kmp_str_buf_print( buffer,
" %s", name );
829 if ( __kmp_monitor_stksize > 0 ) {
830 __kmp_str_buf_print_size( buffer, __kmp_monitor_stksize );
832 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
834 if( __kmp_env_format && __kmp_monitor_stksize ) {
835 __kmp_str_buf_print( buffer,
"'\n");
839 #endif // KMP_USE_MONITOR 846 __kmp_stg_parse_settings(
char const * name,
char const * value,
void * data ) {
847 __kmp_stg_parse_bool( name, value, & __kmp_settings );
851 __kmp_stg_print_settings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
852 __kmp_stg_print_bool( buffer, name, __kmp_settings );
860 __kmp_stg_parse_stackpad(
char const * name,
char const * value,
void * data ) {
871 __kmp_stg_print_stackpad( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
872 __kmp_stg_print_int( buffer, name, __kmp_stkpadding );
880 __kmp_stg_parse_stackoffset(
char const * name,
char const * value,
void * data ) {
881 __kmp_stg_parse_size(
893 __kmp_stg_print_stackoffset( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
894 __kmp_stg_print_size( buffer, name, __kmp_stkoffset );
902 __kmp_stg_parse_stacksize(
char const * name,
char const * value,
void * data ) {
904 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
907 rc = __kmp_stg_check_rivals( name, value, stacksize->rivals );
911 __kmp_stg_parse_size(
914 __kmp_sys_min_stksize,
927 __kmp_stg_print_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
928 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
929 if( __kmp_env_format ) {
930 KMP_STR_BUF_PRINT_NAME_EX(name);
931 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
932 __kmp_str_buf_print( buffer,
"'\n" );
934 __kmp_str_buf_print( buffer,
" %s=", name );
935 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
936 __kmp_str_buf_print( buffer,
"\n" );
945 __kmp_stg_parse_version(
char const * name,
char const * value,
void * data ) {
946 __kmp_stg_parse_bool( name, value, & __kmp_version );
950 __kmp_stg_print_version( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
951 __kmp_stg_print_bool( buffer, name, __kmp_version );
959 __kmp_stg_parse_warnings(
char const * name,
char const * value,
void * data ) {
960 __kmp_stg_parse_bool( name, value, & __kmp_generate_warnings );
961 if (__kmp_generate_warnings != kmp_warnings_off) {
962 __kmp_generate_warnings = kmp_warnings_explicit;
967 __kmp_stg_print_warnings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
968 __kmp_stg_print_bool( buffer, name, __kmp_generate_warnings );
976 __kmp_stg_parse_nested(
char const * name,
char const * value,
void * data ) {
977 __kmp_stg_parse_bool( name, value, & __kmp_dflt_nested );
981 __kmp_stg_print_nested( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
982 __kmp_stg_print_bool( buffer, name, __kmp_dflt_nested );
986 __kmp_parse_nested_num_threads(
const char *var,
const char *env, kmp_nested_nthreads_t *nth_array )
988 const char *next = env;
989 const char *scan = next;
992 int prev_comma = FALSE;
998 if ( *next ==
'\0' ) {
1002 if ( ( ( *next <
'0' ) || ( *next >
'9' ) ) && ( *next !=
',') ) {
1003 KMP_WARNING( NthSyntaxError, var, env );
1007 if ( *next ==
',' ) {
1009 if ( total == 0 || prev_comma ) {
1017 if ( *next >=
'0' && *next <=
'9' ) {
1019 SKIP_DIGITS( next );
1021 const char *tmp = next;
1023 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
1024 KMP_WARNING( NthSpacesNotAllowed, var, env );
1029 KMP_DEBUG_ASSERT( total > 0 );
1031 KMP_WARNING( NthSyntaxError, var, env );
1036 if ( ! nth_array->nth ) {
1038 nth_array->nth = (
int * )KMP_INTERNAL_MALLOC(
sizeof(
int ) * total * 2 );
1039 if ( nth_array->nth == NULL ) {
1040 KMP_FATAL( MemoryAllocFailed );
1042 nth_array->size = total * 2;
1044 if ( nth_array->size < total ) {
1047 nth_array->size *= 2;
1048 }
while ( nth_array->size < total );
1050 nth_array->nth = (
int *) KMP_INTERNAL_REALLOC(
1051 nth_array->nth,
sizeof(
int ) * nth_array->size );
1052 if ( nth_array->nth == NULL ) {
1053 KMP_FATAL( MemoryAllocFailed );
1057 nth_array->used = total;
1065 if ( *scan ==
'\0' ) {
1069 if ( *scan ==
',' ) {
1074 nth_array->nth[i++] = 0;
1076 }
else if ( prev_comma ) {
1078 nth_array->nth[i] = nth_array->nth[i - 1];
1087 if ( *scan >=
'0' && *scan <=
'9' ) {
1089 const char *buf = scan;
1090 char const * msg = NULL;
1092 SKIP_DIGITS( scan );
1095 num = __kmp_str_to_int( buf, *scan );
1096 if ( num < KMP_MIN_NTH ) {
1097 msg = KMP_I18N_STR( ValueTooSmall );
1099 }
else if ( num > __kmp_sys_max_nth ) {
1100 msg = KMP_I18N_STR( ValueTooLarge );
1101 num = __kmp_sys_max_nth;
1103 if ( msg != NULL ) {
1105 KMP_WARNING( ParseSizeIntWarn, var, env, msg );
1106 KMP_INFORM( Using_int_Value, var, num );
1108 nth_array->nth[i++] = num;
1114 __kmp_stg_parse_num_threads(
char const * name,
char const * value,
void * data ) {
1116 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
1118 __kmp_nested_nth.nth = (
int* )KMP_INTERNAL_MALLOC(
sizeof(
int ) );
1119 __kmp_nested_nth.size = __kmp_nested_nth.used = 1;
1120 __kmp_nested_nth.nth[0] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub = __kmp_xproc;
1122 __kmp_parse_nested_num_threads( name, value, & __kmp_nested_nth );
1123 if ( __kmp_nested_nth.nth ) {
1124 __kmp_dflt_team_nth = __kmp_nested_nth.nth[0];
1125 if ( __kmp_dflt_team_nth_ub < __kmp_dflt_team_nth ) {
1126 __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth;
1130 K_DIAG( 1, (
"__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth ) );
1134 __kmp_stg_print_num_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1135 if( __kmp_env_format ) {
1136 KMP_STR_BUF_PRINT_NAME;
1138 __kmp_str_buf_print( buffer,
" %s", name );
1140 if ( __kmp_nested_nth.used ) {
1142 __kmp_str_buf_init( &buf );
1143 for (
int i = 0; i < __kmp_nested_nth.used; i++) {
1144 __kmp_str_buf_print( &buf,
"%d", __kmp_nested_nth.nth[i] );
1145 if ( i < __kmp_nested_nth.used - 1 ) {
1146 __kmp_str_buf_print( &buf,
"," );
1149 __kmp_str_buf_print( buffer,
"='%s'\n", buf.str );
1150 __kmp_str_buf_free(&buf);
1152 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1161 __kmp_stg_parse_tasking(
char const * name,
char const * value,
void * data ) {
1162 __kmp_stg_parse_int( name, value, 0, (
int)tskm_max, (
int *)&__kmp_tasking_mode );
1166 __kmp_stg_print_tasking( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1167 __kmp_stg_print_int( buffer, name, __kmp_tasking_mode );
1171 __kmp_stg_parse_task_stealing(
char const * name,
char const * value,
void * data ) {
1172 __kmp_stg_parse_int( name, value, 0, 1, (
int *)&__kmp_task_stealing_constraint );
1176 __kmp_stg_print_task_stealing( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1177 __kmp_stg_print_int( buffer, name, __kmp_task_stealing_constraint );
1181 __kmp_stg_parse_max_active_levels(
char const * name,
char const * value,
void * data ) {
1182 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_dflt_max_active_levels );
1186 __kmp_stg_print_max_active_levels( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1187 __kmp_stg_print_int( buffer, name, __kmp_dflt_max_active_levels );
1194 static void __kmp_stg_parse_default_device(
char const *name,
char const *value,
void *data) {
1195 __kmp_stg_parse_int(name, value, 0, KMP_MAX_DEFAULT_DEVICE_LIMIT, &__kmp_default_device);
1198 static void __kmp_stg_print_default_device(kmp_str_buf_t *buffer,
char const *name,
void *data) {
1199 __kmp_stg_print_int(buffer, name, __kmp_default_device);
1208 __kmp_stg_parse_max_task_priority(
char const *name,
char const *value,
void *data) {
1209 __kmp_stg_parse_int(name, value, 0, KMP_MAX_TASK_PRIORITY_LIMIT, &__kmp_max_task_priority);
1213 __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer,
char const *name,
void *data) {
1214 __kmp_stg_print_int(buffer, name, __kmp_max_task_priority);
1216 #endif // OMP_45_ENABLED 1222 __kmp_stg_parse_disp_buffers(
char const * name,
char const * value,
void * data ) {
1223 if ( TCR_4(__kmp_init_serial) ) {
1224 KMP_WARNING( EnvSerialWarn, name );
1227 __kmp_stg_parse_int( name, value, 1, KMP_MAX_NTH, & __kmp_dispatch_num_buffers );
1231 __kmp_stg_print_disp_buffers( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1232 __kmp_stg_print_int( buffer, name, __kmp_dispatch_num_buffers );
1235 #if KMP_NESTED_HOT_TEAMS 1241 __kmp_stg_parse_hot_teams_level(
char const * name,
char const * value,
void * data ) {
1242 if ( TCR_4(__kmp_init_parallel) ) {
1243 KMP_WARNING( EnvParallelWarn, name );
1246 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_max_level );
1250 __kmp_stg_print_hot_teams_level( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1251 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_max_level );
1255 __kmp_stg_parse_hot_teams_mode(
char const * name,
char const * value,
void * data ) {
1256 if ( TCR_4(__kmp_init_parallel) ) {
1257 KMP_WARNING( EnvParallelWarn, name );
1260 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_mode );
1264 __kmp_stg_print_hot_teams_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1265 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_mode );
1268 #endif // KMP_NESTED_HOT_TEAMS 1274 #if KMP_HANDLE_SIGNALS 1277 __kmp_stg_parse_handle_signals(
char const * name,
char const * value,
void * data ) {
1278 __kmp_stg_parse_bool( name, value, & __kmp_handle_signals );
1282 __kmp_stg_print_handle_signals( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1283 __kmp_stg_print_bool( buffer, name, __kmp_handle_signals );
1286 #endif // KMP_HANDLE_SIGNALS 1294 #define KMP_STG_X_DEBUG( x ) \ 1295 static void __kmp_stg_parse_##x##_debug( char const * name, char const * value, void * data ) { \ 1296 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_##x##_debug ); \ 1298 static void __kmp_stg_print_##x##_debug( kmp_str_buf_t * buffer, char const * name, void * data ) { \ 1299 __kmp_stg_print_int( buffer, name, kmp_##x##_debug ); \ 1302 KMP_STG_X_DEBUG( a )
1303 KMP_STG_X_DEBUG( b )
1304 KMP_STG_X_DEBUG( c )
1305 KMP_STG_X_DEBUG( d )
1306 KMP_STG_X_DEBUG( e )
1307 KMP_STG_X_DEBUG( f )
1309 #undef KMP_STG_X_DEBUG 1312 __kmp_stg_parse_debug(
char const * name,
char const * value,
void * data ) {
1314 __kmp_stg_parse_int( name, value, 0, INT_MAX, & debug );
1315 if ( kmp_a_debug < debug ) {
1316 kmp_a_debug = debug;
1318 if ( kmp_b_debug < debug ) {
1319 kmp_b_debug = debug;
1321 if ( kmp_c_debug < debug ) {
1322 kmp_c_debug = debug;
1324 if ( kmp_d_debug < debug ) {
1325 kmp_d_debug = debug;
1327 if ( kmp_e_debug < debug ) {
1328 kmp_e_debug = debug;
1330 if ( kmp_f_debug < debug ) {
1331 kmp_f_debug = debug;
1336 __kmp_stg_parse_debug_buf(
char const * name,
char const * value,
void * data ) {
1337 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf );
1340 if ( __kmp_debug_buf ) {
1342 int elements = __kmp_debug_buf_lines * __kmp_debug_buf_chars;
1345 __kmp_debug_buffer = (
char *) __kmp_page_allocate( elements *
sizeof(
char ) );
1346 for ( i = 0; i < elements; i += __kmp_debug_buf_chars )
1347 __kmp_debug_buffer[i] =
'\0';
1349 __kmp_debug_count = 0;
1351 K_DIAG( 1, (
"__kmp_debug_buf = %d\n", __kmp_debug_buf ) );
1355 __kmp_stg_print_debug_buf( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1356 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf );
1360 __kmp_stg_parse_debug_buf_atomic(
char const * name,
char const * value,
void * data ) {
1361 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf_atomic );
1365 __kmp_stg_print_debug_buf_atomic( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1366 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf_atomic );
1370 __kmp_stg_parse_debug_buf_chars(
char const * name,
char const * value,
void * data ) {
1371 __kmp_stg_parse_int(
1374 KMP_DEBUG_BUF_CHARS_MIN,
1376 & __kmp_debug_buf_chars
1381 __kmp_stg_print_debug_buf_chars( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1382 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_chars );
1386 __kmp_stg_parse_debug_buf_lines(
char const * name,
char const * value,
void * data ) {
1387 __kmp_stg_parse_int(
1390 KMP_DEBUG_BUF_LINES_MIN,
1392 & __kmp_debug_buf_lines
1397 __kmp_stg_print_debug_buf_lines( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1398 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_lines );
1402 __kmp_stg_parse_diag(
char const * name,
char const * value,
void * data ) {
1403 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_diag );
1407 __kmp_stg_print_diag( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1408 __kmp_stg_print_int( buffer, name, kmp_diag );
1418 __kmp_stg_parse_align_alloc(
char const * name,
char const * value,
void * data ) {
1419 __kmp_stg_parse_size(
1425 & __kmp_align_alloc,
1431 __kmp_stg_print_align_alloc( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1432 __kmp_stg_print_size( buffer, name, __kmp_align_alloc );
1443 __kmp_stg_parse_barrier_branch_bit(
char const * name,
char const * value,
void * data ) {
1447 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1448 var = __kmp_barrier_branch_bit_env_name[ i ];
1449 if ( ( strcmp( var, name) == 0 ) && ( value != 0 ) ) {
1452 comma = (
char *) strchr( value,
',' );
1453 __kmp_barrier_gather_branch_bits[ i ] = ( kmp_uint32 ) __kmp_str_to_int( value,
',' );
1455 if ( comma == NULL ) {
1456 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1458 __kmp_barrier_release_branch_bits[ i ] = (kmp_uint32) __kmp_str_to_int( comma + 1, 0 );
1460 if ( __kmp_barrier_release_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1461 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1462 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1465 if ( __kmp_barrier_gather_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1466 KMP_WARNING( BarrGatherValueInvalid, name, value );
1467 KMP_INFORM( Using_uint_Value, name, __kmp_barrier_gather_bb_dflt );
1468 __kmp_barrier_gather_branch_bits[ i ] = __kmp_barrier_gather_bb_dflt;
1471 K_DIAG(1, (
"%s == %d,%d\n", __kmp_barrier_branch_bit_env_name[ i ], \
1472 __kmp_barrier_gather_branch_bits [ i ], \
1473 __kmp_barrier_release_branch_bits [ i ]))
1478 __kmp_stg_print_barrier_branch_bit( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1480 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1481 var = __kmp_barrier_branch_bit_env_name[ i ];
1482 if ( strcmp( var, name) == 0 ) {
1483 if( __kmp_env_format ) {
1484 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_branch_bit_env_name[ i ]);
1486 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_branch_bit_env_name[ i ] );
1488 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_barrier_gather_branch_bits [ i ], __kmp_barrier_release_branch_bits [ i ]);
1502 __kmp_stg_parse_barrier_pattern(
char const * name,
char const * value,
void * data ) {
1506 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1507 var = __kmp_barrier_pattern_env_name[ i ];
1509 if ( ( strcmp ( var, name ) == 0 ) && ( value != 0 ) ) {
1511 char *comma = (
char *) strchr( value,
',' );
1514 for ( j = bp_linear_bar; j<bp_last_bar; j++ ) {
1515 if (__kmp_match_with_sentinel( __kmp_barrier_pattern_name[j], value, 1,
',' )) {
1516 __kmp_barrier_gather_pattern[ i ] = (kmp_bar_pat_e) j;
1520 if ( j == bp_last_bar ) {
1521 KMP_WARNING( BarrGatherValueInvalid, name, value );
1522 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1526 if ( comma != NULL ) {
1527 for ( j = bp_linear_bar; j < bp_last_bar; j++ ) {
1528 if ( __kmp_str_match( __kmp_barrier_pattern_name[j], 1, comma + 1 ) ) {
1529 __kmp_barrier_release_pattern[ i ] = (kmp_bar_pat_e) j;
1533 if (j == bp_last_bar) {
1534 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1535 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1543 __kmp_stg_print_barrier_pattern( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1545 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1546 var = __kmp_barrier_pattern_env_name[ i ];
1547 if ( strcmp ( var, name ) == 0 ) {
1548 int j = __kmp_barrier_gather_pattern [ i ];
1549 int k = __kmp_barrier_release_pattern [ i ];
1550 if( __kmp_env_format ) {
1551 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_pattern_env_name[ i ]);
1553 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_pattern_env_name[ i ] );
1555 __kmp_str_buf_print( buffer,
"%s,%s'\n", __kmp_barrier_pattern_name [ j ], __kmp_barrier_pattern_name [ k ]);
1565 __kmp_stg_parse_abort_delay(
char const * name,
char const * value,
void * data ) {
1567 int delay = __kmp_abort_delay / 1000;
1568 __kmp_stg_parse_int( name, value, 0, INT_MAX / 1000, & delay );
1569 __kmp_abort_delay = delay * 1000;
1573 __kmp_stg_print_abort_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1574 __kmp_stg_print_int( buffer, name, __kmp_abort_delay );
1582 __kmp_stg_parse_cpuinfo_file(
char const * name,
char const * value,
void * data ) {
1583 #if KMP_AFFINITY_SUPPORTED 1584 __kmp_stg_parse_str( name, value, & __kmp_cpuinfo_file );
1585 K_DIAG( 1, (
"__kmp_cpuinfo_file == %s\n", __kmp_cpuinfo_file ) );
1590 __kmp_stg_print_cpuinfo_file( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1591 #if KMP_AFFINITY_SUPPORTED 1592 if( __kmp_env_format ) {
1593 KMP_STR_BUF_PRINT_NAME;
1595 __kmp_str_buf_print( buffer,
" %s", name );
1597 if ( __kmp_cpuinfo_file ) {
1598 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_cpuinfo_file );
1600 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1610 __kmp_stg_parse_force_reduction(
char const * name,
char const * value,
void * data )
1612 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1615 rc = __kmp_stg_check_rivals( name, value, reduction->rivals );
1619 if ( reduction->force ) {
1621 if( __kmp_str_match(
"critical", 0, value ) )
1622 __kmp_force_reduction_method = critical_reduce_block;
1623 else if( __kmp_str_match(
"atomic", 0, value ) )
1624 __kmp_force_reduction_method = atomic_reduce_block;
1625 else if( __kmp_str_match(
"tree", 0, value ) )
1626 __kmp_force_reduction_method = tree_reduce_block;
1628 KMP_FATAL( UnknownForceReduction, name, value );
1632 __kmp_stg_parse_bool( name, value, & __kmp_determ_red );
1633 if( __kmp_determ_red ) {
1634 __kmp_force_reduction_method = tree_reduce_block;
1636 __kmp_force_reduction_method = reduction_method_not_defined;
1639 K_DIAG( 1, (
"__kmp_force_reduction_method == %d\n", __kmp_force_reduction_method ) );
1643 __kmp_stg_print_force_reduction( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1645 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1646 if ( reduction->force ) {
1647 if( __kmp_force_reduction_method == critical_reduce_block) {
1648 __kmp_stg_print_str( buffer, name,
"critical");
1649 }
else if ( __kmp_force_reduction_method == atomic_reduce_block ) {
1650 __kmp_stg_print_str( buffer, name,
"atomic");
1651 }
else if ( __kmp_force_reduction_method == tree_reduce_block ) {
1652 __kmp_stg_print_str( buffer, name,
"tree");
1654 if( __kmp_env_format ) {
1655 KMP_STR_BUF_PRINT_NAME;
1657 __kmp_str_buf_print( buffer,
" %s", name );
1659 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1662 __kmp_stg_print_bool( buffer, name, __kmp_determ_red );
1673 __kmp_stg_parse_storage_map(
char const * name,
char const * value,
void * data ) {
1674 if ( __kmp_str_match(
"verbose", 1, value ) ) {
1675 __kmp_storage_map = TRUE;
1676 __kmp_storage_map_verbose = TRUE;
1677 __kmp_storage_map_verbose_specified = TRUE;
1680 __kmp_storage_map_verbose = FALSE;
1681 __kmp_stg_parse_bool( name, value, & __kmp_storage_map );
1686 __kmp_stg_print_storage_map( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1687 if ( __kmp_storage_map_verbose || __kmp_storage_map_verbose_specified ) {
1688 __kmp_stg_print_str( buffer, name,
"verbose" );
1690 __kmp_stg_print_bool( buffer, name, __kmp_storage_map );
1699 __kmp_stg_parse_all_threadprivate(
char const * name,
char const * value,
void * data ) {
1700 __kmp_stg_parse_int( name, value, __kmp_allThreadsSpecified ? __kmp_max_nth : 1, __kmp_max_nth,
1701 & __kmp_tp_capacity );
1705 __kmp_stg_print_all_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1706 __kmp_stg_print_int( buffer, name, __kmp_tp_capacity );
1715 __kmp_stg_parse_foreign_threads_threadprivate(
char const * name,
char const * value,
void * data ) {
1716 __kmp_stg_parse_bool( name, value, & __kmp_foreign_tp );
1720 __kmp_stg_print_foreign_threads_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1721 __kmp_stg_print_bool( buffer, name, __kmp_foreign_tp );
1729 #if KMP_AFFINITY_SUPPORTED 1734 __kmp_parse_affinity_proc_id_list(
const char *var,
const char *env,
1735 const char **nextEnv,
char **proclist )
1737 const char *scan = env;
1738 const char *next = scan;
1744 int start, end, stride;
1748 if (*next ==
'\0') {
1761 if ((*next <
'0') || (*next >
'9')) {
1762 KMP_WARNING( AffSyntaxError, var );
1766 num = __kmp_str_to_int(scan, *next);
1767 KMP_ASSERT(num >= 0);
1791 if ((*next <
'0') || (*next >
'9')) {
1792 KMP_WARNING( AffSyntaxError, var );
1797 num = __kmp_str_to_int(scan, *next);
1798 KMP_ASSERT(num >= 0);
1813 if ((*next <
'0') || (*next >
'9')) {
1815 KMP_WARNING( AffSyntaxError, var );
1825 start = __kmp_str_to_int(scan, *next);
1826 KMP_ASSERT(start >= 0);
1851 if ((*next <
'0') || (*next >
'9')) {
1852 KMP_WARNING( AffSyntaxError, var );
1856 end = __kmp_str_to_int(scan, *next);
1857 KMP_ASSERT(end >= 0);
1878 if ((*next <
'0') || (*next >
'9')) {
1879 KMP_WARNING( AffSyntaxError, var );
1883 stride = __kmp_str_to_int(scan, *next);
1884 KMP_ASSERT(stride >= 0);
1892 KMP_WARNING( AffZeroStride, var );
1897 KMP_WARNING( AffStartGreaterEnd, var, start, end );
1903 KMP_WARNING( AffStrideLessZero, var, start, end );
1907 if ((end - start) / stride > 65536 ) {
1908 KMP_WARNING( AffRangeTooBig, var, end, start, stride );
1927 int len = next - env;
1928 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
1929 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
1930 retlist[len] =
'\0';
1931 *proclist = retlist;
1941 static kmp_setting_t *__kmp_affinity_notype = NULL;
1944 __kmp_parse_affinity_env(
char const * name,
char const * value,
1945 enum affinity_type * out_type,
1946 char ** out_proclist,
1950 enum affinity_gran * out_gran,
1951 int * out_gran_levels,
1957 char * buffer = NULL;
1967 int max_proclist = 0;
1974 KMP_ASSERT( value != NULL );
1976 if ( TCR_4(__kmp_init_middle) ) {
1977 KMP_WARNING( EnvMiddleWarn, name );
1978 __kmp_env_toPrint( name, 0 );
1981 __kmp_env_toPrint( name, 1 );
1983 buffer = __kmp_str_format(
"%s", value );
1995 #define EMIT_WARN(skip,errlist) \ 1999 SKIP_TO(next, ','); \ 2003 KMP_WARNING errlist; \ 2006 if (ch == ',') next++; \ 2011 #define _set_param(_guard,_var,_val) \ 2013 if ( _guard == 0 ) { \ 2016 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \ 2021 #define set_type(val) _set_param( type, *out_type, val ) 2022 #define set_verbose(val) _set_param( verbose, *out_verbose, val ) 2023 #define set_warnings(val) _set_param( warnings, *out_warn, val ) 2024 #define set_respect(val) _set_param( respect, *out_respect, val ) 2025 #define set_dups(val) _set_param( dups, *out_dups, val ) 2026 #define set_proclist(val) _set_param( proclist, *out_proclist, val ) 2028 #define set_gran(val,levels) \ 2030 if ( gran == 0 ) { \ 2032 *out_gran_levels = levels; \ 2034 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \ 2040 KMP_DEBUG_ASSERT( ( __kmp_nested_proc_bind.bind_types != NULL )
2041 && ( __kmp_nested_proc_bind.used > 0 ) );
2044 while ( *buf !=
'\0' ) {
2047 if (__kmp_match_str(
"none", buf, (
const char **)&next)) {
2048 set_type( affinity_none );
2050 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2053 }
else if (__kmp_match_str(
"scatter", buf, (
const char **)&next)) {
2054 set_type( affinity_scatter );
2056 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2059 }
else if (__kmp_match_str(
"compact", buf, (
const char **)&next)) {
2060 set_type( affinity_compact );
2062 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2065 }
else if (__kmp_match_str(
"logical", buf, (
const char **)&next)) {
2066 set_type( affinity_logical );
2068 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2071 }
else if (__kmp_match_str(
"physical", buf, (
const char **)&next)) {
2072 set_type( affinity_physical );
2074 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2077 }
else if (__kmp_match_str(
"explicit", buf, (
const char **)&next)) {
2078 set_type( affinity_explicit );
2080 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2083 }
else if (__kmp_match_str(
"balanced", buf, (
const char **)&next)) {
2084 set_type( affinity_balanced );
2086 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2089 }
else if (__kmp_match_str(
"disabled", buf, (
const char **)&next)) {
2090 set_type( affinity_disabled );
2092 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2095 }
else if (__kmp_match_str(
"verbose", buf, (
const char **)&next)) {
2096 set_verbose( TRUE );
2098 }
else if (__kmp_match_str(
"noverbose", buf, (
const char **)&next)) {
2099 set_verbose( FALSE );
2101 }
else if (__kmp_match_str(
"warnings", buf, (
const char **)&next)) {
2102 set_warnings( TRUE );
2104 }
else if (__kmp_match_str(
"nowarnings", buf, (
const char **)&next)) {
2105 set_warnings( FALSE );
2107 }
else if (__kmp_match_str(
"respect", buf, (
const char **)&next)) {
2108 set_respect( TRUE );
2110 }
else if (__kmp_match_str(
"norespect", buf, (
const char **)&next)) {
2111 set_respect( FALSE );
2113 }
else if (__kmp_match_str(
"duplicates", buf, (
const char **)&next)
2114 || __kmp_match_str(
"dups", buf, (
const char **)&next)) {
2117 }
else if (__kmp_match_str(
"noduplicates", buf, (
const char **)&next)
2118 || __kmp_match_str(
"nodups", buf, (
const char **)&next)) {
2121 }
else if (__kmp_match_str(
"granularity", buf, (
const char **)&next)
2122 || __kmp_match_str(
"gran", buf, (
const char **)&next)) {
2125 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2132 if (__kmp_match_str(
"fine", buf, (
const char **)&next)) {
2133 set_gran( affinity_gran_fine, -1 );
2135 }
else if (__kmp_match_str(
"thread", buf, (
const char **)&next)) {
2136 set_gran( affinity_gran_thread, -1 );
2138 }
else if (__kmp_match_str(
"core", buf, (
const char **)&next)) {
2139 set_gran( affinity_gran_core, -1 );
2141 }
else if (__kmp_match_str(
"package", buf, (
const char **)&next)) {
2142 set_gran( affinity_gran_package, -1 );
2144 }
else if (__kmp_match_str(
"node", buf, (
const char **)&next)) {
2145 set_gran( affinity_gran_node, -1 );
2147 # if KMP_GROUP_AFFINITY 2148 }
else if (__kmp_match_str(
"group", buf, (
const char **)&next)) {
2149 set_gran( affinity_gran_group, -1 );
2152 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2156 n = __kmp_str_to_int( buf, *next );
2159 set_gran( affinity_gran_default, n );
2161 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2164 }
else if (__kmp_match_str(
"proclist", buf, (
const char **)&next)) {
2165 char *temp_proclist;
2169 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2175 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2180 if (! __kmp_parse_affinity_proc_id_list(name, buf,
2181 (
const char **)&next, &temp_proclist)) {
2186 if (*next ==
']') next++;
2188 if (*next ==
',') next++;
2193 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2197 set_proclist( temp_proclist );
2198 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2203 n = __kmp_str_to_int( buf, *next );
2207 number[ count ] = n;
2209 KMP_WARNING( AffManyParams, name, start );
2213 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2222 else if (*next !=
'\0') {
2223 const char *temp = next;
2224 EMIT_WARN( TRUE, ( ParseExtraCharsWarn, name, temp ) );
2236 #undef set_granularity 2238 __kmp_str_free((
const char **) &buffer);
2242 KMP_WARNING( AffProcListNoType, name );
2243 __kmp_affinity_type = affinity_explicit;
2245 else if ( __kmp_affinity_type != affinity_explicit ) {
2246 KMP_WARNING( AffProcListNotExplicit, name );
2247 KMP_ASSERT( *out_proclist != NULL );
2248 KMP_INTERNAL_FREE( *out_proclist );
2249 *out_proclist = NULL;
2252 switch ( *out_type ) {
2253 case affinity_logical:
2254 case affinity_physical: {
2256 *out_offset = number[ 0 ];
2259 KMP_WARNING( AffManyParamsForLogic, name, number[ 1 ] );
2262 case affinity_balanced: {
2264 *out_compact = number[ 0 ];
2267 *out_offset = number[ 1 ];
2270 if ( __kmp_affinity_gran == affinity_gran_default ) {
2271 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 2272 if( __kmp_mic_type != non_mic ) {
2273 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2274 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"fine" );
2276 __kmp_affinity_gran = affinity_gran_fine;
2280 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2281 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"core" );
2283 __kmp_affinity_gran = affinity_gran_core;
2287 case affinity_scatter:
2288 case affinity_compact: {
2290 *out_compact = number[ 0 ];
2293 *out_offset = number[ 1 ];
2296 case affinity_explicit: {
2297 if ( *out_proclist == NULL ) {
2298 KMP_WARNING( AffNoProcList, name );
2299 __kmp_affinity_type = affinity_none;
2302 KMP_WARNING( AffNoParam, name,
"explicit" );
2305 case affinity_none: {
2307 KMP_WARNING( AffNoParam, name,
"none" );
2310 case affinity_disabled: {
2312 KMP_WARNING( AffNoParam, name,
"disabled" );
2315 case affinity_default: {
2317 KMP_WARNING( AffNoParam, name,
"default" );
2327 __kmp_stg_parse_affinity(
char const * name,
char const * value,
void * data )
2329 kmp_setting_t **rivals = (kmp_setting_t **) data;
2332 rc = __kmp_stg_check_rivals( name, value, rivals );
2337 __kmp_parse_affinity_env( name, value, & __kmp_affinity_type,
2338 & __kmp_affinity_proclist, & __kmp_affinity_verbose,
2339 & __kmp_affinity_warnings, & __kmp_affinity_respect_mask,
2340 & __kmp_affinity_gran, & __kmp_affinity_gran_levels,
2341 & __kmp_affinity_dups, & __kmp_affinity_compact,
2342 & __kmp_affinity_offset );
2347 __kmp_stg_print_affinity( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
2348 if( __kmp_env_format ) {
2349 KMP_STR_BUF_PRINT_NAME_EX(name);
2351 __kmp_str_buf_print( buffer,
" %s='", name );
2353 if ( __kmp_affinity_verbose ) {
2354 __kmp_str_buf_print( buffer,
"%s,",
"verbose");
2356 __kmp_str_buf_print( buffer,
"%s,",
"noverbose");
2358 if ( __kmp_affinity_warnings ) {
2359 __kmp_str_buf_print( buffer,
"%s,",
"warnings");
2361 __kmp_str_buf_print( buffer,
"%s,",
"nowarnings");
2363 if ( KMP_AFFINITY_CAPABLE() ) {
2364 if ( __kmp_affinity_respect_mask ) {
2365 __kmp_str_buf_print( buffer,
"%s,",
"respect");
2367 __kmp_str_buf_print( buffer,
"%s,",
"norespect");
2369 switch ( __kmp_affinity_gran ) {
2370 case affinity_gran_default:
2371 __kmp_str_buf_print( buffer,
"%s",
"granularity=default,");
2373 case affinity_gran_fine:
2374 __kmp_str_buf_print( buffer,
"%s",
"granularity=fine,");
2376 case affinity_gran_thread:
2377 __kmp_str_buf_print( buffer,
"%s",
"granularity=thread,");
2379 case affinity_gran_core:
2380 __kmp_str_buf_print( buffer,
"%s",
"granularity=core,");
2382 case affinity_gran_package:
2383 __kmp_str_buf_print( buffer,
"%s",
"granularity=package,");
2385 case affinity_gran_node:
2386 __kmp_str_buf_print( buffer,
"%s",
"granularity=node,");
2388 # if KMP_GROUP_AFFINITY 2389 case affinity_gran_group:
2390 __kmp_str_buf_print( buffer,
"%s",
"granularity=group,");
2394 if ( __kmp_affinity_dups ) {
2395 __kmp_str_buf_print( buffer,
"%s,",
"duplicates");
2397 __kmp_str_buf_print( buffer,
"%s,",
"noduplicates");
2400 if ( ! KMP_AFFINITY_CAPABLE() ) {
2401 __kmp_str_buf_print( buffer,
"%s",
"disabled" );
2403 else switch ( __kmp_affinity_type ){
2405 __kmp_str_buf_print( buffer,
"%s",
"none");
2407 case affinity_physical:
2408 __kmp_str_buf_print( buffer,
"%s,%d",
"physical",
2409 __kmp_affinity_offset );
2411 case affinity_logical:
2412 __kmp_str_buf_print( buffer,
"%s,%d",
"logical",
2413 __kmp_affinity_offset );
2415 case affinity_compact:
2416 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"compact",
2417 __kmp_affinity_compact, __kmp_affinity_offset );
2419 case affinity_scatter:
2420 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"scatter",
2421 __kmp_affinity_compact, __kmp_affinity_offset );
2423 case affinity_explicit:
2424 __kmp_str_buf_print( buffer,
"%s=[%s],%s",
"proclist",
2425 __kmp_affinity_proclist,
"explicit" );
2427 case affinity_balanced:
2428 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"balanced",
2429 __kmp_affinity_compact, __kmp_affinity_offset );
2431 case affinity_disabled:
2432 __kmp_str_buf_print( buffer,
"%s",
"disabled");
2434 case affinity_default:
2435 __kmp_str_buf_print( buffer,
"%s",
"default");
2438 __kmp_str_buf_print( buffer,
"%s",
"<unknown>");
2441 __kmp_str_buf_print( buffer,
"'\n" );
2444 # ifdef KMP_GOMP_COMPAT 2447 __kmp_stg_parse_gomp_cpu_affinity(
char const * name,
char const * value,
void * data )
2449 const char * next = NULL;
2450 char * temp_proclist;
2451 kmp_setting_t **rivals = (kmp_setting_t **) data;
2454 rc = __kmp_stg_check_rivals( name, value, rivals );
2459 if ( TCR_4(__kmp_init_middle) ) {
2460 KMP_WARNING( EnvMiddleWarn, name );
2461 __kmp_env_toPrint( name, 0 );
2465 __kmp_env_toPrint( name, 1 );
2467 if ( __kmp_parse_affinity_proc_id_list( name, value, &next,
2470 if (*next ==
'\0') {
2474 __kmp_affinity_proclist = temp_proclist;
2475 __kmp_affinity_type = affinity_explicit;
2476 __kmp_affinity_gran = affinity_gran_fine;
2478 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2482 KMP_WARNING( AffSyntaxError, name );
2483 if (temp_proclist != NULL) {
2484 KMP_INTERNAL_FREE((
void *)temp_proclist);
2492 __kmp_affinity_type = affinity_none;
2494 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2527 __kmp_parse_subplace_list(
const char *var,
const char **scan )
2532 int start, count, stride;
2538 if ((**scan <
'0') || (**scan >
'9')) {
2539 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2544 start = __kmp_str_to_int(*scan, *next);
2545 KMP_ASSERT(start >= 0);
2552 if (**scan ==
'}') {
2555 if (**scan ==
',') {
2559 if (**scan !=
':') {
2560 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2569 if ((**scan <
'0') || (**scan >
'9')) {
2570 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2575 count = __kmp_str_to_int(*scan, *next);
2576 KMP_ASSERT(count >= 0);
2583 if (**scan ==
'}') {
2586 if (**scan ==
',') {
2590 if (**scan !=
':') {
2591 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2602 if (**scan ==
'+') {
2606 if (**scan ==
'-') {
2614 if ((**scan <
'0') || (**scan >
'9')) {
2615 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2620 stride = __kmp_str_to_int(*scan, *next);
2621 KMP_ASSERT(stride >= 0);
2629 if (**scan ==
'}') {
2632 if (**scan ==
',') {
2637 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2644 __kmp_parse_place(
const char *var,
const char ** scan )
2652 if (**scan ==
'{') {
2654 if (! __kmp_parse_subplace_list(var, scan)) {
2657 if (**scan !=
'}') {
2658 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2663 else if (**scan ==
'!') {
2665 return __kmp_parse_place(var, scan);
2667 else if ((**scan >=
'0') && (**scan <=
'9')) {
2670 int proc = __kmp_str_to_int(*scan, *next);
2671 KMP_ASSERT(proc >= 0);
2675 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2682 __kmp_parse_place_list(
const char *var,
const char *env,
char **place_list )
2684 const char *scan = env;
2685 const char *next = scan;
2688 int start, count, stride;
2690 if (! __kmp_parse_place(var, &scan)) {
2698 if (*scan ==
'\0') {
2706 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2715 if ((*scan <
'0') || (*scan >
'9')) {
2716 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2721 count = __kmp_str_to_int(scan, *next);
2722 KMP_ASSERT(count >= 0);
2729 if (*scan ==
'\0') {
2737 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2760 if ((*scan <
'0') || (*scan >
'9')) {
2761 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2766 stride = __kmp_str_to_int(scan, *next);
2767 KMP_ASSERT(stride >= 0);
2775 if (*scan ==
'\0') {
2783 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2788 int len = scan - env;
2789 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
2790 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
2791 retlist[len] =
'\0';
2792 *place_list = retlist;
2798 __kmp_stg_parse_places(
char const * name,
char const * value,
void * data )
2801 const char *scan = value;
2802 const char *next = scan;
2803 const char *kind =
"\"threads\"";
2804 kmp_setting_t **rivals = (kmp_setting_t **) data;
2807 rc = __kmp_stg_check_rivals( name, value, rivals );
2816 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2817 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2822 if ( __kmp_match_str(
"threads", scan, &next ) ) {
2824 __kmp_affinity_type = affinity_compact;
2825 __kmp_affinity_gran = affinity_gran_thread;
2826 __kmp_affinity_dups = FALSE;
2827 kind =
"\"threads\"";
2829 else if ( __kmp_match_str(
"cores", scan, &next ) ) {
2831 __kmp_affinity_type = affinity_compact;
2832 __kmp_affinity_gran = affinity_gran_core;
2833 __kmp_affinity_dups = FALSE;
2836 else if ( __kmp_match_str(
"sockets", scan, &next ) ) {
2838 __kmp_affinity_type = affinity_compact;
2839 __kmp_affinity_gran = affinity_gran_package;
2840 __kmp_affinity_dups = FALSE;
2841 kind =
"\"sockets\"";
2844 if ( __kmp_affinity_proclist != NULL ) {
2845 KMP_INTERNAL_FREE( (
void *)__kmp_affinity_proclist );
2846 __kmp_affinity_proclist = NULL;
2848 if ( __kmp_parse_place_list( name, value, &__kmp_affinity_proclist ) ) {
2849 __kmp_affinity_type = affinity_explicit;
2850 __kmp_affinity_gran = affinity_gran_fine;
2851 __kmp_affinity_dups = FALSE;
2852 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2853 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2859 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2860 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2864 if ( *scan ==
'\0' ) {
2871 if ( *scan !=
'(' ) {
2872 KMP_WARNING( SyntaxErrorUsing, name, kind );
2880 count = __kmp_str_to_int(scan, *next);
2881 KMP_ASSERT(count >= 0);
2885 if ( *scan !=
')' ) {
2886 KMP_WARNING( SyntaxErrorUsing, name, kind );
2892 if ( *scan !=
'\0' ) {
2893 KMP_WARNING( ParseExtraCharsWarn, name, scan );
2895 __kmp_affinity_num_places = count;
2899 __kmp_stg_print_places( kmp_str_buf_t * buffer,
char const * name,
2902 if( __kmp_env_format ) {
2903 KMP_STR_BUF_PRINT_NAME;
2905 __kmp_str_buf_print( buffer,
" %s", name );
2907 if ( ( __kmp_nested_proc_bind.used == 0 )
2908 || ( __kmp_nested_proc_bind.bind_types == NULL )
2909 || ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_false ) ) {
2910 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2912 else if ( __kmp_affinity_type == affinity_explicit ) {
2913 if ( __kmp_affinity_proclist != NULL ) {
2914 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_affinity_proclist );
2917 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2920 else if ( __kmp_affinity_type == affinity_compact ) {
2922 if ( __kmp_affinity_num_masks > 0 ) {
2923 num = __kmp_affinity_num_masks;
2925 else if ( __kmp_affinity_num_places > 0 ) {
2926 num = __kmp_affinity_num_places;
2931 if ( __kmp_affinity_gran == affinity_gran_thread ) {
2933 __kmp_str_buf_print( buffer,
"='threads(%d)'\n", num );
2936 __kmp_str_buf_print( buffer,
"='threads'\n" );
2939 else if ( __kmp_affinity_gran == affinity_gran_core ) {
2941 __kmp_str_buf_print( buffer,
"='cores(%d)' \n", num );
2944 __kmp_str_buf_print( buffer,
"='cores'\n" );
2947 else if ( __kmp_affinity_gran == affinity_gran_package ) {
2949 __kmp_str_buf_print( buffer,
"='sockets(%d)'\n", num );
2952 __kmp_str_buf_print( buffer,
"='sockets'\n" );
2956 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2960 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2966 # if (! OMP_40_ENABLED) 2969 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
2972 kmp_setting_t **rivals = (kmp_setting_t **) data;
2975 rc = __kmp_stg_check_rivals( name, value, rivals );
2983 __kmp_stg_parse_bool( name, value, & enabled );
2989 __kmp_affinity_type = affinity_scatter;
2990 # if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 2991 if( __kmp_mic_type != non_mic )
2992 __kmp_affinity_gran = affinity_gran_fine;
2995 __kmp_affinity_gran = affinity_gran_core;
2998 __kmp_affinity_type = affinity_none;
3006 __kmp_stg_parse_topology_method(
char const * name,
char const * value,
3008 if ( __kmp_str_match(
"all", 1, value ) ) {
3009 __kmp_affinity_top_method = affinity_top_method_all;
3011 # if KMP_ARCH_X86 || KMP_ARCH_X86_64 3012 else if ( __kmp_str_match(
"x2apic id", 9, value )
3013 || __kmp_str_match(
"x2apic_id", 9, value )
3014 || __kmp_str_match(
"x2apic-id", 9, value )
3015 || __kmp_str_match(
"x2apicid", 8, value )
3016 || __kmp_str_match(
"cpuid leaf 11", 13, value )
3017 || __kmp_str_match(
"cpuid_leaf_11", 13, value )
3018 || __kmp_str_match(
"cpuid-leaf-11", 13, value )
3019 || __kmp_str_match(
"cpuid leaf11", 12, value )
3020 || __kmp_str_match(
"cpuid_leaf11", 12, value )
3021 || __kmp_str_match(
"cpuid-leaf11", 12, value )
3022 || __kmp_str_match(
"cpuidleaf 11", 12, value )
3023 || __kmp_str_match(
"cpuidleaf_11", 12, value )
3024 || __kmp_str_match(
"cpuidleaf-11", 12, value )
3025 || __kmp_str_match(
"cpuidleaf11", 11, value )
3026 || __kmp_str_match(
"cpuid 11", 8, value )
3027 || __kmp_str_match(
"cpuid_11", 8, value )
3028 || __kmp_str_match(
"cpuid-11", 8, value )
3029 || __kmp_str_match(
"cpuid11", 7, value )
3030 || __kmp_str_match(
"leaf 11", 7, value )
3031 || __kmp_str_match(
"leaf_11", 7, value )
3032 || __kmp_str_match(
"leaf-11", 7, value )
3033 || __kmp_str_match(
"leaf11", 6, value ) ) {
3034 __kmp_affinity_top_method = affinity_top_method_x2apicid;
3036 else if ( __kmp_str_match(
"apic id", 7, value )
3037 || __kmp_str_match(
"apic_id", 7, value )
3038 || __kmp_str_match(
"apic-id", 7, value )
3039 || __kmp_str_match(
"apicid", 6, value )
3040 || __kmp_str_match(
"cpuid leaf 4", 12, value )
3041 || __kmp_str_match(
"cpuid_leaf_4", 12, value )
3042 || __kmp_str_match(
"cpuid-leaf-4", 12, value )
3043 || __kmp_str_match(
"cpuid leaf4", 11, value )
3044 || __kmp_str_match(
"cpuid_leaf4", 11, value )
3045 || __kmp_str_match(
"cpuid-leaf4", 11, value )
3046 || __kmp_str_match(
"cpuidleaf 4", 11, value )
3047 || __kmp_str_match(
"cpuidleaf_4", 11, value )
3048 || __kmp_str_match(
"cpuidleaf-4", 11, value )
3049 || __kmp_str_match(
"cpuidleaf4", 10, value )
3050 || __kmp_str_match(
"cpuid 4", 7, value )
3051 || __kmp_str_match(
"cpuid_4", 7, value )
3052 || __kmp_str_match(
"cpuid-4", 7, value )
3053 || __kmp_str_match(
"cpuid4", 6, value )
3054 || __kmp_str_match(
"leaf 4", 6, value )
3055 || __kmp_str_match(
"leaf_4", 6, value )
3056 || __kmp_str_match(
"leaf-4", 6, value )
3057 || __kmp_str_match(
"leaf4", 5, value ) ) {
3058 __kmp_affinity_top_method = affinity_top_method_apicid;
3061 else if ( __kmp_str_match(
"/proc/cpuinfo", 2, value )
3062 || __kmp_str_match(
"cpuinfo", 5, value )) {
3063 __kmp_affinity_top_method = affinity_top_method_cpuinfo;
3065 # if KMP_GROUP_AFFINITY 3066 else if ( __kmp_str_match(
"group", 1, value ) ) {
3067 __kmp_affinity_top_method = affinity_top_method_group;
3070 else if ( __kmp_str_match(
"flat", 1, value ) ) {
3071 __kmp_affinity_top_method = affinity_top_method_flat;
3074 else if ( __kmp_str_match(
"hwloc", 1, value) ) {
3075 __kmp_affinity_top_method = affinity_top_method_hwloc;
3079 KMP_WARNING( StgInvalidValue, name, value );
3084 __kmp_stg_print_topology_method( kmp_str_buf_t * buffer,
char const * name,
3087 char const * value = NULL;
3089 switch ( __kmp_affinity_top_method ) {
3090 case affinity_top_method_default:
3094 case affinity_top_method_all:
3098 # if KMP_ARCH_X86 || KMP_ARCH_X86_64 3099 case affinity_top_method_x2apicid:
3100 value =
"x2APIC id";
3103 case affinity_top_method_apicid:
3108 case affinity_top_method_cpuinfo:
3112 # if KMP_GROUP_AFFINITY 3113 case affinity_top_method_group:
3118 case affinity_top_method_flat:
3123 if ( value != NULL ) {
3124 __kmp_stg_print_str( buffer, name, value );
3139 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
3141 kmp_setting_t **rivals = (kmp_setting_t **) data;
3144 rc = __kmp_stg_check_rivals( name, value, rivals );
3152 KMP_DEBUG_ASSERT( (__kmp_nested_proc_bind.bind_types != NULL)
3153 && ( __kmp_nested_proc_bind.used > 0 ) );
3155 const char *buf = value;
3159 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3161 SKIP_DIGITS( next );
3162 num = __kmp_str_to_int( buf, *next );
3163 KMP_ASSERT( num >= 0 );
3172 if ( __kmp_match_str(
"disabled", buf, &next ) ) {
3175 # if KMP_AFFINITY_SUPPORTED 3176 __kmp_affinity_type = affinity_disabled;
3178 __kmp_nested_proc_bind.used = 1;
3179 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3181 else if ( ( num == (
int)proc_bind_false )
3182 || __kmp_match_str(
"false", buf, &next ) ) {
3185 # if KMP_AFFINITY_SUPPORTED 3186 __kmp_affinity_type = affinity_none;
3188 __kmp_nested_proc_bind.used = 1;
3189 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3191 else if ( ( num == (
int)proc_bind_true )
3192 || __kmp_match_str(
"true", buf, &next ) ) {
3195 __kmp_nested_proc_bind.used = 1;
3196 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3204 for ( scan = buf; *scan !=
'\0'; scan++ ) {
3205 if ( *scan ==
',' ) {
3213 if ( __kmp_nested_proc_bind.size < nelem ) {
3214 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
3215 KMP_INTERNAL_REALLOC( __kmp_nested_proc_bind.bind_types,
3216 sizeof(kmp_proc_bind_t) * nelem );
3217 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
3218 KMP_FATAL( MemoryAllocFailed );
3220 __kmp_nested_proc_bind.size = nelem;
3222 __kmp_nested_proc_bind.used = nelem;
3229 enum kmp_proc_bind_t bind;
3231 if ( ( num == (
int)proc_bind_master )
3232 || __kmp_match_str(
"master", buf, &next ) ) {
3235 bind = proc_bind_master;
3237 else if ( ( num == (
int)proc_bind_close )
3238 || __kmp_match_str(
"close", buf, &next ) ) {
3241 bind = proc_bind_close;
3243 else if ( ( num == (
int)proc_bind_spread )
3244 || __kmp_match_str(
"spread", buf, &next ) ) {
3247 bind = proc_bind_spread;
3250 KMP_WARNING( StgInvalidValue, name, value );
3251 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3252 __kmp_nested_proc_bind.used = 1;
3256 __kmp_nested_proc_bind.bind_types[i++] = bind;
3260 KMP_DEBUG_ASSERT( *buf ==
',' );
3267 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3269 SKIP_DIGITS( next );
3270 num = __kmp_str_to_int( buf, *next );
3271 KMP_ASSERT( num >= 0 );
3281 if ( *buf !=
'\0' ) {
3282 KMP_WARNING( ParseExtraCharsWarn, name, buf );
3288 __kmp_stg_print_proc_bind( kmp_str_buf_t * buffer,
char const * name,
3291 int nelem = __kmp_nested_proc_bind.used;
3292 if( __kmp_env_format ) {
3293 KMP_STR_BUF_PRINT_NAME;
3295 __kmp_str_buf_print( buffer,
" %s", name );
3298 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
3302 __kmp_str_buf_print( buffer,
"='", name );
3303 for ( i = 0; i < nelem; i++ ) {
3304 switch ( __kmp_nested_proc_bind.bind_types[i] ) {
3305 case proc_bind_false:
3306 __kmp_str_buf_print( buffer,
"false" );
3309 case proc_bind_true:
3310 __kmp_str_buf_print( buffer,
"true" );
3313 case proc_bind_master:
3314 __kmp_str_buf_print( buffer,
"master" );
3317 case proc_bind_close:
3318 __kmp_str_buf_print( buffer,
"close" );
3321 case proc_bind_spread:
3322 __kmp_str_buf_print( buffer,
"spread" );
3325 case proc_bind_intel:
3326 __kmp_str_buf_print( buffer,
"intel" );
3329 case proc_bind_default:
3330 __kmp_str_buf_print( buffer,
"default" );
3333 if ( i < nelem - 1 ) {
3334 __kmp_str_buf_print( buffer,
"," );
3337 __kmp_str_buf_print( buffer,
"'\n" );
3349 __kmp_stg_parse_omp_dynamic(
char const * name,
char const * value,
void * data )
3351 __kmp_stg_parse_bool( name, value, & (__kmp_global.g.g_dynamic) );
3355 __kmp_stg_print_omp_dynamic( kmp_str_buf_t * buffer,
char const * name,
void * data )
3357 __kmp_stg_print_bool( buffer, name, __kmp_global.g.g_dynamic );
3361 __kmp_stg_parse_kmp_dynamic_mode(
char const * name,
char const * value,
void * data )
3363 if ( TCR_4(__kmp_init_parallel) ) {
3364 KMP_WARNING( EnvParallelWarn, name );
3365 __kmp_env_toPrint( name, 0 );
3368 #ifdef USE_LOAD_BALANCE 3369 else if ( __kmp_str_match(
"load balance", 2, value )
3370 || __kmp_str_match(
"load_balance", 2, value )
3371 || __kmp_str_match(
"load-balance", 2, value )
3372 || __kmp_str_match(
"loadbalance", 2, value )
3373 || __kmp_str_match(
"balance", 1, value ) ) {
3374 __kmp_global.g.g_dynamic_mode = dynamic_load_balance;
3377 else if ( __kmp_str_match(
"thread limit", 1, value )
3378 || __kmp_str_match(
"thread_limit", 1, value )
3379 || __kmp_str_match(
"thread-limit", 1, value )
3380 || __kmp_str_match(
"threadlimit", 1, value )
3381 || __kmp_str_match(
"limit", 2, value ) ) {
3382 __kmp_global.g.g_dynamic_mode = dynamic_thread_limit;
3384 else if ( __kmp_str_match(
"random", 1, value ) ) {
3385 __kmp_global.g.g_dynamic_mode = dynamic_random;
3388 KMP_WARNING( StgInvalidValue, name, value );
3393 __kmp_stg_print_kmp_dynamic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data )
3396 if ( __kmp_global.g.g_dynamic_mode == dynamic_default ) {
3397 __kmp_str_buf_print( buffer,
" %s: %s \n", name, KMP_I18N_STR( NotDefined ) );
3399 # ifdef USE_LOAD_BALANCE 3400 else if ( __kmp_global.g.g_dynamic_mode == dynamic_load_balance ) {
3401 __kmp_stg_print_str( buffer, name,
"load balance" );
3404 else if ( __kmp_global.g.g_dynamic_mode == dynamic_thread_limit ) {
3405 __kmp_stg_print_str( buffer, name,
"thread limit" );
3407 else if ( __kmp_global.g.g_dynamic_mode == dynamic_random ) {
3408 __kmp_stg_print_str( buffer, name,
"random" );
3417 #ifdef USE_LOAD_BALANCE 3424 __kmp_stg_parse_ld_balance_interval(
char const * name,
char const * value,
void * data )
3426 double interval = __kmp_convert_to_double( value );
3427 if ( interval >= 0 ) {
3428 __kmp_load_balance_interval = interval;
3430 KMP_WARNING( StgInvalidValue, name, value );
3435 __kmp_stg_print_ld_balance_interval( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3437 __kmp_str_buf_print( buffer,
" %s=%8.6f\n", name, __kmp_load_balance_interval );
3448 __kmp_stg_parse_init_at_fork(
char const * name,
char const * value,
void * data ) {
3449 __kmp_stg_parse_bool( name, value, & __kmp_need_register_atfork );
3450 if ( __kmp_need_register_atfork ) {
3451 __kmp_need_register_atfork_specified = TRUE;
3456 __kmp_stg_print_init_at_fork( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3457 __kmp_stg_print_bool( buffer, name, __kmp_need_register_atfork_specified );
3465 __kmp_stg_parse_schedule(
char const * name,
char const * value,
void * data ) {
3467 if ( value != NULL ) {
3468 size_t length = KMP_STRLEN( value );
3469 if ( length > INT_MAX ) {
3470 KMP_WARNING( LongValue, name );
3473 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'' )
3474 KMP_WARNING( UnbalancedQuotes, name );
3478 semicolon = (
char *) strchr( value,
';' );
3479 if( *value && semicolon != value ) {
3480 char *comma = (
char *) strchr( value,
',' );
3487 if ( !__kmp_strcasecmp_with_sentinel(
"static", value, sentinel ) ) {
3488 if( !__kmp_strcasecmp_with_sentinel(
"greedy", comma,
';' ) ) {
3489 __kmp_static = kmp_sch_static_greedy;
3491 }
else if( !__kmp_strcasecmp_with_sentinel(
"balanced", comma,
';' ) ) {
3492 __kmp_static = kmp_sch_static_balanced;
3495 }
else if ( !__kmp_strcasecmp_with_sentinel(
"guided", value, sentinel ) ) {
3496 if ( !__kmp_strcasecmp_with_sentinel(
"iterative", comma,
';' ) ) {
3497 __kmp_guided = kmp_sch_guided_iterative_chunked;
3499 }
else if ( !__kmp_strcasecmp_with_sentinel(
"analytical", comma,
';' ) ) {
3501 __kmp_guided = kmp_sch_guided_analytical_chunked;
3505 KMP_WARNING( InvalidClause, name, value );
3507 KMP_WARNING( EmptyClause, name );
3508 }
while ( (value = semicolon ? semicolon + 1 : NULL) );
3515 __kmp_stg_print_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3516 if( __kmp_env_format ) {
3517 KMP_STR_BUF_PRINT_NAME_EX(name);
3519 __kmp_str_buf_print( buffer,
" %s='", name );
3521 if ( __kmp_static == kmp_sch_static_greedy ) {
3522 __kmp_str_buf_print( buffer,
"%s",
"static,greedy");
3523 }
else if ( __kmp_static == kmp_sch_static_balanced ) {
3524 __kmp_str_buf_print ( buffer,
"%s",
"static,balanced");
3526 if ( __kmp_guided == kmp_sch_guided_iterative_chunked ) {
3527 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,iterative");
3528 }
else if ( __kmp_guided == kmp_sch_guided_analytical_chunked ) {
3529 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,analytical");
3538 __kmp_stg_parse_omp_schedule(
char const * name,
char const * value,
void * data )
3542 length = KMP_STRLEN( value );
3544 char *comma = (
char *) strchr( value,
',' );
3545 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'')
3546 KMP_WARNING( UnbalancedQuotes, name );
3548 if (!__kmp_strcasecmp_with_sentinel(
"dynamic", value,
','))
3549 __kmp_sched = kmp_sch_dynamic_chunked;
3550 else if (!__kmp_strcasecmp_with_sentinel(
"guided", value,
','))
3553 else if (!__kmp_strcasecmp_with_sentinel(
"auto", value,
',')) {
3556 __kmp_msg( kmp_ms_warning, KMP_MSG( IgnoreChunk, name, comma ), __kmp_msg_null );
3560 else if (!__kmp_strcasecmp_with_sentinel(
"trapezoidal", value,
','))
3561 __kmp_sched = kmp_sch_trapezoidal;
3562 else if (!__kmp_strcasecmp_with_sentinel(
"static", value,
','))
3564 #if KMP_STATIC_STEAL_ENABLED 3565 else if (!__kmp_strcasecmp_with_sentinel(
"static_steal", value,
','))
3569 KMP_WARNING( StgInvalidValue, name, value );
3572 if( value && comma ) {
3573 __kmp_env_chunk = TRUE;
3576 __kmp_sched = kmp_sch_static_chunked;
3578 __kmp_chunk = __kmp_str_to_int( comma, 0 );
3579 if ( __kmp_chunk < 1 ) {
3580 __kmp_chunk = KMP_DEFAULT_CHUNK;
3581 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidChunk, name, comma ), __kmp_msg_null );
3582 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3588 }
else if ( __kmp_chunk > KMP_MAX_CHUNK ) {
3589 __kmp_chunk = KMP_MAX_CHUNK;
3590 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeChunk, name, comma ), __kmp_msg_null );
3591 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3594 __kmp_env_chunk = FALSE;
3596 KMP_WARNING( EmptyString, name );
3598 K_DIAG(1, (
"__kmp_static == %d\n", __kmp_static))
3599 K_DIAG(1, (
"__kmp_guided == %d\n", __kmp_guided))
3600 K_DIAG(1, (
"__kmp_sched == %d\n", __kmp_sched))
3601 K_DIAG(1, (
"__kmp_chunk == %d\n", __kmp_chunk))
3605 __kmp_stg_print_omp_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3606 if( __kmp_env_format ) {
3607 KMP_STR_BUF_PRINT_NAME_EX(name);
3609 __kmp_str_buf_print( buffer,
" %s='", name );
3611 if ( __kmp_chunk ) {
3612 switch ( __kmp_sched ) {
3613 case kmp_sch_dynamic_chunked:
3614 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"dynamic", __kmp_chunk);
3616 case kmp_sch_guided_iterative_chunked:
3617 case kmp_sch_guided_analytical_chunked:
3618 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"guided", __kmp_chunk);
3620 case kmp_sch_trapezoidal:
3621 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"trapezoidal", __kmp_chunk);
3624 case kmp_sch_static_chunked:
3625 case kmp_sch_static_balanced:
3626 case kmp_sch_static_greedy:
3627 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static", __kmp_chunk);
3630 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static_steal", __kmp_chunk);
3633 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"auto", __kmp_chunk);
3637 switch ( __kmp_sched ) {
3638 case kmp_sch_dynamic_chunked:
3639 __kmp_str_buf_print( buffer,
"%s'\n",
"dynamic");
3641 case kmp_sch_guided_iterative_chunked:
3642 case kmp_sch_guided_analytical_chunked:
3643 __kmp_str_buf_print( buffer,
"%s'\n",
"guided");
3645 case kmp_sch_trapezoidal:
3646 __kmp_str_buf_print( buffer,
"%s'\n",
"trapezoidal");
3649 case kmp_sch_static_chunked:
3650 case kmp_sch_static_balanced:
3651 case kmp_sch_static_greedy:
3652 __kmp_str_buf_print( buffer,
"%s'\n",
"static");
3655 __kmp_str_buf_print( buffer,
"%s'\n",
"static_steal");
3658 __kmp_str_buf_print( buffer,
"%s'\n",
"auto");
3669 __kmp_stg_parse_atomic_mode(
char const * name,
char const * value,
void * data ) {
3673 #ifdef KMP_GOMP_COMPAT 3676 __kmp_stg_parse_int( name, value, 0, max, & mode );
3680 __kmp_atomic_mode = mode;
3685 __kmp_stg_print_atomic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3686 __kmp_stg_print_int( buffer, name, __kmp_atomic_mode );
3695 __kmp_stg_parse_consistency_check(
char const * name,
char const * value,
void * data ) {
3696 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
3700 __kmp_env_consistency_check = TRUE;
3701 }
else if ( ! __kmp_strcasecmp_with_sentinel(
"none", value, 0 ) ) {
3702 __kmp_env_consistency_check = FALSE;
3704 KMP_WARNING( StgInvalidValue, name, value );
3709 __kmp_stg_print_consistency_check( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3711 const char *value = NULL;
3713 if ( __kmp_env_consistency_check ) {
3719 if ( value != NULL ) {
3720 __kmp_stg_print_str( buffer, name, value );
3734 __kmp_stg_parse_itt_prepare_delay(
char const * name,
char const * value,
void * data )
3738 __kmp_stg_parse_int( name, value, 0, INT_MAX, & delay );
3739 __kmp_itt_prepare_delay = delay;
3743 __kmp_stg_print_itt_prepare_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3744 __kmp_stg_print_uint64( buffer, name, __kmp_itt_prepare_delay );
3748 #endif // USE_ITT_NOTIFY 3756 __kmp_stg_parse_malloc_pool_incr(
char const * name,
char const * value,
void * data ) {
3757 __kmp_stg_parse_size(
3760 KMP_MIN_MALLOC_POOL_INCR,
3761 KMP_MAX_MALLOC_POOL_INCR,
3763 & __kmp_malloc_pool_incr,
3769 __kmp_stg_print_malloc_pool_incr( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3770 __kmp_stg_print_size( buffer, name, __kmp_malloc_pool_incr );
3782 __kmp_stg_parse_par_range_env(
char const * name,
char const * value,
void * data ) {
3783 __kmp_stg_parse_par_range(
3787 __kmp_par_range_routine,
3788 __kmp_par_range_filename,
3789 & __kmp_par_range_lb,
3790 & __kmp_par_range_ub
3795 __kmp_stg_print_par_range_env( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3796 if (__kmp_par_range != 0) {
3797 __kmp_stg_print_str( buffer, name, par_range_to_print );
3807 __kmp_stg_parse_yield_cycle(
char const * name,
char const * value,
void * data ) {
3808 int flag = __kmp_yield_cycle;
3809 __kmp_stg_parse_bool( name, value, & flag );
3810 __kmp_yield_cycle = flag;
3814 __kmp_stg_print_yield_cycle( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3815 __kmp_stg_print_bool( buffer, name, __kmp_yield_cycle );
3819 __kmp_stg_parse_yield_on(
char const * name,
char const * value,
void * data ) {
3820 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_on_count );
3824 __kmp_stg_print_yield_on( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3825 __kmp_stg_print_int( buffer, name, __kmp_yield_on_count );
3829 __kmp_stg_parse_yield_off(
char const * name,
char const * value,
void * data ) {
3830 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_off_count );
3834 __kmp_stg_print_yield_off( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3835 __kmp_stg_print_int( buffer, name, __kmp_yield_off_count );
3837 #endif // KMP_USE_MONITOR 3846 __kmp_stg_parse_init_wait(
char const * name,
char const * value,
void * data ) {
3848 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3849 wait = __kmp_init_wait / 2;
3850 __kmp_stg_parse_int( name, value, KMP_MIN_INIT_WAIT, KMP_MAX_INIT_WAIT, & wait );
3851 __kmp_init_wait = wait * 2;
3852 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3853 __kmp_yield_init = __kmp_init_wait;
3857 __kmp_stg_print_init_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3858 __kmp_stg_print_int( buffer, name, __kmp_init_wait );
3862 __kmp_stg_parse_next_wait(
char const * name,
char const * value,
void * data ) {
3864 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3865 wait = __kmp_next_wait / 2;
3866 __kmp_stg_parse_int( name, value, KMP_MIN_NEXT_WAIT, KMP_MAX_NEXT_WAIT, & wait );
3867 __kmp_next_wait = wait * 2;
3868 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3869 __kmp_yield_next = __kmp_next_wait;
3873 __kmp_stg_print_next_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3874 __kmp_stg_print_int( buffer, name, __kmp_next_wait );
3883 __kmp_stg_parse_gtid_mode(
char const * name,
char const * value,
void * data ) {
3894 #ifdef KMP_TDATA_GTID 3897 __kmp_stg_parse_int( name, value, 0, max, & mode );
3901 __kmp_adjust_gtid_mode = TRUE;
3904 __kmp_gtid_mode = mode;
3905 __kmp_adjust_gtid_mode = FALSE;
3910 __kmp_stg_print_gtid_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3911 if ( __kmp_adjust_gtid_mode ) {
3912 __kmp_stg_print_int( buffer, name, 0 );
3915 __kmp_stg_print_int( buffer, name, __kmp_gtid_mode );
3924 __kmp_stg_parse_lock_block(
char const * name,
char const * value,
void * data ) {
3925 __kmp_stg_parse_int( name, value, 0, KMP_INT_MAX, & __kmp_num_locks_in_block );
3929 __kmp_stg_print_lock_block( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3930 __kmp_stg_print_int( buffer, name, __kmp_num_locks_in_block );
3937 #if KMP_USE_DYNAMIC_LOCK 3938 # define KMP_STORE_LOCK_SEQ(a) (__kmp_user_lock_seq = lockseq_##a) 3940 # define KMP_STORE_LOCK_SEQ(a) 3944 __kmp_stg_parse_lock_kind(
char const * name,
char const * value,
void * data ) {
3945 if ( __kmp_init_user_locks ) {
3946 KMP_WARNING( EnvLockWarn, name );
3950 if ( __kmp_str_match(
"tas", 2, value )
3951 || __kmp_str_match(
"test and set", 2, value )
3952 || __kmp_str_match(
"test_and_set", 2, value )
3953 || __kmp_str_match(
"test-and-set", 2, value )
3954 || __kmp_str_match(
"test andset", 2, value )
3955 || __kmp_str_match(
"test_andset", 2, value )
3956 || __kmp_str_match(
"test-andset", 2, value )
3957 || __kmp_str_match(
"testand set", 2, value )
3958 || __kmp_str_match(
"testand_set", 2, value )
3959 || __kmp_str_match(
"testand-set", 2, value )
3960 || __kmp_str_match(
"testandset", 2, value ) ) {
3961 __kmp_user_lock_kind = lk_tas;
3962 KMP_STORE_LOCK_SEQ(tas);
3965 else if ( __kmp_str_match(
"futex", 1, value ) ) {
3966 if ( __kmp_futex_determine_capable() ) {
3967 __kmp_user_lock_kind = lk_futex;
3968 KMP_STORE_LOCK_SEQ(futex);
3971 KMP_WARNING( FutexNotSupported, name, value );
3975 else if ( __kmp_str_match(
"ticket", 2, value ) ) {
3976 __kmp_user_lock_kind = lk_ticket;
3977 KMP_STORE_LOCK_SEQ(ticket);
3979 else if ( __kmp_str_match(
"queuing", 1, value )
3980 || __kmp_str_match(
"queue", 1, value ) ) {
3981 __kmp_user_lock_kind = lk_queuing;
3982 KMP_STORE_LOCK_SEQ(queuing);
3984 else if ( __kmp_str_match(
"drdpa ticket", 1, value )
3985 || __kmp_str_match(
"drdpa_ticket", 1, value )
3986 || __kmp_str_match(
"drdpa-ticket", 1, value )
3987 || __kmp_str_match(
"drdpaticket", 1, value )
3988 || __kmp_str_match(
"drdpa", 1, value ) ) {
3989 __kmp_user_lock_kind = lk_drdpa;
3990 KMP_STORE_LOCK_SEQ(drdpa);
3992 #if KMP_USE_ADAPTIVE_LOCKS 3993 else if ( __kmp_str_match(
"adaptive", 1, value ) ) {
3994 if( __kmp_cpuinfo.rtm ) {
3995 __kmp_user_lock_kind = lk_adaptive;
3996 KMP_STORE_LOCK_SEQ(adaptive);
3998 KMP_WARNING( AdaptiveNotSupported, name, value );
3999 __kmp_user_lock_kind = lk_queuing;
4000 KMP_STORE_LOCK_SEQ(queuing);
4003 #endif // KMP_USE_ADAPTIVE_LOCKS 4004 #if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX 4005 else if ( __kmp_str_match(
"rtm", 1, value) ) {
4006 if ( __kmp_cpuinfo.rtm ) {
4007 __kmp_user_lock_kind = lk_rtm;
4008 KMP_STORE_LOCK_SEQ(rtm);
4010 KMP_WARNING( AdaptiveNotSupported, name, value );
4011 __kmp_user_lock_kind = lk_queuing;
4012 KMP_STORE_LOCK_SEQ(queuing);
4015 else if ( __kmp_str_match(
"hle", 1, value) ) {
4016 __kmp_user_lock_kind = lk_hle;
4017 KMP_STORE_LOCK_SEQ(hle);
4021 KMP_WARNING( StgInvalidValue, name, value );
4026 __kmp_stg_print_lock_kind( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4027 const char *value = NULL;
4029 switch ( __kmp_user_lock_kind ) {
4044 #if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX 4065 #if KMP_USE_ADAPTIVE_LOCKS 4072 if ( value != NULL ) {
4073 __kmp_stg_print_str( buffer, name, value );
4083 __kmp_stg_parse_spin_backoff_params(
const char* name,
const char* value,
void* data)
4085 const char *next = value;
4088 int prev_comma = FALSE;
4091 kmp_uint32 max_backoff = __kmp_spin_backoff_params.max_backoff;
4092 kmp_uint32 min_tick = __kmp_spin_backoff_params.min_tick;
4095 for ( i = 0; i < 3 ; i++) {
4098 if ( *next ==
'\0' ) {
4102 if ( ( ( *next < '0' || *next >
'9' ) && *next !=
',' ) || total > 2 ) {
4103 KMP_WARNING( EnvSyntaxError, name, value );
4107 if ( *next ==
',' ) {
4109 if ( total == 0 || prev_comma ) {
4117 if ( *next >=
'0' && *next <=
'9' ) {
4119 const char *buf = next;
4120 char const * msg = NULL;
4122 SKIP_DIGITS( next );
4125 const char *tmp = next;
4127 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
4128 KMP_WARNING( EnvSpacesNotAllowed, name, value );
4132 num = __kmp_str_to_int( buf, *next );
4134 msg = KMP_I18N_STR( ValueTooSmall );
4136 }
else if ( num > KMP_INT_MAX ) {
4137 msg = KMP_I18N_STR( ValueTooLarge );
4140 if ( msg != NULL ) {
4142 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
4143 KMP_INFORM( Using_int_Value, name, num );
4147 }
else if( total == 2 ) {
4152 KMP_DEBUG_ASSERT( total > 0 );
4154 KMP_WARNING( EnvSyntaxError, name, value );
4157 __kmp_spin_backoff_params.max_backoff = max_backoff;
4158 __kmp_spin_backoff_params.min_tick = min_tick;
4162 __kmp_stg_print_spin_backoff_params(kmp_str_buf_t *buffer,
char const* name,
void* data)
4164 if( __kmp_env_format ) {
4165 KMP_STR_BUF_PRINT_NAME_EX(name);
4167 __kmp_str_buf_print( buffer,
" %s='", name );
4169 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_spin_backoff_params.max_backoff,
4170 __kmp_spin_backoff_params.min_tick );
4173 #if KMP_USE_ADAPTIVE_LOCKS 4182 __kmp_stg_parse_adaptive_lock_props(
const char *name,
const char *value,
void *data )
4184 int max_retries = 0;
4185 int max_badness = 0;
4187 const char *next = value;
4190 int prev_comma = FALSE;
4195 for ( i = 0; i < 3 ; i++) {
4198 if ( *next ==
'\0' ) {
4202 if ( ( ( *next < '0' || *next >
'9' ) && *next !=
',' ) || total > 2 ) {
4203 KMP_WARNING( EnvSyntaxError, name, value );
4207 if ( *next ==
',' ) {
4209 if ( total == 0 || prev_comma ) {
4217 if ( *next >=
'0' && *next <=
'9' ) {
4219 const char *buf = next;
4220 char const * msg = NULL;
4222 SKIP_DIGITS( next );
4225 const char *tmp = next;
4227 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
4228 KMP_WARNING( EnvSpacesNotAllowed, name, value );
4232 num = __kmp_str_to_int( buf, *next );
4234 msg = KMP_I18N_STR( ValueTooSmall );
4236 }
else if ( num > KMP_INT_MAX ) {
4237 msg = KMP_I18N_STR( ValueTooLarge );
4240 if ( msg != NULL ) {
4242 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
4243 KMP_INFORM( Using_int_Value, name, num );
4247 }
else if( total == 2 ) {
4252 KMP_DEBUG_ASSERT( total > 0 );
4254 KMP_WARNING( EnvSyntaxError, name, value );
4257 __kmp_adaptive_backoff_params.max_soft_retries = max_retries;
4258 __kmp_adaptive_backoff_params.max_badness = max_badness;
4263 __kmp_stg_print_adaptive_lock_props(kmp_str_buf_t * buffer,
char const * name,
void * data )
4265 if( __kmp_env_format ) {
4266 KMP_STR_BUF_PRINT_NAME_EX(name);
4268 __kmp_str_buf_print( buffer,
" %s='", name );
4270 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_adaptive_backoff_params.max_soft_retries,
4271 __kmp_adaptive_backoff_params.max_badness );
4274 #if KMP_DEBUG_ADAPTIVE_LOCKS 4277 __kmp_stg_parse_speculative_statsfile(
char const * name,
char const * value,
void * data ) {
4278 __kmp_stg_parse_file( name, value,
"", & __kmp_speculative_statsfile );
4282 __kmp_stg_print_speculative_statsfile( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4283 if ( __kmp_str_match(
"-", 0, __kmp_speculative_statsfile ) ) {
4284 __kmp_stg_print_str( buffer, name,
"stdout" );
4286 __kmp_stg_print_str( buffer, name, __kmp_speculative_statsfile );
4291 #endif // KMP_DEBUG_ADAPTIVE_LOCKS 4293 #endif // KMP_USE_ADAPTIVE_LOCKS 4300 __kmp_stg_parse_hw_subset(
char const * name,
char const * value,
void * data ) {
4309 #define CHECK_DELIM(_x) (*(_x) == ',' || *(_x) == 'x') 4310 static int parsed = 0;
4312 int single_warning = 0;
4313 int flagS = 0, flagC = 0, flagT = 0, flagSO = 0, flagCO = 0;
4314 const char *next = value;
4317 if( strcmp(name,
"KMP_PLACE_THREADS") == 0 ) {
4318 KMP_INFORM(EnvVarDeprecated,name,
"KMP_HW_SUBSET");
4328 if( strcmp(name,
"KMP_PLACE_THREADS") == 0 ) {
4329 KMP_INFORM(EnvVarDeprecated,name,
"KMP_HW_SUBSET");
4340 if (*next >=
'0' && *next <=
'9') {
4343 num = __kmp_str_to_int(prev, *next);
4345 if (*next ==
's' || *next ==
'S') {
4346 __kmp_place_num_sockets = num;
4352 if (!(*next >=
'0' && *next <=
'9')) {
4353 KMP_WARNING(AffHWSubsetInvalid, name, value);
4357 num = __kmp_str_to_int(prev, *next);
4358 __kmp_place_socket_offset = num;
4360 }
else if (*next ==
'c' || *next ==
'C') {
4361 __kmp_place_num_cores = num;
4367 if (!(*next >=
'0' && *next <=
'9')) {
4368 KMP_WARNING(AffHWSubsetInvalid, name, value);
4372 num = __kmp_str_to_int(prev, *next);
4373 __kmp_place_core_offset = num;
4375 }
else if (CHECK_DELIM(next)) {
4376 __kmp_place_num_cores = num;
4379 }
else if (*next ==
't' || *next ==
'T') {
4380 __kmp_place_num_threads_per_core = num;
4383 }
else if (*next ==
'\0') {
4384 __kmp_place_num_cores = num;
4387 KMP_WARNING(AffHWSubsetInvalid, name, value);
4391 KMP_WARNING(AffHWSubsetInvalid, name, value);
4394 KMP_DEBUG_ASSERT(flagS);
4398 if (CHECK_DELIM(next)) {
4404 if (*next >=
'0' && *next <=
'9') {
4407 num = __kmp_str_to_int(prev, *next);
4409 if (*next ==
'c' || *next ==
'C') {
4410 KMP_DEBUG_ASSERT(flagC == 0);
4411 __kmp_place_num_cores = num;
4417 if (!(*next >=
'0' && *next <=
'9')) {
4418 KMP_WARNING(AffHWSubsetInvalid, name, value);
4422 num = __kmp_str_to_int(prev, *next);
4423 __kmp_place_core_offset = num;
4425 }
else if (*next ==
'o' || *next ==
'O') {
4426 KMP_WARNING(AffHWSubsetDeprecated);
4429 KMP_DEBUG_ASSERT(!flagCO);
4430 __kmp_place_core_offset = num;
4432 KMP_DEBUG_ASSERT(!flagSO);
4433 __kmp_place_socket_offset = num;
4436 }
else if (*next ==
't' || *next ==
'T') {
4437 KMP_DEBUG_ASSERT(flagT == 0);
4438 __kmp_place_num_threads_per_core = num;
4442 }
else if (*next ==
'\0') {
4443 KMP_DEBUG_ASSERT(flagC);
4444 __kmp_place_num_threads_per_core = num;
4447 KMP_WARNING(AffHWSubsetInvalid, name, value);
4451 KMP_WARNING(AffHWSubsetInvalid, name, value);
4457 if (CHECK_DELIM(next)) {
4463 if (*next >=
'0' && *next <=
'9') {
4466 num = __kmp_str_to_int(prev, *next);
4468 if (*next ==
't' || *next ==
'T') {
4469 KMP_DEBUG_ASSERT(flagT == 0);
4470 __kmp_place_num_threads_per_core = num;
4475 }
else if (*next ==
'c' || *next ==
'C') {
4476 KMP_DEBUG_ASSERT(flagC == 0);
4477 __kmp_place_num_cores = num;
4481 }
else if (*next ==
'o' || *next ==
'O') {
4482 KMP_WARNING(AffHWSubsetDeprecated);
4484 KMP_DEBUG_ASSERT(flagC);
4486 __kmp_place_core_offset = num;
4489 KMP_WARNING(AffHWSubsetInvalid, name, value);
4493 KMP_WARNING(AffHWSubsetInvalid, name, value);
4496 KMP_DEBUG_ASSERT(flagC);
4498 if ( *next ==
'\0' )
4500 if (CHECK_DELIM(next)) {
4506 if (*next >=
'0' && *next <=
'9') {
4509 num = __kmp_str_to_int(prev, *next);
4511 if (*next ==
'o' || *next ==
'O') {
4512 if (!single_warning) {
4513 KMP_WARNING(AffHWSubsetDeprecated);
4515 KMP_DEBUG_ASSERT(!flagSO);
4516 __kmp_place_core_offset = num;
4518 }
else if (*next ==
't' || *next ==
'T') {
4519 KMP_DEBUG_ASSERT(flagT == 0);
4520 __kmp_place_num_threads_per_core = num;
4524 KMP_WARNING(AffHWSubsetInvalid, name, value);
4528 KMP_WARNING(AffHWSubsetInvalid, name, value);
4532 if ( *next ==
'\0' )
4534 if (CHECK_DELIM(next)) {
4540 if (*next >=
'0' && *next <=
'9') {
4543 num = __kmp_str_to_int(prev, *next);
4545 if (*next ==
'o' || *next ==
'O') {
4546 if (!single_warning) {
4547 KMP_WARNING(AffHWSubsetDeprecated);
4549 KMP_DEBUG_ASSERT(flagT);
4550 KMP_DEBUG_ASSERT(!flagSO);
4551 __kmp_place_core_offset = num;
4552 }
else if (*next ==
't' || *next ==
'T') {
4553 KMP_DEBUG_ASSERT(flagT == 0);
4554 __kmp_place_num_threads_per_core = num;
4556 KMP_WARNING(AffHWSubsetInvalid, name, value);
4559 KMP_WARNING(AffHWSubsetInvalid, name, value);
4566 __kmp_stg_print_hw_subset( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4567 if (__kmp_place_num_sockets + __kmp_place_num_cores + __kmp_place_num_threads_per_core) {
4570 __kmp_str_buf_init(&buf);
4571 if(__kmp_env_format)
4572 KMP_STR_BUF_PRINT_NAME_EX(name);
4574 __kmp_str_buf_print(buffer,
" %s='", name);
4575 if (__kmp_place_num_sockets) {
4576 __kmp_str_buf_print(&buf,
"%ds", __kmp_place_num_sockets);
4577 if (__kmp_place_socket_offset)
4578 __kmp_str_buf_print(&buf,
"@%d", __kmp_place_socket_offset);
4581 if (__kmp_place_num_cores) {
4582 __kmp_str_buf_print(&buf,
"%s%dc", comma?
",":
"", __kmp_place_num_cores);
4583 if (__kmp_place_core_offset)
4584 __kmp_str_buf_print(&buf,
"@%d", __kmp_place_core_offset);
4587 if (__kmp_place_num_threads_per_core)
4588 __kmp_str_buf_print(&buf,
"%s%dt", comma?
",":
"", __kmp_place_num_threads_per_core);
4589 __kmp_str_buf_print(buffer,
"%s'\n", buf.str );
4590 __kmp_str_buf_free(&buf);
4604 __kmp_stg_parse_forkjoin_frames(
char const * name,
char const * value,
void * data ) {
4605 __kmp_stg_parse_bool( name, value, & __kmp_forkjoin_frames );
4609 __kmp_stg_print_forkjoin_frames( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4610 __kmp_stg_print_bool( buffer, name, __kmp_forkjoin_frames );
4618 __kmp_stg_parse_forkjoin_frames_mode(
char const * name,
char const * value,
void * data ) {
4619 __kmp_stg_parse_int( name, value, 0, 3, & __kmp_forkjoin_frames_mode );
4623 __kmp_stg_print_forkjoin_frames_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4624 __kmp_stg_print_int( buffer, name, __kmp_forkjoin_frames_mode );
4635 __kmp_stg_parse_omp_display_env(
char const * name,
char const * value,
void * data )
4637 if ( __kmp_str_match(
"VERBOSE", 1, value ) )
4639 __kmp_display_env_verbose = TRUE;
4641 __kmp_stg_parse_bool( name, value, & __kmp_display_env );
4647 __kmp_stg_print_omp_display_env( kmp_str_buf_t * buffer,
char const * name,
void * data )
4649 if ( __kmp_display_env_verbose )
4651 __kmp_stg_print_str( buffer, name,
"VERBOSE" );
4653 __kmp_stg_print_bool( buffer, name, __kmp_display_env );
4658 __kmp_stg_parse_omp_cancellation(
char const * name,
char const * value,
void * data ) {
4659 if ( TCR_4(__kmp_init_parallel) ) {
4660 KMP_WARNING( EnvParallelWarn, name );
4663 __kmp_stg_parse_bool( name, value, & __kmp_omp_cancellation );
4667 __kmp_stg_print_omp_cancellation( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4668 __kmp_stg_print_bool( buffer, name, __kmp_omp_cancellation );
4678 static kmp_setting_t __kmp_stg_table[] = {
4680 {
"KMP_ALL_THREADS", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4681 {
"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime, NULL, 0, 0 },
4682 {
"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok, __kmp_stg_print_duplicate_lib_ok, NULL, 0, 0 },
4683 {
"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4684 {
"KMP_MAX_THREADS", __kmp_stg_parse_all_threads, NULL, NULL, 0, 0 },
4686 {
"KMP_MONITOR_STACKSIZE", __kmp_stg_parse_monitor_stacksize, __kmp_stg_print_monitor_stacksize, NULL, 0, 0 },
4688 {
"KMP_SETTINGS", __kmp_stg_parse_settings, __kmp_stg_print_settings, NULL, 0, 0 },
4689 {
"KMP_STACKOFFSET", __kmp_stg_parse_stackoffset, __kmp_stg_print_stackoffset, NULL, 0, 0 },
4690 {
"KMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4691 {
"KMP_STACKPAD", __kmp_stg_parse_stackpad, __kmp_stg_print_stackpad, NULL, 0, 0 },
4692 {
"KMP_VERSION", __kmp_stg_parse_version, __kmp_stg_print_version, NULL, 0, 0 },
4693 {
"KMP_WARNINGS", __kmp_stg_parse_warnings, __kmp_stg_print_warnings, NULL, 0, 0 },
4695 {
"OMP_NESTED", __kmp_stg_parse_nested, __kmp_stg_print_nested, NULL, 0, 0 },
4696 {
"OMP_NUM_THREADS", __kmp_stg_parse_num_threads, __kmp_stg_print_num_threads, NULL, 0, 0 },
4697 {
"OMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4699 {
"KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0, 0 },
4700 {
"KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing, __kmp_stg_print_task_stealing, NULL, 0, 0 },
4701 {
"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels, __kmp_stg_print_max_active_levels, NULL, 0, 0 },
4703 {
"OMP_DEFAULT_DEVICE", __kmp_stg_parse_default_device, __kmp_stg_print_default_device, NULL, 0, 0 },
4706 {
"OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority, __kmp_stg_print_max_task_priority, NULL, 0, 0 },
4708 {
"OMP_THREAD_LIMIT", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4709 {
"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4710 {
"KMP_DISP_NUM_BUFFERS", __kmp_stg_parse_disp_buffers, __kmp_stg_print_disp_buffers, NULL, 0, 0 },
4711 #if KMP_NESTED_HOT_TEAMS 4712 {
"KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level, __kmp_stg_print_hot_teams_level, NULL, 0, 0 },
4713 {
"KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode, __kmp_stg_print_hot_teams_mode, NULL, 0, 0 },
4714 #endif // KMP_NESTED_HOT_TEAMS 4716 #if KMP_HANDLE_SIGNALS 4717 {
"KMP_HANDLE_SIGNALS", __kmp_stg_parse_handle_signals, __kmp_stg_print_handle_signals, NULL, 0, 0 },
4720 #if KMP_ARCH_X86 || KMP_ARCH_X86_64 4721 {
"KMP_INHERIT_FP_CONTROL", __kmp_stg_parse_inherit_fp_control, __kmp_stg_print_inherit_fp_control, NULL, 0, 0 },
4724 #ifdef KMP_GOMP_COMPAT 4725 {
"GOMP_STACKSIZE", __kmp_stg_parse_stacksize, NULL, NULL, 0, 0 },
4729 {
"KMP_A_DEBUG", __kmp_stg_parse_a_debug, __kmp_stg_print_a_debug, NULL, 0, 0 },
4730 {
"KMP_B_DEBUG", __kmp_stg_parse_b_debug, __kmp_stg_print_b_debug, NULL, 0, 0 },
4731 {
"KMP_C_DEBUG", __kmp_stg_parse_c_debug, __kmp_stg_print_c_debug, NULL, 0, 0 },
4732 {
"KMP_D_DEBUG", __kmp_stg_parse_d_debug, __kmp_stg_print_d_debug, NULL, 0, 0 },
4733 {
"KMP_E_DEBUG", __kmp_stg_parse_e_debug, __kmp_stg_print_e_debug, NULL, 0, 0 },
4734 {
"KMP_F_DEBUG", __kmp_stg_parse_f_debug, __kmp_stg_print_f_debug, NULL, 0, 0 },
4735 {
"KMP_DEBUG", __kmp_stg_parse_debug, NULL, NULL, 0, 0 },
4736 {
"KMP_DEBUG_BUF", __kmp_stg_parse_debug_buf, __kmp_stg_print_debug_buf, NULL, 0, 0 },
4737 {
"KMP_DEBUG_BUF_ATOMIC", __kmp_stg_parse_debug_buf_atomic, __kmp_stg_print_debug_buf_atomic, NULL, 0, 0 },
4738 {
"KMP_DEBUG_BUF_CHARS", __kmp_stg_parse_debug_buf_chars, __kmp_stg_print_debug_buf_chars, NULL, 0, 0 },
4739 {
"KMP_DEBUG_BUF_LINES", __kmp_stg_parse_debug_buf_lines, __kmp_stg_print_debug_buf_lines, NULL, 0, 0 },
4740 {
"KMP_DIAG", __kmp_stg_parse_diag, __kmp_stg_print_diag, NULL, 0, 0 },
4742 {
"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env, __kmp_stg_print_par_range_env, NULL, 0, 0 },
4744 {
"KMP_YIELD_CYCLE", __kmp_stg_parse_yield_cycle, __kmp_stg_print_yield_cycle, NULL, 0, 0 },
4745 {
"KMP_YIELD_ON", __kmp_stg_parse_yield_on, __kmp_stg_print_yield_on, NULL, 0, 0 },
4746 {
"KMP_YIELD_OFF", __kmp_stg_parse_yield_off, __kmp_stg_print_yield_off, NULL, 0, 0 },
4750 {
"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc, __kmp_stg_print_align_alloc, NULL, 0, 0 },
4752 {
"KMP_PLAIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4753 {
"KMP_PLAIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4754 {
"KMP_FORKJOIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4755 {
"KMP_FORKJOIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4756 #if KMP_FAST_REDUCTION_BARRIER 4757 {
"KMP_REDUCTION_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4758 {
"KMP_REDUCTION_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4761 {
"KMP_ABORT_DELAY", __kmp_stg_parse_abort_delay, __kmp_stg_print_abort_delay, NULL, 0, 0 },
4762 {
"KMP_CPUINFO_FILE", __kmp_stg_parse_cpuinfo_file, __kmp_stg_print_cpuinfo_file, NULL, 0, 0 },
4763 {
"KMP_FORCE_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4764 {
"KMP_DETERMINISTIC_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4765 {
"KMP_STORAGE_MAP", __kmp_stg_parse_storage_map, __kmp_stg_print_storage_map, NULL, 0, 0 },
4766 {
"KMP_ALL_THREADPRIVATE", __kmp_stg_parse_all_threadprivate, __kmp_stg_print_all_threadprivate, NULL, 0, 0 },
4767 {
"KMP_FOREIGN_THREADS_THREADPRIVATE", __kmp_stg_parse_foreign_threads_threadprivate, __kmp_stg_print_foreign_threads_threadprivate, NULL, 0, 0 },
4769 #if KMP_AFFINITY_SUPPORTED 4770 {
"KMP_AFFINITY", __kmp_stg_parse_affinity, __kmp_stg_print_affinity, NULL, 0, 0 },
4771 # ifdef KMP_GOMP_COMPAT 4772 {
"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL, NULL, 0, 0 },
4775 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4776 {
"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0 },
4778 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, NULL, NULL, 0, 0 },
4781 {
"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method, __kmp_stg_print_topology_method, NULL, 0, 0 },
4790 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4793 #endif // KMP_AFFINITY_SUPPORTED 4795 {
"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork, __kmp_stg_print_init_at_fork, NULL, 0, 0 },
4796 {
"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL, 0, 0 },
4797 {
"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule, NULL, 0, 0 },
4798 {
"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode, __kmp_stg_print_atomic_mode, NULL, 0, 0 },
4799 {
"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check, __kmp_stg_print_consistency_check, NULL, 0, 0 },
4801 #if USE_ITT_BUILD && USE_ITT_NOTIFY 4802 {
"KMP_ITT_PREPARE_DELAY", __kmp_stg_parse_itt_prepare_delay, __kmp_stg_print_itt_prepare_delay, NULL, 0, 0 },
4804 {
"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr, __kmp_stg_print_malloc_pool_incr, NULL, 0, 0 },
4805 {
"KMP_INIT_WAIT", __kmp_stg_parse_init_wait, __kmp_stg_print_init_wait, NULL, 0, 0 },
4806 {
"KMP_NEXT_WAIT", __kmp_stg_parse_next_wait, __kmp_stg_print_next_wait, NULL, 0, 0 },
4807 {
"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode, NULL, 0, 0 },
4808 {
"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic, NULL, 0, 0 },
4809 {
"KMP_DYNAMIC_MODE", __kmp_stg_parse_kmp_dynamic_mode, __kmp_stg_print_kmp_dynamic_mode, NULL, 0, 0 },
4811 #ifdef USE_LOAD_BALANCE 4812 {
"KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,__kmp_stg_print_ld_balance_interval,NULL, 0, 0 },
4815 {
"KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block, __kmp_stg_print_lock_block, NULL, 0, 0 },
4816 {
"KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind, NULL, 0, 0 },
4817 {
"KMP_SPIN_BACKOFF_PARAMS", __kmp_stg_parse_spin_backoff_params, __kmp_stg_print_spin_backoff_params, NULL, 0, 0 },
4818 #if KMP_USE_ADAPTIVE_LOCKS 4819 {
"KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,__kmp_stg_print_adaptive_lock_props, NULL, 0, 0 },
4820 #if KMP_DEBUG_ADAPTIVE_LOCKS 4821 {
"KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,__kmp_stg_print_speculative_statsfile, NULL, 0, 0 },
4823 #endif // KMP_USE_ADAPTIVE_LOCKS 4824 {
"KMP_PLACE_THREADS", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset, NULL, 0, 0 },
4825 {
"KMP_HW_SUBSET", __kmp_stg_parse_hw_subset, __kmp_stg_print_hw_subset, NULL, 0, 0 },
4827 {
"KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames, __kmp_stg_print_forkjoin_frames, NULL, 0, 0 },
4828 {
"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,__kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0 },
4832 {
"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env, __kmp_stg_print_omp_display_env, NULL, 0, 0 },
4833 {
"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation, __kmp_stg_print_omp_cancellation, NULL, 0, 0 },
4835 {
"", NULL, NULL, NULL, 0, 0 }
4838 static int const __kmp_stg_count =
sizeof( __kmp_stg_table ) /
sizeof( kmp_setting_t );
4842 __kmp_stg_find(
char const * name ) {
4845 if ( name != NULL ) {
4846 for ( i = 0; i < __kmp_stg_count; ++ i ) {
4847 if ( strcmp( __kmp_stg_table[ i ].name, name ) == 0 ) {
4848 return & __kmp_stg_table[ i ];
4858 __kmp_stg_cmp(
void const * _a,
void const * _b ) {
4859 kmp_setting_t * a = (kmp_setting_t *) _a;
4860 kmp_setting_t * b = (kmp_setting_t *) _b;
4866 if ( strcmp( a->name,
"KMP_AFFINITY" ) == 0 ) {
4867 if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4872 else if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4875 return strcmp( a->name, b->name );
4880 __kmp_stg_init(
void 4883 static int initialized = 0;
4885 if ( ! initialized ) {
4888 qsort( __kmp_stg_table, __kmp_stg_count - 1,
sizeof( kmp_setting_t ), __kmp_stg_cmp );
4892 kmp_setting_t * kmp_stacksize = __kmp_stg_find(
"KMP_STACKSIZE" );
4893 #ifdef KMP_GOMP_COMPAT 4894 kmp_setting_t * gomp_stacksize = __kmp_stg_find(
"GOMP_STACKSIZE" );
4896 kmp_setting_t * omp_stacksize = __kmp_stg_find(
"OMP_STACKSIZE" );
4901 static kmp_setting_t *
volatile rivals[ 4 ];
4902 static kmp_stg_ss_data_t kmp_data = { 1, (kmp_setting_t **)rivals };
4903 #ifdef KMP_GOMP_COMPAT 4904 static kmp_stg_ss_data_t gomp_data = { 1024, (kmp_setting_t **)rivals };
4906 static kmp_stg_ss_data_t omp_data = { 1024, (kmp_setting_t **)rivals };
4909 rivals[ i ++ ] = kmp_stacksize;
4910 #ifdef KMP_GOMP_COMPAT 4911 if ( gomp_stacksize != NULL ) {
4912 rivals[ i ++ ] = gomp_stacksize;
4915 rivals[ i ++ ] = omp_stacksize;
4916 rivals[ i ++ ] = NULL;
4918 kmp_stacksize->data = & kmp_data;
4919 #ifdef KMP_GOMP_COMPAT 4920 if ( gomp_stacksize != NULL ) {
4921 gomp_stacksize->data = & gomp_data;
4924 omp_stacksize->data = & omp_data;
4930 kmp_setting_t * kmp_library = __kmp_stg_find(
"KMP_LIBRARY" );
4931 kmp_setting_t * omp_wait_policy = __kmp_stg_find(
"OMP_WAIT_POLICY" );
4934 static kmp_setting_t *
volatile rivals[ 3 ];
4935 static kmp_stg_wp_data_t kmp_data = { 0, (kmp_setting_t **)rivals };
4936 static kmp_stg_wp_data_t omp_data = { 1, (kmp_setting_t **)rivals };
4939 rivals[ i ++ ] = kmp_library;
4940 if ( omp_wait_policy != NULL ) {
4941 rivals[ i ++ ] = omp_wait_policy;
4943 rivals[ i ++ ] = NULL;
4945 kmp_library->data = & kmp_data;
4946 if ( omp_wait_policy != NULL ) {
4947 omp_wait_policy->data = & omp_data;
4954 kmp_setting_t * kmp_all_threads = __kmp_stg_find(
"KMP_ALL_THREADS" );
4955 kmp_setting_t * kmp_max_threads = __kmp_stg_find(
"KMP_MAX_THREADS" );
4956 kmp_setting_t * omp_thread_limit = __kmp_stg_find(
"OMP_THREAD_LIMIT" );
4959 static kmp_setting_t *
volatile rivals[ 4 ];
4962 rivals[ i ++ ] = kmp_all_threads;
4963 rivals[ i ++ ] = kmp_max_threads;
4964 if ( omp_thread_limit != NULL ) {
4965 rivals[ i ++ ] = omp_thread_limit;
4967 rivals[ i ++ ] = NULL;
4969 kmp_all_threads->data = (
void*)& rivals;
4970 kmp_max_threads->data = (
void*)& rivals;
4971 if ( omp_thread_limit != NULL ) {
4972 omp_thread_limit->data = (
void*)& rivals;
4977 #if KMP_AFFINITY_SUPPORTED 4980 kmp_setting_t * kmp_affinity = __kmp_stg_find(
"KMP_AFFINITY" );
4981 KMP_DEBUG_ASSERT( kmp_affinity != NULL );
4983 # ifdef KMP_GOMP_COMPAT 4984 kmp_setting_t * gomp_cpu_affinity = __kmp_stg_find(
"GOMP_CPU_AFFINITY" );
4985 KMP_DEBUG_ASSERT( gomp_cpu_affinity != NULL );
4988 kmp_setting_t * omp_proc_bind = __kmp_stg_find(
"OMP_PROC_BIND" );
4989 KMP_DEBUG_ASSERT( omp_proc_bind != NULL );
4992 static kmp_setting_t *
volatile rivals[ 4 ];
4995 rivals[ i ++ ] = kmp_affinity;
4997 # ifdef KMP_GOMP_COMPAT 4998 rivals[ i ++ ] = gomp_cpu_affinity;
4999 gomp_cpu_affinity->data = (
void*)& rivals;
5002 rivals[ i ++ ] = omp_proc_bind;
5003 omp_proc_bind->data = (
void*)& rivals;
5004 rivals[ i ++ ] = NULL;
5007 static kmp_setting_t *
volatile places_rivals[ 4 ];
5010 kmp_setting_t * omp_places = __kmp_stg_find(
"OMP_PLACES" );
5011 KMP_DEBUG_ASSERT( omp_places != NULL );
5013 places_rivals[ i ++ ] = kmp_affinity;
5014 # ifdef KMP_GOMP_COMPAT 5015 places_rivals[ i ++ ] = gomp_cpu_affinity;
5017 places_rivals[ i ++ ] = omp_places;
5018 omp_places->data = (
void*)& places_rivals;
5019 places_rivals[ i ++ ] = NULL;
5025 #endif // KMP_AFFINITY_SUPPORTED 5029 kmp_setting_t * kmp_force_red = __kmp_stg_find(
"KMP_FORCE_REDUCTION" );
5030 kmp_setting_t * kmp_determ_red = __kmp_stg_find(
"KMP_DETERMINISTIC_REDUCTION" );
5033 static kmp_setting_t *
volatile rivals[ 3 ];
5034 static kmp_stg_fr_data_t force_data = { 1, (kmp_setting_t **)rivals };
5035 static kmp_stg_fr_data_t determ_data = { 0, (kmp_setting_t **)rivals };
5038 rivals[ i ++ ] = kmp_force_red;
5039 if ( kmp_determ_red != NULL ) {
5040 rivals[ i ++ ] = kmp_determ_red;
5042 rivals[ i ++ ] = NULL;
5044 kmp_force_red->data = & force_data;
5045 if ( kmp_determ_red != NULL ) {
5046 kmp_determ_red->data = & determ_data;
5056 for ( i = 0; i < __kmp_stg_count; ++ i ) {
5057 __kmp_stg_table[ i ].set = 0;
5071 if ( name[ 0 ] == 0 ) {
5075 if ( value != NULL ) {
5076 kmp_setting_t * setting = __kmp_stg_find( name );
5077 if ( setting != NULL ) {
5078 setting->parse( name, value, setting->data );
5079 setting->defined = 1;
5087 __kmp_stg_check_rivals(
5090 kmp_setting_t * * rivals
5093 if ( rivals == NULL ) {
5099 for ( ; strcmp( rivals[ i ]->name, name ) != 0; i++ ) {
5100 KMP_DEBUG_ASSERT( rivals[ i ] != NULL );
5102 #if KMP_AFFINITY_SUPPORTED 5103 if ( rivals[ i ] == __kmp_affinity_notype ) {
5112 if ( rivals[ i ]->
set ) {
5113 KMP_WARNING( StgIgnored, name, rivals[ i ]->name );
5125 __kmp_env_toPrint(
char const * name,
int flag ) {
5127 kmp_setting_t * setting = __kmp_stg_find( name );
5128 if ( setting != NULL ) {
5129 rc = setting->defined;
5131 setting->defined = flag;
5139 __kmp_aux_env_initialize( kmp_env_blk_t* block ) {
5144 value = __kmp_env_blk_var( block,
"OMP_NUM_THREADS" );
5146 ompc_set_num_threads( __kmp_dflt_team_nth );
5150 value = __kmp_env_blk_var( block,
"KMP_BLOCKTIME" );
5152 kmpc_set_blocktime( __kmp_dflt_blocktime );
5156 value = __kmp_env_blk_var( block,
"OMP_NESTED" );
5158 ompc_set_nested( __kmp_dflt_nested );
5162 value = __kmp_env_blk_var( block,
"OMP_DYNAMIC" );
5164 ompc_set_dynamic( __kmp_global.g.g_dynamic );
5170 __kmp_env_initialize(
char const *
string ) {
5172 kmp_env_blk_t block;
5178 if (
string == NULL ) {
5180 __kmp_threads_capacity = __kmp_initial_threads_capacity( __kmp_dflt_team_nth_ub );
5182 __kmp_env_blk_init( & block,
string );
5187 for ( i = 0; i < block.count; ++ i ) {
5188 if (( block.vars[ i ].name == NULL )
5189 || ( *block.vars[ i ].name ==
'\0')) {
5192 if ( block.vars[ i ].value == NULL ) {
5195 kmp_setting_t * setting = __kmp_stg_find( block.vars[ i ].name );
5196 if ( setting != NULL ) {
5202 blocktime_str = __kmp_env_blk_var( & block,
"KMP_BLOCKTIME" );
5205 if (
string == NULL ) {
5206 char const * name =
"KMP_WARNINGS";
5207 char const * value = __kmp_env_blk_var( & block, name );
5208 __kmp_stg_parse( name, value );
5211 #if KMP_AFFINITY_SUPPORTED 5219 __kmp_affinity_notype = NULL;
5220 char const *aff_str = __kmp_env_blk_var( & block,
"KMP_AFFINITY" );
5221 if ( aff_str != NULL ) {
5235 # define FIND strstr 5237 # define FIND strcasestr 5240 if ( ( FIND( aff_str,
"none" ) == NULL )
5241 && ( FIND( aff_str,
"physical" ) == NULL )
5242 && ( FIND( aff_str,
"logical" ) == NULL )
5243 && ( FIND( aff_str,
"compact" ) == NULL )
5244 && ( FIND( aff_str,
"scatter" ) == NULL )
5245 && ( FIND( aff_str,
"explicit" ) == NULL )
5246 && ( FIND( aff_str,
"balanced" ) == NULL )
5247 && ( FIND( aff_str,
"disabled" ) == NULL ) ) {
5248 __kmp_affinity_notype = __kmp_stg_find(
"KMP_AFFINITY" );
5256 __kmp_affinity_type = affinity_default;
5257 __kmp_affinity_gran = affinity_gran_default;
5258 __kmp_affinity_top_method = affinity_top_method_default;
5259 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5267 aff_str = __kmp_env_blk_var( & block,
"OMP_PROC_BIND" );
5268 if ( aff_str != NULL ) {
5269 __kmp_affinity_type = affinity_default;
5270 __kmp_affinity_gran = affinity_gran_default;
5271 __kmp_affinity_top_method = affinity_top_method_default;
5272 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5283 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5284 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
5285 KMP_INTERNAL_MALLOC(
sizeof(kmp_proc_bind_t) );
5286 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5287 KMP_FATAL( MemoryAllocFailed );
5289 __kmp_nested_proc_bind.size = 1;
5290 __kmp_nested_proc_bind.used = 1;
5291 # if KMP_AFFINITY_SUPPORTED 5292 __kmp_nested_proc_bind.bind_types[0] = proc_bind_default;
5295 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5304 for ( i = 0; i < block.count; ++ i ) {
5305 __kmp_stg_parse( block.vars[ i ].name, block.vars[ i ].value );
5311 if ( ! __kmp_init_user_locks ) {
5312 if ( __kmp_user_lock_kind == lk_default ) {
5313 __kmp_user_lock_kind = lk_queuing;
5315 #if KMP_USE_DYNAMIC_LOCK 5316 __kmp_init_dynamic_user_locks();
5318 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5322 KMP_DEBUG_ASSERT(
string != NULL);
5323 KMP_DEBUG_ASSERT( __kmp_user_lock_kind != lk_default );
5328 #if KMP_USE_DYNAMIC_LOCK 5329 __kmp_init_dynamic_user_locks();
5331 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5335 #if KMP_AFFINITY_SUPPORTED 5337 if ( ! TCR_4(__kmp_init_middle) ) {
5342 const char *var =
"KMP_AFFINITY";
5343 KMPAffinity::pick_api();
5344 if ( __kmp_affinity_type == affinity_disabled ) {
5345 KMP_AFFINITY_DISABLE();
5347 else if ( ! KMP_AFFINITY_CAPABLE() ) {
5348 __kmp_affinity_dispatch->determine_capable(var);
5349 if ( ! KMP_AFFINITY_CAPABLE() ) {
5350 if ( __kmp_affinity_verbose || ( __kmp_affinity_warnings
5351 && ( __kmp_affinity_type != affinity_default )
5352 && ( __kmp_affinity_type != affinity_none )
5353 && ( __kmp_affinity_type != affinity_disabled ) ) ) {
5354 KMP_WARNING( AffNotSupported, var );
5356 __kmp_affinity_type = affinity_disabled;
5357 __kmp_affinity_respect_mask = 0;
5358 __kmp_affinity_gran = affinity_gran_fine;
5363 if ( __kmp_affinity_type == affinity_disabled ) {
5364 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5366 else if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_true ) {
5370 __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
5374 if ( KMP_AFFINITY_CAPABLE() ) {
5376 # if KMP_GROUP_AFFINITY 5383 if ( ( ( __kmp_num_proc_groups > 1 )
5384 && ( __kmp_affinity_type == affinity_default )
5386 && ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) )
5388 || ( __kmp_affinity_top_method == affinity_top_method_group ) ) {
5389 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5390 __kmp_affinity_respect_mask = FALSE;
5392 if ( __kmp_affinity_type == affinity_default ) {
5393 __kmp_affinity_type = affinity_compact;
5395 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5398 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5399 if ( __kmp_affinity_gran == affinity_gran_default ) {
5400 __kmp_affinity_top_method = affinity_top_method_group;
5401 __kmp_affinity_gran = affinity_gran_group;
5403 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5404 __kmp_affinity_top_method = affinity_top_method_group;
5407 __kmp_affinity_top_method = affinity_top_method_all;
5410 else if ( __kmp_affinity_top_method == affinity_top_method_group ) {
5411 if ( __kmp_affinity_gran == affinity_gran_default ) {
5412 __kmp_affinity_gran = affinity_gran_group;
5414 else if ( ( __kmp_affinity_gran != affinity_gran_group )
5415 && ( __kmp_affinity_gran != affinity_gran_fine )
5416 && ( __kmp_affinity_gran != affinity_gran_thread ) ) {
5417 const char *str = NULL;
5418 switch ( __kmp_affinity_gran ) {
5419 case affinity_gran_core: str =
"core";
break;
5420 case affinity_gran_package: str =
"package";
break;
5421 case affinity_gran_node: str =
"node";
break;
5422 default: KMP_DEBUG_ASSERT( 0 );
5424 KMP_WARNING( AffGranTopGroup, var, str );
5425 __kmp_affinity_gran = affinity_gran_fine;
5429 if ( __kmp_affinity_gran == affinity_gran_default ) {
5430 __kmp_affinity_gran = affinity_gran_core;
5432 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5433 const char *str = NULL;
5434 switch ( __kmp_affinity_type ) {
5435 case affinity_physical: str =
"physical";
break;
5436 case affinity_logical: str =
"logical";
break;
5437 case affinity_compact: str =
"compact";
break;
5438 case affinity_scatter: str =
"scatter";
break;
5439 case affinity_explicit: str =
"explicit";
break;
5441 default: KMP_DEBUG_ASSERT( 0 );
5443 KMP_WARNING( AffGranGroupType, var, str );
5444 __kmp_affinity_gran = affinity_gran_core;
5453 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5454 # if KMP_GROUP_AFFINITY 5455 if ( __kmp_num_proc_groups > 1 ) {
5456 __kmp_affinity_respect_mask = FALSE;
5461 __kmp_affinity_respect_mask = TRUE;
5465 if ( ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_intel )
5466 && ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default ) ) {
5467 if ( __kmp_affinity_type == affinity_default ) {
5468 __kmp_affinity_type = affinity_compact;
5469 __kmp_affinity_dups = FALSE;
5474 if ( __kmp_affinity_type == affinity_default ) {
5476 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5477 if( __kmp_mic_type != non_mic ) {
5478 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5482 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5485 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5486 if( __kmp_mic_type != non_mic ) {
5487 __kmp_affinity_type = affinity_scatter;
5491 __kmp_affinity_type = affinity_none;
5495 if ( ( __kmp_affinity_gran == affinity_gran_default )
5496 && ( __kmp_affinity_gran_levels < 0 ) ) {
5497 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5498 if( __kmp_mic_type != non_mic ) {
5499 __kmp_affinity_gran = affinity_gran_fine;
5503 __kmp_affinity_gran = affinity_gran_core;
5506 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5507 __kmp_affinity_top_method = affinity_top_method_all;
5512 K_DIAG( 1, (
"__kmp_affinity_type == %d\n", __kmp_affinity_type ) );
5513 K_DIAG( 1, (
"__kmp_affinity_compact == %d\n", __kmp_affinity_compact ) );
5514 K_DIAG( 1, (
"__kmp_affinity_offset == %d\n", __kmp_affinity_offset ) );
5515 K_DIAG( 1, (
"__kmp_affinity_verbose == %d\n", __kmp_affinity_verbose ) );
5516 K_DIAG( 1, (
"__kmp_affinity_warnings == %d\n", __kmp_affinity_warnings ) );
5517 K_DIAG( 1, (
"__kmp_affinity_respect_mask == %d\n", __kmp_affinity_respect_mask ) );
5518 K_DIAG( 1, (
"__kmp_affinity_gran == %d\n", __kmp_affinity_gran ) );
5520 KMP_DEBUG_ASSERT( __kmp_affinity_type != affinity_default);
5522 KMP_DEBUG_ASSERT( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default );
5528 if ( __kmp_version ) {
5529 __kmp_print_version_1();
5533 if (
string != NULL) {
5534 __kmp_aux_env_initialize( &block );
5537 __kmp_env_blk_free( & block );
5547 kmp_env_blk_t block;
5549 kmp_str_buf_t buffer;
5552 __kmp_str_buf_init( & buffer );
5554 __kmp_env_blk_init( & block, NULL );
5555 __kmp_env_blk_sort( & block );
5558 __kmp_str_buf_print( & buffer,
"\n%s\n\n", KMP_I18N_STR( UserSettings ) );
5559 for ( i = 0; i < block.count; ++ i ) {
5560 char const * name = block.vars[ i ].name;
5561 char const * value = block.vars[ i ].value;
5563 ( KMP_STRLEN( name ) > 4 && strncmp( name,
"KMP_", 4 ) == 0 )
5564 || strncmp( name,
"OMP_", 4 ) == 0
5565 #ifdef KMP_GOMP_COMPAT
5566 || strncmp( name,
"GOMP_", 5 ) == 0
5569 __kmp_str_buf_print( & buffer,
" %s=%s\n", name, value );
5572 __kmp_str_buf_print( & buffer,
"\n" );
5575 __kmp_str_buf_print( & buffer,
"%s\n\n", KMP_I18N_STR( EffectiveSettings ) );
5576 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5577 if ( __kmp_stg_table[ i ].print != NULL ) {
5578 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5582 __kmp_printf(
"%s", buffer.str );
5584 __kmp_env_blk_free( & block );
5585 __kmp_str_buf_free( & buffer );
5594 __kmp_env_print_2() {
5596 kmp_env_blk_t block;
5597 kmp_str_buf_t buffer;
5599 __kmp_env_format = 1;
5602 __kmp_str_buf_init( & buffer );
5604 __kmp_env_blk_init( & block, NULL );
5605 __kmp_env_blk_sort( & block );
5607 __kmp_str_buf_print( & buffer,
"\n%s\n", KMP_I18N_STR( DisplayEnvBegin ) );
5608 __kmp_str_buf_print( & buffer,
" _OPENMP='%d'\n", __kmp_openmp_version );
5610 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5611 if ( __kmp_stg_table[ i ].print != NULL &&
5612 ( ( __kmp_display_env && strncmp( __kmp_stg_table[ i ].name,
"OMP_", 4 ) == 0 ) || __kmp_display_env_verbose ) ) {
5613 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5617 __kmp_str_buf_print( & buffer,
"%s\n", KMP_I18N_STR( DisplayEnvEnd ) );
5618 __kmp_str_buf_print( & buffer,
"\n" );
5620 __kmp_printf(
"%s", buffer.str );
5622 __kmp_env_blk_free( & block );
5623 __kmp_str_buf_free( & buffer );
5628 #endif // OMP_40_ENABLED