Allocates special parallel memory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real_8), | DIMENSION(:), POINTER, CONTIGUOUS | :: | DATA |
pointer to integer array to allocate |
||
integer, | intent(in) | :: | len |
number of integers to allocate |
||
integer, | intent(out), | optional | :: | stat |
allocation status result |
SUBROUTINE mp_allocate_d (DATA, len, stat)
!! Allocates special parallel memory
REAL(kind=real_8), DIMENSION(:), POINTER, CONTIGUOUS :: DATA
!! pointer to integer array to allocate
INTEGER, INTENT(IN) :: len
!! number of integers to allocate
INTEGER, INTENT(OUT), OPTIONAL :: stat
!! allocation status result
CHARACTER(LEN=*), PARAMETER :: routineN = 'mp_allocate_d'
INTEGER :: ierr, handle
CALL timeset(routineN, handle)
ierr = 0
#if defined(__parallel)
NULLIFY (DATA)
CALL mp_alloc_mem(DATA, len, stat=ierr)
IF (ierr /= 0 .AND. .NOT. PRESENT(stat)) &
CALL mp_stop(ierr, "mpi_alloc_mem @ "//routineN)
#else
ALLOCATE (DATA(len), stat=ierr)
IF (ierr /= 0 .AND. .NOT. PRESENT(stat)) &
CALL mp_stop(ierr, "ALLOCATE @ "//routineN)
#endif
IF (PRESENT(stat)) stat = ierr
CALL timestop(handle)
END SUBROUTINE mp_allocate_d