mem_alloc_d Subroutine

private subroutine mem_alloc_d(mem, n, mem_type)

Allocates memory

Arguments

TypeIntentOptionalAttributesName
real(kind=real_8), DIMENSION(:), POINTER, CONTIGUOUS:: mem

memory to allocate

integer, intent(in) :: n

length of elements to allocate

type(dbcsr_memtype_type), intent(in) :: mem_type

memory type


Contents

Source Code


Source Code

      SUBROUTINE mem_alloc_d (mem, n, mem_type)
     !! Allocates memory

         REAL(kind=real_8), DIMENSION(:), POINTER, CONTIGUOUS :: mem
        !! memory to allocate
         INTEGER, INTENT(IN)                   :: n
        !! length of elements to allocate
         TYPE(dbcsr_memtype_type), INTENT(IN)  :: mem_type
        !! memory type
         CHARACTER(len=*), PARAMETER :: routineN = 'mem_alloc_d'
         INTEGER                               :: error_handle
!   ---------------------------------------------------------------------------

         IF (careful_mod) &
            CALL timeset(routineN, error_handle)

         IF (mem_type%acc_hostalloc .AND. n > 1) THEN
            CALL acc_hostmem_allocate(mem, n, mem_type%acc_stream)
         ELSE IF (mem_type%mpi .AND. dbcsr_data_allocation%use_mpi_allocator) THEN
            CALL mp_allocate(mem, n)
         ELSE
            ALLOCATE (mem(n))
         END IF

         IF (careful_mod) &
            CALL timestop(error_handle)
      END SUBROUTINE mem_alloc_d