acc_hostmem_alloc_c8 Subroutine

private subroutine acc_hostmem_alloc_c8(host_mem, n, stream)

Allocates 1D fortan-array as GPU host-pinned memory.

Arguments

TypeIntentOptionalAttributesName
complex(kind=real_8), DIMENSION(:), POINTER:: host_mem

pointer to array

integer, intent(in) :: n

size given in terms of item-count (not bytes!)

type(acc_stream_type), intent(in) :: stream

Contents

Source Code


Source Code

      SUBROUTINE acc_hostmem_alloc_c8 (host_mem, n, stream)
      !! Allocates 1D fortan-array as GPU host-pinned memory.

         COMPLEX(kind=real_8), DIMENSION(:), POINTER          :: host_mem
         !! pointer to array
         INTEGER, INTENT(IN)                      :: n
         !! size given in terms of item-count (not bytes!)
         TYPE(acc_stream_type), INTENT(IN)        :: stream
#if defined (__DBCSR_ACC)
         TYPE(C_PTR)                              :: host_mem_c_ptr
         INTEGER(KIND=C_SIZE_T)                   :: n_bytes

         n_bytes = INT(2*real_8_size, KIND=C_SIZE_T)* &
                   INT(MAX(1, n), KIND=C_SIZE_T)
         CALL acc_hostmem_alloc_raw(host_mem_c_ptr, n_bytes, stream)
         CALL C_F_POINTER(host_mem_c_ptr, host_mem, (/MAX(1, n)/))
#else
         MARK_USED(host_mem)
         MARK_USED(n)
         MARK_USED(stream)
         DBCSR_ABORT("acc_hostmem_alloc_c8: ACC not compiled in.")
#endif
      END SUBROUTINE acc_hostmem_alloc_c8