Class CudaEvent
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 close
d.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Use blocking synchronization.static final int
Default event creation flag.static final int
Do not record timing data.static final int
Event is suitable for interprocess use. -
Constructor Summary
ConstructorDescriptionCudaEvent
(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 TypeMethodDescriptionvoid
close()
Releases resources associated with this event.float
elapsedTimeSince
(CudaEvent priorEvent) Returns the elapsed time (in milliseconds) relative to the specifiedpriorEvent
.int
query()
Queries the state of this event.void
record
(CudaDevice device) Records this event on the default stream of the specified device.void
record
(CudaStream stream) Records this event on the specified stream.void
Synchronizes 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:
close
in 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()
)
-