Permalink
Browse files

Merge pull request #3456 from msimberg/hwloc-version-checks

Add #ifdefs to topology.cpp to support old hwloc versions again
  • Loading branch information...
sithhell committed Sep 13, 2018
2 parents a450028 + 729eaac commit 0c6fdbaa8770ce7aa46b3c715748098983d449ec
Showing with 34 additions and 6 deletions.
  1. +34 −6 src/runtime/threads/topology.cpp
@@ -517,8 +517,13 @@ namespace hpx { namespace threads
{
std::unique_lock<hpx::util::spinlock> lk(topo_mtx);
int ret =
#if HWLOC_API_VERSION >= 0x00010b06
hwloc_get_area_membind(topo, reinterpret_cast<void const*>(lva),
1, nodeset, &policy, HWLOC_MEMBIND_BYNODESET);
#else
hwloc_get_area_membind_nodeset(topo,
reinterpret_cast<void const*>(lva), 1, nodeset, &policy, 0);
#endif
if (-1 != ret)
{
@@ -838,7 +843,11 @@ namespace hpx { namespace threads
{
hwloc_bitmap_t cpuset = mask_to_bitmap(mask, HWLOC_OBJ_PU);
hwloc_bitmap_t nodeset = hwloc_bitmap_alloc();
#if HWLOC_API_VERSION >= 0x00020000
hwloc_cpuset_to_nodeset(topo, cpuset, nodeset);
#else
hwloc_cpuset_to_nodeset_strict(topo, cpuset, nodeset);
#endif
hwloc_bitmap_free(cpuset);
return std::make_shared<hpx::threads::hpx_hwloc_bitmap_wrapper>(nodeset);
}
@@ -1232,8 +1241,15 @@ namespace hpx { namespace threads
hwloc_bitmap_ptr bitmap,
hpx_hwloc_membind_policy policy, int flags) const
{
return hwloc_alloc_membind(topo, len, bitmap->get_bmp(),
(hwloc_membind_policy_t)(policy), flags | HWLOC_MEMBIND_BYNODESET);
return
#if HWLOC_API_VERSION >= 0x00010b06
hwloc_alloc_membind(topo, len, bitmap->get_bmp(),
(hwloc_membind_policy_t)(policy),
flags | HWLOC_MEMBIND_BYNODESET);
#else
hwloc_alloc_membind_nodeset(topo, len, bitmap->get_bmp(),
(hwloc_membind_policy_t)(policy), flags);
#endif
}
bool topology::set_area_membind_nodeset(
@@ -1242,8 +1258,14 @@ namespace hpx { namespace threads
#if !defined(__APPLE__)
hwloc_membind_policy_t policy = ::HWLOC_MEMBIND_BIND;
hwloc_nodeset_t ns = reinterpret_cast<hwloc_nodeset_t>(nodeset);
int ret = hwloc_set_area_membind(
topo, addr, len, ns, policy, HWLOC_MEMBIND_BYNODESET);
int ret =
#if HWLOC_API_VERSION >= 0x00010b06
hwloc_set_area_membind(
topo, addr, len, ns, policy, HWLOC_MEMBIND_BYNODESET);
#else
hwloc_set_area_membind_nodeset(topo, addr, len, ns, policy, 0);
#endif
if (ret < 0)
{
std::string msg = std::strerror(errno);
@@ -1275,8 +1297,14 @@ namespace hpx { namespace threads
hwloc_membind_policy_t policy;
hwloc_nodeset_t ns = reinterpret_cast<hwloc_nodeset_t>(nodeset->get_bmp());
if (hwloc_get_area_membind(
topo, addr, len, ns, &policy, HWLOC_MEMBIND_BYNODESET) == -1)
if (
#if HWLOC_API_VERSION >= 0x00010b06
hwloc_get_area_membind(
topo, addr, len, ns, &policy, HWLOC_MEMBIND_BYNODESET)
#else
hwloc_get_area_membind_nodeset(topo, addr, len, ns, &policy, 0)
#endif
== -1)
{
HPX_THROW_EXCEPTION(kernel_error,
"hpx::threads::topology::get_area_membind_nodeset",

0 comments on commit 0c6fdba

Please sign in to comment.