[MPI3 Fortran] Proposed solution for the volatile buffer problem

N.M. Maclaren nmm1 at cam.ac.uk
Thu Jan 15 03:33:18 CST 2009


On Jan 14 2009, Bill Long wrote:
>Aleksandar Donev wrote:
>>
>>> Remember the goal - to prevent code motion across the CALL.  
>>> Identifying the CALL, almost by definition, is enough - it is just 
>>> overkill.  I covers all variables, including the ones you want to 
>>> tag.  The price of simplicity.

As I explained, and Aleksandar repeated, it isn't JUST that call that
needs identifying.  I will give more details at the end.

>> The price, as Nick tried to explain to you, is that it kills other 
>> optimizations *throughout* the code, because the compilers has to 
>> assume worst-case scenarios. Not acceptable for a language like 
>> Fortran. We cannot trade simplicity for efficiency soo easily!
>
>Yes, except that Nick's argument was complete nonsense.  Vendors have 
>known how to do a "suppress" at subroutine boundaries for decades. 

The problem with optimisation, at least for the past 30 years has not
been in knowing how to do it - it has been in knowing when it can be
done safely.  And that is what is failing here.

Here is a code fragment (extracted from something that I have put in
for interpretation):

PROGRAM Gerbil
    INTEGER, ASYNCHRONOUS, ALLOCATABLE :: array(100) = 0
    OPEN (UNIT=11, FORM='unformatted', ACTION='read', &
        ASYNCHRONOUS='yes', FILE='wombat')
    READ (UNIT=11, ASYNCHRONOUS='yes', ID=id) array
    CALL Fred(array(1:99:2)
    WAIT (UNIT=11, ID=id)
    PRINT *, array
END PROGRAM Gerbil

SUBROUTINE Fred (arg)
    INTEGER, ASYNCHRONOUS :: arg(*)
    ! Delays, processing etc., but nothing that touches arg IN THIS CALL
    CONTINUE
END SUBROUTINE Fred

Note that the actual update may occur during the execution of Fred, and
will take effect on the array as declared in Gerbil.  But Fred will need
to use copy-in/copy-out (as it is converting a discontiguous section to
assumed size), and so will overwrite the update with the original contents
on return.

And THAT is one of the problems that has to be resolved.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679






More information about the mpiwg-fortran mailing list