-
Notifications
You must be signed in to change notification settings - Fork 9
Description
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