Skip to content

MPI_Type_size(MPI_INTEGER,..) with INTEGER size promotion #744

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

Open
jeffhammond opened this issue Aug 23, 2023 · 4 comments
Open

MPI_Type_size(MPI_INTEGER,..) with INTEGER size promotion #744

jeffhammond opened this issue Aug 23, 2023 · 4 comments
Labels
mpi-6 For inclusion in the MPI 5.1 or 6.0 standard

Comments

@jeffhammond
Copy link
Member

Problem

We do not prohibit the modification of Fortran INTEGER using compiler options.

I would like someone to explain to me how they think this should be implemented.

My contention is this is almost impossible to implement, and we should disallow it.

This program illustrates the problem. How do people think implementers can make it so that the output of this program depends on the compiler option used?

program main
  use mpi_f08
  implicit none
  integer :: size,ierr
  call MPI_Init(ierr)
  call MPI_Type_size(MPI_INTEGER,size,ierr)
  print*,size
  call MPI_Finalize(ierr)
end program main

To be clear, I know how to implement this, but it's tricky and requires Fortran 2003, which isn't something we assume with mpif.h or the MPI module.

Proposal

We should disallow modification of the size Fortran INTEGER in the MPI standard.

Changes to the Text

Impact on Implementations

Intel MPI has at least partial support for ILP64 in the MPI module (but not the MPI_F08 module). This would disallow that.

Impact on Users

Users like this feature but do not understand its implications. It has never been safe to use.

References and Pull Requests

@jeffhammond
Copy link
Member Author

@jsquyres @RolfRabenseifner @hritzdorf you have any thoughts?

@jeffhammond
Copy link
Member Author

Also, one can have the same program in C and somehow it has to know what Fortran compiler options were used. How does it know that?

I accept that one can implement this by having a separate MPI C library for each Fortran INTEGER option and the user is responsible for using the right everything throughout their build but is this really the world we want to live in?

How does this work when building C shared libraries? How do those know what Fortran compiler options are going to be used?

@hritzdorf
Copy link

(1) a mpicc compile time option is used or a C macro is defined

(2) The reason for this is, that it is a common Fortran compile/link option to expand the width of integers (and other kind of variables); for example gnu Fortran option: -fdefault-integer-8
A reason to use this option may be, that the numbers to be stored in integer variables are too large for 4 byte wide integers and the users don't want to manually change the entire code.
In general, logical and real variables are also expanded to 8 byte wide variables if integer variables are expanded.
NEC MPI supports this feature since many (> 25) years. Users asked for it.

(3) By using different library names or different directories. Linking of applications is done by the MPI Fortran compile/link script, which knows how to link the executable correctly.

@jeffhammond
Copy link
Member Author

Okay, I am coming around to the need to have a C ABI for every possible INTEGER size on a platform.

@wesbland wesbland added the mpi-5.0 For inclusion in the MPI 5.0 standard label Sep 13, 2023
@github-project-automation github-project-automation bot moved this to To Do in MPI 5.0 Sep 13, 2023
@wesbland wesbland added mpi-6 For inclusion in the MPI 5.1 or 6.0 standard and removed mpi-5.0 For inclusion in the MPI 5.0 standard labels Jan 9, 2025
@github-project-automation github-project-automation bot moved this to To Do in MPI Next Jan 9, 2025
@wesbland wesbland removed this from MPI 5.0 Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mpi-6 For inclusion in the MPI 5.1 or 6.0 standard
Projects
Status: To Do
Development

No branches or pull requests

3 participants