Skip to content

Allow MPI_*_GET_NAME functions to accept MPI_*_NULL handles #544

@jsquyres

Description

@jsquyres

Problem

The MPI_*_SET_NAME and MPI_*_GET_NAME functions were created to aid debugging. However, similar to most other MPI functions, it is (likely?) invalid to pass the MPI_*_NULL handles to the MPI_*_GET_NAME functions. For example:

MPI_Datatype dt = MPI_DATATYPE_NULL;
char name[MPI_MAX_OBJECT_NAME];
int outlen = 0;

// ...
MPI_Type_get_name(dt, name, &outlen);
printf("The datatype is: %s\n", name);

If dt is still MPI_DATATYPE_NULL, Open MPI v4.1.x and MPICH 4.0.0 will both invoke errors. Indeed, a user reported this behavior as a bug to Open MPI: open-mpi/ompi#10028

Instead, users must add an alternate code path to make the above snipit valid, perhaps something like this:

if (dt == MPI_DATATYPE_NULL) {
    strcpy(name, "MPI_DATATYPE_NULL");
} else {
    MPI_Type_get_name(dt, name, &outlen);
}
printf("The datatype is: %s\n", name);

Proposal

We propose making it permissible to pass in the MPI_*_NULL handles to the MPI_*_GET_NAME functions.

Note: we do not propose making it permissible to pass in the MPI_*_NULL handles to the MPI_*_SET_NAME functions.

Changes to the Text

Add sentences to the MPI_*_GET_NAMES definitions. See the PDF built from https://github.com/mpi-forum/mpi-standard/pull/652, pages:

  • 361: MPI_COMM_GET_NAME
  • 362: MPI_TYPE_GET_NAME
  • 363: MPI_WIN_GET_NAME
  • 1001: changelog

Impact on Implementations

Allow the MPI_*_NULL handles in the MPI_*_GET_NAME functions. This will involve relaxing the error checking of these 3 functions, and possibly special-casing the string that is returned in the case of MPI_*_NULL inputs.

Impact on Users

Users no longer need to special-case the use of these functions.

References and Pull Requests

https://github.com/mpi-forum/mpi-standard/pull/652

Metadata

Metadata

Labels

[done] mpi-4.1For inclusion in the MPI 4.1 standardchap-contextsGroups, Contexts, Communicators, Caching Chapter Committeehad readingCompleted the formal proposal readingpassed final votePassed the final formal votepassed first votePassed the first formal vote

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions