Skip to content

Commit 608249b

Browse files
Allow users to specify bind string listing types. (#309)
This commit allows users to specify logical, physical (OS), or both bind string listing types. This also does away with exposing a hex bind string format at the user interface. Signed-off-by: Samuel K. Gutierrez <[email protected]> Co-authored-by: Guillaume Mercier <[email protected]>
1 parent 845ae99 commit 608249b

18 files changed

+176
-194
lines changed

include/quo-vadis.h

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2020-2024 Triad National Security, LLC
3+
* Copyright (c) 2020-2025 Triad National Security, LLC
44
* All rights reserved.
55
*
66
* Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
@@ -100,12 +100,19 @@ typedef enum {
100100
} qv_hw_obj_type_t;
101101

102102
/**
103-
* Binding string representation formats.
103+
* Binding string representation format flags.
104104
*/
105-
typedef enum {
106-
QV_BIND_STRING_AS_BITMAP = 0,
107-
QV_BIND_STRING_AS_LIST
108-
} qv_bind_string_format_t;
105+
typedef int qv_bind_string_flags_t;
106+
107+
/**
108+
* Output the logical binding.
109+
*/
110+
const qv_bind_string_flags_t QV_BIND_STRING_LOGICAL = 0x00000001;
111+
112+
/**
113+
* Output the physical (OS) binding.
114+
*/
115+
const qv_bind_string_flags_t QV_BIND_STRING_PHYSICAL = 0x00000002;
109116

110117
/**
111118
* Automatic grouping options for qv_scope_split(). The following values can be
@@ -277,7 +284,7 @@ qv_scope_bind_pop(
277284
int
278285
qv_scope_bind_string(
279286
qv_scope_t *scope,
280-
qv_bind_string_format_t format,
287+
qv_bind_string_flags_t flags,
281288
char **str
282289
);
283290

src/fortran/quo-vadisf.f90

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!
2-
! Copyright (c) 2013-2024 Triad National Security, LLC
2+
! Copyright (c) 2013-2025 Triad National Security, LLC
33
! All rights reserved.
44
!
55
! This file is part of the quo-vadis project. See the LICENSE file at the
@@ -96,13 +96,13 @@ module quo_vadisf
9696
parameter (QV_HW_OBJ_LAST = 11)
9797

9898
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
99-
! Binding string representaiton formats.
99+
! Binding string representation format flags.
100100
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
101-
integer(c_int) QV_BIND_STRING_AS_BITMAP
102-
integer(c_int) QV_BIND_STRING_AS_LIST
101+
integer(c_int), parameter :: QV_BIND_STRING_LOGICAL = &
102+
int(Z'00000001', kind=c_int)
103103

104-
parameter (QV_BIND_STRING_AS_BITMAP = 0)
105-
parameter (QV_BIND_STRING_AS_LIST = 1)
104+
integer(c_int), parameter :: QV_BIND_STRING_PHYSICAL = &
105+
int(Z'00000002', kind=c_int)
106106

107107
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108108
! Automatic grouping options for qv_scope_split().

src/quo-vadis.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ qv_scope_bind_pop(
6262
int
6363
qv_scope_bind_string(
6464
qv_scope_t *scope,
65-
qv_bind_string_format_t format,
65+
qv_bind_string_flags_t flags,
6666
char **str
6767
) {
6868
if (qvi_unlikely(!scope || !str)) {
6969
return QV_ERR_INVLD_ARG;
7070
}
7171
try {
72-
return scope->bind_string(format, str);
72+
return scope->bind_string(flags, str);
7373
}
7474
qvi_catch_and_return();
7575
}

src/qvi-bbuff-rmi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ qvi_bbuff_rmi_pack_item_impl(
459459
}
460460
// Non-null data.
461461
char *datas = nullptr;
462-
int rc = qvi_hwloc_bitmap_asprintf(NULL, data, &datas);
462+
int rc = qvi_hwloc_bitmap_asprintf(data, &datas);
463463
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;
464464
// We are sending the string representation of the cpuset.
465465
rc = buff->append(datas, strlen(datas) + 1);

0 commit comments

Comments
 (0)