Changeset View
Changeset View
Standalone View
Standalone View
runtime/src/kmp_settings.cpp
Show First 20 Lines • Show All 3,246 Lines • ▼ Show 20 Lines | if (nelem == 0) { | ||||
} | } | ||||
__kmp_str_buf_print(buffer, "'\n"); | __kmp_str_buf_print(buffer, "'\n"); | ||||
} | } | ||||
} | } | ||||
#endif /* OMP_40_ENABLED */ | #endif /* OMP_40_ENABLED */ | ||||
#if OMP_50_ENABLED | #if OMP_50_ENABLED | ||||
static void __kmp_stg_parse_display_affinity(char const *name, | |||||
char const *value, void *data) { | |||||
__kmp_stg_parse_bool(name, value, &__kmp_display_affinity); | |||||
} | |||||
static void __kmp_stg_print_display_affinity(kmp_str_buf_t *buffer, | |||||
char const *name, void *data) { | |||||
__kmp_stg_print_bool(buffer, name, __kmp_display_affinity); | |||||
} | |||||
static void __kmp_stg_parse_affinity_format(char const *name, char const *value, | |||||
void *data) { | |||||
size_t length = KMP_STRLEN(value); | |||||
__kmp_strncpy_truncate(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, value, | |||||
length); | |||||
} | |||||
static void __kmp_stg_print_affinity_format(kmp_str_buf_t *buffer, | |||||
char const *name, void *data) { | |||||
if (__kmp_env_format) { | |||||
KMP_STR_BUF_PRINT_NAME_EX(name); | |||||
} else { | |||||
__kmp_str_buf_print(buffer, " %s='", name); | |||||
} | |||||
__kmp_str_buf_print(buffer, "%s'\n", __kmp_affinity_format); | |||||
} | |||||
// OMP_ALLOCATOR sets default allocator | // OMP_ALLOCATOR sets default allocator | ||||
static void __kmp_stg_parse_allocator(char const *name, char const *value, | static void __kmp_stg_parse_allocator(char const *name, char const *value, | ||||
void *data) { | void *data) { | ||||
/* | /* | ||||
The value can be any predefined allocator: | The value can be any predefined allocator: | ||||
omp_default_mem_alloc = 1; | omp_default_mem_alloc = 1; | ||||
omp_large_cap_mem_alloc = 2; | omp_large_cap_mem_alloc = 2; | ||||
omp_const_mem_alloc = 3; | omp_const_mem_alloc = 3; | ||||
▲ Show 20 Lines • Show All 1,610 Lines • ▼ Show 20 Lines | |||||
// KMP_AFFINITY is not supported on OS X*, nor is OMP_PLACES. | // KMP_AFFINITY is not supported on OS X*, nor is OMP_PLACES. | ||||
// OMP_PROC_BIND and proc-bind-var are supported, however. | // OMP_PROC_BIND and proc-bind-var are supported, however. | ||||
#if OMP_40_ENABLED | #if OMP_40_ENABLED | ||||
{"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, | {"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind, | ||||
NULL, 0, 0}, | NULL, 0, 0}, | ||||
#endif | #endif | ||||
#endif // KMP_AFFINITY_SUPPORTED | #endif // KMP_AFFINITY_SUPPORTED | ||||
#if OMP_50_ENABLED | |||||
{"OMP_DISPLAY_AFFINITY", __kmp_stg_parse_display_affinity, | |||||
__kmp_stg_print_display_affinity, NULL, 0, 0}, | |||||
{"OMP_AFFINITY_FORMAT", __kmp_stg_parse_affinity_format, | |||||
__kmp_stg_print_affinity_format, NULL, 0, 0}, | |||||
#endif | |||||
{"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork, | {"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork, | ||||
__kmp_stg_print_init_at_fork, NULL, 0, 0}, | __kmp_stg_print_init_at_fork, NULL, 0, 0}, | ||||
{"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL, | {"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL, | ||||
0, 0}, | 0, 0}, | ||||
{"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule, | {"OMP_SCHEDULE", __kmp_stg_parse_omp_schedule, __kmp_stg_print_omp_schedule, | ||||
NULL, 0, 0}, | NULL, 0, 0}, | ||||
#if KMP_USE_HIER_SCHED | #if KMP_USE_HIER_SCHED | ||||
{"KMP_DISP_HAND_THREAD", __kmp_stg_parse_kmp_hand_thread, | {"KMP_DISP_HAND_THREAD", __kmp_stg_parse_kmp_hand_thread, | ||||
▲ Show 20 Lines • Show All 513 Lines • ▼ Show 20 Lines | #if KMP_AFFINITY_SUPPORTED | ||||
__kmp_nested_proc_bind.bind_types[0] = proc_bind_default; | __kmp_nested_proc_bind.bind_types[0] = proc_bind_default; | ||||
#else | #else | ||||
// default proc bind is false if affinity not supported | // default proc bind is false if affinity not supported | ||||
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false; | __kmp_nested_proc_bind.bind_types[0] = proc_bind_false; | ||||
#endif | #endif | ||||
} | } | ||||
#endif /* OMP_40_ENABLED */ | #endif /* OMP_40_ENABLED */ | ||||
#if OMP_50_ENABLED | |||||
// Set up the affinity format ICV | |||||
// Grab the default affinity format string from the message catalog | |||||
kmp_msg_t m = | |||||
__kmp_msg_format(kmp_i18n_msg_AffFormatDefault, "%P", "%i", "%n", "%A"); | |||||
KMP_DEBUG_ASSERT(KMP_STRLEN(m.str) < KMP_AFFINITY_FORMAT_SIZE); | |||||
if (__kmp_affinity_format == NULL) { | |||||
__kmp_affinity_format = | |||||
(char *)KMP_INTERNAL_MALLOC(sizeof(char) * KMP_AFFINITY_FORMAT_SIZE); | |||||
} | |||||
KMP_STRCPY_S(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, m.str); | |||||
__kmp_str_free(&m.str); | |||||
#endif | |||||
// Now process all of the settings. | // Now process all of the settings. | ||||
for (i = 0; i < block.count; ++i) { | for (i = 0; i < block.count; ++i) { | ||||
__kmp_stg_parse(block.vars[i].name, block.vars[i].value); | __kmp_stg_parse(block.vars[i].name, block.vars[i].value); | ||||
} | } | ||||
// If user locks have been allocated yet, don't reset the lock vptr table. | // If user locks have been allocated yet, don't reset the lock vptr table. | ||||
if (!__kmp_init_user_locks) { | if (!__kmp_init_user_locks) { | ||||
if (__kmp_user_lock_kind == lk_default) { | if (__kmp_user_lock_kind == lk_default) { | ||||
▲ Show 20 Lines • Show All 371 Lines • Show Last 20 Lines |