Skip to content

Commit 03d9be9

Browse files
committed
Workaround a bug in hwloc_bitmap_nr_ulongs in older hwloc versions
1 parent 10392df commit 03d9be9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/memory_targets/memory_target_numa.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ numa_targets_create_nodemask(struct numa_memory_target_t **targets,
7171

7272
*maxnode = lastBit + 1;
7373

74-
int nrUlongs = hwloc_bitmap_nr_ulongs(bitmap);
75-
if (nrUlongs == -1) {
76-
hwloc_bitmap_free(bitmap);
77-
return UMF_RESULT_ERROR_UNKNOWN;
78-
}
74+
// Do not use hwloc_bitmap_nr_ulongs due to:
75+
// https://github.com/open-mpi/hwloc/issues/429
76+
unsigned bits_per_long = sizeof(unsigned long) * 8;
77+
int nrUlongs = (lastBit + bits_per_long) / bits_per_long;
7978

8079
unsigned long *nodemask = malloc(sizeof(unsigned long) * nrUlongs);
8180
if (!nodemask) {

0 commit comments

Comments
 (0)