[MPI3 Fortran] ASYNC attribute
Craig Rasmussen
crasmussen at newmexicoconsortium.org
Tue May 5 18:45:00 CDT 2009
I'm at the WG5 Fortran standards meeting and I think we've made
significant advances regarding the MPI-3 Fortran API. We are
discussing adding a new variable attribute, ASYNC. I'd like to get
feedback from the MPI-3 Fortran working group on these possible changes.
ASYNC implies that a variable is potentially active in asynchronous
operations outside of Fortran. The use of this new attribute should
give the compiler enough information to inhibit optimizations similar
to inhibitions involved in Fortran asynchronous I/O, specifically
copyin/copyout and code motion. The compiler will likely have to
inhibit code motion regarding any use of a variable with the ASYNC
attribute and procedures other than intrinsics. The affect is similar
to the use of the volatile attribute (but not regarding loads and
stores).
Usage is outlined below:
----------------
real, ASYNC_EXTERNAL :: buf(100,100)
type(MPI_Request) :: request
! initiate data transfer of boundary
CALL MPI_IRecv(buf(:,1),...,request,...) ! no copyin/copyout will
happen
! do work on interior of the buffer while transfer is in progress
CALL UPDATE_INTERIOR(buf) ! dummy arg should have ASYNC attribute
! wait for the communication to finish
CALL MPI_Wait(request,...) ! no code motion allowed with respect to
buf
! finish work on buffer boundaries
CALL UPDATE_BOUNDARIES(buf) ! should copyin/copyout be allowed here?
----------------
So how does this look? Anything we've left out? I'm also including
the interface definition.
- craig
----------------
interface
SUBROUTINE MPI_Irecv(buf, count, datatype, source, tag, comm, request,
err) BIND(C, name="MPI_Irecv")
import MPI_Datatype, MPI_Comm, MPI_Request
TYPE(*), DIMENSION(..), ASYNC :: buf
integer, value, intent(in) :: count
type(MPI_Datatype), intent(in) :: datatype
integer, value, intent(in) :: source
integer, value, intent(in) :: tag
type(MPI_Comm), intent(in) :: comm
type(MPI_Request), intent(out) :: request
integer, intent(out) :: err
END SUBROUTINE MPI_Irecv
SUBROUTINE MPI_Isend(buf, count, datatype, dest, tag, comm, request,
err) BIND(C, name="MPI_Isend")
import MPI_Datatype, MPI_Comm, MPI_Request
TYPE(*), DIMENSION(..), ASYNC :: buf
integer, value, intent(in) :: count
type(MPI_Datatype), intent(in) :: datatype
integer, value, intent(in) :: dest
integer, value, intent(in) :: tag
type(MPI_Comm), intent(in) :: comm
type(MPI_Request), intent(out) :: request
integer, intent(out) :: err
END SUBROUTINE MPI_Isend
SUBROUTINE MPI_Wait(request, status, err) BIND(C, name="MPI_Wait")
import MPI_Request, MPI_Status
type(MPI_Request), intent(in) :: request ! inout?
type(MPI_Status), intent(out) :: status
integer, intent(out) :: err
END SUBROUTINE MPI_Wait
end interface
More information about the mpiwg-fortran
mailing list