MPI_ALLOC_MEM(3)MPI_ALLOC_MEM(3)NAMEMPI_Alloc_mem - Allocates special memory
SYNOPSIS
C:
#include <mpi.h>
int MPI_Alloc_mem( size, info, *baseptr)
MPI_Aint size;
MPI_Info info;
void *baseptr;
Fortran:
INCLUDE "mpif.h" (or USE MPI)
INTEGER info, ierror
INTEGER(KIND=MPI_ADDRESS_KIND) size, baseptr
CALL MPI_ALLOC_MEM(size, info, baseptr, ierror)
DESCRIPTION
The MPI_Alloc_mem function allocates special memory. It is used in
conjunction with MPI_Free_mem. Like any other dynamically allocated
memory, a call to MPI_Alloc_mem should be paired by a later call to
MPI_Free_mem. If no memory is available, baseptr is set to NULL, and
MPI_ERR_NO_MEM is returned.
This routine accepts the following parameters:
size Specifies the size of the desired chunk of memory.
info Specifies an object that can be used to provide directives that
control the desired location of the allocated memory.
baseptr Specifies the initial address of the memory segment that has
been allocated.
ierror Specifies the return code value for successful completion. A
return value of MPI_ERR_NO_MEM indicates failure.
NOTES
The MPI_Alloc_mem function has the following limitations:
* In C, the routine works with -n32 and -64 applications on IRIX. For
-n32, however, if you have not explicitly linked in -lsma, the
routine will always set the baseptr argument to NULL and return
MPI_ERR_NO_MEM. On Linux, only 64-bit C applications are supported.
Page 1
MPI_ALLOC_MEM(3)MPI_ALLOC_MEM(3)
* In Fortran, the routine works only with 64-bit applications.
Attempting to link a Fortran -n32 application might generate an error
at link time.
* On IRIX, to use this function for memory allocation, the user must
set the SMA_GLOBAL_ALLOC shell variable. You can adjust the total
available memory that MPI_Alloc_mem can allocate by using the
SMA_GLOBAL_HEAP_SIZE shell variable. The default when
SMA_GLOBAL_ALLOC is set is 32 Mbytes per process for 64-bit MPI
applications. Note that setting the MPI_NO_LIBSMA shell variable
always results in a return value of MPI_ERR_NO_MEM. For additional
information on setting this and related shell variables, see the
MPI(1) man page.
* On Linux, MPI_Alloc_mem allocates memory from the private heap. No
additional environment variable settings are necessary.
* Currently, the info object is not used, but the data structure for
managing memory allocation keeps a copy of this info structure, to be
used later on.
EXAMPLE
The following example shows how MPI_Alloc_mem and MPI_Free_mem may be
used from Fortran.
DOUBLE PRECISION U
POINTER (P,U(0:50,0:20))
INTEGER(KIND=MPI_ADDRESS_KIND) SIZE
INTEGER SIZEOFDOUBLE,IERROR
! CAREFUL WITH SIZE (MUST BE MPI_ADDRESS_KIND)
SIZE = 51 * 21 * 8
CALL MPI_ALLOC_MEM(SIZE,MPI_INFO_NULL,P,IERROR)
CALL MPI_FREE_MEM(U,IERROR) ! NOT P!
SEE ALSOMPI_Free_mem(1)
Page 2