public final class CudaEvent extends Object implements AutoCloseable
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.
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_BLOCKING_SYNC
Use blocking synchronization.
|
static int |
FLAG_DEFAULT
Default event creation flag.
|
static int |
FLAG_DISABLE_TIMING
Do not record timing data.
|
static int |
FLAG_INTERPROCESS
Event is suitable for interprocess use.
|
Constructor and Description |
---|
CudaEvent(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 specified
flags . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases resources associated with this event.
|
float |
elapsedTimeSince(CudaEvent priorEvent)
Returns the elapsed time (in milliseconds) relative to the specified
priorEvent . |
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 |
synchronize()
Synchronizes on this event.
|
public static final int FLAG_DEFAULT
public static final int FLAG_BLOCKING_SYNC
public static final int FLAG_DISABLE_TIMING
public static final int FLAG_INTERPROCESS
public CudaEvent(CudaDevice device) throws CudaException
device
- the specified deviceCudaException
- if a CUDA exception occurspublic CudaEvent(CudaDevice device, int flags) throws CudaException
flags
.device
- the specified deviceflags
- the desired flagsCudaException
- if a CUDA exception occurspublic void close() throws CudaException
close
in interface AutoCloseable
CudaException
- if a CUDA exception occurspublic float elapsedTimeSince(CudaEvent priorEvent) throws CudaException
priorEvent
.priorEvent
- the prior eventCudaException
- if a CUDA exception occursIllegalStateException
- if this event or the prior event has been closed (see close()
)public int query()
IllegalStateException
- if this event has been closed (see close()
)CudaError
public void record(CudaDevice device) throws CudaException
device
- the specified deviceCudaException
- if a CUDA exception occursIllegalStateException
- if this event has been closed (see close()
)public void record(CudaStream stream) throws CudaException
stream
- the specified streamCudaException
- if a CUDA exception occursIllegalStateException
- if this event has been closed (see close()
),
or the stream has been closed (see CudaStream.close()
)public void synchronize() throws CudaException
CudaException
- if a CUDA exception occursIllegalStateException
- if this event has been closed (see close()
)Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2013, 2025 IBM Corp. and others.