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

MPI 2.0 Datatypes #173

Closed
hannesbrandt opened this issue Mar 8, 2024 · 7 comments
Closed

MPI 2.0 Datatypes #173

hannesbrandt opened this issue Mar 8, 2024 · 7 comments

Comments

@hannesbrandt
Copy link
Collaborator

In sc_mpi.h we define several MPI Datatypes that are not part of the MPI 1.3 standard, but were added in more recent versions: MPI_SIGNED_CHAR, MPI_INT8_T and MPI_UNSIGNED_LONG_LONG.
Both MPI_SIGNED_CHAR and MPI_UNSIGNED_LONG_LONG are not yet used in libsc, while MPI_INT8_T is used several times in the test_mpi_pack example.
It may be an option to remove them or to check for their existence during configuration.

@cburstedde
Copy link
Owner

cburstedde commented Mar 10, 2024 via email

@hannesbrandt
Copy link
Collaborator Author

As a third option, we might redefine:

  • sc_UNSIGNED_LONG_LONG to MPI_LONG_LONG
  • sc_MPI_SIGNED_CHAR to MPI_CHAR
  • sc_MPI_INT8_T to MPI_BYTE

Would this work cleanly without anyone even noticing?

I think this approach might cause troubles. According to the C99 standard long long can represent values up to $2^{63}-1$ while unsigned long long can represent values up to $2^{64}-1$. So, the name sc_UNSIGNED_LONG_LONG might tempt the user to assign values that can not be represented by MPI_LONG_LONG.
Similarly, the number of bits in a byte is not defined to be 8 by the C standard and signed char might cover a different range than char.

@cburstedde
Copy link
Owner

cburstedde commented Mar 18, 2024

As a third option, we might redefine:

  • sc_UNSIGNED_LONG_LONG to MPI_LONG_LONG
  • sc_MPI_SIGNED_CHAR to MPI_CHAR
  • sc_MPI_INT8_T to MPI_BYTE

Would this work cleanly without anyone even noticing?

I think this approach might cause troubles. According to the C99 standard long long can represent values up to 263−1 while unsigned long long can represent values up to 264−1. So, the name sc_UNSIGNED_LONG_LONG might tempt the user to assign values that can not be represented by MPI_LONG_LONG. Similarly, the number of bits in a byte is not defined to be 8 by the C standard and signed char might cover a different range than char.

Thanks for the analysis! Please feel free to push to #175, entirely removing questionable types if need be.

@cburstedde
Copy link
Owner

Pinging @lukasdreyer to warn that MPI_INT8_T may be removed. Please check if a workaround will be possible.

@cburstedde
Copy link
Owner

Merged. This is now officially a release candidate.

@lukasdreyer
Copy link
Contributor

The workaround would be the same as you took in the test, to replace SC_MPI_INT8_T by SC_MPI_BYTE, although I am not happy with it, as it is not as declarative as it should be.
We will probably create our own wrappers, T8_MPI_INT8_T, which I was hoping not being necessary to do.

@cburstedde
Copy link
Owner

cburstedde commented Mar 19, 2024 via email

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

No branches or pull requests

3 participants