[MPI3 Fortran] [Interop-tr] [Mpi-forum] Comment on Fortran WG5 ballot N1846

Bill Long longb at cray.com
Thu Apr 14 17:36:21 CDT 2011



On 4/14/11 3:03 PM, Rolf Rabenseifner wrote:
> ----- Original Message -----
>> From: "N.M. Maclaren"<nmm1 at cam.ac.uk>
>>> From: "Rolf Rabenseifner"
>
> Nick,
>
> Let's look at
>    CALL MPI_Irecv(buf, rq)
>    CALL MPI_Wait(rq)
>    xnew=buf
> and the new value for buf may be received within the MPI_Wait call.
>
>>> To summarize, there are several options:
>>> - TARGET buf
>>
>> Why should that work? Fortran compilers are required to take
>> notice of it only when also operating with POINTER variables. And
>> there is nothing stopping them from moving such data dynamically,
>> if they update all associated pointers. That's old technology,
>> after all.

The normal user mechanism to prevent the reference to buf from moving 
across the call to MPI_Wait is to put buf in a module.  The compiler has 
to assume that MPI_Wait uses that module and hence could modify buf. 
The fftw library has similar problems (pointer to "buf" hidden inside 
"rq") and the normally recommended solution is module variables.

In the case of MPI_Wait, I think that a solution that prevented ALL code 
motion across the call would be acceptable.   Currently compiler 
directives (vendor-dependent) are employed for this.  Perhaps a new 
<prefix> on the subroutine interface.  We currently have PURE and 
IMPURE.  We would need a third option that is stronger than IMPURE that 
would indicate that the subroutine can access and modify variables that 
are, or are associated with,  variables that are not in common, not in a 
module, and not associated with arguments (i.e. violates the normal 
Fortran rules).   Perhaps the VILE prefix would be appropriate. :)

An outside-the-standard solution is to have implementations just "know" 
about MPI_Wait and never move code across a call.  Typically this would 
involve the processor inserting a hidden directive at the call site that 
suppresses all code motion and forces variables to memory.  Equivalent 
to the MPI standard mandating this for an implementation that claims to 
support MPI 3.0.

Cheers,
Bill






-- 
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