[MPI3 Fortran] Deprecate mpif.h?

Bill Long longb at cray.com
Wed Mar 3 13:03:03 CST 2010

Jeff Squyres wrote:

>> As far as I understand, it is valid that an MPI implementation
>> defines mpif.h with exactly one line:
>>       use mpi
>> because all compilers are Fortran 90 compilers
>> and use mpi is allowed in free and fixed form sources.
> Yes, I think that's right, too.
> So I've been calling them the "implicit interfaces" -- I guess that's wrong, too.  Sigh.  Now I'll have to think of a better name.  :-)
>> As far as I know, IBM and NEC are doing argument checking with
>> "use mpi" and also with "include 'mpif.h'".
> What do you mean -- that they have an mpif.h that just does "use mpi"?
> Question: if you "implicit none", doesn't that change where you can include an mpif.h, depending on whether it has "use mpi" or one that doesn't?  That seems to be unportable to me.

This would be an issue.  USE statements come before IMPLICIT statements, 
whereas ordinary declarations come after.  You could nest things the 
other way around, with

    module mpi
       include "mpif.h"
    end module mpi

assuming everything you wanted in the module is also in the mpif.h file, 
and the .h file contained only the sort of declarations that are legal 
in a module. I assume the motivation here is to have just one file to 

>> If there is a difference between "use mpi" and "use mpi3" for
>> buffer arguments, then argument checking together with "use mpi"
>> must implement the buf arguments as "unchecked" arguments,
>> and not with the new features coming in Fortran 2008.
> I thought that J3 gave us a format to use for un-typed buffers, and even though full F08 compilers won't be available for a while, this feature was likely to start becoming available in the near future...?

The TYPE(*) declaration is actually being included in a TR that is being 
done in parallel with the F08 standard.  When such things become 
available in production compilers depends on the order in which vendors 
choose to implement new features, which in turn depends on customer 
demands. Given the size of the MPI community, I would expect a request 
from your users to carry considerable weight.  I don't think that 
TYPE(*) will be difficult for vendors to implement.

>> In this case I would strongly recommend
>>  - not to deprecate "use mpi" nor "include mpif.h", and
>>  - all vendors add the IBM/NEC hack (void arguments) to their
>>    Fortran compiler, and

Many vendors provide some sort of 'hack' to allow for 'typeless' buffer 
arguments in interfaces, such as are used by MPI.  The TYPE(*) proposal 
was an attempt to provide a common syntax for portable code.   That 
would be the preferred way forward.

> What about Fortran codes that don't use a preprocessor?

I would discourage any requirement for preprocessing.  A well-written 
portable code should not require preprocessing.


Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101

More information about the mpiwg-fortran mailing list