aboutsummaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2017-04-25 19:04:07 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2017-04-25 19:04:07 +0000
commit20e13d4a3868fff5beac98e3ea78ac51d61738ea (patch)
treedafea12c7bd24c8e27b993f3706ab752d87d6237 /openmp
parent356822fe7b0632b9b542831645cdf123f812164f (diff)
downloadllvm-20e13d4a3868fff5beac98e3ea78ac51d61738ea.zip
llvm-20e13d4a3868fff5beac98e3ea78ac51d61738ea.tar.gz
llvm-20e13d4a3868fff5beac98e3ea78ac51d61738ea.tar.bz2
Fix Hwloc API Incompatibility
Older Hwloc libraries (< 1.10.0) don't offer the HWLOC_OBJ_NUMANODE nor HWLOC_OBJ_PACKAGE types. Instead they are named HWLOC_OBJ_NODE and HWLOC_OBJ_SOCKET instead. This patch just defines the newer names based on the older names when using an older Hwloc. Differential Revision: https://reviews.llvm.org/D32496 llvm-svn: 301349
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp.h8
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp8
2 files changed, 11 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 466c748..85b661b 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -87,7 +87,13 @@ class kmp_stats_list;
#endif
#if KMP_USE_HWLOC && KMP_AFFINITY_SUPPORTED
-# include "hwloc.h"
+#include "hwloc.h"
+#ifndef HWLOC_OBJ_NUMANODE
+#define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
+#endif
+#ifndef HWLOC_OBJ_PACKAGE
+#define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
+#endif
#endif
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index 871ab0c..f8d579a 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -343,7 +343,7 @@ __kmp_affinity_remove_radix_one_levels(AddrUnsPair *address2os, int nActiveThrea
}
// Returns the number of objects of type 'type' below 'obj' within the topology tree structure.
-// e.g., if obj is a HWLOC_OBJ_SOCKET object, and type is HWLOC_OBJ_PU, then
+// e.g., if obj is a HWLOC_OBJ_PACKAGE object, and type is HWLOC_OBJ_PU, then
// this will return the number of PU's under the SOCKET object.
static int
__kmp_hwloc_get_nobjs_under_obj(hwloc_obj_t obj, hwloc_obj_type_t type) {
@@ -385,7 +385,7 @@ __kmp_affinity_create_hwloc_map(AddrUnsPair **address2os,
//
KMP_ASSERT(__kmp_affinity_type == affinity_none);
- nCoresPerPkg = __kmp_hwloc_get_nobjs_under_obj(hwloc_get_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_SOCKET, 0), HWLOC_OBJ_CORE);
+ nCoresPerPkg = __kmp_hwloc_get_nobjs_under_obj(hwloc_get_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_PACKAGE, 0), HWLOC_OBJ_CORE);
__kmp_nThreadsPerCore = __kmp_hwloc_get_nobjs_under_obj(hwloc_get_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_CORE, 0), HWLOC_OBJ_PU);
__kmp_ncores = __kmp_xproc / __kmp_nThreadsPerCore;
nPackages = (__kmp_xproc + nCoresPerPkg - 1) / nCoresPerPkg;
@@ -424,9 +424,9 @@ __kmp_affinity_create_hwloc_map(AddrUnsPair **address2os,
int socket_identifier = 0;
// re-calculate globals to count only accessible resources
__kmp_ncores = nPackages = nCoresPerPkg = __kmp_nThreadsPerCore = 0;
- for(socket = hwloc_get_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_SOCKET, 0);
+ for(socket = hwloc_get_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_PACKAGE, 0);
socket != NULL;
- socket = hwloc_get_next_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_SOCKET, socket),
+ socket = hwloc_get_next_obj_by_type(__kmp_hwloc_topology, HWLOC_OBJ_PACKAGE, socket),
socket_identifier++)
{
int core_identifier = 0;