java.lang.Object
com.ibm.cuda.CudaEvent
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intUse blocking synchronization.static final intDefault event creation flag.static final intDo not record timing data.static final intEvent is suitable for interprocess use. -
Constructor Summary
ConstructorsConstructorDescriptionCudaEvent(CudaDevice device) Creates a new event on the specified device with default flags.CudaEvent(CudaDevice device, int flags) Creates a new event on the specified device with the specifiedflags. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases resources associated with this event.floatelapsedTimeSince(CudaEvent priorEvent) Returns the elapsed time (in milliseconds) relative to the specifiedpriorEvent.intquery()Queries the state of this event.voidrecord(CudaDevice device) Records this event on the default stream of the specified device.voidrecord(CudaStream stream) Records this event on the specified stream.voidSynchronizes on this event.
-
Field Details
-
FLAG_DEFAULT
public static final int FLAG_DEFAULTDefault event creation flag.- See Also:
-
FLAG_BLOCKING_SYNC
public static final int FLAG_BLOCKING_SYNCUse blocking synchronization.- See Also:
-
FLAG_DISABLE_TIMING
public static final int FLAG_DISABLE_TIMINGDo not record timing data.- See Also:
-
FLAG_INTERPROCESS
public static final int FLAG_INTERPROCESSEvent is suitable for interprocess use. FLAG_DISABLE_TIMING must be set.- See Also:
-
-
Constructor Details
-
CudaEvent
Creates a new event on the specified device with default flags.- Parameters:
device- the specified device- Throws:
CudaException- if a CUDA exception occurs
-
CudaEvent
Creates a new event on the specified device with the specifiedflags.- Parameters:
device- the specified deviceflags- the desired flags- Throws:
CudaException- if a CUDA exception occurs
-
-
Method Details
-
close
Releases resources associated with this event.- Specified by:
closein interfaceAutoCloseable- Throws:
CudaException- if a CUDA exception occurs
-
elapsedTimeSince
Returns the elapsed time (in milliseconds) relative to the specifiedpriorEvent.- 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 occursIllegalStateException- if this event or the prior event has been closed (seeclose())
-
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 (seeclose())- See Also:
-
record
Records this event on the default stream of the specified device.- Parameters:
device- the specified device- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this event has been closed (seeclose())
-
record
Records this event on the specified stream.- Parameters:
stream- the specified stream- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this event has been closed (seeclose()), or the stream has been closed (seeCudaStream.close())
-
synchronize
Synchronizes on this event. This method blocks until the associated event has occurred.- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this event has been closed (seeclose())
-