dbcsr_data_dev2host Subroutine

public subroutine dbcsr_data_dev2host(area)

Transfers data from device- to host-buffer, asynchronously.

Arguments

TypeIntentOptionalAttributesName
type(dbcsr_data_obj), intent(inout) :: area

Contents

Source Code


Source Code

   SUBROUTINE dbcsr_data_dev2host(area)
      !! Transfers data from device- to host-buffer, asynchronously.
      TYPE(dbcsr_data_obj), INTENT(INOUT)                :: area

      COMPLEX(KIND=real_4), DIMENSION(:), POINTER        :: c_sp
      COMPLEX(KIND=real_8), DIMENSION(:), POINTER        :: c_dp
      REAL(KIND=real_4), DIMENSION(:), POINTER           :: r_sp
      REAL(KIND=real_8), DIMENSION(:), POINTER           :: r_dp

      IF (area%d%ref_size == 0) RETURN !nothing to do

      SELECT CASE (area%d%data_type)
      CASE (dbcsr_type_real_4)
         r_sp => area%d%r_sp(:area%d%ref_size)
         CALL acc_devmem_dev2host(area%d%acc_devmem, hostmem=r_sp, stream=area%d%memory_type%acc_stream)
      CASE (dbcsr_type_real_8)
         r_dp => area%d%r_dp(:area%d%ref_size)
         CALL acc_devmem_dev2host(area%d%acc_devmem, hostmem=r_dp, stream=area%d%memory_type%acc_stream)
      CASE (dbcsr_type_complex_4)
         c_sp => area%d%c_sp(:area%d%ref_size)
         CALL acc_devmem_dev2host(area%d%acc_devmem, hostmem=c_sp, stream=area%d%memory_type%acc_stream)
      CASE (dbcsr_type_complex_8)
         c_dp => area%d%c_dp(:area%d%ref_size)
         CALL acc_devmem_dev2host(area%d%acc_devmem, hostmem=c_dp, stream=area%d%memory_type%acc_stream)
      CASE default
         DBCSR_ABORT("Invalid data type.")
      END SELECT

   END SUBROUTINE dbcsr_data_dev2host