Skip to content

Commit

Permalink
core: better handle empty topology errors
Browse files Browse the repository at this point in the history
Don't abort if the topology is empty, just return an error.
Also return an error if there are no PU or no NUMA node
(empty means there are no PU AND no NUMA node).

Always print a error message on stderr since this shouldn't
happen in normal cases.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Sep 21, 2018
1 parent 5738ac4 commit d8e539d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions hwloc/topology.c
Expand Up @@ -3133,11 +3133,19 @@ hwloc_discover(struct hwloc_topology *topology)
hwloc_filter_bridges(topology, topology->levels[0][0]);
hwloc_debug_print_objects(0, topology->levels[0][0]);

hwloc_debug("%s", "\nRemoving empty objects except numa nodes and PCI devices\n");
hwloc_debug("%s", "\nRemoving empty objects\n");
remove_empty(topology, &topology->levels[0][0]);
if (!topology->levels[0][0]) {
if (!topology->levels[0][0]) {
fprintf(stderr, "Topology became empty, aborting!\n");
abort();
return -1;
}
if (hwloc_bitmap_iszero(topology->levels[0][0]->cpuset)) {
fprintf(stderr, "Topology does not contain any PU, aborting!\n");
return -1;
}
if (hwloc_bitmap_iszero(topology->levels[0][0]->nodeset)) {
fprintf(stderr, "Topology does not contain any NUMA node, aborting!\n");
return -1;
}
hwloc_debug_print_objects(0, topology->levels[0][0]);

Expand Down

0 comments on commit d8e539d

Please sign in to comment.