Allocates 2D fortan-array as GPU host-pinned memory.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real_4), | DIMENSION(:, :), POINTER | :: | host_mem |
pointer to array |
||
integer, | intent(in) | :: | n1 |
sizes given in terms of item-count (not bytes!) sizes given in terms of item-count (not bytes!) |
||
integer, | intent(in) | :: | n2 |
sizes given in terms of item-count (not bytes!) sizes given in terms of item-count (not bytes!) |
||
type(acc_stream_type), | intent(in) | :: | stream |
SUBROUTINE acc_hostmem_alloc_r4_2D(host_mem, n1, n2, stream) !! Allocates 2D fortan-array as GPU host-pinned memory. REAL(kind=real_4), DIMENSION(:, :), POINTER :: host_mem !! pointer to array INTEGER, INTENT(IN) :: n1, n2 !! sizes given in terms of item-count (not bytes!) !! sizes 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(real_4_size, KIND=C_SIZE_T)* & INT(MAX(1, n1), KIND=C_SIZE_T)*INT(MAX(1, n2), 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, n1), MAX(1, n2)/)) #else MARK_USED(host_mem) MARK_USED(n1) MARK_USED(n2) MARK_USED(stream) DBCSR_ABORT("acc_hostmem_alloc_r4_2D: ACC not compiled in.") #endif END SUBROUTINE acc_hostmem_alloc_r4_2D