Skip to content

Commit

Permalink
Merge pull request #3225 from STEllAR-GROUP/fix_3221
Browse files Browse the repository at this point in the history
Applying quick fix for hwloc-2.0
  • Loading branch information
hkaiser committed Mar 18, 2018
2 parents 6350c24 + 69040e1 commit aa33855
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/runtime/threads/topology.cpp
Expand Up @@ -112,6 +112,20 @@ namespace hpx { namespace threads { namespace detail

return static_cast<std::size_t>(obj->logical_index);
}

hwloc_obj_t adjust_node_obj(hwloc_obj_t node) noexcept
{
#if HWLOC_API_VERSION >= 0x00020000
// www.open-mpi.org/projects/hwloc/doc/hwloc-v2.0.0-letter.pdf:
// Starting with hwloc v2.0, NUMA nodes are not in the main tree
// anymore. They are attached under objects as Memory Children
// on the side of normal children.
while (hwloc_obj_type_is_memory(node->type))
node = node->parent;
HPX_ASSERT(node);
#endif
return node;
}
}}}

namespace hpx { namespace threads
Expand Down Expand Up @@ -745,6 +759,7 @@ namespace hpx { namespace threads
{
HPX_ASSERT(numa_node == detail::get_index(node_obj));
std::size_t pu_count = 0;
node_obj = detail::adjust_node_obj(node_obj);
return extract_node_count(node_obj, HWLOC_OBJ_PU, pu_count);
}

Expand Down Expand Up @@ -810,6 +825,7 @@ namespace hpx { namespace threads
{
HPX_ASSERT(numa_node == detail::get_index(node_obj));
std::size_t pu_count = 0;
node_obj = detail::adjust_node_obj(node_obj);
return extract_node_count(node_obj, HWLOC_OBJ_CORE, pu_count);
}

Expand Down Expand Up @@ -985,6 +1001,7 @@ namespace hpx { namespace threads
mask_type node_affinity_mask = mask_type();
resize(node_affinity_mask, get_number_of_pus());

numa_node_obj = detail::adjust_node_obj(numa_node_obj);
extract_node_mask(numa_node_obj, node_affinity_mask);
return node_affinity_mask;
}
Expand Down

0 comments on commit aa33855

Please sign in to comment.