ALIs
kommt nochOne-sided communication with MPI
One-sided MPI calls may provide a more efficient way to use an interconnect with RDMA facilities, by allowing one process to specify all communication parameters, both for the sending side and the receiving side. Additional synchronization calls are needed to assure that communication has completed before the transferred data are locally accessed.
Table of contents
- Memory management
- Various synchronization models
Memory management
In order to safely use allocated memory within, e. g., MPI one-sided communication routines, one should use MPI_Alloc_mem instead of Fortran 90 ALLOCATE or C malloc. Depending on wether the Fortran 2003 C interoperability features are available, one needs to use non-standard language extensions for calls from Fortran, namely Cray Pointers, since MPI_Alloc_mem wants a C pointer argument. The following code fragment shows how to handle this situation with double precision buffers:
| Using Cray pointers | Using Fortran 2003 C interoperability |
|
integer(kind=MPI_ADDRESS_KIND) size, intptr
integer :: itemsize, length ! Specify largest anticipated value. ! Will not be actually allocated ! at this point pointer (baseptr, farray(200)) double precision :: farray : call MPI_Type_extent(MPI_DOUBLE_PRECISION, & itemsize, ierror) ! length at most 200 size=length*itemsize call MPI_Alloc_mem(size, MPI_INFO_NULL, & intptr, ierror) ! enable access to allocated storage ! via farray: baseptr = intptr ! Now perform one-sided calls etc. : ! Once done, deallocate call MPI_FREE_MEM(farray, ierror)
|
integer(kind=MPI_ADDRESS_KIND) size
integer :: itemsize, length ! ! C pointer to void will later be associated with ! array pointer type(c_ptr) :: baseptr double precision, pointer :: farray : call MPI_Type_extent(MPI_DOUBLE_PRECISION, & itemsize, ierror) ! size=length*itemsize call MPI_Alloc_mem(size, MPI_INFO_NULL, & baseptr, ierror) ! enable access to allocated storage ! via farray: call c_f_pointer(baseptr, farray, (/ length /)) ! Now perform one-sided calls etc. : ! Once done, deallocate call MPI_FREE_MEM(farray, ierror) |
Various synchronization models
(To be done)