Module openj9.cuda
Package com.ibm.cuda

Class CudaEvent

java.lang.Object
com.ibm.cuda.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 Details

    • FLAG_DEFAULT

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

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

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

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

    • 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 Details

    • close

      public void close() throws CudaException
      Releases resources associated with this event.
      Specified by:
      close in interface AutoCloseable
      Throws:
      CudaException - if a CUDA exception occurs
    • 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:
    • record

      public void record(CudaDevice device) throws CudaException
      Records this event on the default stream of the specified device.
      Parameters:
      device - the specified device
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this event has been closed (see close())
    • record

      public void record(CudaStream stream) throws CudaException
      Records this event on the specified stream.
      Parameters:
      stream - the specified stream
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this event has been closed (see close()), or the stream has been closed (see CudaStream.close())
    • synchronize

      public void synchronize() throws CudaException
      Synchronizes on this event. This method blocks until the associated event has occurred.
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this event has been closed (see close())