MPI_WIN_ALLOCATE(size, disp_unit, info, comm, baseptr, win) | |
IN size | size of window in bytes (non-negative integer) |
IN disp_unit | local unit size for displacements, in bytes (positive integer) |
IN info | info argument (handle) |
IN comm | intra-communicator (handle) |
OUT baseptr | initial address of window (choice) |
OUT win | window object (handle) |
This procedure is collective over the group of comm. On each MPI process, it allocates memory of at least size bytes and returns a pointer to it along with a handle to a new window that can be used by all MPI processes in the group of comm to perform RMA operations. The returned memory consists of size bytes local to each MPI process, starting at address baseptr and is associated with the window as if the user called MPI_WIN_CREATE on existing memory. The size argument may be different at each MPI process and size = 0 is valid; however, a library might allocate and expose more memory in order to create a fast, globally symmetric allocation. The discussion of and rationales for MPI_ALLOC_MEM and MPI_FREE_MEM in Section Memory Allocation also apply to MPI_WIN_ALLOCATE; in particular, see the rationale in Section Memory Allocation for an explanation of the type used for baseptr.
Implementations may make allocated memory available for load/store accesses by MPI processes in the same shared memory domain. A communicator of such processes can be constructed as described in Section Communicator Constructors using MPI_COMM_SPLIT_TYPE. Pointers to access a shared memory segment can be queried using MPI_WIN_SHARED_QUERY. If shared memory is available it is not guaranteed to be contiguous (see Section Window That Allocates Shared Memory).
If the Fortran compiler provides TYPE(C_PTR), then the following generic interface must be provided in the mpi module and should be provided in the (deprecated) mpif.h include file through overloading, i.e., with the same routine name as the routine with INTEGER(KIND=MPI_ADDRESS_KIND) BASEPTR, but with a different specific procedure name:
INTERFACE MPI_WIN_ALLOCATE SUBROUTINE MPI_WIN_ALLOCATE(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, & WIN, IERROR) IMPORT :: MPI_ADDRESS_KIND INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE, BASEPTR END SUBROUTINE SUBROUTINE MPI_WIN_ALLOCATE_CPTR(SIZE, DISP_UNIT, INFO, COMM, BASEPTR, & WIN, IERROR) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR IMPORT :: MPI_ADDRESS_KIND INTEGER :: DISP_UNIT, INFO, COMM, WIN, IERROR INTEGER(KIND=MPI_ADDRESS_KIND) :: SIZE TYPE(C_PTR) :: BASEPTR END SUBROUTINE END INTERFACEThe base procedure name of this overloaded function is MPI_WIN_ALLOCATE_CPTR. The implied specific procedure names are described in Section Interface Specifications, Procedure Names, and the Profiling Interface.
Rationale.
By allocating (potentially aligned) memory instead of allowing the user
to pass in an arbitrary buffer, this call can improve the performance
for systems with remote direct memory access.
This also permits the collective allocation of memory and
supports what is sometimes called the ``symmetric allocation'' model
that can be more scalable (for example, the implementation can
arrange to return an address for the allocated memory that is the
same on all MPI processes).
( End of rationale.)
The info argument can be used to specify hints
similar to the info argument for MPI_WIN_CREATE and
MPI_ALLOC_MEM.
The default memory alignment requirements and the mpi_minimum_memory_alignment info key described for MPI_ALLOC_MEM in Section Memory Allocation apply to all MPI processes with nonzero size argument.