acc_hostmem_alloc_i4 Subroutine

private subroutine acc_hostmem_alloc_i4(host_mem, n, stream)

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

Arguments

Type IntentOptional Attributes Name
integer(kind=int_4), 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

Source Code

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

         INTEGER(kind=int_4), 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(int_4_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_i4: ACC not compiled in.")
#endif
      END SUBROUTINE acc_hostmem_alloc_i4