acc_stream_wait_event Subroutine

public subroutine acc_stream_wait_event(stream, event)

Fortran-wrapper for making a GPU compute stream wait on an event. Because of fortran circular dependency restriction this can not go into acc_stream.F

Arguments

Type IntentOptional Attributes Name
type(acc_stream_type), intent(in) :: stream
type(acc_event_type), intent(in) :: event

Source Code

   SUBROUTINE acc_stream_wait_event(stream, event)
      !! Fortran-wrapper for making a GPU compute stream wait on an event.
      !! Because of fortran circular dependency restriction this can not go into acc_stream.F

      TYPE(acc_stream_type), INTENT(IN) :: stream
      TYPE(acc_event_type), INTENT(IN)  :: event

#if ! defined (__DBCSR_ACC)
      MARK_USED(stream)
      MARK_USED(event)
      DBCSR_ABORT("__DBCSR_ACC not compiled in.")
#else
      INTEGER                                  :: istat
      TYPE(C_PTR)                              :: stream_cptr

      stream_cptr = acc_stream_cptr(stream)
      IF (.NOT. C_ASSOCIATED(event%cptr)) &
         DBCSR_ABORT("acc_stream_wait_event: event not allocated")
      IF (.NOT. C_ASSOCIATED(stream_cptr)) &
         DBCSR_ABORT("acc_stream_wait_event: stream not allocated")
      CALL dbcsr_acc_set_active_device(get_accdrv_active_device_id())
      istat = acc_interface_stream_wait_event(stream_cptr, event%cptr)
      IF (istat /= 0) &
         DBCSR_ABORT("acc_stream_wait_event failed")
#endif
   END SUBROUTINE acc_stream_wait_event