[MPI3 Fortran] Specify IN/OUT/INOUT in MPI spec?

Bill Long longb at cray.com
Tue May 26 14:10:27 CDT 2009

Lionel, Steve wrote:
> Jeff Squyres wrote:
> "I note that none of the current Fortran API interface specifications  
> in MPI-2.1 list the intent of the parameters.  Do we want to update  
> all of MPI in 3.0 to list the INTENT, and/or use "more modern Fortran  
> notation""
> Yes, please!  

I'll second that.  Intents are a good idea in general.  One caution: One 
of the most often misunderstood (based on bug reports) aspect of intent 
is that INTENT(OUT) causes the argument to become undefined on entry to 
the routine.  The side effects of this have tripped up quite a few 
people.  If the argument might get defined, but if not it should retain 
its old value, then specify intent(inout).

> Also, the "integer" and other datatypes should specify a KIND specifier from a set defined in the MPI module.  IMPORT should be used to get these values into the interface block so a separate module for the types and kinds is not required.  See http://software.intel.com/en-us/blogs/2006/10/05/domestic-or-imported/ for an item I wrote on IMPORT.
> We should also consider whether BIND(C) and other C interoperability features should be used (especially the KIND values from ISO_C_BINDING that correspond to C types.)

Using bind(c) and some other modern features - the VALUE attribute could 
be used beneficially in many instances - does have the the side effect 
that having the interface visible (i.e. including the USE MPI statement) 
is required rather than optional.  That would involve a level of user 
awareness that is greater than if you only use features that do not 
require explicit interfaces.  Some compilers have an "automatic use" 
option that would avoid having to modify existing user sources, but I 
don't think this is universally available.  I'm all in favor of using 
the modern stuff. I just want to make sure we have 'full disclosure' on 
what that involves.

Another side effect of users including USE MPI with interfaces that 
include intent specs:  some codes that start to experience compile-time 
errors.  Granted, the code was wrong all along, and the compiler is now 
able to detect that.  In the end this is a good thing, but the initial 
response is "but it worked before" (or so they thought).


> While IMPORT and C interoperability are Fortran 2003 features, most reasonably current Fortran compilers support them.
> Steve Lionel
> Intel Developer Support
> Nashua, NH
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran

Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120


More information about the mpiwg-fortran mailing list