From dec01097f8ae99a8d297c25319b2bf1564a4fb34 Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Sun, 18 Jan 2015 09:30:20 +0100 Subject: [PATCH] hwloc: groups: add complete sets when inserting distance/pci groups Make sure we define complete cpuset/nodeset when we define groups' main cpuset/nodeset during later insert of groups (for PCI hostbridges or distances). Otherwise they may end up clearing child/parent complete sets which suddenly become incoherent while they were fixed earlier. Needed to fix allowed_nodeset meaning. (cherry picked from commit open-mpi/hwloc@7c88d17addba12c74c7accc69e1a7685e2c01d06) Signed-off-by: Jeff Squyres --- opal/mca/hwloc/hwloc191/hwloc/src/distances.c | 20 +++++++++++++++++++ .../mca/hwloc/hwloc191/hwloc/src/pci-common.c | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/opal/mca/hwloc/hwloc191/hwloc/src/distances.c b/opal/mca/hwloc/hwloc191/hwloc/src/distances.c index ba9ec219e0..47085296fc 100644 --- a/opal/mca/hwloc/hwloc191/hwloc/src/distances.c +++ b/opal/mca/hwloc/hwloc191/hwloc/src/distances.c @@ -852,12 +852,22 @@ hwloc__groups_by_distances(struct hwloc_topology *topology, if (groupids[j] == i+1) { /* assemble the group cpuset */ hwloc_bitmap_or(group_obj->cpuset, group_obj->cpuset, objs[j]->cpuset); + if (objs[i]->complete_cpuset) { + if (!group_obj->complete_cpuset) + group_obj->complete_cpuset = hwloc_bitmap_alloc(); + hwloc_bitmap_or(group_obj->complete_cpuset, group_obj->complete_cpuset, objs[j]->complete_cpuset); + } /* if one obj has a nodeset, assemble a group nodeset */ if (objs[j]->nodeset) { if (!group_obj->nodeset) group_obj->nodeset = hwloc_bitmap_alloc(); hwloc_bitmap_or(group_obj->nodeset, group_obj->nodeset, objs[j]->nodeset); } + if (objs[i]->complete_nodeset) { + if (!group_obj->complete_nodeset) + group_obj->complete_nodeset = hwloc_bitmap_alloc(); + hwloc_bitmap_or(group_obj->complete_nodeset, group_obj->complete_nodeset, objs[j]->complete_nodeset); + } groupsizes[i]++; } hwloc_debug_1arg_bitmap("adding Group object with %u objects and cpuset %s\n", @@ -1010,12 +1020,22 @@ hwloc_group_by_distances(struct hwloc_topology *topology) for(i=0; icpuset, group_obj->cpuset, osdist->objs[i]->cpuset); + if (osdist->objs[i]->complete_cpuset) { + if (!group_obj->complete_cpuset) + group_obj->complete_cpuset = hwloc_bitmap_alloc(); + hwloc_bitmap_or(group_obj->complete_cpuset, group_obj->complete_cpuset, osdist->objs[i]->complete_cpuset); + } /* if one obj has a nodeset, assemble a group nodeset */ if (osdist->objs[i]->nodeset) { if (!group_obj->nodeset) group_obj->nodeset = hwloc_bitmap_alloc(); hwloc_bitmap_or(group_obj->nodeset, group_obj->nodeset, osdist->objs[i]->nodeset); } + if (osdist->objs[i]->complete_nodeset) { + if (!group_obj->complete_nodeset) + group_obj->complete_nodeset = hwloc_bitmap_alloc(); + hwloc_bitmap_or(group_obj->complete_nodeset, group_obj->complete_nodeset, osdist->objs[i]->complete_nodeset); + } } hwloc_debug_1arg_bitmap("adding Group object (as root of distance matrix with %u objects) with cpuset %s\n", nbobjs, group_obj->cpuset); diff --git a/opal/mca/hwloc/hwloc191/hwloc/src/pci-common.c b/opal/mca/hwloc/hwloc191/hwloc/src/pci-common.c index 562ee3bab8..c48093a95c 100644 --- a/opal/mca/hwloc/hwloc191/hwloc/src/pci-common.c +++ b/opal/mca/hwloc/hwloc191/hwloc/src/pci-common.c @@ -1,5 +1,5 @@ /* - * Copyright © 2009-2014 Inria. All rights reserved. + * Copyright © 2009-2015 Inria. All rights reserved. * See COPYING in top-level directory. */ @@ -263,6 +263,7 @@ hwloc_pci_find_hostbridge_parent(struct hwloc_topology *topology, struct hwloc_b hwloc_obj_t group_obj = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, -1); if (group_obj) { group_obj->cpuset = hwloc_bitmap_dup(cpuset); + group_obj->complete_cpuset = hwloc_bitmap_dup(cpuset); group_obj->attr->group.depth = (unsigned) -1; parent = hwloc__insert_object_by_cpuset(topology, group_obj, hwloc_report_os_error); if (parent == group_obj)