Skip to content

Commit 880a25a

Browse files
committed
synthetic/export/v1: ignore memcaches instead of failing to export
Signed-off-by: Brice Goglin <[email protected]>
1 parent 659f102 commit 880a25a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

hwloc/topology-synthetic.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ hwloc__export_synthetic_memory_children(struct hwloc_topology * topology, unsign
13601360

13611361
if (flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1) {
13621362
/* v1: export a single NUMA child */
1363-
if (parent->memory_arity > 1 || mchild->type != HWLOC_OBJ_NUMANODE) {
1363+
if (parent->memory_arity > 1) {
13641364
/* not supported */
13651365
if (verbose)
13661366
fprintf(stderr, "Cannot export to synthetic v1 if multiple memory children are attached to the same location.\n");
@@ -1371,6 +1371,9 @@ hwloc__export_synthetic_memory_children(struct hwloc_topology * topology, unsign
13711371
if (needprefix)
13721372
hwloc__export_synthetic_add_char(&ret, &tmp, &tmplen, ' ');
13731373

1374+
/* ignore memcaches and export the NUMA node */
1375+
while (mchild->type != HWLOC_OBJ_NUMANODE)
1376+
mchild = mchild->memory_first_child;
13741377
res = hwloc__export_synthetic_obj(topology, flags, mchild, 1, tmp, tmplen);
13751378
if (hwloc__export_synthetic_update_status(&ret, &tmp, &tmplen, res) < 0)
13761379
return -1;
@@ -1531,17 +1534,21 @@ hwloc_topology_export_synthetic(struct hwloc_topology * topology,
15311534

15321535
if (flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1) {
15331536
/* v1 requires all NUMA at the same level */
1534-
hwloc_obj_t node;
1537+
hwloc_obj_t node, parent;
15351538
signed pdepth;
15361539

15371540
node = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, 0);
15381541
assert(node);
1539-
assert(hwloc__obj_type_is_normal(node->parent->type)); /* only depth-1 memory children for now */
1540-
pdepth = node->parent->depth;
1542+
parent = node->parent;
1543+
while (!hwloc__obj_type_is_normal(parent->type))
1544+
parent = parent->parent;
1545+
pdepth = parent->depth;
15411546

15421547
while ((node = node->next_cousin) != NULL) {
1543-
assert(hwloc__obj_type_is_normal(node->parent->type)); /* only depth-1 memory children for now */
1544-
if (node->parent->depth != pdepth) {
1548+
parent = node->parent;
1549+
while (!hwloc__obj_type_is_normal(parent->type))
1550+
parent = parent->parent;
1551+
if (parent->depth != pdepth) {
15451552
if (verbose)
15461553
fprintf(stderr, "Cannot export to synthetic v1 if memory is attached to parents at different depths.\n");
15471554
errno = EINVAL;

0 commit comments

Comments
 (0)