[mpich-discuss] mpifort wrapper compiler?

Jeff Hammond jeff.science at gmail.com
Sat Dec 7 15:50:56 CST 2013

Users really shouldn't read this email.  And yes Dave Goodell, I know
I'm tilting at windmills :-)

>>> Is this MPICH, or IBM MPI?
>> That dichotomy is dated, but not particularly relevant for this discussion.
> Ah -- forgive my ignorance; I thought/assumed IBM periodically seeded from upstream MPICH and was an actual separate MPI implementation distribution.  My bad.

IBM's implementation of MPI based upon PAMI, which ships on Blue Gene,
PERCS and InfiniBand systems, is downstream from MPICH.  Whether or
not one can build the MPICH master on Blue Gene/Q on a given day is a
function of planetary alignment.  I have certainly done it, albeit not

I know IBM supports other MPI implementations, but I really can't
comment on the details.  The MPI formerly known as Platform is not
dead as I understand it.

>>> When I install MPICH 3.x on my Linux commodity cluster, I only see mpif77 and mpif90.  Does MPICH do something different when installed on a BG system?
>> IBM deploys MPICH for BG with a bunch of wrappers, one for each bgxl*
>> compiler (including an _r variant for each as well).  They are named
>> mpixl* to prevent confusion with the GCC wrappers, at least when some
>> variants of MPI are used.  See
>> https://wiki.alcf.anl.gov/parts/index.php/Mira_MPI_Documentation#Explanation_of_MPI_variants
>> for details.  If you have further questions, request an ALCF account
>> and you can dig around yourself :-)
> Good enough.
> But my original point remains: those wrappers are not in MPICH itself -- they come from IBM.

I honestly don't know exactly where the generation of
mpixl{c,cxx,f77,f90,f95,f2003,f2008}{,_r} happens w.r.t. MPICH's build
system.  It might be part of the IBM toolchain packaging.

>> MPICH does not have these, but I don't see why it would today given
>> that it only supports the F77 and F90 interfaces.
> I'm going to be pedantic again, because this is a critical point: there are no such things as "F77" and "F90" interfaces for MPI.
> There is mpif.h, the mpi module, and the mpi_f08 module.  Labeling them as F77 and F90 is incorrect.

The interfaces _are in the spirit_ of F77 and F90.  It is stupid to
use mpif.h in F90+ because modules are infinitely better that common
blocks.  Fortran common blocks are a crime against humanity that are
only acceptable in F77 codes.  That mpif.h relies upon common blocks
for MPI_BOTTOM, for instance, makes them a uniquely F77-like design.

The use of a module is something that is strictly impossible in an F77
code and thus has to be considered an F90+ interface.  As F90 is the
first language for which the MPI module can be used, I think it is
reasonable to call it the F90 interface.

I accept that people will use the mpi module rather than the mpi_f08
module in F08 codes because of inertia, but that doesn't mean that the
mpi_f08 module shouldn't be called the F08 interface to MPI.  After
all, it's in the name.

> 1st case in point: mpif.h never worked for Fortran 77.

Yes, and as Nick McLaren points out, all forms of asynchronous
communication in MPI (e.g. MPI_Isend and MPI_Put) are incompatible
with every specification of Fortran, including 2008, unless we include
TS 29113, right?  I suppose MPI works if all buffers in Fortran are in
common blocks or modules.  Other than 11.7.4, does the MPI Standard
say that is required?  I guess all the Fortran codes calling MPI_IRECV
with automatic buffers are not strictly valid, regardless of whether
they 'include mpif.h' or 'use mpi'.

Pedantic Squyres must admit that there is no valid Fortran interface
to MPI, just ones that happen to work due to the absence of
sufficiently optimizing compilers :-D

> 2nd case in point: you can use mpif.h with any version of Fortran that supports MPI (e.g., 90, 95, 03, 08), and you can use the mpi module with any version of Fortran that supports MPI and modules (e.g., 90, 95, 03, 08).  The mpi_f08 module works with F08 and later, obviously (it uses some newer features that debuted in Fortran 2008).
Isn't every C89 program also a C++11 program?  So I can go around
saying that MPICH is written in C++11?  I don't consider arguments
based upon the backwards compatibility of languages to be particularly

> My point: They are not F77 and F90 interfaces, since they can be used with many different Fortran versions.

Sure, and we need to stop talking about how we deleted "the" C++
interface since we really only deleted the _newer_ C++ interface and
made sure the older C89-based C++ interface works with C++ types.

> Also, MPI states that you should be able to use all 3 interfaces in a single compilation unit.

It also defines MPI_Alltoallw.

> So other than the backwards compatibility issue, a single "mpifort" wrapper that makes all 3 interfaces available makes perfect sense.
> I don't think there can be any expectation that "mpif77" provides a true, honest, and only Fortran 77 compiler (because MPI never worked with Fortran 77).

How about we have mpifisffc (MPI FIxed Source Form Fortran Compiler)
and mpifrsffc (MPI FRee Source Form Fortran Compiler) then?

> "mpif90" might have a reasonable expectation that it only provides Fortran 90 syntax, and potentially errors out if you use F03/F08 syntax.  But that's kinda weak.

I believe that F90 compilers are allowed to define array layout in a
nonstandard way whereas they removed this in F03 (because it was a
horrible idea in the first place).  In theory, forcing the user to use
an F08 compiler on F90 code can reduce performance.

If Fortran 2008 deprecates any features of older versions of Fortran,
it may be a problem for users to force everyone to use the newest

The only natural conclusion at this point is that it is critical to
deprecate both mpif.h and the 'mpi' module, since the 'mpi_f08' module
is clearly the only sane way to use MPI from Fortran.



Jeff Hammond
jeff.science at gmail.com

More information about the discuss mailing list