Force HWLOC topology method for NUMA-specific topology

If user requested affinity with granularity=tile we need to either use HWLOC
or ignore the request. The change allows user to not specify
KMP_TOPOLOGY_METHOD=hwloc and choose it automatically instead.

Patch by Andrey Churbanov

Differential Revision: https://reviews.llvm.org/D40905

llvm-svn: 322205
This commit is contained in:
Jonathan Peyton 2018-01-10 18:31:49 +00:00
parent 1800ecec70
commit 79390ad709
1 changed files with 9 additions and 0 deletions

View File

@ -5126,6 +5126,15 @@ void __kmp_env_initialize(char const *string) {
#if KMP_AFFINITY_SUPPORTED
if (!TCR_4(__kmp_init_middle)) {
#if KMP_USE_HWLOC
// Force using hwloc when either tiles or numa nodes requested within
// KMP_HW_SUBSET and no other topology method is requested
if ((__kmp_hws_node.num > 0 || __kmp_hws_tile.num > 0 ||
__kmp_affinity_gran == affinity_gran_tile) &&
(__kmp_affinity_top_method == affinity_top_method_default)) {
__kmp_affinity_top_method = affinity_top_method_hwloc;
}
#endif
// Determine if the machine/OS is actually capable of supporting
// affinity.
const char *var = "KMP_AFFINITY";