[mpich-discuss] [CIG-SEISMO] MPICH mpif.h incompatible with gfortran-4.8 -std=f2003

Jed Brown jedbrown at mcs.anl.gov
Sat Jun 29 09:41:55 CDT 2013


Dimitri Komatitsch <komatitsch at lma.cnrs-mrs.fr> writes:

> Dear all,
>
> The (only) three things to do to make mpif.h conform to recent standards 
> (F90, F95, F2003) would be:
>
> - change all character* declarations to character(len=...)
>
> - change all real*8 to either double precision or real(kind=8)  (both 
> are OK)
>
> - change all integer*8 to integer(kind=8)

Well, mpif.h is supposed to be backward-compatible to F77.  Upon
checking the code, I see that MPICH offers the feature of tolerating -i8
and -r8 options.  Open MPI uses 'double precision' for MPI_WTIME, which
would be promoted to 16 bytes under -r8, so it won't behave correctly if
the user expects a real*8 (perhaps specified as real(kind=8) [1]).

The MPI standard says the prototype is

  DOUBLE PRECISION MPI_WTIME()

so I would say that MPICH is non-conforming by using REAL*8, though the
standard does not make any statements about what changes when compiled
with -r8.  I haven't checked to see how MPI data types are mapped in
case of -r8.  For example, MPI_REAL is defined to a constant in mpif.h,
and the MPI library (which was compiled in advance) would not be aware
of whether user code was being built with -r8.  Is the user expected to
use MPI_REAL4 and MPI_REAL8 explicitly in this case?

Is -r8 and -i8 tested somewhere in MPICH?  What exactly is the user
expected to do in order to use this feature?  I see this comment in
src/binding/f90/mpi_sizeofs.f90.in:

  ! If reals and doubles have been forced to the same size (e.g., with 
  ! -i8 -r8 to compilers like g95), then the compiler may refuse to 
  ! allow interfaces that use real and double precision (failing to 
  ! determine which one is intended)


[1] Note that real(kind=8) is not guaranteed by the Fortran standard to
    be 8 bytes.  For example, g77 and the Salford F95 compilers denote
    4-bytes reals with real(kind=1), and 8-byte reals with real(kind=2).

    http://www.silverfrost.com/manuals/salfordftn95.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20130629/e7eb4bfd/attachment.sig>


More information about the discuss mailing list