Module openj9.cuda
Package com.ibm.cuda

Class CudaEvent

  • All Implemented Interfaces:
    AutoCloseable

    public final class CudaEvent
    extends Object
    implements AutoCloseable
    The CudaEvent class represents an event that can be queued in a stream on a CUDA-capable device.

    When no longer required, an event must be closed.

    • Field Detail

      • FLAG_DEFAULT

        public static final int FLAG_DEFAULT
        Default event creation flag.
        See Also:
        Constant Field Values
      • FLAG_BLOCKING_SYNC

        public static final int FLAG_BLOCKING_SYNC
        Use blocking synchronization.
        See Also:
        Constant Field Values
      • FLAG_DISABLE_TIMING

        public static final int FLAG_DISABLE_TIMING
        Do not record timing data.
        See Also:
        Constant Field Values
      • FLAG_INTERPROCESS

        public static final int FLAG_INTERPROCESS
        Event is suitable for interprocess use. FLAG_DISABLE_TIMING must be set.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CudaEvent

        public CudaEvent​(CudaDevice device)
                  throws CudaException
        Creates a new event on the specified device with default flags.
        Parameters:
        device - the specified device
        Throws:
        CudaException - if a CUDA exception occurs
      • CudaEvent

        public CudaEvent​(CudaDevice device,
                         int flags)
                  throws CudaException
        Creates a new event on the specified device with the specified flags.
        Parameters:
        device - the specified device
        flags - the desired flags
        Throws:
        CudaException - if a CUDA exception occurs
    • Method Detail

      • elapsedTimeSince

        public float elapsedTimeSince​(CudaEvent priorEvent)
                               throws CudaException
        Returns the elapsed time (in milliseconds) relative to the specified priorEvent.
        Parameters:
        priorEvent - the prior event
        Returns:
        the elapsed time (in milliseconds) between the occurrence of the prior event and this event
        Throws:
        CudaException - if a CUDA exception occurs
        IllegalStateException - if this event or the prior event has been closed (see close())
      • query

        public int query()
        Queries the state of this event. The common normally occurring states are:
        • CudaError.Success - event has occurred
        • CudaError.NotReady - event has not occurred
        Returns:
        the state of this event
        Throws:
        IllegalStateException - if this event has been closed (see close())
        See Also:
        CudaError