(j3.2006) (SC22WG5.3892) [ukfortran] [MPI3 Fortran] MPI non-blocking transfers

Jim Xia jimxia
Thu Jan 22 13:50:01 EST 2009

> Except that the WAIT statement does have at least some semantics that 
> the compiler understands. Which raises an interesting point.  Nick has 
> pointed out several places where it is theoretically possible for the 
> compiler optimizer to cause problems because the "invisible hand" of the 

> MPI runtime  currently "owns" part of the program's memory space and 
> either expects it to remain static (sends) or modifies it (receives). 

The "invisible hand" can be expressed by a visible hint if the association 
between the two entities are explicitly established in language.  For 
example something like ALIAS_ASSOCIATED(buffer, MPI_WAIT) hints an 
aliasing (or asynchronous) relationship between buffer and MPI_WAIT, then 
the compiler (more precisely the optimizer) may have enough information 
not to perform the code motion.  I think it is also more direct and 
obvious than asynchronous/wait.

> Fortran already has an attribute designed exactly for this situation - 
> VOLATILE.   VOLATILE and ASYNCHRONOUS normally appear together in the 
> standard since they are so similar in effect.

I disagree here.  VOLATILE and ASYNCHRONOUS has near zero similarity in 
semantics.  Volatile tells compilers the variable may be accessed by 
another processor so don't trust register/cache, and always goes to memory 
for any reference.  I can't imagine any relation to asynchronous except 
that both may disable optimization one way or another.

                                                 The one difference (from 
> the compiler's point of view) is that the volatility of a variable with 
> the asynchronous attribute can be "turned off" when the compiler sees a 
> global WAIT. 

What is the volatility of an asynchronous variable?

                    If we modify the ASYNCHRONOUS attribute to be used to 
> solve the issues with MPI calls, then WAIT is no longer special, and 
> VOLATILE and ASYNCHRONOUS become functionally identical.

I don't think they will.  They have different semantics.

                                                           That's one of 
> the undesirable side effect that makes me dislike the idea of modifying 
> ASYNCHRONOUS.  (The other is that it incorrectly suggests that MPI calls 

> have something to do with I/O which is not the case (except for the 
> actual MPI I/O calls).)  If we use a different name, like 
> ASYNC_EXTERNAL, is there any difference between that and VOLATILE?  I 
> suspect not.  In which case, the obvious solution is to just use 
> VOLATILE.  (Which was the conclusion of the previous round of 
> discussions on this topic.)  VOLATILE had a couple of very attractive 
> features.  It requires zero changes in either the Fortran standard or in 

> any compiler implementations.  Thus, it is an immediately available 
> solution for the MPI group.  VOLATILE might be strong enough to solve 
> the code-motion problem as well.

I doubt volatile can effectively "turns off" code motion since it does not 
have that semantics.


Jim Xia

RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20090122/d0db6e42/attachment-0001.html 

More information about the J3 mailing list