[MPI3 Fortran] What if Fortran is the primary interface?

Aleksandar Donev donev1 at llnl.gov
Mon Mar 17 15:03:59 CDT 2008

On Monday 17 March 2008 11:54, Hubert Ritzdorf wrote:

> I have an additional question. Is this really guaranteed by the
> Fortran 2003 standard that
> type(MPI_COMM), bind(C), protected :: MPI_COMM_WORLD
> err = MPI_Recv (..., ..., MPI_COMM_WORLD, ...)
> in the same C Pointer such as the MPI_Comm MPI_COMM_WORLD ?
No, it is not.

> My feeling is that it points to a structure containing the C pointer
Exactly. One can put the VALUE attribute on the communicator dummy argument, 
which means that the communicator will be passed in whatever way structs are 
passed by value (presumably put on the stack). Whether that is the same as 
passing the actual pointer (without the enclosing struct) depends on the ABI, 
I believe.

On Monday 17 March 2008 12:53, Jeff Squyres wrote:
> FWIW, I don't think the 2-level indirection is necessary. 
Depends on the details of the MPI implementation, and the ABI for passing 

> I think   
> that Craig was trying to unify everything, but I would agree with  
> Hubert: it would be better if MPI_COMM directly referred to whatever  
> the Right stuff is in C.
What is the *set of Right things* accross implementations. Is a plain C 
pointer (void*) always good enough---then just make the argument TYPE(C_PTR) 
and pass a pointer instead of a struct containing a pointer. Do some 
implementations use non-pointers, say a simple integer, for that argument?

Craig's scheme has two advantages:
1) Uniform interface to MPI accross implementations---put inside the struct 
whatever you need (pointers, integers, etc.).
2) Strong type-checking
BUT, it has the disadvantage that I don't think it is possible to avoid a 
wrapper level of indirection to massage the arguments. Personally, I don't 
see that as a design goal: MPI internally surely will call dozens of wrappers 
until the actual work gets done?


More information about the mpiwg-fortran mailing list