Skip to content

Commit

Permalink
Avoiding hang during creation of the resource partitioner
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Sep 18, 2017
1 parent 04a6b6b commit 1c37b94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion hpx/runtime/resource/detail/partitioner.hpp
Expand Up @@ -213,7 +213,6 @@ namespace hpx { namespace resource { namespace detail
std::vector<detail::init_pool_data> initial_thread_pools_;

// reference to the topology and affinity data
threads::topology &topology_;
hpx::threads::policies::detail::affinity_data affinity_data_;

// contains the internal topology back-end used to add resources to
Expand Down
17 changes: 9 additions & 8 deletions src/runtime/resource/detail/detail_partitioner.cpp
Expand Up @@ -215,7 +215,6 @@ namespace hpx { namespace resource { namespace detail
partitioner::partitioner()
: first_core_(std::size_t(-1))
, cores_needed_(std::size_t(-1))
, topology_(threads::create_topology())
, mode_(mode_default)
{
// allow only one partitioner instance
Expand All @@ -240,10 +239,12 @@ namespace hpx { namespace resource { namespace detail

void partitioner::fill_topology_vectors()
{
threads::topology& topo = get_topology();

std::size_t pid = 0;
std::size_t num_numa_nodes = topology_.get_number_of_numa_nodes();
std::size_t num_numa_nodes = topo.get_number_of_numa_nodes();
if (num_numa_nodes == 0)
num_numa_nodes = topology_.get_number_of_sockets();
num_numa_nodes = topo.get_number_of_sockets();
numa_domains_.reserve(num_numa_nodes);

// loop on the numa-domains
Expand All @@ -252,8 +253,7 @@ namespace hpx { namespace resource { namespace detail
numa_domains_.emplace_back(i); // add a numa domain
numa_domain &nd = numa_domains_.back(); // numa-domain just added

std::size_t numa_node_cores =
topology_.get_number_of_numa_node_cores(i);
std::size_t numa_node_cores = topo.get_number_of_numa_node_cores(i);
nd.cores_.reserve(numa_node_cores);

bool numa_domain_contains_exposed_cores = false;
Expand All @@ -264,7 +264,7 @@ namespace hpx { namespace resource { namespace detail
nd.cores_.emplace_back(j, &nd);
core &c = nd.cores_.back();

std::size_t core_pus = topology_.get_number_of_core_pus(j);
std::size_t core_pus = topo.get_number_of_core_pus(j);
c.pus_.reserve(core_pus);

bool core_contains_exposed_pus = false;
Expand Down Expand Up @@ -315,7 +315,8 @@ namespace hpx { namespace resource { namespace detail
if (first_core_ != first_core)
{
std::size_t offset = first_core;
std::size_t num_pus_core = topology_.get_number_of_core_pus(offset);
std::size_t num_pus_core =
get_topology().get_number_of_core_pus(offset);

if (first_core_ != std::size_t(-1))
{
Expand Down Expand Up @@ -754,7 +755,7 @@ namespace hpx { namespace resource { namespace detail

threads::topology &partitioner::get_topology() const
{
return topology_;
return threads::create_topology();
}

util::command_line_handling &
Expand Down

0 comments on commit 1c37b94

Please sign in to comment.