Skip to content

Commit

Permalink
Allow users to specify bind string listing types. (#309)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
samuelkgutierrez and GuillaumeMercier authored Feb 19, 2025
1 parent 845ae99 commit 608249b
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 194 deletions.
21 changes: 14 additions & 7 deletions include/quo-vadis.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2020-2024 Triad National Security, LLC
* Copyright (c) 2020-2025 Triad National Security, LLC
* All rights reserved.
*
* Copyright (c) 2020-2021 Lawrence Livermore National Security, LLC
Expand Down Expand Up @@ -100,12 +100,19 @@ typedef enum {
} qv_hw_obj_type_t;

/**
* Binding string representation formats.
* Binding string representation format flags.
*/
typedef enum {
QV_BIND_STRING_AS_BITMAP = 0,
QV_BIND_STRING_AS_LIST
} qv_bind_string_format_t;
typedef int qv_bind_string_flags_t;

/**
* Output the logical binding.
*/
const qv_bind_string_flags_t QV_BIND_STRING_LOGICAL = 0x00000001;

/**
* Output the physical (OS) binding.
*/
const qv_bind_string_flags_t QV_BIND_STRING_PHYSICAL = 0x00000002;

/**
* Automatic grouping options for qv_scope_split(). The following values can be
Expand Down Expand Up @@ -277,7 +284,7 @@ qv_scope_bind_pop(
int
qv_scope_bind_string(
qv_scope_t *scope,
qv_bind_string_format_t format,
qv_bind_string_flags_t flags,
char **str
);

Expand Down
12 changes: 6 additions & 6 deletions src/fortran/quo-vadisf.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!
! Copyright (c) 2013-2024 Triad National Security, LLC
! Copyright (c) 2013-2025 Triad National Security, LLC
! All rights reserved.
!
! This file is part of the quo-vadis project. See the LICENSE file at the
Expand Down Expand Up @@ -96,13 +96,13 @@ module quo_vadisf
parameter (QV_HW_OBJ_LAST = 11)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Binding string representaiton formats.
! Binding string representation format flags.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
integer(c_int) QV_BIND_STRING_AS_BITMAP
integer(c_int) QV_BIND_STRING_AS_LIST
integer(c_int), parameter :: QV_BIND_STRING_LOGICAL = &
int(Z'00000001', kind=c_int)

parameter (QV_BIND_STRING_AS_BITMAP = 0)
parameter (QV_BIND_STRING_AS_LIST = 1)
integer(c_int), parameter :: QV_BIND_STRING_PHYSICAL = &
int(Z'00000002', kind=c_int)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Automatic grouping options for qv_scope_split().
Expand Down
4 changes: 2 additions & 2 deletions src/quo-vadis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ qv_scope_bind_pop(
int
qv_scope_bind_string(
qv_scope_t *scope,
qv_bind_string_format_t format,
qv_bind_string_flags_t flags,
char **str
) {
if (qvi_unlikely(!scope || !str)) {
return QV_ERR_INVLD_ARG;
}
try {
return scope->bind_string(format, str);
return scope->bind_string(flags, str);
}
qvi_catch_and_return();
}
Expand Down
2 changes: 1 addition & 1 deletion src/qvi-bbuff-rmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ qvi_bbuff_rmi_pack_item_impl(
}
// Non-null data.
char *datas = nullptr;
int rc = qvi_hwloc_bitmap_asprintf(NULL, data, &datas);
int rc = qvi_hwloc_bitmap_asprintf(data, &datas);
if (qvi_unlikely(rc != QV_SUCCESS)) return rc;
// We are sending the string representation of the cpuset.
rc = buff->append(datas, strlen(datas) + 1);
Expand Down
Loading

0 comments on commit 608249b

Please sign in to comment.