[MPI3 Fortran] [Fwd: add TYPE(*) and DIMENSION(..) to Fortran]

Jeff Squyres jsquyres at cisco.com
Sat Sep 6 05:39:01 CDT 2008


On Sep 5, 2008, at 8:20 PM, Aleksandar Donev wrote:

>> But there is the issue that if the compiler copies, will the  
>> temporary
>> buffer match the MPI datatype that the user passed in?
> It will match the type of the array. If that does not match the  
> MPI_Datatype,
> then the user made a mistake.

I should be more clear -- matching the type is easy (e.g., an array  
subset of double precisions can easy map to MPI_DOUBLE_PRECISION), but  
will the *type map* match?  E.g., if I call MPI_SEND with foo(13,  
10:20, 1:5), will MPI get a contiguous region of memory (which it  
always seems to today...?), or will we get a descriptor that a) points  
to the beginning of the memory, and b) has a description of the layout?

I *think* you're telling me that we can have it both ways (let's  
assume blocking MPI_SEND for the moment, for simplicity):

1. an MPI_SEND that takes an explicit MPI datatype argument and  
returns contiguous memory (probably a copy if the original memory is  
not contiguous).  It is this case that could be problematic if the  
user specifies an MPI datatype that reflects the true sparseness of  
the memory, but the compiler has copied it into a temporary contiguous  
buffer.

2. an MPI_SEND that takes no MPI datatype argument but passes the  
Fortran descriptor to MPI, so that MPI can build up its own MPI  
datatype and use that instead of having the user explicitly mention  
it.  This could be expensive if the type map is complex (e.g., non- 
contiguous), especially for short messages.  If the type map is simple  
(e.g., contiguous, single pre-defined Fortran type -- not a Fortran  
user-defined struct), we might be able to have a simple switch/case  
(or a set of overloaded functions or ...) that can deduce the correct  
Fortran datatype -> MPI datatype mapping properly.

I don't know what the Forum will think about #2; this kind of approach  
is a slippery slope because we're adding interpretation on top of the  
official MPI Forum standard.  In MPI-2.0, the feeling was that this  
kind of functionality was discussed for the C++ bindings, but the  
Forum felt that it was better suited to libraries on top of MPI.

>> I'm not sure I follow -- I see what the pass-thru Fortran wrapper
>> would be; what's the other one that you're referring to?
> If you have
>
> type(*), dimension(..) :: buffer ! Latest syntax for assumed rank  
> and type
>
> then the descriptor will contain rank, type, size (specifically  
> bounds), etc.
> There is no need for the programmer to pass mpi datatypes or the  
> size of the
> buffer as they have to in the C binding.

Ok.

> I am assuming Python bindings for
> MPI are such modern beasts?


I know that Python bindings exist, but I confess that I have not  
looked at them at all.

-- 
Jeff Squyres
Cisco Systems




More information about the mpiwg-fortran mailing list