Skip to content

Commit 9cac832

Browse files
committed
Workaround a bug in hwloc_bitmap_nr_ulongs in older hwloc versions
1 parent 21841a7 commit 9cac832

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
@@ -85,11 +85,10 @@ numa_targets_create_nodemask(struct numa_memory_target_t **targets,
8585

8686
*maxnode = lastBit + 1;
8787

88-
int nrUlongs = hwloc_bitmap_nr_ulongs(bitmap);
89-
if (nrUlongs == -1) {
90-
hwloc_bitmap_free(bitmap);
91-
return UMF_RESULT_ERROR_UNKNOWN;
92-
}
88+
// Do not use hwloc_bitmap_nr_ulongs due to:
89+
// https://github.com/open-mpi/hwloc/issues/429
90+
unsigned bits_per_long = sizeof(unsigned long) * 8;
91+
int nrUlongs = (lastBit + bits_per_long)/bits_per_long;
9392

9493
unsigned long *nodemask = malloc(sizeof(unsigned long) * nrUlongs);
9594
int ret = hwloc_bitmap_to_ulongs(bitmap, nrUlongs, nodemask);

0 commit comments

Comments
 (0)