[Openmp-commits] [PATCH] D84065: [OpenMP] libomp cleanup: check presence of hwloc objects CORE, PACKAGE
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jul 17 15:16:18 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86fb2db49b33: [OpenMP] libomp cleanup: check presence of hwloc objects CORE, PACKAGE (authored by AndreyChurbanov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84065/new/
https://reviews.llvm.org/D84065
Files:
openmp/runtime/src/kmp_affinity.cpp
Index: openmp/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/runtime/src/kmp_affinity.cpp
+++ openmp/runtime/src/kmp_affinity.cpp
@@ -577,11 +577,17 @@
// Hack to try and infer the machine topology using only the data
// available from cpuid on the current thread, and __kmp_xproc.
KMP_ASSERT(__kmp_affinity_type == affinity_none);
-
- nCoresPerPkg = __kmp_hwloc_get_nobjs_under_obj(
- hwloc_get_obj_by_type(tp, HWLOC_OBJ_PACKAGE, 0), HWLOC_OBJ_CORE);
- __kmp_nThreadsPerCore = __kmp_hwloc_get_nobjs_under_obj(
- hwloc_get_obj_by_type(tp, HWLOC_OBJ_CORE, 0), HWLOC_OBJ_PU);
+ // hwloc only guarantees existance of PU object, so check PACKAGE and CORE
+ hwloc_obj_t o = hwloc_get_obj_by_type(tp, HWLOC_OBJ_PACKAGE, 0);
+ if (o != NULL)
+ nCoresPerPkg = __kmp_hwloc_get_nobjs_under_obj(o, HWLOC_OBJ_CORE);
+ else
+ nCoresPerPkg = 1; // no PACKAGE found
+ o = hwloc_get_obj_by_type(tp, HWLOC_OBJ_CORE, 0);
+ if (o != NULL)
+ __kmp_nThreadsPerCore = __kmp_hwloc_get_nobjs_under_obj(o, HWLOC_OBJ_PU);
+ else
+ __kmp_nThreadsPerCore = 1; // no CORE found
__kmp_ncores = __kmp_xproc / __kmp_nThreadsPerCore;
nPackages = (__kmp_xproc + nCoresPerPkg - 1) / nCoresPerPkg;
if (__kmp_affinity_verbose) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84065.278911.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200717/507520e9/attachment.bin>
More information about the Openmp-commits
mailing list