Skip to content

Commit 57a4c80

Browse files
bgoglinndenoyelle
authored andcommitted
lstopo/draw: make sure we always remove the separator between PU boxes
Some topology may have cores at level N-2 and PU at level N because a unrelated level was placed at N-1 (for instance groups of GPU CPU-less NUMA node on the side). There's no easy way to force PU parents at N-1 and everything lese before. Fix lstopo to handle that case instead of assuming PU parents are always N-1. Signed-off-by: Brice Goglin <[email protected]>
1 parent 716275f commit 57a4c80

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

utils/lstopo/lstopo-draw.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
504504
unsigned children_width = 0, children_height = 0;
505505
unsigned above_children_width, above_children_height;
506506
unsigned existing_kinds;
507+
int normal_children_are_PUs;
507508
hwloc_obj_t child;
508509
int ncstate;
509510
unsigned i;
@@ -539,23 +540,27 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
539540
orient = LSTOPO_ORIENT_HORIZ;
540541
}
541542

542-
/* recurse into children to prepare their sizes */
543+
/* recurse into children to prepare their sizes,
544+
* and check whether all normal children are PUs. */
545+
normal_children_are_PUs = 1;
543546
for(i = 0, child = next_child(loutput, parent, LSTOPO_CHILD_KIND_ALL, NULL, &ncstate);
544547
child;
545548
i++, child = next_child(loutput, parent, LSTOPO_CHILD_KIND_ALL, child, &ncstate)) {
546549
get_type_fun(child->type)(loutput, child, 0, 0, 0);
550+
if (hwloc_obj_type_is_normal(child->type) && child->type != HWLOC_OBJ_PU)
551+
normal_children_are_PUs = 0;
547552
}
548553
if (!i)
549554
return;
550555

551556

552557
/* no separator between PUs */
553-
if ((unsigned)parent->depth == loutput->depth-2)
558+
if (normal_children_are_PUs)
554559
normal_children_separator = 0;
555560

556561
/* add separator between a cache parent and its children */
557562
if (hwloc_obj_type_is_cache(parent->type) || parent->type == HWLOC_OBJ_MEMCACHE) {
558-
if ((unsigned)parent->depth == loutput->depth-2 || parent->type == HWLOC_OBJ_MEMCACHE)
563+
if (normal_children_are_PUs || parent->type == HWLOC_OBJ_MEMCACHE)
559564
/* except between cache parent and PU children */
560565
separator_below_cache = 0;
561566
/* update children placement */

0 commit comments

Comments
 (0)