}
__kmp_str_buf_print(buffer, "%s'\n", __kmp_affinity_format);
}
+
// OMP_ALLOCATOR sets default allocator
static void __kmp_stg_parse_allocator(char const *name, char const *value,
void *data) {
*/
const char *buf = value;
const char *next;
- int num;
SKIP_WS(buf);
- if ((*buf > '0') && (*buf < '9')) {
- next = buf;
- SKIP_DIGITS(next);
- num = __kmp_str_to_int(buf, *next);
- KMP_ASSERT(num > 0);
- switch (num) {
- case 4:
+ next = buf;
+ // check HBW first as the only non-default supported
+ if (__kmp_match_str("omp_high_bw_mem_alloc", buf, &next) ||
+ __kmp_match_str("4", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
if (__kmp_memkind_available) {
__kmp_def_allocator = omp_high_bw_mem_alloc;
+ return;
} else {
- __kmp_msg(kmp_ms_warning,
- KMP_MSG(OmpNoAllocator, "omp_high_bw_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
+ KMP_WARNING(OmpNoAllocator, "omp_high_bw_mem_alloc");
}
- break;
- case 1:
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 2:
- __kmp_msg(kmp_ms_warning,
- KMP_MSG(OmpNoAllocator, "omp_large_cap_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 3:
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_const_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 5:
- __kmp_msg(kmp_ms_warning,
- KMP_MSG(OmpNoAllocator, "omp_low_lat_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 6:
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_cgroup_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 7:
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_pteam_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
- case 8:
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_thread_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- break;
}
- return;
- }
- next = buf;
- if (__kmp_match_str("omp_high_bw_mem_alloc", buf, &next)) {
- if (__kmp_memkind_available) {
- __kmp_def_allocator = omp_high_bw_mem_alloc;
- } else {
- __kmp_msg(kmp_ms_warning,
- KMP_MSG(OmpNoAllocator, "omp_high_bw_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
+ } else if (__kmp_match_str("omp_default_mem_alloc", buf, &next) ||
+ __kmp_match_str("1", buf, &next)) {
+ // default requested
+ SKIP_WS(next);
+ } else if (__kmp_match_str("omp_large_cap_mem_alloc", buf, &next) ||
+ __kmp_match_str("2", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_large_cap_mem_alloc");
+ }
+ } else if (__kmp_match_str("omp_const_mem_alloc", buf, &next) ||
+ __kmp_match_str("3", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_const_mem_alloc");
+ }
+ } else if (__kmp_match_str("omp_low_lat_mem_alloc", buf, &next) ||
+ __kmp_match_str("5", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_low_lat_mem_alloc");
+ }
+ } else if (__kmp_match_str("omp_cgroup_mem_alloc", buf, &next) ||
+ __kmp_match_str("6", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_cgroup_mem_alloc");
+ }
+ } else if (__kmp_match_str("omp_pteam_mem_alloc", buf, &next) ||
+ __kmp_match_str("7", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_pteam_mem_alloc");
+ }
+ } else if (__kmp_match_str("omp_thread_mem_alloc", buf, &next) ||
+ __kmp_match_str("8", buf, &next)) {
+ SKIP_WS(next);
+ if (*next == '\0') {
+ KMP_WARNING(OmpNoAllocator, "omp_thread_mem_alloc");
}
- } else if (__kmp_match_str("omp_default_mem_alloc", buf, &next)) {
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_large_cap_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning,
- KMP_MSG(OmpNoAllocator, "omp_large_cap_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_const_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_const_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_low_lat_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_low_lat_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_cgroup_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_cgroup_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_pteam_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_pteam_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
- } else if (__kmp_match_str("omp_thread_mem_alloc", buf, &next)) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(OmpNoAllocator, "omp_thread_mem_alloc"),
- __kmp_msg_null);
- __kmp_def_allocator = omp_default_mem_alloc;
}
- buf = next;
- SKIP_WS(buf);
- if (*buf != '\0') {
- KMP_WARNING(ParseExtraCharsWarn, name, buf);
+ __kmp_def_allocator = omp_default_mem_alloc;
+ if (next == buf || *next != '\0') {
+ // either no match or extra symbols present after the matched token
+ KMP_WARNING(StgInvalidValue, name, value);
}
}