acc_devmem_deallocate Subroutine

public subroutine acc_devmem_deallocate(this)

Deallocates a given devmem.

Arguments

TypeIntentOptionalAttributesName
type(acc_devmem_type), intent(inout) :: this

Contents

Source Code


Source Code

   SUBROUTINE acc_devmem_deallocate(this)
      !! Deallocates a given devmem.

      TYPE(acc_devmem_type), INTENT(INOUT) :: this

#if ! defined (__DBCSR_ACC)
      MARK_USED(this)
      DBCSR_ABORT("__DBCSR_ACC not compiled in.")
#else
      INTEGER                                  :: istat

      IF (this%size_in_bytes < 0) &
         DBCSR_ABORT("acc_devmem_deallocate: double free")
      IF (this%size_in_bytes > 0) THEN
         istat = acc_interface_dev_mem_dealloc(this%cptr)
         IF (istat /= 0) &
            DBCSR_ABORT("acc_devmem_deallocate: failed")
      END IF

      this%size_in_bytes = -1

#endif
   END SUBROUTINE acc_devmem_deallocate