17 #include "kmp_wrapper_getpid.h" 18 #include "kmp_environment.h" 19 #include "kmp_atomic.h" 22 #include "kmp_settings.h" 26 static int __kmp_env_toPrint(
char const * name,
int flag );
28 bool __kmp_env_format = 0;
34 __kmp_convert_to_double(
char const * s )
38 if ( KMP_SSCANF( s,
"%lf", &result ) < 1 ) {
47 __kmp_readstr_with_sentinel(
char *dest,
char const * src,
size_t len,
char sentinel) {
49 for (i = 0; i < len; i++) {
50 if ((*src ==
'\0') || (*src == sentinel)) {
61 __kmp_match_with_sentinel(
char const * a,
char const * b,
size_t len,
char sentinel ) {
68 while(*a && *b && *b != sentinel) {
69 char ca = *a, cb = *b;
71 if(ca >=
'a' && ca <=
'z')
73 if(cb >=
'a' && cb <=
'z')
111 __kmp_match_str(
char const *token,
char const *buf,
const char **end) {
113 KMP_ASSERT(token != NULL);
114 KMP_ASSERT(buf != NULL);
115 KMP_ASSERT(end != NULL);
117 while (*token && *buf) {
118 char ct = *token, cb = *buf;
120 if(ct >=
'a' && ct <=
'z')
122 if(cb >=
'a' && cb <=
'z')
138 __kmp_round4k(
size_t size ) {
139 size_t _4k = 4 * 1024;
140 if ( size & ( _4k - 1 ) ) {
141 size &= ~ ( _4k - 1 );
142 if ( size <= KMP_SIZE_T_MAX - _4k ) {
157 __kmp_convert_to_milliseconds(
char const * data )
159 int ret, nvalues, factor;
163 if (data == NULL)
return (-1);
164 if ( __kmp_str_match(
"infinit", -1, data))
return (INT_MAX);
165 value = (double) 0.0;
167 nvalues = KMP_SSCANF (data,
"%lf%c%c", &value, &mult, &extra);
168 if (nvalues < 1)
return (-1);
169 if (nvalues == 1) mult =
'\0';
170 if (nvalues == 3)
return (-1);
172 if (value < 0)
return (-1);
186 factor = 1000 * 60 * 60;
189 factor = 1000 * 24 * 60 * 60;
195 if ( value >= ( (INT_MAX-1) / factor) )
198 ret = (int) (value * (
double) factor);
205 __kmp_strcasecmp_with_sentinel(
char const * a,
char const * b,
char sentinel ) {
210 while(*a && *b && *b != sentinel) {
211 char ca = *a, cb = *b;
213 if(ca >=
'a' && ca <=
'z')
215 if(cb >=
'a' && cb <=
'z')
218 return (
int)(
unsigned char)*a - (
int)(
unsigned char)*b;
223 (*b && *b != sentinel) ? (
int)(
unsigned char)*a - (
int)(
unsigned char)*b : 1 :
224 (*b && *b != sentinel) ? -1 : 0;
232 typedef struct __kmp_setting kmp_setting_t;
233 typedef struct __kmp_stg_ss_data kmp_stg_ss_data_t;
234 typedef struct __kmp_stg_wp_data kmp_stg_wp_data_t;
235 typedef struct __kmp_stg_fr_data kmp_stg_fr_data_t;
237 typedef void ( * kmp_stg_parse_func_t )(
char const * name,
char const * value,
void * data );
238 typedef void ( * kmp_stg_print_func_t )( kmp_str_buf_t * buffer,
char const * name,
void * data );
240 struct __kmp_setting {
242 kmp_stg_parse_func_t parse;
243 kmp_stg_print_func_t print;
250 struct __kmp_stg_ss_data {
252 kmp_setting_t * * rivals;
255 struct __kmp_stg_wp_data {
257 kmp_setting_t * * rivals;
260 struct __kmp_stg_fr_data {
262 kmp_setting_t * * rivals;
266 __kmp_stg_check_rivals(
269 kmp_setting_t * * rivals
278 __kmp_stg_parse_bool(
283 if ( __kmp_str_match_true( value ) ) {
285 }
else if (__kmp_str_match_false( value ) ) {
290 KMP_MSG( BadBoolValue, name, value ),
291 KMP_HNT( ValidBoolValues ),
298 __kmp_stg_parse_size(
307 char const * msg = NULL;
309 size_min = __kmp_round4k( size_min );
310 size_max = __kmp_round4k( size_max );
311 #endif // KMP_OS_DARWIN 313 if ( is_specified != NULL ) {
316 __kmp_str_to_size( value, out, factor, & msg );
318 if ( * out > size_max ) {
320 msg = KMP_I18N_STR( ValueTooLarge );
321 }
else if ( * out < size_min ) {
323 msg = KMP_I18N_STR( ValueTooSmall );
326 size_t round4k = __kmp_round4k( * out );
327 if ( * out != round4k ) {
329 msg = KMP_I18N_STR( NotMultiple4K );
335 if ( * out < size_min ) {
338 else if ( * out > size_max ) {
345 __kmp_str_buf_init( & buf );
346 __kmp_str_buf_print_size( & buf, * out );
347 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
348 KMP_INFORM( Using_str_Value, name, buf.str );
349 __kmp_str_buf_free( & buf );
354 #if KMP_AFFINITY_SUPPORTED 361 KMP_INTERNAL_FREE( (
void *) * out );
362 * out = __kmp_str_format(
"%s", value );
374 char const * msg = NULL;
375 kmp_uint64 uint = * out;
376 __kmp_str_to_uint( value, & uint, & msg );
378 if ( uint < (
unsigned int)min ) {
379 msg = KMP_I18N_STR( ValueTooSmall );
381 }
else if ( uint > (
unsigned int)max ) {
382 msg = KMP_I18N_STR( ValueTooLarge );
388 if ( uint < (
unsigned int)min ) {
391 else if ( uint > (
unsigned int)max ) {
398 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
399 __kmp_str_buf_init( & buf );
400 __kmp_str_buf_print( &buf,
"%" KMP_UINT64_SPEC
"", uint );
401 KMP_INFORM( Using_uint64_Value, name, buf.str );
402 __kmp_str_buf_free( &buf );
408 #if KMP_DEBUG_ADAPTIVE_LOCKS 410 __kmp_stg_parse_file(
419 KMP_INTERNAL_FREE( (
void *) * out );
420 t = (
char *) strrchr(value,
'.');
421 hasSuffix = t && __kmp_str_eqf( t, suffix );
422 t = __kmp_str_format(
"%s%s", value, hasSuffix ?
"" : suffix );
423 __kmp_expand_file_name( buffer,
sizeof(buffer), t);
424 KMP_INTERNAL_FREE(t);
425 * out = __kmp_str_format(
"%s", buffer );
430 static char * par_range_to_print = NULL;
433 __kmp_stg_parse_par_range(
442 size_t len = KMP_STRLEN( value + 1 );
443 par_range_to_print = (
char *) KMP_INTERNAL_MALLOC( len +1 );
444 KMP_STRNCPY_S( par_range_to_print, len + 1, value, len + 1);
445 __kmp_par_range = +1;
446 __kmp_par_range_lb = 0;
447 __kmp_par_range_ub = INT_MAX;
450 if (( value == NULL ) || ( *value ==
'\0' )) {
453 if ( ! __kmp_strcasecmp_with_sentinel(
"routine", value,
'=' )) {
454 value = strchr( value,
'=' ) + 1;
455 len = __kmp_readstr_with_sentinel( out_routine,
456 value, KMP_PAR_RANGE_ROUTINE_LEN - 1,
',' );
458 goto par_range_error;
460 value = strchr( value,
',' );
461 if ( value != NULL ) {
466 if ( ! __kmp_strcasecmp_with_sentinel(
"filename", value,
'=' )) {
467 value = strchr( value,
'=' ) + 1;
468 len = __kmp_readstr_with_sentinel( out_file,
469 value, KMP_PAR_RANGE_FILENAME_LEN - 1,
',' );
471 goto par_range_error;
473 value = strchr( value,
',' );
474 if ( value != NULL ) {
479 if (( ! __kmp_strcasecmp_with_sentinel(
"range", value,
'=' ))
480 || ( ! __kmp_strcasecmp_with_sentinel(
"incl_range", value,
'=' ))) {
481 value = strchr( value,
'=' ) + 1;
482 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub ) != 2 ) {
483 goto par_range_error;
486 value = strchr( value,
',' );
487 if ( value != NULL ) {
492 if ( ! __kmp_strcasecmp_with_sentinel(
"excl_range", value,
'=' )) {
493 value = strchr( value,
'=' ) + 1;
494 if ( KMP_SSCANF( value,
"%d:%d", out_lb, out_ub) != 2 ) {
495 goto par_range_error;
498 value = strchr( value,
',' );
499 if ( value != NULL ) {
505 KMP_WARNING( ParRangeSyntax, name );
513 __kmp_initial_threads_capacity(
int req_nproc )
518 if (nth < (4 * req_nproc))
519 nth = (4 * req_nproc);
520 if (nth < (4 * __kmp_xproc))
521 nth = (4 * __kmp_xproc);
523 if (nth > __kmp_max_nth)
531 __kmp_default_tp_capacity(
int req_nproc,
int max_nth,
int all_threads_specified) {
534 if(all_threads_specified)
537 if (nth < (4 * req_nproc))
538 nth = (4 * req_nproc);
539 if (nth < (4 * __kmp_xproc))
540 nth = (4 * __kmp_xproc);
542 if (nth > __kmp_max_nth)
554 __kmp_stg_print_bool( kmp_str_buf_t * buffer,
char const * name,
int value ) {
555 if( __kmp_env_format ) {
556 KMP_STR_BUF_PRINT_BOOL;
558 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value ?
"true" :
"false" );
563 __kmp_stg_print_int( kmp_str_buf_t * buffer,
char const * name,
int value ) {
564 if( __kmp_env_format ) {
565 KMP_STR_BUF_PRINT_INT;
567 __kmp_str_buf_print( buffer,
" %s=%d\n", name, value );
572 __kmp_stg_print_uint64( kmp_str_buf_t * buffer,
char const * name, kmp_uint64 value ) {
573 if( __kmp_env_format ) {
574 KMP_STR_BUF_PRINT_UINT64;
576 __kmp_str_buf_print( buffer,
" %s=%" KMP_UINT64_SPEC
"\n", name, value );
581 __kmp_stg_print_str( kmp_str_buf_t * buffer,
char const * name,
char const * value ) {
582 if( __kmp_env_format ) {
583 KMP_STR_BUF_PRINT_STR;
585 __kmp_str_buf_print( buffer,
" %s=%s\n", name, value );
590 __kmp_stg_print_size( kmp_str_buf_t * buffer,
char const * name,
size_t value ) {
591 if( __kmp_env_format ) {
592 KMP_STR_BUF_PRINT_NAME_EX(name);
593 __kmp_str_buf_print_size( buffer, value );
594 __kmp_str_buf_print( buffer,
"'\n" );
596 __kmp_str_buf_print( buffer,
" %s=", name );
597 __kmp_str_buf_print_size( buffer, value );
598 __kmp_str_buf_print( buffer,
"\n" );
613 __kmp_stg_parse_all_threads(
char const * name,
char const * value,
void * data ) {
615 kmp_setting_t * * rivals = (kmp_setting_t * *) data;
617 rc = __kmp_stg_check_rivals( name, value, rivals );
621 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
622 __kmp_max_nth = __kmp_xproc;
623 __kmp_allThreadsSpecified = 1;
625 __kmp_stg_parse_int( name, value, 1, __kmp_sys_max_nth, & __kmp_max_nth );
626 __kmp_allThreadsSpecified = 0;
628 K_DIAG( 1, (
"__kmp_max_nth == %d\n", __kmp_max_nth ) );
633 __kmp_stg_print_all_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
634 __kmp_stg_print_int( buffer, name, __kmp_max_nth );
642 __kmp_stg_parse_blocktime(
char const * name,
char const * value,
void * data ) {
643 __kmp_dflt_blocktime = __kmp_convert_to_milliseconds( value );
644 if ( __kmp_dflt_blocktime < 0 ) {
645 __kmp_dflt_blocktime = KMP_DEFAULT_BLOCKTIME;
646 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidValue, name, value ), __kmp_msg_null );
647 KMP_INFORM( Using_int_Value, name, __kmp_dflt_blocktime );
648 __kmp_env_blocktime = FALSE;
650 if ( __kmp_dflt_blocktime < KMP_MIN_BLOCKTIME ) {
651 __kmp_dflt_blocktime = KMP_MIN_BLOCKTIME;
652 __kmp_msg( kmp_ms_warning, KMP_MSG( SmallValue, name, value ), __kmp_msg_null );
653 KMP_INFORM( MinValueUsing, name, __kmp_dflt_blocktime );
654 }
else if ( __kmp_dflt_blocktime > KMP_MAX_BLOCKTIME ) {
655 __kmp_dflt_blocktime = KMP_MAX_BLOCKTIME;
656 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeValue, name, value ), __kmp_msg_null );
657 KMP_INFORM( MaxValueUsing, name, __kmp_dflt_blocktime );
659 __kmp_env_blocktime = TRUE;
662 __kmp_monitor_wakeups = KMP_WAKEUPS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
663 __kmp_bt_intervals = KMP_INTERVALS_FROM_BLOCKTIME( __kmp_dflt_blocktime, __kmp_monitor_wakeups );
664 K_DIAG( 1, (
"__kmp_env_blocktime == %d\n", __kmp_env_blocktime ) );
665 if ( __kmp_env_blocktime ) {
666 K_DIAG( 1, (
"__kmp_dflt_blocktime == %d\n", __kmp_dflt_blocktime ) );
671 __kmp_stg_print_blocktime( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
672 __kmp_stg_print_int( buffer, name, __kmp_dflt_blocktime );
680 __kmp_stg_parse_duplicate_lib_ok(
char const * name,
char const * value,
void * data ) {
683 __kmp_stg_parse_bool( name, value, & __kmp_duplicate_library_ok );
687 __kmp_stg_print_duplicate_lib_ok( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
688 __kmp_stg_print_bool( buffer, name, __kmp_duplicate_library_ok );
695 #if KMP_ARCH_X86 || KMP_ARCH_X86_64 698 __kmp_stg_parse_inherit_fp_control(
char const * name,
char const * value,
void * data ) {
699 __kmp_stg_parse_bool( name, value, & __kmp_inherit_fp_control );
703 __kmp_stg_print_inherit_fp_control( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
705 __kmp_stg_print_bool( buffer, name, __kmp_inherit_fp_control );
716 __kmp_stg_parse_wait_policy(
char const * name,
char const * value,
void * data ) {
718 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
721 rc = __kmp_stg_check_rivals( name, value, wait->rivals );
727 if ( __kmp_str_match(
"ACTIVE", 1, value ) ) {
728 __kmp_library = library_turnaround;
729 }
else if ( __kmp_str_match(
"PASSIVE", 1, value ) ) {
730 __kmp_library = library_throughput;
732 KMP_WARNING( StgInvalidValue, name, value );
735 if ( __kmp_str_match(
"serial", 1, value ) ) {
736 __kmp_library = library_serial;
737 }
else if ( __kmp_str_match(
"throughput", 2, value ) ) {
738 __kmp_library = library_throughput;
739 }
else if ( __kmp_str_match(
"turnaround", 2, value ) ) {
740 __kmp_library = library_turnaround;
741 }
else if ( __kmp_str_match(
"dedicated", 1, value ) ) {
742 __kmp_library = library_turnaround;
743 }
else if ( __kmp_str_match(
"multiuser", 1, value ) ) {
744 __kmp_library = library_throughput;
746 KMP_WARNING( StgInvalidValue, name, value );
749 __kmp_aux_set_library( __kmp_library );
754 __kmp_stg_print_wait_policy( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
756 kmp_stg_wp_data_t * wait = (kmp_stg_wp_data_t *) data;
757 char const * value = NULL;
760 switch ( __kmp_library ) {
761 case library_turnaround : {
764 case library_throughput : {
769 switch ( __kmp_library ) {
770 case library_serial : {
773 case library_turnaround : {
774 value =
"turnaround";
776 case library_throughput : {
777 value =
"throughput";
781 if ( value != NULL ) {
782 __kmp_stg_print_str( buffer, name, value );
792 __kmp_stg_parse_monitor_stacksize(
char const * name,
char const * value,
void * data ) {
793 __kmp_stg_parse_size(
796 __kmp_sys_min_stksize,
799 & __kmp_monitor_stksize,
805 __kmp_stg_print_monitor_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
806 if( __kmp_env_format ) {
807 if ( __kmp_monitor_stksize > 0 )
808 KMP_STR_BUF_PRINT_NAME_EX(name);
810 KMP_STR_BUF_PRINT_NAME;
812 __kmp_str_buf_print( buffer,
" %s", name );
814 if ( __kmp_monitor_stksize > 0 ) {
815 __kmp_str_buf_print_size( buffer, __kmp_monitor_stksize );
817 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
819 if( __kmp_env_format && __kmp_monitor_stksize ) {
820 __kmp_str_buf_print( buffer,
"'\n");
830 __kmp_stg_parse_settings(
char const * name,
char const * value,
void * data ) {
831 __kmp_stg_parse_bool( name, value, & __kmp_settings );
835 __kmp_stg_print_settings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
836 __kmp_stg_print_bool( buffer, name, __kmp_settings );
844 __kmp_stg_parse_stackpad(
char const * name,
char const * value,
void * data ) {
855 __kmp_stg_print_stackpad( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
856 __kmp_stg_print_int( buffer, name, __kmp_stkpadding );
864 __kmp_stg_parse_stackoffset(
char const * name,
char const * value,
void * data ) {
865 __kmp_stg_parse_size(
877 __kmp_stg_print_stackoffset( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
878 __kmp_stg_print_size( buffer, name, __kmp_stkoffset );
886 __kmp_stg_parse_stacksize(
char const * name,
char const * value,
void * data ) {
888 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
891 rc = __kmp_stg_check_rivals( name, value, stacksize->rivals );
895 __kmp_stg_parse_size(
898 __kmp_sys_min_stksize,
911 __kmp_stg_print_stacksize( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
912 kmp_stg_ss_data_t * stacksize = (kmp_stg_ss_data_t *) data;
913 if( __kmp_env_format ) {
914 KMP_STR_BUF_PRINT_NAME_EX(name);
915 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
916 __kmp_str_buf_print( buffer,
"'\n" );
918 __kmp_str_buf_print( buffer,
" %s=", name );
919 __kmp_str_buf_print_size( buffer, (__kmp_stksize % 1024) ? __kmp_stksize / stacksize->factor : __kmp_stksize );
920 __kmp_str_buf_print( buffer,
"\n" );
929 __kmp_stg_parse_version(
char const * name,
char const * value,
void * data ) {
930 __kmp_stg_parse_bool( name, value, & __kmp_version );
934 __kmp_stg_print_version( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
935 __kmp_stg_print_bool( buffer, name, __kmp_version );
943 __kmp_stg_parse_warnings(
char const * name,
char const * value,
void * data ) {
944 __kmp_stg_parse_bool( name, value, & __kmp_generate_warnings );
945 if (__kmp_generate_warnings != kmp_warnings_off) {
946 __kmp_generate_warnings = kmp_warnings_explicit;
951 __kmp_stg_print_warnings( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
952 __kmp_stg_print_bool( buffer, name, __kmp_generate_warnings );
960 __kmp_stg_parse_nested(
char const * name,
char const * value,
void * data ) {
961 __kmp_stg_parse_bool( name, value, & __kmp_dflt_nested );
965 __kmp_stg_print_nested( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
966 __kmp_stg_print_bool( buffer, name, __kmp_dflt_nested );
970 __kmp_parse_nested_num_threads(
const char *var,
const char *env, kmp_nested_nthreads_t *nth_array )
972 const char *next = env;
973 const char *scan = next;
976 int prev_comma = FALSE;
982 if ( *next ==
'\0' ) {
986 if ( ( ( *next <
'0' ) || ( *next >
'9' ) ) && ( *next !=
',') ) {
987 KMP_WARNING( NthSyntaxError, var, env );
991 if ( *next ==
',' ) {
993 if ( total == 0 || prev_comma ) {
1001 if ( *next >=
'0' && *next <=
'9' ) {
1003 SKIP_DIGITS( next );
1005 const char *tmp = next;
1007 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
1008 KMP_WARNING( NthSpacesNotAllowed, var, env );
1013 KMP_DEBUG_ASSERT( total > 0 );
1015 KMP_WARNING( NthSyntaxError, var, env );
1020 if ( ! nth_array->nth ) {
1022 nth_array->nth = (
int * )KMP_INTERNAL_MALLOC(
sizeof(
int ) * total * 2 );
1023 if ( nth_array->nth == NULL ) {
1024 KMP_FATAL( MemoryAllocFailed );
1026 nth_array->size = total * 2;
1028 if ( nth_array->size < total ) {
1031 nth_array->size *= 2;
1032 }
while ( nth_array->size < total );
1034 nth_array->nth = (
int *) KMP_INTERNAL_REALLOC(
1035 nth_array->nth,
sizeof(
int ) * nth_array->size );
1036 if ( nth_array->nth == NULL ) {
1037 KMP_FATAL( MemoryAllocFailed );
1041 nth_array->used = total;
1049 if ( *scan ==
'\0' ) {
1053 if ( *scan ==
',' ) {
1058 nth_array->nth[i++] = 0;
1060 }
else if ( prev_comma ) {
1062 nth_array->nth[i] = nth_array->nth[i - 1];
1071 if ( *scan >=
'0' && *scan <=
'9' ) {
1073 const char *buf = scan;
1074 char const * msg = NULL;
1076 SKIP_DIGITS( scan );
1079 num = __kmp_str_to_int( buf, *scan );
1080 if ( num < KMP_MIN_NTH ) {
1081 msg = KMP_I18N_STR( ValueTooSmall );
1083 }
else if ( num > __kmp_sys_max_nth ) {
1084 msg = KMP_I18N_STR( ValueTooLarge );
1085 num = __kmp_sys_max_nth;
1087 if ( msg != NULL ) {
1089 KMP_WARNING( ParseSizeIntWarn, var, env, msg );
1090 KMP_INFORM( Using_int_Value, var, num );
1092 nth_array->nth[i++] = num;
1098 __kmp_stg_parse_num_threads(
char const * name,
char const * value,
void * data ) {
1100 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
1102 __kmp_nested_nth.nth = (
int* )KMP_INTERNAL_MALLOC(
sizeof(
int ) );
1103 __kmp_nested_nth.size = __kmp_nested_nth.used = 1;
1104 __kmp_nested_nth.nth[0] = __kmp_dflt_team_nth = __kmp_dflt_team_nth_ub = __kmp_xproc;
1106 __kmp_parse_nested_num_threads( name, value, & __kmp_nested_nth );
1107 if ( __kmp_nested_nth.nth ) {
1108 __kmp_dflt_team_nth = __kmp_nested_nth.nth[0];
1109 if ( __kmp_dflt_team_nth_ub < __kmp_dflt_team_nth ) {
1110 __kmp_dflt_team_nth_ub = __kmp_dflt_team_nth;
1114 K_DIAG( 1, (
"__kmp_dflt_team_nth == %d\n", __kmp_dflt_team_nth ) );
1118 __kmp_stg_print_num_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1119 if( __kmp_env_format ) {
1120 KMP_STR_BUF_PRINT_NAME;
1122 __kmp_str_buf_print( buffer,
" %s", name );
1124 if ( __kmp_nested_nth.used ) {
1126 __kmp_str_buf_init( &buf );
1127 for (
int i = 0; i < __kmp_nested_nth.used; i++) {
1128 __kmp_str_buf_print( &buf,
"%d", __kmp_nested_nth.nth[i] );
1129 if ( i < __kmp_nested_nth.used - 1 ) {
1130 __kmp_str_buf_print( &buf,
"," );
1133 __kmp_str_buf_print( buffer,
"='%s'\n", buf.str );
1134 __kmp_str_buf_free(&buf);
1136 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1145 __kmp_stg_parse_tasking(
char const * name,
char const * value,
void * data ) {
1146 __kmp_stg_parse_int( name, value, 0, (
int)tskm_max, (
int *)&__kmp_tasking_mode );
1150 __kmp_stg_print_tasking( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1151 __kmp_stg_print_int( buffer, name, __kmp_tasking_mode );
1155 __kmp_stg_parse_task_stealing(
char const * name,
char const * value,
void * data ) {
1156 __kmp_stg_parse_int( name, value, 0, 1, (
int *)&__kmp_task_stealing_constraint );
1160 __kmp_stg_print_task_stealing( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1161 __kmp_stg_print_int( buffer, name, __kmp_task_stealing_constraint );
1165 __kmp_stg_parse_max_active_levels(
char const * name,
char const * value,
void * data ) {
1166 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_dflt_max_active_levels );
1170 __kmp_stg_print_max_active_levels( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1171 __kmp_stg_print_int( buffer, name, __kmp_dflt_max_active_levels );
1174 #if KMP_NESTED_HOT_TEAMS 1180 __kmp_stg_parse_hot_teams_level(
char const * name,
char const * value,
void * data ) {
1181 if ( TCR_4(__kmp_init_parallel) ) {
1182 KMP_WARNING( EnvParallelWarn, name );
1185 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_max_level );
1189 __kmp_stg_print_hot_teams_level( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1190 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_max_level );
1194 __kmp_stg_parse_hot_teams_mode(
char const * name,
char const * value,
void * data ) {
1195 if ( TCR_4(__kmp_init_parallel) ) {
1196 KMP_WARNING( EnvParallelWarn, name );
1199 __kmp_stg_parse_int( name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT, & __kmp_hot_teams_mode );
1203 __kmp_stg_print_hot_teams_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1204 __kmp_stg_print_int( buffer, name, __kmp_hot_teams_mode );
1207 #endif // KMP_NESTED_HOT_TEAMS 1213 #if KMP_HANDLE_SIGNALS 1216 __kmp_stg_parse_handle_signals(
char const * name,
char const * value,
void * data ) {
1217 __kmp_stg_parse_bool( name, value, & __kmp_handle_signals );
1221 __kmp_stg_print_handle_signals( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1222 __kmp_stg_print_bool( buffer, name, __kmp_handle_signals );
1225 #endif // KMP_HANDLE_SIGNALS 1233 #define KMP_STG_X_DEBUG( x ) \ 1234 static void __kmp_stg_parse_##x##_debug( char const * name, char const * value, void * data ) { \ 1235 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_##x##_debug ); \ 1237 static void __kmp_stg_print_##x##_debug( kmp_str_buf_t * buffer, char const * name, void * data ) { \ 1238 __kmp_stg_print_int( buffer, name, kmp_##x##_debug ); \ 1241 KMP_STG_X_DEBUG( a )
1242 KMP_STG_X_DEBUG( b )
1243 KMP_STG_X_DEBUG( c )
1244 KMP_STG_X_DEBUG( d )
1245 KMP_STG_X_DEBUG( e )
1246 KMP_STG_X_DEBUG( f )
1248 #undef KMP_STG_X_DEBUG 1251 __kmp_stg_parse_debug(
char const * name,
char const * value,
void * data ) {
1253 __kmp_stg_parse_int( name, value, 0, INT_MAX, & debug );
1254 if ( kmp_a_debug < debug ) {
1255 kmp_a_debug = debug;
1257 if ( kmp_b_debug < debug ) {
1258 kmp_b_debug = debug;
1260 if ( kmp_c_debug < debug ) {
1261 kmp_c_debug = debug;
1263 if ( kmp_d_debug < debug ) {
1264 kmp_d_debug = debug;
1266 if ( kmp_e_debug < debug ) {
1267 kmp_e_debug = debug;
1269 if ( kmp_f_debug < debug ) {
1270 kmp_f_debug = debug;
1275 __kmp_stg_parse_debug_buf(
char const * name,
char const * value,
void * data ) {
1276 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf );
1279 if ( __kmp_debug_buf ) {
1281 int elements = __kmp_debug_buf_lines * __kmp_debug_buf_chars;
1284 __kmp_debug_buffer = (
char *) __kmp_page_allocate( elements *
sizeof(
char ) );
1285 for ( i = 0; i < elements; i += __kmp_debug_buf_chars )
1286 __kmp_debug_buffer[i] =
'\0';
1288 __kmp_debug_count = 0;
1290 K_DIAG( 1, (
"__kmp_debug_buf = %d\n", __kmp_debug_buf ) );
1294 __kmp_stg_print_debug_buf( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1295 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf );
1299 __kmp_stg_parse_debug_buf_atomic(
char const * name,
char const * value,
void * data ) {
1300 __kmp_stg_parse_bool( name, value, & __kmp_debug_buf_atomic );
1304 __kmp_stg_print_debug_buf_atomic( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1305 __kmp_stg_print_bool( buffer, name, __kmp_debug_buf_atomic );
1309 __kmp_stg_parse_debug_buf_chars(
char const * name,
char const * value,
void * data ) {
1310 __kmp_stg_parse_int(
1313 KMP_DEBUG_BUF_CHARS_MIN,
1315 & __kmp_debug_buf_chars
1320 __kmp_stg_print_debug_buf_chars( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1321 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_chars );
1325 __kmp_stg_parse_debug_buf_lines(
char const * name,
char const * value,
void * data ) {
1326 __kmp_stg_parse_int(
1329 KMP_DEBUG_BUF_LINES_MIN,
1331 & __kmp_debug_buf_lines
1336 __kmp_stg_print_debug_buf_lines( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1337 __kmp_stg_print_int( buffer, name, __kmp_debug_buf_lines );
1341 __kmp_stg_parse_diag(
char const * name,
char const * value,
void * data ) {
1342 __kmp_stg_parse_int( name, value, 0, INT_MAX, & kmp_diag );
1346 __kmp_stg_print_diag( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1347 __kmp_stg_print_int( buffer, name, kmp_diag );
1357 __kmp_stg_parse_align_alloc(
char const * name,
char const * value,
void * data ) {
1358 __kmp_stg_parse_size(
1364 & __kmp_align_alloc,
1370 __kmp_stg_print_align_alloc( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1371 __kmp_stg_print_size( buffer, name, __kmp_align_alloc );
1382 __kmp_stg_parse_barrier_branch_bit(
char const * name,
char const * value,
void * data ) {
1386 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1387 var = __kmp_barrier_branch_bit_env_name[ i ];
1388 if ( ( strcmp( var, name) == 0 ) && ( value != 0 ) ) {
1391 comma = (
char *) strchr( value,
',' );
1392 __kmp_barrier_gather_branch_bits[ i ] = ( kmp_uint32 ) __kmp_str_to_int( value,
',' );
1394 if ( comma == NULL ) {
1395 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1397 __kmp_barrier_release_branch_bits[ i ] = (kmp_uint32) __kmp_str_to_int( comma + 1, 0 );
1399 if ( __kmp_barrier_release_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1400 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1401 __kmp_barrier_release_branch_bits[ i ] = __kmp_barrier_release_bb_dflt;
1404 if ( __kmp_barrier_gather_branch_bits[ i ] > KMP_MAX_BRANCH_BITS ) {
1405 KMP_WARNING( BarrGatherValueInvalid, name, value );
1406 KMP_INFORM( Using_uint_Value, name, __kmp_barrier_gather_bb_dflt );
1407 __kmp_barrier_gather_branch_bits[ i ] = __kmp_barrier_gather_bb_dflt;
1410 K_DIAG(1, (
"%s == %d,%d\n", __kmp_barrier_branch_bit_env_name[ i ], \
1411 __kmp_barrier_gather_branch_bits [ i ], \
1412 __kmp_barrier_release_branch_bits [ i ]))
1417 __kmp_stg_print_barrier_branch_bit( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1419 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1420 var = __kmp_barrier_branch_bit_env_name[ i ];
1421 if ( strcmp( var, name) == 0 ) {
1422 if( __kmp_env_format ) {
1423 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_branch_bit_env_name[ i ]);
1425 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_branch_bit_env_name[ i ] );
1427 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_barrier_gather_branch_bits [ i ], __kmp_barrier_release_branch_bits [ i ]);
1441 __kmp_stg_parse_barrier_pattern(
char const * name,
char const * value,
void * data ) {
1445 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1446 var = __kmp_barrier_pattern_env_name[ i ];
1448 if ( ( strcmp ( var, name ) == 0 ) && ( value != 0 ) ) {
1450 char *comma = (
char *) strchr( value,
',' );
1453 for ( j = bp_linear_bar; j<bp_last_bar; j++ ) {
1454 if (__kmp_match_with_sentinel( __kmp_barrier_pattern_name[j], value, 1,
',' )) {
1455 __kmp_barrier_gather_pattern[ i ] = (kmp_bar_pat_e) j;
1459 if ( j == bp_last_bar ) {
1460 KMP_WARNING( BarrGatherValueInvalid, name, value );
1461 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1465 if ( comma != NULL ) {
1466 for ( j = bp_linear_bar; j < bp_last_bar; j++ ) {
1467 if ( __kmp_str_match( __kmp_barrier_pattern_name[j], 1, comma + 1 ) ) {
1468 __kmp_barrier_release_pattern[ i ] = (kmp_bar_pat_e) j;
1472 if (j == bp_last_bar) {
1473 __kmp_msg( kmp_ms_warning, KMP_MSG( BarrReleaseValueInvalid, name, comma + 1 ), __kmp_msg_null );
1474 KMP_INFORM( Using_str_Value, name, __kmp_barrier_pattern_name[ bp_linear_bar ] );
1482 __kmp_stg_print_barrier_pattern( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1484 for (
int i=bs_plain_barrier; i<bs_last_barrier; i++ ) {
1485 var = __kmp_barrier_pattern_env_name[ i ];
1486 if ( strcmp ( var, name ) == 0 ) {
1487 int j = __kmp_barrier_gather_pattern [ i ];
1488 int k = __kmp_barrier_release_pattern [ i ];
1489 if( __kmp_env_format ) {
1490 KMP_STR_BUF_PRINT_NAME_EX(__kmp_barrier_pattern_env_name[ i ]);
1492 __kmp_str_buf_print( buffer,
" %s='", __kmp_barrier_pattern_env_name[ i ] );
1494 __kmp_str_buf_print( buffer,
"%s,%s'\n", __kmp_barrier_pattern_name [ j ], __kmp_barrier_pattern_name [ k ]);
1504 __kmp_stg_parse_abort_delay(
char const * name,
char const * value,
void * data ) {
1506 int delay = __kmp_abort_delay / 1000;
1507 __kmp_stg_parse_int( name, value, 0, INT_MAX / 1000, & delay );
1508 __kmp_abort_delay = delay * 1000;
1512 __kmp_stg_print_abort_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1513 __kmp_stg_print_int( buffer, name, __kmp_abort_delay );
1521 __kmp_stg_parse_cpuinfo_file(
char const * name,
char const * value,
void * data ) {
1522 #if KMP_AFFINITY_SUPPORTED 1523 __kmp_stg_parse_str( name, value, & __kmp_cpuinfo_file );
1524 K_DIAG( 1, (
"__kmp_cpuinfo_file == %s\n", __kmp_cpuinfo_file ) );
1529 __kmp_stg_print_cpuinfo_file( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1530 #if KMP_AFFINITY_SUPPORTED 1531 if( __kmp_env_format ) {
1532 KMP_STR_BUF_PRINT_NAME;
1534 __kmp_str_buf_print( buffer,
" %s", name );
1536 if ( __kmp_cpuinfo_file ) {
1537 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_cpuinfo_file );
1539 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1549 __kmp_stg_parse_force_reduction(
char const * name,
char const * value,
void * data )
1551 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1554 rc = __kmp_stg_check_rivals( name, value, reduction->rivals );
1558 if ( reduction->force ) {
1560 if( __kmp_str_match(
"critical", 0, value ) )
1561 __kmp_force_reduction_method = critical_reduce_block;
1562 else if( __kmp_str_match(
"atomic", 0, value ) )
1563 __kmp_force_reduction_method = atomic_reduce_block;
1564 else if( __kmp_str_match(
"tree", 0, value ) )
1565 __kmp_force_reduction_method = tree_reduce_block;
1567 KMP_FATAL( UnknownForceReduction, name, value );
1571 __kmp_stg_parse_bool( name, value, & __kmp_determ_red );
1572 if( __kmp_determ_red ) {
1573 __kmp_force_reduction_method = tree_reduce_block;
1575 __kmp_force_reduction_method = reduction_method_not_defined;
1578 K_DIAG( 1, (
"__kmp_force_reduction_method == %d\n", __kmp_force_reduction_method ) );
1582 __kmp_stg_print_force_reduction( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1584 kmp_stg_fr_data_t * reduction = (kmp_stg_fr_data_t *) data;
1585 if ( reduction->force ) {
1586 if( __kmp_force_reduction_method == critical_reduce_block) {
1587 __kmp_stg_print_str( buffer, name,
"critical");
1588 }
else if ( __kmp_force_reduction_method == atomic_reduce_block ) {
1589 __kmp_stg_print_str( buffer, name,
"atomic");
1590 }
else if ( __kmp_force_reduction_method == tree_reduce_block ) {
1591 __kmp_stg_print_str( buffer, name,
"tree");
1593 if( __kmp_env_format ) {
1594 KMP_STR_BUF_PRINT_NAME;
1596 __kmp_str_buf_print( buffer,
" %s", name );
1598 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
1601 __kmp_stg_print_bool( buffer, name, __kmp_determ_red );
1612 __kmp_stg_parse_storage_map(
char const * name,
char const * value,
void * data ) {
1613 if ( __kmp_str_match(
"verbose", 1, value ) ) {
1614 __kmp_storage_map = TRUE;
1615 __kmp_storage_map_verbose = TRUE;
1616 __kmp_storage_map_verbose_specified = TRUE;
1619 __kmp_storage_map_verbose = FALSE;
1620 __kmp_stg_parse_bool( name, value, & __kmp_storage_map );
1625 __kmp_stg_print_storage_map( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1626 if ( __kmp_storage_map_verbose || __kmp_storage_map_verbose_specified ) {
1627 __kmp_stg_print_str( buffer, name,
"verbose" );
1629 __kmp_stg_print_bool( buffer, name, __kmp_storage_map );
1638 __kmp_stg_parse_all_threadprivate(
char const * name,
char const * value,
void * data ) {
1639 __kmp_stg_parse_int( name, value, __kmp_allThreadsSpecified ? __kmp_max_nth : 1, __kmp_max_nth,
1640 & __kmp_tp_capacity );
1644 __kmp_stg_print_all_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1645 __kmp_stg_print_int( buffer, name, __kmp_tp_capacity );
1654 __kmp_stg_parse_foreign_threads_threadprivate(
char const * name,
char const * value,
void * data ) {
1655 __kmp_stg_parse_bool( name, value, & __kmp_foreign_tp );
1659 __kmp_stg_print_foreign_threads_threadprivate( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
1660 __kmp_stg_print_bool( buffer, name, __kmp_foreign_tp );
1668 #if KMP_AFFINITY_SUPPORTED 1673 __kmp_parse_affinity_proc_id_list(
const char *var,
const char *env,
1674 const char **nextEnv,
char **proclist )
1676 const char *scan = env;
1677 const char *next = scan;
1683 int start, end, stride;
1687 if (*next ==
'\0') {
1700 if ((*next <
'0') || (*next >
'9')) {
1701 KMP_WARNING( AffSyntaxError, var );
1705 num = __kmp_str_to_int(scan, *next);
1706 KMP_ASSERT(num >= 0);
1730 if ((*next <
'0') || (*next >
'9')) {
1731 KMP_WARNING( AffSyntaxError, var );
1736 num = __kmp_str_to_int(scan, *next);
1737 KMP_ASSERT(num >= 0);
1752 if ((*next <
'0') || (*next >
'9')) {
1754 KMP_WARNING( AffSyntaxError, var );
1764 start = __kmp_str_to_int(scan, *next);
1765 KMP_ASSERT(start >= 0);
1790 if ((*next <
'0') || (*next >
'9')) {
1791 KMP_WARNING( AffSyntaxError, var );
1795 end = __kmp_str_to_int(scan, *next);
1796 KMP_ASSERT(end >= 0);
1817 if ((*next <
'0') || (*next >
'9')) {
1818 KMP_WARNING( AffSyntaxError, var );
1822 stride = __kmp_str_to_int(scan, *next);
1823 KMP_ASSERT(stride >= 0);
1831 KMP_WARNING( AffZeroStride, var );
1836 KMP_WARNING( AffStartGreaterEnd, var, start, end );
1842 KMP_WARNING( AffStrideLessZero, var, start, end );
1846 if ((end - start) / stride > 65536 ) {
1847 KMP_WARNING( AffRangeTooBig, var, end, start, stride );
1866 int len = next - env;
1867 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
1868 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
1869 retlist[len] =
'\0';
1870 *proclist = retlist;
1880 static kmp_setting_t *__kmp_affinity_notype = NULL;
1883 __kmp_parse_affinity_env(
char const * name,
char const * value,
1884 enum affinity_type * out_type,
1885 char ** out_proclist,
1889 enum affinity_gran * out_gran,
1890 int * out_gran_levels,
1896 char * buffer = NULL;
1906 int max_proclist = 0;
1913 KMP_ASSERT( value != NULL );
1915 if ( TCR_4(__kmp_init_middle) ) {
1916 KMP_WARNING( EnvMiddleWarn, name );
1917 __kmp_env_toPrint( name, 0 );
1920 __kmp_env_toPrint( name, 1 );
1922 buffer = __kmp_str_format(
"%s", value );
1934 #define EMIT_WARN(skip,errlist) \ 1938 SKIP_TO(next, ','); \ 1942 KMP_WARNING errlist; \ 1945 if (ch == ',') next++; \ 1950 #define _set_param(_guard,_var,_val) \ 1952 if ( _guard == 0 ) { \ 1955 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \ 1960 #define set_type(val) _set_param( type, *out_type, val ) 1961 #define set_verbose(val) _set_param( verbose, *out_verbose, val ) 1962 #define set_warnings(val) _set_param( warnings, *out_warn, val ) 1963 #define set_respect(val) _set_param( respect, *out_respect, val ) 1964 #define set_dups(val) _set_param( dups, *out_dups, val ) 1965 #define set_proclist(val) _set_param( proclist, *out_proclist, val ) 1967 #define set_gran(val,levels) \ 1969 if ( gran == 0 ) { \ 1971 *out_gran_levels = levels; \ 1973 EMIT_WARN( FALSE, ( AffParamDefined, name, start ) ); \ 1979 KMP_DEBUG_ASSERT( ( __kmp_nested_proc_bind.bind_types != NULL )
1980 && ( __kmp_nested_proc_bind.used > 0 ) );
1983 while ( *buf !=
'\0' ) {
1986 if (__kmp_match_str(
"none", buf, (
const char **)&next)) {
1987 set_type( affinity_none );
1989 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
1992 }
else if (__kmp_match_str(
"scatter", buf, (
const char **)&next)) {
1993 set_type( affinity_scatter );
1995 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
1998 }
else if (__kmp_match_str(
"compact", buf, (
const char **)&next)) {
1999 set_type( affinity_compact );
2001 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2004 }
else if (__kmp_match_str(
"logical", buf, (
const char **)&next)) {
2005 set_type( affinity_logical );
2007 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2010 }
else if (__kmp_match_str(
"physical", buf, (
const char **)&next)) {
2011 set_type( affinity_physical );
2013 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2016 }
else if (__kmp_match_str(
"explicit", buf, (
const char **)&next)) {
2017 set_type( affinity_explicit );
2019 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2022 }
else if (__kmp_match_str(
"balanced", buf, (
const char **)&next)) {
2023 set_type( affinity_balanced );
2025 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2028 }
else if (__kmp_match_str(
"disabled", buf, (
const char **)&next)) {
2029 set_type( affinity_disabled );
2031 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2034 }
else if (__kmp_match_str(
"verbose", buf, (
const char **)&next)) {
2035 set_verbose( TRUE );
2037 }
else if (__kmp_match_str(
"noverbose", buf, (
const char **)&next)) {
2038 set_verbose( FALSE );
2040 }
else if (__kmp_match_str(
"warnings", buf, (
const char **)&next)) {
2041 set_warnings( TRUE );
2043 }
else if (__kmp_match_str(
"nowarnings", buf, (
const char **)&next)) {
2044 set_warnings( FALSE );
2046 }
else if (__kmp_match_str(
"respect", buf, (
const char **)&next)) {
2047 set_respect( TRUE );
2049 }
else if (__kmp_match_str(
"norespect", buf, (
const char **)&next)) {
2050 set_respect( FALSE );
2052 }
else if (__kmp_match_str(
"duplicates", buf, (
const char **)&next)
2053 || __kmp_match_str(
"dups", buf, (
const char **)&next)) {
2056 }
else if (__kmp_match_str(
"noduplicates", buf, (
const char **)&next)
2057 || __kmp_match_str(
"nodups", buf, (
const char **)&next)) {
2060 }
else if (__kmp_match_str(
"granularity", buf, (
const char **)&next)
2061 || __kmp_match_str(
"gran", buf, (
const char **)&next)) {
2064 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2071 if (__kmp_match_str(
"fine", buf, (
const char **)&next)) {
2072 set_gran( affinity_gran_fine, -1 );
2074 }
else if (__kmp_match_str(
"thread", buf, (
const char **)&next)) {
2075 set_gran( affinity_gran_thread, -1 );
2077 }
else if (__kmp_match_str(
"core", buf, (
const char **)&next)) {
2078 set_gran( affinity_gran_core, -1 );
2080 }
else if (__kmp_match_str(
"package", buf, (
const char **)&next)) {
2081 set_gran( affinity_gran_package, -1 );
2083 }
else if (__kmp_match_str(
"node", buf, (
const char **)&next)) {
2084 set_gran( affinity_gran_node, -1 );
2086 # if KMP_GROUP_AFFINITY 2087 }
else if (__kmp_match_str(
"group", buf, (
const char **)&next)) {
2088 set_gran( affinity_gran_group, -1 );
2091 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2095 n = __kmp_str_to_int( buf, *next );
2098 set_gran( affinity_gran_default, n );
2100 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2103 }
else if (__kmp_match_str(
"proclist", buf, (
const char **)&next)) {
2104 char *temp_proclist;
2108 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2114 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2119 if (! __kmp_parse_affinity_proc_id_list(name, buf,
2120 (
const char **)&next, &temp_proclist)) {
2125 if (*next ==
']') next++;
2127 if (*next ==
',') next++;
2132 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2136 set_proclist( temp_proclist );
2137 }
else if ((*buf >=
'0') && (*buf <=
'9')) {
2142 n = __kmp_str_to_int( buf, *next );
2146 number[ count ] = n;
2148 KMP_WARNING( AffManyParams, name, start );
2152 EMIT_WARN( TRUE, ( AffInvalidParam, name, start ) );
2161 else if (*next !=
'\0') {
2162 const char *temp = next;
2163 EMIT_WARN( TRUE, ( ParseExtraCharsWarn, name, temp ) );
2175 #undef set_granularity 2177 KMP_INTERNAL_FREE( buffer );
2181 KMP_WARNING( AffProcListNoType, name );
2182 __kmp_affinity_type = affinity_explicit;
2184 else if ( __kmp_affinity_type != affinity_explicit ) {
2185 KMP_WARNING( AffProcListNotExplicit, name );
2186 KMP_ASSERT( *out_proclist != NULL );
2187 KMP_INTERNAL_FREE( *out_proclist );
2188 *out_proclist = NULL;
2191 switch ( *out_type ) {
2192 case affinity_logical:
2193 case affinity_physical: {
2195 *out_offset = number[ 0 ];
2198 KMP_WARNING( AffManyParamsForLogic, name, number[ 1 ] );
2201 case affinity_balanced: {
2203 *out_compact = number[ 0 ];
2206 *out_offset = number[ 1 ];
2209 if ( __kmp_affinity_gran == affinity_gran_default ) {
2210 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 2211 if( __kmp_mic_type != non_mic ) {
2212 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2213 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"fine" );
2215 __kmp_affinity_gran = affinity_gran_fine;
2219 if( __kmp_affinity_verbose || __kmp_affinity_warnings ) {
2220 KMP_WARNING( AffGranUsing,
"KMP_AFFINITY",
"core" );
2222 __kmp_affinity_gran = affinity_gran_core;
2226 case affinity_scatter:
2227 case affinity_compact: {
2229 *out_compact = number[ 0 ];
2232 *out_offset = number[ 1 ];
2235 case affinity_explicit: {
2236 if ( *out_proclist == NULL ) {
2237 KMP_WARNING( AffNoProcList, name );
2238 __kmp_affinity_type = affinity_none;
2241 KMP_WARNING( AffNoParam, name,
"explicit" );
2244 case affinity_none: {
2246 KMP_WARNING( AffNoParam, name,
"none" );
2249 case affinity_disabled: {
2251 KMP_WARNING( AffNoParam, name,
"disabled" );
2254 case affinity_default: {
2256 KMP_WARNING( AffNoParam, name,
"default" );
2266 __kmp_stg_parse_affinity(
char const * name,
char const * value,
void * data )
2268 kmp_setting_t **rivals = (kmp_setting_t **) data;
2271 rc = __kmp_stg_check_rivals( name, value, rivals );
2276 __kmp_parse_affinity_env( name, value, & __kmp_affinity_type,
2277 & __kmp_affinity_proclist, & __kmp_affinity_verbose,
2278 & __kmp_affinity_warnings, & __kmp_affinity_respect_mask,
2279 & __kmp_affinity_gran, & __kmp_affinity_gran_levels,
2280 & __kmp_affinity_dups, & __kmp_affinity_compact,
2281 & __kmp_affinity_offset );
2286 __kmp_stg_print_affinity( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
2287 if( __kmp_env_format ) {
2288 KMP_STR_BUF_PRINT_NAME_EX(name);
2290 __kmp_str_buf_print( buffer,
" %s='", name );
2292 if ( __kmp_affinity_verbose ) {
2293 __kmp_str_buf_print( buffer,
"%s,",
"verbose");
2295 __kmp_str_buf_print( buffer,
"%s,",
"noverbose");
2297 if ( __kmp_affinity_warnings ) {
2298 __kmp_str_buf_print( buffer,
"%s,",
"warnings");
2300 __kmp_str_buf_print( buffer,
"%s,",
"nowarnings");
2302 if ( KMP_AFFINITY_CAPABLE() ) {
2303 if ( __kmp_affinity_respect_mask ) {
2304 __kmp_str_buf_print( buffer,
"%s,",
"respect");
2306 __kmp_str_buf_print( buffer,
"%s,",
"norespect");
2308 switch ( __kmp_affinity_gran ) {
2309 case affinity_gran_default:
2310 __kmp_str_buf_print( buffer,
"%s",
"granularity=default,");
2312 case affinity_gran_fine:
2313 __kmp_str_buf_print( buffer,
"%s",
"granularity=fine,");
2315 case affinity_gran_thread:
2316 __kmp_str_buf_print( buffer,
"%s",
"granularity=thread,");
2318 case affinity_gran_core:
2319 __kmp_str_buf_print( buffer,
"%s",
"granularity=core,");
2321 case affinity_gran_package:
2322 __kmp_str_buf_print( buffer,
"%s",
"granularity=package,");
2324 case affinity_gran_node:
2325 __kmp_str_buf_print( buffer,
"%s",
"granularity=node,");
2327 # if KMP_GROUP_AFFINITY 2328 case affinity_gran_group:
2329 __kmp_str_buf_print( buffer,
"%s",
"granularity=group,");
2333 if ( __kmp_affinity_dups ) {
2334 __kmp_str_buf_print( buffer,
"%s,",
"duplicates");
2336 __kmp_str_buf_print( buffer,
"%s,",
"noduplicates");
2339 if ( ! KMP_AFFINITY_CAPABLE() ) {
2340 __kmp_str_buf_print( buffer,
"%s",
"disabled" );
2342 else switch ( __kmp_affinity_type ){
2344 __kmp_str_buf_print( buffer,
"%s",
"none");
2346 case affinity_physical:
2347 __kmp_str_buf_print( buffer,
"%s,%d",
"physical",
2348 __kmp_affinity_offset );
2350 case affinity_logical:
2351 __kmp_str_buf_print( buffer,
"%s,%d",
"logical",
2352 __kmp_affinity_offset );
2354 case affinity_compact:
2355 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"compact",
2356 __kmp_affinity_compact, __kmp_affinity_offset );
2358 case affinity_scatter:
2359 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"scatter",
2360 __kmp_affinity_compact, __kmp_affinity_offset );
2362 case affinity_explicit:
2363 __kmp_str_buf_print( buffer,
"%s=[%s],%s",
"proclist",
2364 __kmp_affinity_proclist,
"explicit" );
2366 case affinity_balanced:
2367 __kmp_str_buf_print( buffer,
"%s,%d,%d",
"balanced",
2368 __kmp_affinity_compact, __kmp_affinity_offset );
2370 case affinity_disabled:
2371 __kmp_str_buf_print( buffer,
"%s",
"disabled");
2373 case affinity_default:
2374 __kmp_str_buf_print( buffer,
"%s",
"default");
2377 __kmp_str_buf_print( buffer,
"%s",
"<unknown>");
2380 __kmp_str_buf_print( buffer,
"'\n" );
2383 # ifdef KMP_GOMP_COMPAT 2386 __kmp_stg_parse_gomp_cpu_affinity(
char const * name,
char const * value,
void * data )
2388 const char * next = NULL;
2389 char * temp_proclist;
2390 kmp_setting_t **rivals = (kmp_setting_t **) data;
2393 rc = __kmp_stg_check_rivals( name, value, rivals );
2398 if ( TCR_4(__kmp_init_middle) ) {
2399 KMP_WARNING( EnvMiddleWarn, name );
2400 __kmp_env_toPrint( name, 0 );
2404 __kmp_env_toPrint( name, 1 );
2406 if ( __kmp_parse_affinity_proc_id_list( name, value, &next,
2409 if (*next ==
'\0') {
2413 __kmp_affinity_proclist = temp_proclist;
2414 __kmp_affinity_type = affinity_explicit;
2415 __kmp_affinity_gran = affinity_gran_fine;
2417 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
2421 KMP_WARNING( AffSyntaxError, name );
2422 if (temp_proclist != NULL) {
2423 KMP_INTERNAL_FREE((
void *)temp_proclist);
2431 __kmp_affinity_type = affinity_none;
2433 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
2466 __kmp_parse_subplace_list(
const char *var,
const char **scan )
2471 int start, count, stride;
2477 if ((**scan <
'0') || (**scan >
'9')) {
2478 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2483 start = __kmp_str_to_int(*scan, *next);
2484 KMP_ASSERT(start >= 0);
2491 if (**scan ==
'}') {
2494 if (**scan ==
',') {
2498 if (**scan !=
':') {
2499 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2508 if ((**scan <
'0') || (**scan >
'9')) {
2509 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2514 count = __kmp_str_to_int(*scan, *next);
2515 KMP_ASSERT(count >= 0);
2522 if (**scan ==
'}') {
2525 if (**scan ==
',') {
2529 if (**scan !=
':') {
2530 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2541 if (**scan ==
'+') {
2545 if (**scan ==
'-') {
2553 if ((**scan <
'0') || (**scan >
'9')) {
2554 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2559 stride = __kmp_str_to_int(*scan, *next);
2560 KMP_ASSERT(stride >= 0);
2568 if (**scan ==
'}') {
2571 if (**scan ==
',') {
2576 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2583 __kmp_parse_place(
const char *var,
const char ** scan )
2591 if (**scan ==
'{') {
2593 if (! __kmp_parse_subplace_list(var, scan)) {
2596 if (**scan !=
'}') {
2597 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2602 else if (**scan ==
'!') {
2604 return __kmp_parse_place(var, scan);
2606 else if ((**scan >=
'0') && (**scan <=
'9')) {
2609 int proc = __kmp_str_to_int(*scan, *next);
2610 KMP_ASSERT(proc >= 0);
2614 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2621 __kmp_parse_place_list(
const char *var,
const char *env,
char **place_list )
2623 const char *scan = env;
2624 const char *next = scan;
2627 int start, count, stride;
2629 if (! __kmp_parse_place(var, &scan)) {
2637 if (*scan ==
'\0') {
2645 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2654 if ((*scan <
'0') || (*scan >
'9')) {
2655 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2660 count = __kmp_str_to_int(scan, *next);
2661 KMP_ASSERT(count >= 0);
2668 if (*scan ==
'\0') {
2676 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2699 if ((*scan <
'0') || (*scan >
'9')) {
2700 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2705 stride = __kmp_str_to_int(scan, *next);
2706 KMP_ASSERT(stride >= 0);
2714 if (*scan ==
'\0') {
2722 KMP_WARNING( SyntaxErrorUsing, var,
"\"threads\"" );
2727 int len = scan - env;
2728 char *retlist = (
char *)__kmp_allocate((len + 1) *
sizeof(char));
2729 KMP_MEMCPY_S(retlist, (len+1)*
sizeof(
char), env, len *
sizeof(
char));
2730 retlist[len] =
'\0';
2731 *place_list = retlist;
2737 __kmp_stg_parse_places(
char const * name,
char const * value,
void * data )
2740 const char *scan = value;
2741 const char *next = scan;
2742 const char *kind =
"\"threads\"";
2743 kmp_setting_t **rivals = (kmp_setting_t **) data;
2746 rc = __kmp_stg_check_rivals( name, value, rivals );
2755 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2756 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2761 if ( __kmp_match_str(
"threads", scan, &next ) ) {
2763 __kmp_affinity_type = affinity_compact;
2764 __kmp_affinity_gran = affinity_gran_thread;
2765 __kmp_affinity_dups = FALSE;
2766 kind =
"\"threads\"";
2768 else if ( __kmp_match_str(
"cores", scan, &next ) ) {
2770 __kmp_affinity_type = affinity_compact;
2771 __kmp_affinity_gran = affinity_gran_core;
2772 __kmp_affinity_dups = FALSE;
2775 else if ( __kmp_match_str(
"sockets", scan, &next ) ) {
2777 __kmp_affinity_type = affinity_compact;
2778 __kmp_affinity_gran = affinity_gran_package;
2779 __kmp_affinity_dups = FALSE;
2780 kind =
"\"sockets\"";
2783 if ( __kmp_affinity_proclist != NULL ) {
2784 KMP_INTERNAL_FREE( (
void *)__kmp_affinity_proclist );
2785 __kmp_affinity_proclist = NULL;
2787 if ( __kmp_parse_place_list( name, value, &__kmp_affinity_proclist ) ) {
2788 __kmp_affinity_type = affinity_explicit;
2789 __kmp_affinity_gran = affinity_gran_fine;
2790 __kmp_affinity_dups = FALSE;
2791 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2792 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2798 if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) {
2799 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
2803 if ( *scan ==
'\0' ) {
2810 if ( *scan !=
'(' ) {
2811 KMP_WARNING( SyntaxErrorUsing, name, kind );
2819 count = __kmp_str_to_int(scan, *next);
2820 KMP_ASSERT(count >= 0);
2824 if ( *scan !=
')' ) {
2825 KMP_WARNING( SyntaxErrorUsing, name, kind );
2831 if ( *scan !=
'\0' ) {
2832 KMP_WARNING( ParseExtraCharsWarn, name, scan );
2834 __kmp_affinity_num_places = count;
2838 __kmp_stg_print_places( kmp_str_buf_t * buffer,
char const * name,
2841 if( __kmp_env_format ) {
2842 KMP_STR_BUF_PRINT_NAME;
2844 __kmp_str_buf_print( buffer,
" %s", name );
2846 if ( ( __kmp_nested_proc_bind.used == 0 )
2847 || ( __kmp_nested_proc_bind.bind_types == NULL )
2848 || ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_false ) ) {
2849 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2851 else if ( __kmp_affinity_type == affinity_explicit ) {
2852 if ( __kmp_affinity_proclist != NULL ) {
2853 __kmp_str_buf_print( buffer,
"='%s'\n", __kmp_affinity_proclist );
2856 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2859 else if ( __kmp_affinity_type == affinity_compact ) {
2861 if ( __kmp_affinity_num_masks > 0 ) {
2862 num = __kmp_affinity_num_masks;
2864 else if ( __kmp_affinity_num_places > 0 ) {
2865 num = __kmp_affinity_num_places;
2870 if ( __kmp_affinity_gran == affinity_gran_thread ) {
2872 __kmp_str_buf_print( buffer,
"='threads(%d)'\n", num );
2875 __kmp_str_buf_print( buffer,
"='threads'\n" );
2878 else if ( __kmp_affinity_gran == affinity_gran_core ) {
2880 __kmp_str_buf_print( buffer,
"='cores(%d)' \n", num );
2883 __kmp_str_buf_print( buffer,
"='cores'\n" );
2886 else if ( __kmp_affinity_gran == affinity_gran_package ) {
2888 __kmp_str_buf_print( buffer,
"='sockets(%d)'\n", num );
2891 __kmp_str_buf_print( buffer,
"='sockets'\n" );
2895 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2899 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
2905 # if (! OMP_40_ENABLED) 2908 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
2911 kmp_setting_t **rivals = (kmp_setting_t **) data;
2914 rc = __kmp_stg_check_rivals( name, value, rivals );
2922 __kmp_stg_parse_bool( name, value, & enabled );
2928 __kmp_affinity_type = affinity_scatter;
2929 # if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 2930 if( __kmp_mic_type != non_mic )
2931 __kmp_affinity_gran = affinity_gran_fine;
2934 __kmp_affinity_gran = affinity_gran_core;
2937 __kmp_affinity_type = affinity_none;
2945 __kmp_stg_parse_topology_method(
char const * name,
char const * value,
2947 if ( __kmp_str_match(
"all", 1, value ) ) {
2948 __kmp_affinity_top_method = affinity_top_method_all;
2950 # if KMP_ARCH_X86 || KMP_ARCH_X86_64 2951 else if ( __kmp_str_match(
"x2apic id", 9, value )
2952 || __kmp_str_match(
"x2apic_id", 9, value )
2953 || __kmp_str_match(
"x2apic-id", 9, value )
2954 || __kmp_str_match(
"x2apicid", 8, value )
2955 || __kmp_str_match(
"cpuid leaf 11", 13, value )
2956 || __kmp_str_match(
"cpuid_leaf_11", 13, value )
2957 || __kmp_str_match(
"cpuid-leaf-11", 13, value )
2958 || __kmp_str_match(
"cpuid leaf11", 12, value )
2959 || __kmp_str_match(
"cpuid_leaf11", 12, value )
2960 || __kmp_str_match(
"cpuid-leaf11", 12, value )
2961 || __kmp_str_match(
"cpuidleaf 11", 12, value )
2962 || __kmp_str_match(
"cpuidleaf_11", 12, value )
2963 || __kmp_str_match(
"cpuidleaf-11", 12, value )
2964 || __kmp_str_match(
"cpuidleaf11", 11, value )
2965 || __kmp_str_match(
"cpuid 11", 8, value )
2966 || __kmp_str_match(
"cpuid_11", 8, value )
2967 || __kmp_str_match(
"cpuid-11", 8, value )
2968 || __kmp_str_match(
"cpuid11", 7, value )
2969 || __kmp_str_match(
"leaf 11", 7, value )
2970 || __kmp_str_match(
"leaf_11", 7, value )
2971 || __kmp_str_match(
"leaf-11", 7, value )
2972 || __kmp_str_match(
"leaf11", 6, value ) ) {
2973 __kmp_affinity_top_method = affinity_top_method_x2apicid;
2975 else if ( __kmp_str_match(
"apic id", 7, value )
2976 || __kmp_str_match(
"apic_id", 7, value )
2977 || __kmp_str_match(
"apic-id", 7, value )
2978 || __kmp_str_match(
"apicid", 6, value )
2979 || __kmp_str_match(
"cpuid leaf 4", 12, value )
2980 || __kmp_str_match(
"cpuid_leaf_4", 12, value )
2981 || __kmp_str_match(
"cpuid-leaf-4", 12, value )
2982 || __kmp_str_match(
"cpuid leaf4", 11, value )
2983 || __kmp_str_match(
"cpuid_leaf4", 11, value )
2984 || __kmp_str_match(
"cpuid-leaf4", 11, value )
2985 || __kmp_str_match(
"cpuidleaf 4", 11, value )
2986 || __kmp_str_match(
"cpuidleaf_4", 11, value )
2987 || __kmp_str_match(
"cpuidleaf-4", 11, value )
2988 || __kmp_str_match(
"cpuidleaf4", 10, value )
2989 || __kmp_str_match(
"cpuid 4", 7, value )
2990 || __kmp_str_match(
"cpuid_4", 7, value )
2991 || __kmp_str_match(
"cpuid-4", 7, value )
2992 || __kmp_str_match(
"cpuid4", 6, value )
2993 || __kmp_str_match(
"leaf 4", 6, value )
2994 || __kmp_str_match(
"leaf_4", 6, value )
2995 || __kmp_str_match(
"leaf-4", 6, value )
2996 || __kmp_str_match(
"leaf4", 5, value ) ) {
2997 __kmp_affinity_top_method = affinity_top_method_apicid;
3000 else if ( __kmp_str_match(
"/proc/cpuinfo", 2, value )
3001 || __kmp_str_match(
"cpuinfo", 5, value )) {
3002 __kmp_affinity_top_method = affinity_top_method_cpuinfo;
3004 # if KMP_GROUP_AFFINITY 3005 else if ( __kmp_str_match(
"group", 1, value ) ) {
3006 __kmp_affinity_top_method = affinity_top_method_group;
3009 else if ( __kmp_str_match(
"flat", 1, value ) ) {
3010 __kmp_affinity_top_method = affinity_top_method_flat;
3013 else if ( __kmp_str_match(
"hwloc", 1, value) ) {
3014 __kmp_affinity_top_method = affinity_top_method_hwloc;
3018 KMP_WARNING( StgInvalidValue, name, value );
3023 __kmp_stg_print_topology_method( kmp_str_buf_t * buffer,
char const * name,
3026 char const * value = NULL;
3028 switch ( __kmp_affinity_top_method ) {
3029 case affinity_top_method_default:
3033 case affinity_top_method_all:
3037 # if KMP_ARCH_X86 || KMP_ARCH_X86_64 3038 case affinity_top_method_x2apicid:
3039 value =
"x2APIC id";
3042 case affinity_top_method_apicid:
3047 case affinity_top_method_cpuinfo:
3051 # if KMP_GROUP_AFFINITY 3052 case affinity_top_method_group:
3057 case affinity_top_method_flat:
3062 if ( value != NULL ) {
3063 __kmp_stg_print_str( buffer, name, value );
3078 __kmp_stg_parse_proc_bind(
char const * name,
char const * value,
void * data )
3080 kmp_setting_t **rivals = (kmp_setting_t **) data;
3083 rc = __kmp_stg_check_rivals( name, value, rivals );
3091 KMP_DEBUG_ASSERT( (__kmp_nested_proc_bind.bind_types != NULL)
3092 && ( __kmp_nested_proc_bind.used > 0 ) );
3094 const char *buf = value;
3098 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3100 SKIP_DIGITS( next );
3101 num = __kmp_str_to_int( buf, *next );
3102 KMP_ASSERT( num >= 0 );
3111 if ( __kmp_match_str(
"disabled", buf, &next ) ) {
3114 # if KMP_AFFINITY_SUPPORTED 3115 __kmp_affinity_type = affinity_disabled;
3117 __kmp_nested_proc_bind.used = 1;
3118 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3120 else if ( ( num == (
int)proc_bind_false )
3121 || __kmp_match_str(
"false", buf, &next ) ) {
3124 # if KMP_AFFINITY_SUPPORTED 3125 __kmp_affinity_type = affinity_none;
3127 __kmp_nested_proc_bind.used = 1;
3128 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3130 else if ( ( num == (
int)proc_bind_true )
3131 || __kmp_match_str(
"true", buf, &next ) ) {
3134 __kmp_nested_proc_bind.used = 1;
3135 __kmp_nested_proc_bind.bind_types[0] = proc_bind_true;
3143 for ( scan = buf; *scan !=
'\0'; scan++ ) {
3144 if ( *scan ==
',' ) {
3152 if ( __kmp_nested_proc_bind.size < nelem ) {
3153 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
3154 KMP_INTERNAL_REALLOC( __kmp_nested_proc_bind.bind_types,
3155 sizeof(kmp_proc_bind_t) * nelem );
3156 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
3157 KMP_FATAL( MemoryAllocFailed );
3159 __kmp_nested_proc_bind.size = nelem;
3161 __kmp_nested_proc_bind.used = nelem;
3168 enum kmp_proc_bind_t bind;
3170 if ( ( num == (
int)proc_bind_master )
3171 || __kmp_match_str(
"master", buf, &next ) ) {
3174 bind = proc_bind_master;
3176 else if ( ( num == (
int)proc_bind_close )
3177 || __kmp_match_str(
"close", buf, &next ) ) {
3180 bind = proc_bind_close;
3182 else if ( ( num == (
int)proc_bind_spread )
3183 || __kmp_match_str(
"spread", buf, &next ) ) {
3186 bind = proc_bind_spread;
3189 KMP_WARNING( StgInvalidValue, name, value );
3190 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
3191 __kmp_nested_proc_bind.used = 1;
3195 __kmp_nested_proc_bind.bind_types[i++] = bind;
3199 KMP_DEBUG_ASSERT( *buf ==
',' );
3206 if ( (*buf >=
'0') && (*buf <=
'9') ) {
3208 SKIP_DIGITS( next );
3209 num = __kmp_str_to_int( buf, *next );
3210 KMP_ASSERT( num >= 0 );
3220 if ( *buf !=
'\0' ) {
3221 KMP_WARNING( ParseExtraCharsWarn, name, buf );
3227 __kmp_stg_print_proc_bind( kmp_str_buf_t * buffer,
char const * name,
3230 int nelem = __kmp_nested_proc_bind.used;
3231 if( __kmp_env_format ) {
3232 KMP_STR_BUF_PRINT_NAME;
3234 __kmp_str_buf_print( buffer,
" %s", name );
3237 __kmp_str_buf_print( buffer,
": %s\n", KMP_I18N_STR( NotDefined ) );
3241 __kmp_str_buf_print( buffer,
"='", name );
3242 for ( i = 0; i < nelem; i++ ) {
3243 switch ( __kmp_nested_proc_bind.bind_types[i] ) {
3244 case proc_bind_false:
3245 __kmp_str_buf_print( buffer,
"false" );
3248 case proc_bind_true:
3249 __kmp_str_buf_print( buffer,
"true" );
3252 case proc_bind_master:
3253 __kmp_str_buf_print( buffer,
"master" );
3256 case proc_bind_close:
3257 __kmp_str_buf_print( buffer,
"close" );
3260 case proc_bind_spread:
3261 __kmp_str_buf_print( buffer,
"spread" );
3264 case proc_bind_intel:
3265 __kmp_str_buf_print( buffer,
"intel" );
3268 case proc_bind_default:
3269 __kmp_str_buf_print( buffer,
"default" );
3272 if ( i < nelem - 1 ) {
3273 __kmp_str_buf_print( buffer,
"," );
3276 __kmp_str_buf_print( buffer,
"'\n" );
3288 __kmp_stg_parse_omp_dynamic(
char const * name,
char const * value,
void * data )
3290 __kmp_stg_parse_bool( name, value, & (__kmp_global.g.g_dynamic) );
3294 __kmp_stg_print_omp_dynamic( kmp_str_buf_t * buffer,
char const * name,
void * data )
3296 __kmp_stg_print_bool( buffer, name, __kmp_global.g.g_dynamic );
3300 __kmp_stg_parse_kmp_dynamic_mode(
char const * name,
char const * value,
void * data )
3302 if ( TCR_4(__kmp_init_parallel) ) {
3303 KMP_WARNING( EnvParallelWarn, name );
3304 __kmp_env_toPrint( name, 0 );
3307 #ifdef USE_LOAD_BALANCE 3308 else if ( __kmp_str_match(
"load balance", 2, value )
3309 || __kmp_str_match(
"load_balance", 2, value )
3310 || __kmp_str_match(
"load-balance", 2, value )
3311 || __kmp_str_match(
"loadbalance", 2, value )
3312 || __kmp_str_match(
"balance", 1, value ) ) {
3313 __kmp_global.g.g_dynamic_mode = dynamic_load_balance;
3316 else if ( __kmp_str_match(
"thread limit", 1, value )
3317 || __kmp_str_match(
"thread_limit", 1, value )
3318 || __kmp_str_match(
"thread-limit", 1, value )
3319 || __kmp_str_match(
"threadlimit", 1, value )
3320 || __kmp_str_match(
"limit", 2, value ) ) {
3321 __kmp_global.g.g_dynamic_mode = dynamic_thread_limit;
3323 else if ( __kmp_str_match(
"random", 1, value ) ) {
3324 __kmp_global.g.g_dynamic_mode = dynamic_random;
3327 KMP_WARNING( StgInvalidValue, name, value );
3332 __kmp_stg_print_kmp_dynamic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data )
3335 if ( __kmp_global.g.g_dynamic_mode == dynamic_default ) {
3336 __kmp_str_buf_print( buffer,
" %s: %s \n", name, KMP_I18N_STR( NotDefined ) );
3338 # ifdef USE_LOAD_BALANCE 3339 else if ( __kmp_global.g.g_dynamic_mode == dynamic_load_balance ) {
3340 __kmp_stg_print_str( buffer, name,
"load balance" );
3343 else if ( __kmp_global.g.g_dynamic_mode == dynamic_thread_limit ) {
3344 __kmp_stg_print_str( buffer, name,
"thread limit" );
3346 else if ( __kmp_global.g.g_dynamic_mode == dynamic_random ) {
3347 __kmp_stg_print_str( buffer, name,
"random" );
3356 #ifdef USE_LOAD_BALANCE 3363 __kmp_stg_parse_ld_balance_interval(
char const * name,
char const * value,
void * data )
3365 double interval = __kmp_convert_to_double( value );
3366 if ( interval >= 0 ) {
3367 __kmp_load_balance_interval = interval;
3369 KMP_WARNING( StgInvalidValue, name, value );
3374 __kmp_stg_print_ld_balance_interval( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3376 __kmp_str_buf_print( buffer,
" %s=%8.6f\n", name, __kmp_load_balance_interval );
3387 __kmp_stg_parse_init_at_fork(
char const * name,
char const * value,
void * data ) {
3388 __kmp_stg_parse_bool( name, value, & __kmp_need_register_atfork );
3389 if ( __kmp_need_register_atfork ) {
3390 __kmp_need_register_atfork_specified = TRUE;
3395 __kmp_stg_print_init_at_fork( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3396 __kmp_stg_print_bool( buffer, name, __kmp_need_register_atfork_specified );
3404 __kmp_stg_parse_schedule(
char const * name,
char const * value,
void * data ) {
3406 if ( value != NULL ) {
3407 size_t length = KMP_STRLEN( value );
3408 if ( length > INT_MAX ) {
3409 KMP_WARNING( LongValue, name );
3412 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'' )
3413 KMP_WARNING( UnbalancedQuotes, name );
3417 semicolon = (
char *) strchr( value,
';' );
3418 if( *value && semicolon != value ) {
3419 char *comma = (
char *) strchr( value,
',' );
3426 if ( !__kmp_strcasecmp_with_sentinel(
"static", value, sentinel ) ) {
3427 if( !__kmp_strcasecmp_with_sentinel(
"greedy", comma,
';' ) ) {
3428 __kmp_static = kmp_sch_static_greedy;
3430 }
else if( !__kmp_strcasecmp_with_sentinel(
"balanced", comma,
';' ) ) {
3431 __kmp_static = kmp_sch_static_balanced;
3434 }
else if ( !__kmp_strcasecmp_with_sentinel(
"guided", value, sentinel ) ) {
3435 if ( !__kmp_strcasecmp_with_sentinel(
"iterative", comma,
';' ) ) {
3436 __kmp_guided = kmp_sch_guided_iterative_chunked;
3438 }
else if ( !__kmp_strcasecmp_with_sentinel(
"analytical", comma,
';' ) ) {
3440 __kmp_guided = kmp_sch_guided_analytical_chunked;
3444 KMP_WARNING( InvalidClause, name, value );
3446 KMP_WARNING( EmptyClause, name );
3447 }
while ( (value = semicolon ? semicolon + 1 : NULL) );
3454 __kmp_stg_print_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3455 if( __kmp_env_format ) {
3456 KMP_STR_BUF_PRINT_NAME_EX(name);
3458 __kmp_str_buf_print( buffer,
" %s='", name );
3460 if ( __kmp_static == kmp_sch_static_greedy ) {
3461 __kmp_str_buf_print( buffer,
"%s",
"static,greedy");
3462 }
else if ( __kmp_static == kmp_sch_static_balanced ) {
3463 __kmp_str_buf_print ( buffer,
"%s",
"static,balanced");
3465 if ( __kmp_guided == kmp_sch_guided_iterative_chunked ) {
3466 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,iterative");
3467 }
else if ( __kmp_guided == kmp_sch_guided_analytical_chunked ) {
3468 __kmp_str_buf_print( buffer,
";%s'\n",
"guided,analytical");
3477 __kmp_stg_parse_omp_schedule(
char const * name,
char const * value,
void * data )
3481 length = KMP_STRLEN( value );
3483 char *comma = (
char *) strchr( value,
',' );
3484 if( value[ length - 1 ] ==
'"' || value[ length -1 ] ==
'\'')
3485 KMP_WARNING( UnbalancedQuotes, name );
3487 if (!__kmp_strcasecmp_with_sentinel(
"dynamic", value,
','))
3488 __kmp_sched = kmp_sch_dynamic_chunked;
3489 else if (!__kmp_strcasecmp_with_sentinel(
"guided", value,
','))
3492 else if (!__kmp_strcasecmp_with_sentinel(
"auto", value,
',')) {
3495 __kmp_msg( kmp_ms_warning, KMP_MSG( IgnoreChunk, name, comma ), __kmp_msg_null );
3499 else if (!__kmp_strcasecmp_with_sentinel(
"trapezoidal", value,
','))
3500 __kmp_sched = kmp_sch_trapezoidal;
3501 else if (!__kmp_strcasecmp_with_sentinel(
"static", value,
','))
3503 #ifdef KMP_STATIC_STEAL_ENABLED 3504 else if (KMP_ARCH_X86_64 &&
3505 !__kmp_strcasecmp_with_sentinel(
"static_steal", value,
','))
3509 KMP_WARNING( StgInvalidValue, name, value );
3512 if( value && comma ) {
3513 __kmp_env_chunk = TRUE;
3516 __kmp_sched = kmp_sch_static_chunked;
3518 __kmp_chunk = __kmp_str_to_int( comma, 0 );
3519 if ( __kmp_chunk < 1 ) {
3520 __kmp_chunk = KMP_DEFAULT_CHUNK;
3521 __kmp_msg( kmp_ms_warning, KMP_MSG( InvalidChunk, name, comma ), __kmp_msg_null );
3522 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3528 }
else if ( __kmp_chunk > KMP_MAX_CHUNK ) {
3529 __kmp_chunk = KMP_MAX_CHUNK;
3530 __kmp_msg( kmp_ms_warning, KMP_MSG( LargeChunk, name, comma ), __kmp_msg_null );
3531 KMP_INFORM( Using_int_Value, name, __kmp_chunk );
3534 __kmp_env_chunk = FALSE;
3536 KMP_WARNING( EmptyString, name );
3538 K_DIAG(1, (
"__kmp_static == %d\n", __kmp_static))
3539 K_DIAG(1, ("__kmp_guided == %d\n", __kmp_guided))
3540 K_DIAG(1, ("__kmp_sched == %d\n", __kmp_sched))
3541 K_DIAG(1, ("__kmp_chunk == %d\n", __kmp_chunk))
3545 __kmp_stg_print_omp_schedule( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3546 if( __kmp_env_format ) {
3547 KMP_STR_BUF_PRINT_NAME_EX(name);
3549 __kmp_str_buf_print( buffer,
" %s='", name );
3551 if ( __kmp_chunk ) {
3552 switch ( __kmp_sched ) {
3553 case kmp_sch_dynamic_chunked:
3554 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"dynamic", __kmp_chunk);
3556 case kmp_sch_guided_iterative_chunked:
3557 case kmp_sch_guided_analytical_chunked:
3558 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"guided", __kmp_chunk);
3560 case kmp_sch_trapezoidal:
3561 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"trapezoidal", __kmp_chunk);
3564 case kmp_sch_static_chunked:
3565 case kmp_sch_static_balanced:
3566 case kmp_sch_static_greedy:
3567 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static", __kmp_chunk);
3570 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"static_steal", __kmp_chunk);
3573 __kmp_str_buf_print( buffer,
"%s,%d'\n",
"auto", __kmp_chunk);
3577 switch ( __kmp_sched ) {
3578 case kmp_sch_dynamic_chunked:
3579 __kmp_str_buf_print( buffer,
"%s'\n",
"dynamic");
3581 case kmp_sch_guided_iterative_chunked:
3582 case kmp_sch_guided_analytical_chunked:
3583 __kmp_str_buf_print( buffer,
"%s'\n",
"guided");
3585 case kmp_sch_trapezoidal:
3586 __kmp_str_buf_print( buffer,
"%s'\n",
"trapezoidal");
3589 case kmp_sch_static_chunked:
3590 case kmp_sch_static_balanced:
3591 case kmp_sch_static_greedy:
3592 __kmp_str_buf_print( buffer,
"%s'\n",
"static");
3595 __kmp_str_buf_print( buffer,
"%s'\n",
"static_steal");
3598 __kmp_str_buf_print( buffer,
"%s'\n",
"auto");
3609 __kmp_stg_parse_atomic_mode(
char const * name,
char const * value,
void * data ) {
3613 #ifdef KMP_GOMP_COMPAT 3616 __kmp_stg_parse_int( name, value, 0, max, & mode );
3620 __kmp_atomic_mode = mode;
3625 __kmp_stg_print_atomic_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3626 __kmp_stg_print_int( buffer, name, __kmp_atomic_mode );
3635 __kmp_stg_parse_consistency_check(
char const * name,
char const * value,
void * data ) {
3636 if ( ! __kmp_strcasecmp_with_sentinel(
"all", value, 0 ) ) {
3640 __kmp_env_consistency_check = TRUE;
3641 }
else if ( ! __kmp_strcasecmp_with_sentinel(
"none", value, 0 ) ) {
3642 __kmp_env_consistency_check = FALSE;
3644 KMP_WARNING( StgInvalidValue, name, value );
3649 __kmp_stg_print_consistency_check( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3651 const char *value = NULL;
3653 if ( __kmp_env_consistency_check ) {
3659 if ( value != NULL ) {
3660 __kmp_stg_print_str( buffer, name, value );
3674 __kmp_stg_parse_itt_prepare_delay(
char const * name,
char const * value,
void * data )
3678 __kmp_stg_parse_int( name, value, 0, INT_MAX, & delay );
3679 __kmp_itt_prepare_delay = delay;
3683 __kmp_stg_print_itt_prepare_delay( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3684 __kmp_stg_print_uint64( buffer, name, __kmp_itt_prepare_delay );
3688 #endif // USE_ITT_NOTIFY 3696 __kmp_stg_parse_malloc_pool_incr(
char const * name,
char const * value,
void * data ) {
3697 __kmp_stg_parse_size(
3700 KMP_MIN_MALLOC_POOL_INCR,
3701 KMP_MAX_MALLOC_POOL_INCR,
3703 & __kmp_malloc_pool_incr,
3709 __kmp_stg_print_malloc_pool_incr( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3710 __kmp_stg_print_size( buffer, name, __kmp_malloc_pool_incr );
3722 __kmp_stg_parse_par_range_env(
char const * name,
char const * value,
void * data ) {
3723 __kmp_stg_parse_par_range(
3727 __kmp_par_range_routine,
3728 __kmp_par_range_filename,
3729 & __kmp_par_range_lb,
3730 & __kmp_par_range_ub
3735 __kmp_stg_print_par_range_env( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3736 if (__kmp_par_range != 0) {
3737 __kmp_stg_print_str( buffer, name, par_range_to_print );
3746 __kmp_stg_parse_yield_cycle(
char const * name,
char const * value,
void * data ) {
3747 int flag = __kmp_yield_cycle;
3748 __kmp_stg_parse_bool( name, value, & flag );
3749 __kmp_yield_cycle = flag;
3753 __kmp_stg_print_yield_cycle( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3754 __kmp_stg_print_bool( buffer, name, __kmp_yield_cycle );
3758 __kmp_stg_parse_yield_on(
char const * name,
char const * value,
void * data ) {
3759 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_on_count );
3763 __kmp_stg_print_yield_on( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3764 __kmp_stg_print_int( buffer, name, __kmp_yield_on_count );
3768 __kmp_stg_parse_yield_off(
char const * name,
char const * value,
void * data ) {
3769 __kmp_stg_parse_int( name, value, 2, INT_MAX, & __kmp_yield_off_count );
3773 __kmp_stg_print_yield_off( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3774 __kmp_stg_print_int( buffer, name, __kmp_yield_off_count );
3784 __kmp_stg_parse_init_wait(
char const * name,
char const * value,
void * data ) {
3786 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3787 wait = __kmp_init_wait / 2;
3788 __kmp_stg_parse_int( name, value, KMP_MIN_INIT_WAIT, KMP_MAX_INIT_WAIT, & wait );
3789 __kmp_init_wait = wait * 2;
3790 KMP_ASSERT( ( __kmp_init_wait & 1 ) == 0 );
3791 __kmp_yield_init = __kmp_init_wait;
3795 __kmp_stg_print_init_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3796 __kmp_stg_print_int( buffer, name, __kmp_init_wait );
3800 __kmp_stg_parse_next_wait(
char const * name,
char const * value,
void * data ) {
3802 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3803 wait = __kmp_next_wait / 2;
3804 __kmp_stg_parse_int( name, value, KMP_MIN_NEXT_WAIT, KMP_MAX_NEXT_WAIT, & wait );
3805 __kmp_next_wait = wait * 2;
3806 KMP_ASSERT( ( __kmp_next_wait & 1 ) == 0 );
3807 __kmp_yield_next = __kmp_next_wait;
3811 __kmp_stg_print_next_wait( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3812 __kmp_stg_print_int( buffer, name, __kmp_next_wait );
3821 __kmp_stg_parse_gtid_mode(
char const * name,
char const * value,
void * data ) {
3832 #ifdef KMP_TDATA_GTID 3835 __kmp_stg_parse_int( name, value, 0, max, & mode );
3839 __kmp_adjust_gtid_mode = TRUE;
3842 __kmp_gtid_mode = mode;
3843 __kmp_adjust_gtid_mode = FALSE;
3848 __kmp_stg_print_gtid_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3849 if ( __kmp_adjust_gtid_mode ) {
3850 __kmp_stg_print_int( buffer, name, 0 );
3853 __kmp_stg_print_int( buffer, name, __kmp_gtid_mode );
3863 __kmp_stg_parse_lock_block(
char const * name,
char const * value,
void * data ) {
3864 __kmp_stg_parse_int( name, value, 0, KMP_INT_MAX, & __kmp_num_locks_in_block );
3868 __kmp_stg_print_lock_block( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3869 __kmp_stg_print_int( buffer, name, __kmp_num_locks_in_block );
3876 #if KMP_USE_DYNAMIC_LOCK 3877 # define KMP_STORE_LOCK_SEQ(a) (__kmp_user_lock_seq = lockseq_##a) 3879 # define KMP_STORE_LOCK_SEQ(a) 3883 __kmp_stg_parse_lock_kind(
char const * name,
char const * value,
void * data ) {
3884 if ( __kmp_init_user_locks ) {
3885 KMP_WARNING( EnvLockWarn, name );
3889 if ( __kmp_str_match(
"tas", 2, value )
3890 || __kmp_str_match(
"test and set", 2, value )
3891 || __kmp_str_match(
"test_and_set", 2, value )
3892 || __kmp_str_match(
"test-and-set", 2, value )
3893 || __kmp_str_match(
"test andset", 2, value )
3894 || __kmp_str_match(
"test_andset", 2, value )
3895 || __kmp_str_match(
"test-andset", 2, value )
3896 || __kmp_str_match(
"testand set", 2, value )
3897 || __kmp_str_match(
"testand_set", 2, value )
3898 || __kmp_str_match(
"testand-set", 2, value )
3899 || __kmp_str_match(
"testandset", 2, value ) ) {
3900 __kmp_user_lock_kind = lk_tas;
3901 KMP_STORE_LOCK_SEQ(tas);
3903 #if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_ARCH_ARM) 3904 else if ( __kmp_str_match(
"futex", 1, value ) ) {
3905 if ( __kmp_futex_determine_capable() ) {
3906 __kmp_user_lock_kind = lk_futex;
3907 KMP_STORE_LOCK_SEQ(futex);
3910 KMP_WARNING( FutexNotSupported, name, value );
3914 else if ( __kmp_str_match(
"ticket", 2, value ) ) {
3915 __kmp_user_lock_kind = lk_ticket;
3916 KMP_STORE_LOCK_SEQ(ticket);
3918 else if ( __kmp_str_match(
"queuing", 1, value )
3919 || __kmp_str_match(
"queue", 1, value ) ) {
3920 __kmp_user_lock_kind = lk_queuing;
3921 KMP_STORE_LOCK_SEQ(queuing);
3923 else if ( __kmp_str_match(
"drdpa ticket", 1, value )
3924 || __kmp_str_match(
"drdpa_ticket", 1, value )
3925 || __kmp_str_match(
"drdpa-ticket", 1, value )
3926 || __kmp_str_match(
"drdpaticket", 1, value )
3927 || __kmp_str_match(
"drdpa", 1, value ) ) {
3928 __kmp_user_lock_kind = lk_drdpa;
3929 KMP_STORE_LOCK_SEQ(drdpa);
3931 #if KMP_USE_ADAPTIVE_LOCKS 3932 else if ( __kmp_str_match(
"adaptive", 1, value ) ) {
3933 if( __kmp_cpuinfo.rtm ) {
3934 __kmp_user_lock_kind = lk_adaptive;
3935 KMP_STORE_LOCK_SEQ(adaptive);
3937 KMP_WARNING( AdaptiveNotSupported, name, value );
3938 __kmp_user_lock_kind = lk_queuing;
3939 KMP_STORE_LOCK_SEQ(queuing);
3942 #endif // KMP_USE_ADAPTIVE_LOCKS 3943 #if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX 3944 else if ( __kmp_str_match(
"rtm", 1, value) ) {
3945 if ( __kmp_cpuinfo.rtm ) {
3946 __kmp_user_lock_kind = lk_rtm;
3947 KMP_STORE_LOCK_SEQ(rtm);
3949 KMP_WARNING( AdaptiveNotSupported, name, value );
3950 __kmp_user_lock_kind = lk_queuing;
3951 KMP_STORE_LOCK_SEQ(queuing);
3954 else if ( __kmp_str_match(
"hle", 1, value) ) {
3955 __kmp_user_lock_kind = lk_hle;
3956 KMP_STORE_LOCK_SEQ(hle);
3960 KMP_WARNING( StgInvalidValue, name, value );
3965 __kmp_stg_print_lock_kind( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
3966 const char *value = NULL;
3968 switch ( __kmp_user_lock_kind ) {
3977 #if KMP_OS_LINUX && (KMP_ARCH_X86 || KMP_ARCH_X86_64) 3983 #if KMP_USE_DYNAMIC_LOCK && KMP_USE_TSX 4004 #if KMP_USE_ADAPTIVE_LOCKS 4011 if ( value != NULL ) {
4012 __kmp_stg_print_str( buffer, name, value );
4016 #if KMP_USE_ADAPTIVE_LOCKS 4025 __kmp_stg_parse_adaptive_lock_props(
const char *name,
const char *value,
void *data )
4027 int max_retries = 0;
4028 int max_badness = 0;
4030 const char *next = value;
4033 int prev_comma = FALSE;
4038 for ( i = 0; i < 3 ; i++) {
4041 if ( *next ==
'\0' ) {
4045 if ( ( ( *next < '0' || *next >
'9' ) && *next !=
',' ) || total > 2 ) {
4046 KMP_WARNING( EnvSyntaxError, name, value );
4050 if ( *next ==
',' ) {
4052 if ( total == 0 || prev_comma ) {
4060 if ( *next >=
'0' && *next <=
'9' ) {
4062 const char *buf = next;
4063 char const * msg = NULL;
4065 SKIP_DIGITS( next );
4068 const char *tmp = next;
4070 if ( ( *next ==
' ' || *next ==
'\t' ) && ( *tmp >=
'0' && *tmp <=
'9' ) ) {
4071 KMP_WARNING( EnvSpacesNotAllowed, name, value );
4075 num = __kmp_str_to_int( buf, *next );
4077 msg = KMP_I18N_STR( ValueTooSmall );
4079 }
else if ( num > KMP_INT_MAX ) {
4080 msg = KMP_I18N_STR( ValueTooLarge );
4083 if ( msg != NULL ) {
4085 KMP_WARNING( ParseSizeIntWarn, name, value, msg );
4086 KMP_INFORM( Using_int_Value, name, num );
4090 }
else if( total == 2 ) {
4095 KMP_DEBUG_ASSERT( total > 0 );
4097 KMP_WARNING( EnvSyntaxError, name, value );
4100 __kmp_adaptive_backoff_params.max_soft_retries = max_retries;
4101 __kmp_adaptive_backoff_params.max_badness = max_badness;
4106 __kmp_stg_print_adaptive_lock_props(kmp_str_buf_t * buffer,
char const * name,
void * data )
4108 if( __kmp_env_format ) {
4109 KMP_STR_BUF_PRINT_NAME_EX(name);
4111 __kmp_str_buf_print( buffer,
" %s='", name );
4113 __kmp_str_buf_print( buffer,
"%d,%d'\n", __kmp_adaptive_backoff_params.max_soft_retries,
4114 __kmp_adaptive_backoff_params.max_badness );
4117 #if KMP_DEBUG_ADAPTIVE_LOCKS 4120 __kmp_stg_parse_speculative_statsfile(
char const * name,
char const * value,
void * data ) {
4121 __kmp_stg_parse_file( name, value,
"", & __kmp_speculative_statsfile );
4125 __kmp_stg_print_speculative_statsfile( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4126 if ( __kmp_str_match(
"-", 0, __kmp_speculative_statsfile ) ) {
4127 __kmp_stg_print_str( buffer, name,
"stdout" );
4129 __kmp_stg_print_str( buffer, name, __kmp_speculative_statsfile );
4134 #endif // KMP_DEBUG_ADAPTIVE_LOCKS 4136 #endif // KMP_USE_ADAPTIVE_LOCKS 4143 __kmp_stg_parse_place_threads(
char const * name,
char const * value,
void * data ) {
4152 #define CHECK_DELIM(_x) (*(_x) == ',' || *(_x) == 'x') 4154 int single_warning = 0;
4155 int flagS = 0, flagC = 0, flagT = 0, flagSO = 0, flagCO = 0;
4156 const char *next = value;
4163 if (*next >=
'0' && *next <=
'9') {
4166 num = __kmp_str_to_int(prev, *next);
4168 if (*next ==
's' || *next ==
'S') {
4169 __kmp_place_num_sockets = num;
4175 if (!(*next >=
'0' && *next <=
'9')) {
4176 KMP_WARNING(AffThrPlaceInvalid, name, value);
4180 num = __kmp_str_to_int(prev, *next);
4181 __kmp_place_socket_offset = num;
4183 }
else if (*next ==
'c' || *next ==
'C') {
4184 __kmp_place_num_cores = num;
4190 if (!(*next >=
'0' && *next <=
'9')) {
4191 KMP_WARNING(AffThrPlaceInvalid, name, value);
4195 num = __kmp_str_to_int(prev, *next);
4196 __kmp_place_core_offset = num;
4198 }
else if (CHECK_DELIM(next)) {
4199 __kmp_place_num_cores = num;
4202 }
else if (*next ==
't' || *next ==
'T') {
4203 __kmp_place_num_threads_per_core = num;
4206 }
else if (*next ==
'\0') {
4207 __kmp_place_num_cores = num;
4210 KMP_WARNING(AffThrPlaceInvalid, name, value);
4214 KMP_WARNING(AffThrPlaceInvalid, name, value);
4217 KMP_DEBUG_ASSERT(flagS);
4221 if (CHECK_DELIM(next)) {
4227 if (*next >=
'0' && *next <=
'9') {
4230 num = __kmp_str_to_int(prev, *next);
4232 if (*next ==
'c' || *next ==
'C') {
4233 KMP_DEBUG_ASSERT(flagC == 0);
4234 __kmp_place_num_cores = num;
4240 if (!(*next >=
'0' && *next <=
'9')) {
4241 KMP_WARNING(AffThrPlaceInvalid, name, value);
4245 num = __kmp_str_to_int(prev, *next);
4246 __kmp_place_core_offset = num;
4248 }
else if (*next ==
'o' || *next ==
'O') {
4249 KMP_WARNING(AffThrPlaceDeprecated);
4252 KMP_DEBUG_ASSERT(!flagCO);
4253 __kmp_place_core_offset = num;
4255 KMP_DEBUG_ASSERT(!flagSO);
4256 __kmp_place_socket_offset = num;
4259 }
else if (*next ==
't' || *next ==
'T') {
4260 KMP_DEBUG_ASSERT(flagT == 0);
4261 __kmp_place_num_threads_per_core = num;
4265 }
else if (*next ==
'\0') {
4266 KMP_DEBUG_ASSERT(flagC);
4267 __kmp_place_num_threads_per_core = num;
4270 KMP_WARNING(AffThrPlaceInvalid, name, value);
4274 KMP_WARNING(AffThrPlaceInvalid, name, value);
4280 if (CHECK_DELIM(next)) {
4286 if (*next >=
'0' && *next <=
'9') {
4289 num = __kmp_str_to_int(prev, *next);
4291 if (*next ==
't' || *next ==
'T') {
4292 KMP_DEBUG_ASSERT(flagT == 0);
4293 __kmp_place_num_threads_per_core = num;
4298 }
else if (*next ==
'c' || *next ==
'C') {
4299 KMP_DEBUG_ASSERT(flagC == 0);
4300 __kmp_place_num_cores = num;
4304 }
else if (*next ==
'o' || *next ==
'O') {
4305 KMP_WARNING(AffThrPlaceDeprecated);
4307 KMP_DEBUG_ASSERT(flagC);
4309 __kmp_place_core_offset = num;
4312 KMP_WARNING(AffThrPlaceInvalid, name, value);
4316 KMP_WARNING(AffThrPlaceInvalid, name, value);
4319 KMP_DEBUG_ASSERT(flagC);
4321 if ( *next ==
'\0' )
4323 if (CHECK_DELIM(next)) {
4329 if (*next >=
'0' && *next <=
'9') {
4332 num = __kmp_str_to_int(prev, *next);
4334 if (*next ==
'o' || *next ==
'O') {
4335 if (!single_warning) {
4336 KMP_WARNING(AffThrPlaceDeprecated);
4338 KMP_DEBUG_ASSERT(!flagSO);
4339 __kmp_place_core_offset = num;
4341 }
else if (*next ==
't' || *next ==
'T') {
4342 KMP_DEBUG_ASSERT(flagT == 0);
4343 __kmp_place_num_threads_per_core = num;
4347 KMP_WARNING(AffThrPlaceInvalid, name, value);
4351 KMP_WARNING(AffThrPlaceInvalid, name, value);
4355 if ( *next ==
'\0' )
4357 if (CHECK_DELIM(next)) {
4363 if (*next >=
'0' && *next <=
'9') {
4366 num = __kmp_str_to_int(prev, *next);
4368 if (*next ==
'o' || *next ==
'O') {
4369 if (!single_warning) {
4370 KMP_WARNING(AffThrPlaceDeprecated);
4372 KMP_DEBUG_ASSERT(flagT);
4373 KMP_DEBUG_ASSERT(!flagSO);
4374 __kmp_place_core_offset = num;
4375 }
else if (*next ==
't' || *next ==
'T') {
4376 KMP_DEBUG_ASSERT(flagT == 0);
4377 __kmp_place_num_threads_per_core = num;
4379 KMP_WARNING(AffThrPlaceInvalid, name, value);
4382 KMP_WARNING(AffThrPlaceInvalid, name, value);
4389 __kmp_stg_print_place_threads( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4390 if (__kmp_place_num_sockets + __kmp_place_num_cores + __kmp_place_num_threads_per_core) {
4393 __kmp_str_buf_init(&buf);
4394 if(__kmp_env_format)
4395 KMP_STR_BUF_PRINT_NAME_EX(name);
4397 __kmp_str_buf_print(buffer,
" %s='", name);
4398 if (__kmp_place_num_sockets) {
4399 __kmp_str_buf_print(&buf,
"%ds", __kmp_place_num_sockets);
4400 if (__kmp_place_socket_offset)
4401 __kmp_str_buf_print(&buf,
"@%d", __kmp_place_socket_offset);
4404 if (__kmp_place_num_cores) {
4405 __kmp_str_buf_print(&buf,
"%s%dc", comma?
",":
"", __kmp_place_num_cores);
4406 if (__kmp_place_core_offset)
4407 __kmp_str_buf_print(&buf,
"@%d", __kmp_place_core_offset);
4410 if (__kmp_place_num_threads_per_core)
4411 __kmp_str_buf_print(&buf,
"%s%dt", comma?
",":
"", __kmp_place_num_threads_per_core);
4412 __kmp_str_buf_print(buffer,
"%s'\n", buf.str );
4413 __kmp_str_buf_free(&buf);
4427 __kmp_stg_parse_forkjoin_frames(
char const * name,
char const * value,
void * data ) {
4428 __kmp_stg_parse_bool( name, value, & __kmp_forkjoin_frames );
4432 __kmp_stg_print_forkjoin_frames( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4433 __kmp_stg_print_bool( buffer, name, __kmp_forkjoin_frames );
4441 __kmp_stg_parse_forkjoin_frames_mode(
char const * name,
char const * value,
void * data ) {
4442 __kmp_stg_parse_int( name, value, 0, 3, & __kmp_forkjoin_frames_mode );
4446 __kmp_stg_print_forkjoin_frames_mode( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4447 __kmp_stg_print_int( buffer, name, __kmp_forkjoin_frames_mode );
4458 __kmp_stg_parse_omp_display_env(
char const * name,
char const * value,
void * data )
4460 if ( __kmp_str_match(
"VERBOSE", 1, value ) )
4462 __kmp_display_env_verbose = TRUE;
4464 __kmp_stg_parse_bool( name, value, & __kmp_display_env );
4470 __kmp_stg_print_omp_display_env( kmp_str_buf_t * buffer,
char const * name,
void * data )
4472 if ( __kmp_display_env_verbose )
4474 __kmp_stg_print_str( buffer, name,
"VERBOSE" );
4476 __kmp_stg_print_bool( buffer, name, __kmp_display_env );
4481 __kmp_stg_parse_omp_cancellation(
char const * name,
char const * value,
void * data ) {
4482 if ( TCR_4(__kmp_init_parallel) ) {
4483 KMP_WARNING( EnvParallelWarn, name );
4486 __kmp_stg_parse_bool( name, value, & __kmp_omp_cancellation );
4490 __kmp_stg_print_omp_cancellation( kmp_str_buf_t * buffer,
char const * name,
void * data ) {
4491 __kmp_stg_print_bool( buffer, name, __kmp_omp_cancellation );
4501 static kmp_setting_t __kmp_stg_table[] = {
4503 {
"KMP_ALL_THREADS", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4504 {
"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime, NULL, 0, 0 },
4505 {
"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok, __kmp_stg_print_duplicate_lib_ok, NULL, 0, 0 },
4506 {
"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4507 {
"KMP_MAX_THREADS", __kmp_stg_parse_all_threads, NULL, NULL, 0, 0 },
4508 {
"KMP_MONITOR_STACKSIZE", __kmp_stg_parse_monitor_stacksize, __kmp_stg_print_monitor_stacksize, NULL, 0, 0 },
4509 {
"KMP_SETTINGS", __kmp_stg_parse_settings, __kmp_stg_print_settings, NULL, 0, 0 },
4510 {
"KMP_STACKOFFSET", __kmp_stg_parse_stackoffset, __kmp_stg_print_stackoffset, NULL, 0, 0 },
4511 {
"KMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4512 {
"KMP_STACKPAD", __kmp_stg_parse_stackpad, __kmp_stg_print_stackpad, NULL, 0, 0 },
4513 {
"KMP_VERSION", __kmp_stg_parse_version, __kmp_stg_print_version, NULL, 0, 0 },
4514 {
"KMP_WARNINGS", __kmp_stg_parse_warnings, __kmp_stg_print_warnings, NULL, 0, 0 },
4516 {
"OMP_NESTED", __kmp_stg_parse_nested, __kmp_stg_print_nested, NULL, 0, 0 },
4517 {
"OMP_NUM_THREADS", __kmp_stg_parse_num_threads, __kmp_stg_print_num_threads, NULL, 0, 0 },
4518 {
"OMP_STACKSIZE", __kmp_stg_parse_stacksize, __kmp_stg_print_stacksize, NULL, 0, 0 },
4520 {
"KMP_TASKING", __kmp_stg_parse_tasking, __kmp_stg_print_tasking, NULL, 0, 0 },
4521 {
"KMP_TASK_STEALING_CONSTRAINT", __kmp_stg_parse_task_stealing, __kmp_stg_print_task_stealing, NULL, 0, 0 },
4522 {
"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels, __kmp_stg_print_max_active_levels, NULL, 0, 0 },
4523 {
"OMP_THREAD_LIMIT", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0 },
4524 {
"OMP_WAIT_POLICY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy, NULL, 0, 0 },
4525 #if KMP_NESTED_HOT_TEAMS 4526 {
"KMP_HOT_TEAMS_MAX_LEVEL", __kmp_stg_parse_hot_teams_level, __kmp_stg_print_hot_teams_level, NULL, 0, 0 },
4527 {
"KMP_HOT_TEAMS_MODE", __kmp_stg_parse_hot_teams_mode, __kmp_stg_print_hot_teams_mode, NULL, 0, 0 },
4528 #endif // KMP_NESTED_HOT_TEAMS 4530 #if KMP_HANDLE_SIGNALS 4531 {
"KMP_HANDLE_SIGNALS", __kmp_stg_parse_handle_signals, __kmp_stg_print_handle_signals, NULL, 0, 0 },
4534 #if KMP_ARCH_X86 || KMP_ARCH_X86_64 4535 {
"KMP_INHERIT_FP_CONTROL", __kmp_stg_parse_inherit_fp_control, __kmp_stg_print_inherit_fp_control, NULL, 0, 0 },
4538 #ifdef KMP_GOMP_COMPAT 4539 {
"GOMP_STACKSIZE", __kmp_stg_parse_stacksize, NULL, NULL, 0, 0 },
4543 {
"KMP_A_DEBUG", __kmp_stg_parse_a_debug, __kmp_stg_print_a_debug, NULL, 0, 0 },
4544 {
"KMP_B_DEBUG", __kmp_stg_parse_b_debug, __kmp_stg_print_b_debug, NULL, 0, 0 },
4545 {
"KMP_C_DEBUG", __kmp_stg_parse_c_debug, __kmp_stg_print_c_debug, NULL, 0, 0 },
4546 {
"KMP_D_DEBUG", __kmp_stg_parse_d_debug, __kmp_stg_print_d_debug, NULL, 0, 0 },
4547 {
"KMP_E_DEBUG", __kmp_stg_parse_e_debug, __kmp_stg_print_e_debug, NULL, 0, 0 },
4548 {
"KMP_F_DEBUG", __kmp_stg_parse_f_debug, __kmp_stg_print_f_debug, NULL, 0, 0 },
4549 {
"KMP_DEBUG", __kmp_stg_parse_debug, NULL, NULL, 0, 0 },
4550 {
"KMP_DEBUG_BUF", __kmp_stg_parse_debug_buf, __kmp_stg_print_debug_buf, NULL, 0, 0 },
4551 {
"KMP_DEBUG_BUF_ATOMIC", __kmp_stg_parse_debug_buf_atomic, __kmp_stg_print_debug_buf_atomic, NULL, 0, 0 },
4552 {
"KMP_DEBUG_BUF_CHARS", __kmp_stg_parse_debug_buf_chars, __kmp_stg_print_debug_buf_chars, NULL, 0, 0 },
4553 {
"KMP_DEBUG_BUF_LINES", __kmp_stg_parse_debug_buf_lines, __kmp_stg_print_debug_buf_lines, NULL, 0, 0 },
4554 {
"KMP_DIAG", __kmp_stg_parse_diag, __kmp_stg_print_diag, NULL, 0, 0 },
4556 {
"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env, __kmp_stg_print_par_range_env, NULL, 0, 0 },
4557 {
"KMP_YIELD_CYCLE", __kmp_stg_parse_yield_cycle, __kmp_stg_print_yield_cycle, NULL, 0, 0 },
4558 {
"KMP_YIELD_ON", __kmp_stg_parse_yield_on, __kmp_stg_print_yield_on, NULL, 0, 0 },
4559 {
"KMP_YIELD_OFF", __kmp_stg_parse_yield_off, __kmp_stg_print_yield_off, NULL, 0, 0 },
4562 {
"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc, __kmp_stg_print_align_alloc, NULL, 0, 0 },
4564 {
"KMP_PLAIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4565 {
"KMP_PLAIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4566 {
"KMP_FORKJOIN_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4567 {
"KMP_FORKJOIN_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4568 #if KMP_FAST_REDUCTION_BARRIER 4569 {
"KMP_REDUCTION_BARRIER", __kmp_stg_parse_barrier_branch_bit, __kmp_stg_print_barrier_branch_bit, NULL, 0, 0 },
4570 {
"KMP_REDUCTION_BARRIER_PATTERN", __kmp_stg_parse_barrier_pattern, __kmp_stg_print_barrier_pattern, NULL, 0, 0 },
4573 {
"KMP_ABORT_DELAY", __kmp_stg_parse_abort_delay, __kmp_stg_print_abort_delay, NULL, 0, 0 },
4574 {
"KMP_CPUINFO_FILE", __kmp_stg_parse_cpuinfo_file, __kmp_stg_print_cpuinfo_file, NULL, 0, 0 },
4575 {
"KMP_FORCE_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4576 {
"KMP_DETERMINISTIC_REDUCTION", __kmp_stg_parse_force_reduction, __kmp_stg_print_force_reduction, NULL, 0, 0 },
4577 {
"KMP_STORAGE_MAP", __kmp_stg_parse_storage_map, __kmp_stg_print_storage_map, NULL, 0, 0 },
4578 {
"KMP_ALL_THREADPRIVATE", __kmp_stg_parse_all_threadprivate, __kmp_stg_print_all_threadprivate, NULL, 0, 0 },
4579 {
"KMP_FOREIGN_THREADS_THREADPRIVATE", __kmp_stg_parse_foreign_threads_threadprivate, __kmp_stg_print_foreign_threads_threadprivate, NULL, 0, 0 },
4581 #if KMP_AFFINITY_SUPPORTED 4582 {
"KMP_AFFINITY", __kmp_stg_parse_affinity, __kmp_stg_print_affinity, NULL, 0, 0 },
4583 # ifdef KMP_GOMP_COMPAT 4584 {
"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL, NULL, 0, 0 },
4587 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4588 {
"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0 },
4590 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, NULL, NULL, 0, 0 },
4593 {
"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method, __kmp_stg_print_topology_method, NULL, 0, 0 },
4602 {
"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, NULL, 0, 0 },
4605 #endif // KMP_AFFINITY_SUPPORTED 4607 {
"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork, __kmp_stg_print_init_at_fork, NULL, 0, 0 },
4608 {
"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL, 0, 0 },
4609 {
"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule, NULL, 0, 0 },
4610 {
"KMP_ATOMIC_MODE", __kmp_stg_parse_atomic_mode, __kmp_stg_print_atomic_mode, NULL, 0, 0 },
4611 {
"KMP_CONSISTENCY_CHECK", __kmp_stg_parse_consistency_check, __kmp_stg_print_consistency_check, NULL, 0, 0 },
4613 #if USE_ITT_BUILD && USE_ITT_NOTIFY 4614 {
"KMP_ITT_PREPARE_DELAY", __kmp_stg_parse_itt_prepare_delay, __kmp_stg_print_itt_prepare_delay, NULL, 0, 0 },
4616 {
"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr, __kmp_stg_print_malloc_pool_incr, NULL, 0, 0 },
4617 {
"KMP_INIT_WAIT", __kmp_stg_parse_init_wait, __kmp_stg_print_init_wait, NULL, 0, 0 },
4618 {
"KMP_NEXT_WAIT", __kmp_stg_parse_next_wait, __kmp_stg_print_next_wait, NULL, 0, 0 },
4619 {
"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode, NULL, 0, 0 },
4620 {
"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic, NULL, 0, 0 },
4621 {
"KMP_DYNAMIC_MODE", __kmp_stg_parse_kmp_dynamic_mode, __kmp_stg_print_kmp_dynamic_mode, NULL, 0, 0 },
4623 #ifdef USE_LOAD_BALANCE 4624 {
"KMP_LOAD_BALANCE_INTERVAL", __kmp_stg_parse_ld_balance_interval,__kmp_stg_print_ld_balance_interval,NULL, 0, 0 },
4627 {
"KMP_NUM_LOCKS_IN_BLOCK", __kmp_stg_parse_lock_block, __kmp_stg_print_lock_block, NULL, 0, 0 },
4628 {
"KMP_LOCK_KIND", __kmp_stg_parse_lock_kind, __kmp_stg_print_lock_kind, NULL, 0, 0 },
4629 #if KMP_USE_ADAPTIVE_LOCKS 4630 {
"KMP_ADAPTIVE_LOCK_PROPS", __kmp_stg_parse_adaptive_lock_props,__kmp_stg_print_adaptive_lock_props, NULL, 0, 0 },
4631 #if KMP_DEBUG_ADAPTIVE_LOCKS 4632 {
"KMP_SPECULATIVE_STATSFILE", __kmp_stg_parse_speculative_statsfile,__kmp_stg_print_speculative_statsfile, NULL, 0, 0 },
4634 #endif // KMP_USE_ADAPTIVE_LOCKS 4635 {
"KMP_PLACE_THREADS", __kmp_stg_parse_place_threads, __kmp_stg_print_place_threads, NULL, 0, 0 },
4637 {
"KMP_FORKJOIN_FRAMES", __kmp_stg_parse_forkjoin_frames, __kmp_stg_print_forkjoin_frames, NULL, 0, 0 },
4638 {
"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,__kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0 },
4642 {
"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env, __kmp_stg_print_omp_display_env, NULL, 0, 0 },
4643 {
"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation, __kmp_stg_print_omp_cancellation, NULL, 0, 0 },
4645 {
"", NULL, NULL, NULL, 0, 0 }
4648 static int const __kmp_stg_count =
sizeof( __kmp_stg_table ) /
sizeof( kmp_setting_t );
4652 __kmp_stg_find(
char const * name ) {
4655 if ( name != NULL ) {
4656 for ( i = 0; i < __kmp_stg_count; ++ i ) {
4657 if ( strcmp( __kmp_stg_table[ i ].name, name ) == 0 ) {
4658 return & __kmp_stg_table[ i ];
4668 __kmp_stg_cmp(
void const * _a,
void const * _b ) {
4669 kmp_setting_t * a = (kmp_setting_t *) _a;
4670 kmp_setting_t * b = (kmp_setting_t *) _b;
4676 if ( strcmp( a->name,
"KMP_AFFINITY" ) == 0 ) {
4677 if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4682 else if ( strcmp( b->name,
"KMP_AFFINITY" ) == 0 ) {
4685 return strcmp( a->name, b->name );
4690 __kmp_stg_init(
void 4693 static int initialized = 0;
4695 if ( ! initialized ) {
4698 qsort( __kmp_stg_table, __kmp_stg_count - 1,
sizeof( kmp_setting_t ), __kmp_stg_cmp );
4702 kmp_setting_t * kmp_stacksize = __kmp_stg_find(
"KMP_STACKSIZE" );
4703 #ifdef KMP_GOMP_COMPAT 4704 kmp_setting_t * gomp_stacksize = __kmp_stg_find(
"GOMP_STACKSIZE" );
4706 kmp_setting_t * omp_stacksize = __kmp_stg_find(
"OMP_STACKSIZE" );
4711 static kmp_setting_t *
volatile rivals[ 4 ];
4712 static kmp_stg_ss_data_t kmp_data = { 1, (kmp_setting_t **)rivals };
4713 #ifdef KMP_GOMP_COMPAT 4714 static kmp_stg_ss_data_t gomp_data = { 1024, (kmp_setting_t **)rivals };
4716 static kmp_stg_ss_data_t omp_data = { 1024, (kmp_setting_t **)rivals };
4719 rivals[ i ++ ] = kmp_stacksize;
4720 #ifdef KMP_GOMP_COMPAT 4721 if ( gomp_stacksize != NULL ) {
4722 rivals[ i ++ ] = gomp_stacksize;
4725 rivals[ i ++ ] = omp_stacksize;
4726 rivals[ i ++ ] = NULL;
4728 kmp_stacksize->data = & kmp_data;
4729 #ifdef KMP_GOMP_COMPAT 4730 if ( gomp_stacksize != NULL ) {
4731 gomp_stacksize->data = & gomp_data;
4734 omp_stacksize->data = & omp_data;
4740 kmp_setting_t * kmp_library = __kmp_stg_find(
"KMP_LIBRARY" );
4741 kmp_setting_t * omp_wait_policy = __kmp_stg_find(
"OMP_WAIT_POLICY" );
4744 static kmp_setting_t *
volatile rivals[ 3 ];
4745 static kmp_stg_wp_data_t kmp_data = { 0, (kmp_setting_t **)rivals };
4746 static kmp_stg_wp_data_t omp_data = { 1, (kmp_setting_t **)rivals };
4749 rivals[ i ++ ] = kmp_library;
4750 if ( omp_wait_policy != NULL ) {
4751 rivals[ i ++ ] = omp_wait_policy;
4753 rivals[ i ++ ] = NULL;
4755 kmp_library->data = & kmp_data;
4756 if ( omp_wait_policy != NULL ) {
4757 omp_wait_policy->data = & omp_data;
4764 kmp_setting_t * kmp_all_threads = __kmp_stg_find(
"KMP_ALL_THREADS" );
4765 kmp_setting_t * kmp_max_threads = __kmp_stg_find(
"KMP_MAX_THREADS" );
4766 kmp_setting_t * omp_thread_limit = __kmp_stg_find(
"OMP_THREAD_LIMIT" );
4769 static kmp_setting_t *
volatile rivals[ 4 ];
4772 rivals[ i ++ ] = kmp_all_threads;
4773 rivals[ i ++ ] = kmp_max_threads;
4774 if ( omp_thread_limit != NULL ) {
4775 rivals[ i ++ ] = omp_thread_limit;
4777 rivals[ i ++ ] = NULL;
4779 kmp_all_threads->data = (
void*)& rivals;
4780 kmp_max_threads->data = (
void*)& rivals;
4781 if ( omp_thread_limit != NULL ) {
4782 omp_thread_limit->data = (
void*)& rivals;
4787 #if KMP_AFFINITY_SUPPORTED 4790 kmp_setting_t * kmp_affinity = __kmp_stg_find(
"KMP_AFFINITY" );
4791 KMP_DEBUG_ASSERT( kmp_affinity != NULL );
4793 # ifdef KMP_GOMP_COMPAT 4794 kmp_setting_t * gomp_cpu_affinity = __kmp_stg_find(
"GOMP_CPU_AFFINITY" );
4795 KMP_DEBUG_ASSERT( gomp_cpu_affinity != NULL );
4798 kmp_setting_t * omp_proc_bind = __kmp_stg_find(
"OMP_PROC_BIND" );
4799 KMP_DEBUG_ASSERT( omp_proc_bind != NULL );
4802 static kmp_setting_t *
volatile rivals[ 4 ];
4805 rivals[ i ++ ] = kmp_affinity;
4807 # ifdef KMP_GOMP_COMPAT 4808 rivals[ i ++ ] = gomp_cpu_affinity;
4809 gomp_cpu_affinity->data = (
void*)& rivals;
4812 rivals[ i ++ ] = omp_proc_bind;
4813 omp_proc_bind->data = (
void*)& rivals;
4814 rivals[ i ++ ] = NULL;
4817 static kmp_setting_t *
volatile places_rivals[ 4 ];
4820 kmp_setting_t * omp_places = __kmp_stg_find(
"OMP_PLACES" );
4821 KMP_DEBUG_ASSERT( omp_places != NULL );
4823 places_rivals[ i ++ ] = kmp_affinity;
4824 # ifdef KMP_GOMP_COMPAT 4825 places_rivals[ i ++ ] = gomp_cpu_affinity;
4827 places_rivals[ i ++ ] = omp_places;
4828 omp_places->data = (
void*)& places_rivals;
4829 places_rivals[ i ++ ] = NULL;
4835 #endif // KMP_AFFINITY_SUPPORTED 4839 kmp_setting_t * kmp_force_red = __kmp_stg_find(
"KMP_FORCE_REDUCTION" );
4840 kmp_setting_t * kmp_determ_red = __kmp_stg_find(
"KMP_DETERMINISTIC_REDUCTION" );
4843 static kmp_setting_t *
volatile rivals[ 3 ];
4844 static kmp_stg_fr_data_t force_data = { 1, (kmp_setting_t **)rivals };
4845 static kmp_stg_fr_data_t determ_data = { 0, (kmp_setting_t **)rivals };
4848 rivals[ i ++ ] = kmp_force_red;
4849 if ( kmp_determ_red != NULL ) {
4850 rivals[ i ++ ] = kmp_determ_red;
4852 rivals[ i ++ ] = NULL;
4854 kmp_force_red->data = & force_data;
4855 if ( kmp_determ_red != NULL ) {
4856 kmp_determ_red->data = & determ_data;
4866 for ( i = 0; i < __kmp_stg_count; ++ i ) {
4867 __kmp_stg_table[ i ].set = 0;
4881 if ( name[ 0 ] == 0 ) {
4885 if ( value != NULL ) {
4886 kmp_setting_t * setting = __kmp_stg_find( name );
4887 if ( setting != NULL ) {
4888 setting->parse( name, value, setting->data );
4889 setting->defined = 1;
4897 __kmp_stg_check_rivals(
4900 kmp_setting_t * * rivals
4903 if ( rivals == NULL ) {
4909 for ( ; strcmp( rivals[ i ]->name, name ) != 0; i++ ) {
4910 KMP_DEBUG_ASSERT( rivals[ i ] != NULL );
4912 #if KMP_AFFINITY_SUPPORTED 4913 if ( rivals[ i ] == __kmp_affinity_notype ) {
4922 if ( rivals[ i ]->
set ) {
4923 KMP_WARNING( StgIgnored, name, rivals[ i ]->name );
4935 __kmp_env_toPrint(
char const * name,
int flag ) {
4937 kmp_setting_t * setting = __kmp_stg_find( name );
4938 if ( setting != NULL ) {
4939 rc = setting->defined;
4941 setting->defined = flag;
4949 __kmp_aux_env_initialize( kmp_env_blk_t* block ) {
4954 value = __kmp_env_blk_var( block,
"OMP_NUM_THREADS" );
4956 ompc_set_num_threads( __kmp_dflt_team_nth );
4960 value = __kmp_env_blk_var( block,
"KMP_BLOCKTIME" );
4962 kmpc_set_blocktime( __kmp_dflt_blocktime );
4966 value = __kmp_env_blk_var( block,
"OMP_NESTED" );
4968 ompc_set_nested( __kmp_dflt_nested );
4972 value = __kmp_env_blk_var( block,
"OMP_DYNAMIC" );
4974 ompc_set_dynamic( __kmp_global.g.g_dynamic );
4980 __kmp_env_initialize(
char const *
string ) {
4982 kmp_env_blk_t block;
4988 if (
string == NULL ) {
4990 __kmp_threads_capacity = __kmp_initial_threads_capacity( __kmp_dflt_team_nth_ub );
4992 __kmp_env_blk_init( & block,
string );
4997 for ( i = 0; i < block.count; ++ i ) {
4998 if (( block.vars[ i ].name == NULL )
4999 || ( *block.vars[ i ].name ==
'\0')) {
5002 if ( block.vars[ i ].value == NULL ) {
5005 kmp_setting_t * setting = __kmp_stg_find( block.vars[ i ].name );
5006 if ( setting != NULL ) {
5012 if (
string == NULL ) {
5013 char const * name =
"KMP_WARNINGS";
5014 char const * value = __kmp_env_blk_var( & block, name );
5015 __kmp_stg_parse( name, value );
5018 #if KMP_AFFINITY_SUPPORTED 5026 __kmp_affinity_notype = NULL;
5027 char const *aff_str = __kmp_env_blk_var( & block,
"KMP_AFFINITY" );
5028 if ( aff_str != NULL ) {
5042 # define FIND strstr 5044 # define FIND strcasestr 5047 if ( ( FIND( aff_str,
"none" ) == NULL )
5048 && ( FIND( aff_str,
"physical" ) == NULL )
5049 && ( FIND( aff_str,
"logical" ) == NULL )
5050 && ( FIND( aff_str,
"compact" ) == NULL )
5051 && ( FIND( aff_str,
"scatter" ) == NULL )
5052 && ( FIND( aff_str,
"explicit" ) == NULL )
5053 && ( FIND( aff_str,
"balanced" ) == NULL )
5054 && ( FIND( aff_str,
"disabled" ) == NULL ) ) {
5055 __kmp_affinity_notype = __kmp_stg_find(
"KMP_AFFINITY" );
5063 __kmp_affinity_type = affinity_default;
5064 __kmp_affinity_gran = affinity_gran_default;
5065 __kmp_affinity_top_method = affinity_top_method_default;
5066 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5074 aff_str = __kmp_env_blk_var( & block,
"OMP_PROC_BIND" );
5075 if ( aff_str != NULL ) {
5076 __kmp_affinity_type = affinity_default;
5077 __kmp_affinity_gran = affinity_gran_default;
5078 __kmp_affinity_top_method = affinity_top_method_default;
5079 __kmp_affinity_respect_mask = affinity_respect_mask_default;
5090 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5091 __kmp_nested_proc_bind.bind_types = (kmp_proc_bind_t *)
5092 KMP_INTERNAL_MALLOC(
sizeof(kmp_proc_bind_t) );
5093 if ( __kmp_nested_proc_bind.bind_types == NULL ) {
5094 KMP_FATAL( MemoryAllocFailed );
5096 __kmp_nested_proc_bind.size = 1;
5097 __kmp_nested_proc_bind.used = 1;
5098 # if KMP_AFFINITY_SUPPORTED 5099 __kmp_nested_proc_bind.bind_types[0] = proc_bind_default;
5102 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5111 for ( i = 0; i < block.count; ++ i ) {
5112 __kmp_stg_parse( block.vars[ i ].name, block.vars[ i ].value );
5118 if ( ! __kmp_init_user_locks ) {
5119 if ( __kmp_user_lock_kind == lk_default ) {
5120 __kmp_user_lock_kind = lk_queuing;
5122 #if KMP_USE_DYNAMIC_LOCK 5123 __kmp_init_dynamic_user_locks();
5125 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5129 KMP_DEBUG_ASSERT(
string != NULL);
5130 KMP_DEBUG_ASSERT( __kmp_user_lock_kind != lk_default );
5135 #if KMP_USE_DYNAMIC_LOCK 5136 __kmp_init_dynamic_user_locks();
5138 __kmp_set_user_lock_vptrs( __kmp_user_lock_kind );
5142 #if KMP_AFFINITY_SUPPORTED 5144 if ( ! TCR_4(__kmp_init_middle) ) {
5149 const char *var =
"KMP_AFFINITY";
5151 if(hwloc_topology_init(&__kmp_hwloc_topology) < 0) {
5152 __kmp_hwloc_error = TRUE;
5153 if(__kmp_affinity_verbose)
5154 KMP_WARNING(AffHwlocErrorOccurred, var,
"hwloc_topology_init()");
5156 hwloc_topology_ignore_type(__kmp_hwloc_topology, HWLOC_OBJ_CACHE);
5158 if ( __kmp_affinity_type == affinity_disabled ) {
5159 KMP_AFFINITY_DISABLE();
5161 else if ( ! KMP_AFFINITY_CAPABLE() ) {
5163 const hwloc_topology_support* topology_support = hwloc_topology_get_support(__kmp_hwloc_topology);
5164 if(hwloc_topology_load(__kmp_hwloc_topology) < 0) {
5165 __kmp_hwloc_error = TRUE;
5166 if(__kmp_affinity_verbose)
5167 KMP_WARNING(AffHwlocErrorOccurred, var,
"hwloc_topology_load()");
5172 if(topology_support->cpubind->set_thisthread_cpubind &&
5173 topology_support->cpubind->get_thisthread_cpubind &&
5174 topology_support->discovery->pu &&
5178 KMP_AFFINITY_ENABLE(TRUE);
5181 __kmp_hwloc_error = TRUE;
5182 KMP_AFFINITY_DISABLE();
5185 __kmp_affinity_determine_capable( var );
5186 # endif // KMP_USE_HWLOC 5187 if ( ! KMP_AFFINITY_CAPABLE() ) {
5188 if ( __kmp_affinity_verbose || ( __kmp_affinity_warnings
5189 && ( __kmp_affinity_type != affinity_default )
5190 && ( __kmp_affinity_type != affinity_none )
5191 && ( __kmp_affinity_type != affinity_disabled ) ) ) {
5192 KMP_WARNING( AffNotSupported, var );
5194 __kmp_affinity_type = affinity_disabled;
5195 __kmp_affinity_respect_mask = 0;
5196 __kmp_affinity_gran = affinity_gran_fine;
5201 if ( __kmp_affinity_type == affinity_disabled ) {
5202 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5204 else if ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_true ) {
5208 __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
5212 if ( KMP_AFFINITY_CAPABLE() ) {
5214 # if KMP_GROUP_AFFINITY 5221 if ( ( ( __kmp_num_proc_groups > 1 )
5222 && ( __kmp_affinity_type == affinity_default )
5224 && ( __kmp_nested_proc_bind.bind_types[0] == proc_bind_default ) )
5226 || ( __kmp_affinity_top_method == affinity_top_method_group ) ) {
5227 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5228 __kmp_affinity_respect_mask = FALSE;
5230 if ( __kmp_affinity_type == affinity_default ) {
5231 __kmp_affinity_type = affinity_compact;
5233 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5236 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5237 if ( __kmp_affinity_gran == affinity_gran_default ) {
5238 __kmp_affinity_top_method = affinity_top_method_group;
5239 __kmp_affinity_gran = affinity_gran_group;
5241 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5242 __kmp_affinity_top_method = affinity_top_method_group;
5245 __kmp_affinity_top_method = affinity_top_method_all;
5248 else if ( __kmp_affinity_top_method == affinity_top_method_group ) {
5249 if ( __kmp_affinity_gran == affinity_gran_default ) {
5250 __kmp_affinity_gran = affinity_gran_group;
5252 else if ( ( __kmp_affinity_gran != affinity_gran_group )
5253 && ( __kmp_affinity_gran != affinity_gran_fine )
5254 && ( __kmp_affinity_gran != affinity_gran_thread ) ) {
5256 switch ( __kmp_affinity_gran ) {
5257 case affinity_gran_core: str =
"core";
break;
5258 case affinity_gran_package: str =
"package";
break;
5259 case affinity_gran_node: str =
"node";
break;
5260 default: KMP_DEBUG_ASSERT( 0 );
5262 KMP_WARNING( AffGranTopGroup, var, str );
5263 __kmp_affinity_gran = affinity_gran_fine;
5267 if ( __kmp_affinity_gran == affinity_gran_default ) {
5268 __kmp_affinity_gran = affinity_gran_core;
5270 else if ( __kmp_affinity_gran == affinity_gran_group ) {
5272 switch ( __kmp_affinity_type ) {
5273 case affinity_physical: str =
"physical";
break;
5274 case affinity_logical: str =
"logical";
break;
5275 case affinity_compact: str =
"compact";
break;
5276 case affinity_scatter: str =
"scatter";
break;
5277 case affinity_explicit: str =
"explicit";
break;
5279 default: KMP_DEBUG_ASSERT( 0 );
5281 KMP_WARNING( AffGranGroupType, var, str );
5282 __kmp_affinity_gran = affinity_gran_core;
5291 if ( __kmp_affinity_respect_mask == affinity_respect_mask_default ) {
5292 # if KMP_GROUP_AFFINITY 5293 if ( __kmp_num_proc_groups > 1 ) {
5294 __kmp_affinity_respect_mask = FALSE;
5299 __kmp_affinity_respect_mask = TRUE;
5303 if ( ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_intel )
5304 && ( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default ) ) {
5305 if ( __kmp_affinity_type == affinity_default ) {
5306 __kmp_affinity_type = affinity_compact;
5307 __kmp_affinity_dups = FALSE;
5312 if ( __kmp_affinity_type == affinity_default ) {
5314 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5315 if( __kmp_mic_type != non_mic ) {
5316 __kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
5320 __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
5323 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5324 if( __kmp_mic_type != non_mic ) {
5325 __kmp_affinity_type = affinity_scatter;
5329 __kmp_affinity_type = affinity_none;
5333 if ( ( __kmp_affinity_gran == affinity_gran_default )
5334 && ( __kmp_affinity_gran_levels < 0 ) ) {
5335 #if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) 5336 if( __kmp_mic_type != non_mic ) {
5337 __kmp_affinity_gran = affinity_gran_fine;
5341 __kmp_affinity_gran = affinity_gran_core;
5344 if ( __kmp_affinity_top_method == affinity_top_method_default ) {
5345 __kmp_affinity_top_method = affinity_top_method_all;
5350 K_DIAG( 1, (
"__kmp_affinity_type == %d\n", __kmp_affinity_type ) );
5351 K_DIAG( 1, (
"__kmp_affinity_compact == %d\n", __kmp_affinity_compact ) );
5352 K_DIAG( 1, (
"__kmp_affinity_offset == %d\n", __kmp_affinity_offset ) );
5353 K_DIAG( 1, (
"__kmp_affinity_verbose == %d\n", __kmp_affinity_verbose ) );
5354 K_DIAG( 1, (
"__kmp_affinity_warnings == %d\n", __kmp_affinity_warnings ) );
5355 K_DIAG( 1, (
"__kmp_affinity_respect_mask == %d\n", __kmp_affinity_respect_mask ) );
5356 K_DIAG( 1, (
"__kmp_affinity_gran == %d\n", __kmp_affinity_gran ) );
5358 KMP_DEBUG_ASSERT( __kmp_affinity_type != affinity_default);
5360 KMP_DEBUG_ASSERT( __kmp_nested_proc_bind.bind_types[0] != proc_bind_default );
5366 if ( __kmp_version ) {
5367 __kmp_print_version_1();
5371 if (
string != NULL) {
5372 __kmp_aux_env_initialize( &block );
5375 __kmp_env_blk_free( & block );
5385 kmp_env_blk_t block;
5387 kmp_str_buf_t buffer;
5390 __kmp_str_buf_init( & buffer );
5392 __kmp_env_blk_init( & block, NULL );
5393 __kmp_env_blk_sort( & block );
5396 __kmp_str_buf_print( & buffer,
"\n%s\n\n", KMP_I18N_STR( UserSettings ) );
5397 for ( i = 0; i < block.count; ++ i ) {
5398 char const * name = block.vars[ i ].name;
5399 char const * value = block.vars[ i ].value;
5401 ( KMP_STRLEN( name ) > 4 && strncmp( name,
"KMP_", 4 ) == 0 )
5402 || strncmp( name,
"OMP_", 4 ) == 0
5403 #ifdef KMP_GOMP_COMPAT
5404 || strncmp( name,
"GOMP_", 5 ) == 0
5407 __kmp_str_buf_print( & buffer,
" %s=%s\n", name, value );
5410 __kmp_str_buf_print( & buffer,
"\n" );
5413 __kmp_str_buf_print( & buffer,
"%s\n\n", KMP_I18N_STR( EffectiveSettings ) );
5414 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5415 if ( __kmp_stg_table[ i ].print != NULL ) {
5416 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5420 __kmp_printf(
"%s", buffer.str );
5422 __kmp_env_blk_free( & block );
5423 __kmp_str_buf_free( & buffer );
5432 __kmp_env_print_2() {
5434 kmp_env_blk_t block;
5435 kmp_str_buf_t buffer;
5437 __kmp_env_format = 1;
5440 __kmp_str_buf_init( & buffer );
5442 __kmp_env_blk_init( & block, NULL );
5443 __kmp_env_blk_sort( & block );
5445 __kmp_str_buf_print( & buffer,
"\n%s\n", KMP_I18N_STR( DisplayEnvBegin ) );
5446 __kmp_str_buf_print( & buffer,
" _OPENMP='%d'\n", __kmp_openmp_version );
5448 for (
int i = 0; i < __kmp_stg_count; ++ i ) {
5449 if ( __kmp_stg_table[ i ].print != NULL &&
5450 ( ( __kmp_display_env && strncmp( __kmp_stg_table[ i ].name,
"OMP_", 4 ) == 0 ) || __kmp_display_env_verbose ) ) {
5451 __kmp_stg_table[ i ].print( & buffer, __kmp_stg_table[ i ].name, __kmp_stg_table[ i ].data );
5455 __kmp_str_buf_print( & buffer,
"%s\n", KMP_I18N_STR( DisplayEnvEnd ) );
5456 __kmp_str_buf_print( & buffer,
"\n" );
5458 __kmp_printf(
"%s", buffer.str );
5460 __kmp_env_blk_free( & block );
5461 __kmp_str_buf_free( & buffer );
5466 #endif // OMP_40_ENABLED