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

Fortran pair types #70

Open
jeffhammond opened this issue Nov 10, 2017 · 4 comments
Open

Fortran pair types #70

jeffhammond opened this issue Nov 10, 2017 · 4 comments
Labels
mpi-5 For inclusion in the MPI 5.0 standard wg-collectives Collectives Working Group wg-fortran Fortran Working Group

Comments

@jeffhammond
Copy link
Member

jeffhammond commented Nov 10, 2017

Problem

The current list of enumerated pair types is rather limiting, particularly in Fortran. The Fortran pair types are designed for Fortran 77, which does not support anything like a C struct. Fortran 90+ supports user-defined types. Given that the MPI standard has never been compliant with Fortran 77, and we now have explicit support for Fortran 2008, we should leverage Fortran 90 features to improve pair types (which are used in MPI_MAXLOC and MPI_MINLOC reductions, of course).

This is a future-proof solution to the challenge of enumerating all the potentially valid pair types, which was proposed in #18. This or something similar is essential if and when we add large-count support to MPI (see https://github.com/mpiwg-large-count/large-count-issues/issues for details).

Proposal

We can create a pair type constructor along the lines of MPI_Type_create_f90_real...

MPI_Type_create_f90_pair(valtype, loctype, newtype, ierror)
    TYPE(MPI_Datatype), INTENT(IN) ::  valtype
    TYPE(MPI_Datatype), INTENT(IN) ::  loctype
    TYPE(MPI_Datatype), INTENT(OUT) ::  newtype
    INTEGER, OPTIONAL, INTENT(OUT) ::  ierror

...that returns to the user the predefined defined associated with the following Fortran type:

type pairtype
   <VALUE TYPE> :: value
   <LOCATION TYPE> :: location
end type pairtype

Note that this is a special case of MPI_Type_create_struct that only returns MPI_SUCCESS when the resulting type is valid for use with MPI_MAXLOC and MPI_MINLOC.

Changes to the Text

TODO

Impact on Implementations

This is a special case of MPI_Type_create_struct so the implementation is quite simple. Implementers merely need to determine what pair types are valid and only support those.

Having a separate function for this makes it easier to do error checking for the user.

Impact on Users

This function allows Fortran users to use modern language features instead of the awkward hacks MPI_2REAL, MPI_2DOUBLE, and MPI_2INTEGER. It also allows Fortran users to perform M**LOC reductions over more types, such as when the array values are INTEGER*8 and the locations are INTEGER, which is often INTEGER*4.

References

@jeffhammond jeffhammond added not ready wg-collectives Collectives Working Group wg-fortran Fortran Working Group labels Nov 10, 2017
@jeffhammond jeffhammond self-assigned this Nov 10, 2017
@jeffhammond jeffhammond added this to the 2018-02 Portland, USA milestone Nov 10, 2017
@wesbland wesbland removed this from the 2018-02 Portland, USA milestone Mar 1, 2018
@tonyskjellum
Copy link

tonyskjellum commented Sep 26, 2018

@jeffhammond , do you plan to work on this for the December timeframe; we need a champion to get this ready for reading. Otherwise, who else could we encourage to write it up?

Thanks,
Tony

@jeffhammond
Copy link
Member Author

I seriously doubt I will have time for this for December. My priority is #23.

@tonyskjellum
Copy link

tonyskjellum commented Sep 26, 2018 via email

@bosilca
Copy link
Member

bosilca commented Sep 10, 2021

Predefined MPI_Op only apply to predefined MPI_Datatype. This dynamic creation of datatypes would require to also extend the definition of predefined ops and datatypes.

@wesbland wesbland added the mpi-5 For inclusion in the MPI 5.0 standard label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mpi-5 For inclusion in the MPI 5.0 standard wg-collectives Collectives Working Group wg-fortran Fortran Working Group
Projects
Status: To Do
Development

No branches or pull requests

4 participants