diff --git a/include/quo-vadis.h b/include/quo-vadis.h index eaf12d8a..f50456fe 100644 --- a/include/quo-vadis.h +++ b/include/quo-vadis.h @@ -134,7 +134,6 @@ enum { typedef enum qv_scope_create_hint_e { // TODO(skg) Enumerate all actual values. // TODO(skg) Add to Fortran interface. - // TODO(skg) Test bitmap operations in Fortran. QV_SCOPE_CREATE_EXCLUSIVE = 0x00000001, QV_SCOPE_CREATE_CLOSE = 0x00000002 } qv_scope_create_hint_t; diff --git a/src/qvi-hwloc.cc b/src/qvi-hwloc.cc index c4a50ef8..585c76a9 100644 --- a/src/qvi-hwloc.cc +++ b/src/qvi-hwloc.cc @@ -794,6 +794,20 @@ qvi_hwloc_bitmap_copy( return QV_SUCCESS; } +int +qvi_hwloc_bitmap_nbits( + hwloc_const_cpuset_t cpuset, + size_t *nbits +) { + *nbits = 0; + + const int inbits = hwloc_bitmap_last(cpuset); + if (inbits == -1) return QV_ERR_HWLOC; + + *nbits = (size_t)inbits; + return QV_SUCCESS; +} + static int topo_fname( const char *base, diff --git a/src/qvi-hwloc.h b/src/qvi-hwloc.h index 2f89661e..b6af97df 100644 --- a/src/qvi-hwloc.h +++ b/src/qvi-hwloc.h @@ -150,6 +150,15 @@ qvi_hwloc_bitmap_copy( hwloc_cpuset_t dest ); +/** + * Returns the number of bits required to represent a given cpuset. + */ +int +qvi_hwloc_bitmap_nbits( + hwloc_const_cpuset_t cpuset, + size_t *nbits +); + /** * */