Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error clases #4

Open
dalcinl opened this issue Apr 9, 2023 · 8 comments
Open

Error clases #4

dalcinl opened this issue Apr 9, 2023 · 8 comments

Comments

@dalcinl
Copy link
Contributor

dalcinl commented Apr 9, 2023

As of now, the value of error classes (other than MPI_SUCCESS and MPI_ERR_LASTCODE ) is assigned by listing the names in alphabetical order. I don't really like this approach, as it is not future-proof. As soon as a new MPI standard adds a new error class, the order will be broken.

I would like to propose an slightly alternative approach:

  • We group error classes by the major.minor version of the standard in which they appeared.
  • Within each group, we subgroup them by its prefix MPI_ and MPI_T_,
  • Within each subgroup, we sort alphabetically by name to generate a list.
  • From that list, we assign values from 1,...,N. Of course MPI_STATUS is first with value 0.
  • We can still keep the MPI_T values in a separate range, let say starting as 1000 as now, although I would rather prefer the first one be 1001' , such that errclass % 1000is positive. I'm still thinking about the convenience of this separate range. It may not play well with user-defined error classes and theMPI_LASTUSEDCODEattribute toCOMM_WORLD`.

I can easily get the MPI_ prefixed error class groups by MPI major.minor version from the mpi4py source tree :

grep '#define PyMPI_HAVE_MPI_ERR_' src/lib-mpi/config/mpi-*.h

I don't have the MPI_T ones, but these are just a few, it is not hard to do.

Related, I would like to reconsider the case of MPI_ERR_LASTCODE. Our proposal right now follows the Open MPI approach, where MPI_ERR_LASTCODE leaves (a bit) of room for extension, but it is still a relatively small integer. MPICH, on the other hand, uses a large value of 0x3fffffff. I see little benefit on the Open MPI approach. IMHO, After the introduction of user-defined error classes and code, MPI_ERR_LASTCODE became a bit obsolete. I would like to propose defining MPI_ERR_LASTCODE at least as large as 32767, or even INT_MAX if there are no objections.

Comments?

@jeffhammond
Copy link
Member

We should try to omit MPI_ERR_LASTCODE from the ABI. It doesn't serve the apparent purpose unless it is a version and/or implementation-dependent tight (?) upper bound on the number of error codes.

Setting MPI_ERR_LASTCODE to INT_MAX means it is useless. Omitting it from the ABI is a less aggressive alternative.

@dalcinl
Copy link
Contributor Author

dalcinl commented Apr 17, 2023

For MPICH folks, it is effectively useless, they use a very large value. I'm not sure omitting thing from the ABI is a good idea. I'm inclined to think that is better to define it to INT_MAX (which IIUC would be backward compatible regarding the MPI standard), deprecate it, and tells users to rely on the attribute query mechanism.

@jeffhammond
Copy link
Member

What is gained by setting it to INT_MAX versus saying that it is not specified in the ABI? I just don't understand the use case where this would be better.

@jeffhammond
Copy link
Member

For starters, what code are people writing that depends on MPI_ERR_LASTCODE?

@dalcinl
Copy link
Contributor Author

dalcinl commented Apr 17, 2023

Probably no correct code uses it, it's useless, and it has been useless since MPI-2. But you cannot simply remove it, at best you can deprecate it. I'm just a bit worried of leaving things out of the ABI.

PS: mpi4py uses it, but in an unusual way. For exampe, if you build mpi4py with an MPI-4 implementation, then the value of MPI.ERR_HANDLER in Python will map to MPI_ERR_LASTCODE to signal "not available in the backend MPI implementation". But I could very well use a negative number instead.

@qkoziol
Copy link

qkoziol commented Apr 18, 2023 via email

@dalcinl
Copy link
Contributor Author

dalcinl commented Apr 19, 2023

Yes, I understand that. But then we now will have two categories of MPI symbols/constants. Those that are in the ABI, and those that are not. I have the hope of making all of the MPI API part of the ABI, without any exceptions.

@jeffhammond
Copy link
Member

I have relented from excluding it from the ABI. We just need to pick a suitably large value to avoid backwards compatibility issues in the future. The slack discussion in #general is relevant to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants