Skip to content

Add procedure to check if an info object's value matches some value #587

Open
@brandongc

Description

@brandongc

Problem

Querying MPI_Info objects can be verbose and result in extra resource usage.

Consider some code such as

bool use_feature = false;
int len = MPI_MAX_INFO_VAL, flag = 0;
char *val = malloc(MPI_MAX_INFO_VAL);
MPI_Info_get_string(MPI_INFO_ENV, “mpi_some_feature”, &len, val, &flag);

if (flag && strcasecmp(val, "some_value") == 0) use_feature = true;
free(val);

A user has to allocate/ free a buffer to hold the value and write string parsing code to check for a value or matching substring.

Proposal

Add a match/ test function for MPI_Info objects to simplify some queries such as

MPI_Info_Test(info, key, test_substring, key_is_defined, value_is_matching);

would allow a user to write

int key_exists = 0, use_feature =0 ;
MPI_Info_Test(info, “mpi_some_feature”, "some_value", &key_exists, &use_feature);

Changes to the Text

Add new routines to "The Info Object" chapter.

Impact on Implementations

Implementors would have to add a routine and code to match strings.

Impact on Users

Easier to use MPI_Info keys for users.

Metadata

Metadata

Assignees

Labels

chap-infoThe Info Object Chapter Committeempi-6For inclusion in the MPI 5.1 or 6.0 standard

Type

No type

Projects

Status

To Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions