Skip to content

Commit 2d6d607

Browse files
committed
utils: fix the filtering of osdevs by osdev.type bitmask
If GPU is requested, GPU|CoProc is OK Signed-off-by: Brice Goglin <[email protected]>
1 parent e381de8 commit 2d6d607

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

utils/hwloc/hwloc-calc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ hwloc_calc_output(hwloc_topology_t topology, const char *sep, hwloc_bitmap_t set
195195
hwloc_obj_t obj = NULL;
196196
while ((obj = hwloc_calc_get_next_obj_covering_set_by_depth(topology, set, nodeseto, numberofdepth, obj)) != NULL) {
197197
if (numberofdepth == HWLOC_TYPE_DEPTH_OS_DEVICE
198-
&& numberofattr.osdev.type
199-
&& numberofattr.osdev.type != obj->attr->osdev.type)
198+
&& (obj->attr->osdev.type & numberofattr.osdev.type) != numberofattr.osdev.type)
200199
continue;
201200
nb++;
202201
}
@@ -209,8 +208,7 @@ hwloc_calc_output(hwloc_topology_t topology, const char *sep, hwloc_bitmap_t set
209208
while ((obj = hwloc_calc_get_next_obj_covering_set_by_depth(topology, set, nodeseto, intersectdepth, obj)) != NULL) {
210209
unsigned idx;
211210
if (intersectdepth == HWLOC_TYPE_DEPTH_OS_DEVICE
212-
&& intersectattr.osdev.type
213-
&& intersectattr.osdev.type != obj->attr->osdev.type)
211+
&& (obj->attr->osdev.type & intersectattr.osdev.type) != intersectattr.osdev.type)
214212
continue;
215213
if (!first)
216214
printf("%s", sep);

utils/hwloc/hwloc-calc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ hwloc_calc_append_iodev_by_index(struct hwloc_calc_location_context_s *lcontext,
529529
}
530530

531531
if (type == HWLOC_OBJ_OS_DEVICE) {
532-
if (osdevtype != 0 && obj->attr->osdev.type != osdevtype)
532+
if ((obj->attr->osdev.type & osdevtype) != osdevtype)
533533
continue;
534534
}
535535

0 commit comments

Comments
 (0)