public final class CudaStream
extends java.lang.Object
implements java.lang.AutoCloseable
CudaStream
class represents an independent queue of work for a
specific CudaDevice
.
When no longer required, a stream must be close
d.
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_DEFAULT
Default stream creation flag.
|
static int |
FLAG_NON_BLOCKING
Stream creation flag requesting no implicit synchronization with the
default stream.
|
Constructor and Description |
---|
CudaStream(CudaDevice device)
Creates a new stream on the specified device, with the default flags
and the default priority.
|
CudaStream(CudaDevice device,
int flags,
int priority)
Creates a new stream on the specified device, with the specified flags
and priority.
|
Modifier and Type | Method and Description |
---|---|
void |
addCallback(java.lang.Runnable callback)
Enqueues a callback to be run after all previous work on this stream
has been completed.
|
void |
close()
Closes this stream.
|
int |
getFlags()
Returns the flags of this stream.
|
int |
getPriority()
Returns the priority of this stream.
|
int |
query()
Queries the state of this stream.
|
void |
synchronize()
Synchronizes with this stream.
|
void |
waitFor(CudaEvent event)
Makes all future work submitted to this stream wait for the specified
event to occur.
|
public static final int FLAG_DEFAULT
public static final int FLAG_NON_BLOCKING
public CudaStream(CudaDevice device) throws CudaException
device
- the specified deviceCudaException
- if a CUDA exception occurspublic CudaStream(CudaDevice device, int flags, int priority) throws CudaException
device
- the specified deviceflags
- the desired flagspriority
- the desired priorityCudaException
- if a CUDA exception occurspublic void addCallback(java.lang.Runnable callback) throws CudaException
Note that the callback will occur on a distinct thread. Further, any
attempts to interact with CUDA devices will fail with a CudaException
with code CudaError.NotPermitted
.
callback
- the runnable to be runCudaException
- if a CUDA exception occurspublic void close() throws CudaException
close
in interface java.lang.AutoCloseable
CudaException
- if a CUDA exception occurspublic int getFlags() throws CudaException
CudaException
- if a CUDA exception occursjava.lang.IllegalStateException
- if this stream has been closed (see close()
)public int getPriority() throws CudaException
CudaException
- if a CUDA exception occursjava.lang.IllegalStateException
- if this stream has been closed (see close()
)public int query()
java.lang.IllegalStateException
- if this stream has been closed (see close()
)public void synchronize() throws CudaException
CudaException
- if a CUDA exception occursjava.lang.IllegalStateException
- if this stream has been closed (see close()
)public void waitFor(CudaEvent event) throws CudaException
event
- the specified eventCudaException
- if a CUDA exception occursjava.lang.IllegalStateException
- if this stream has been closed (see close()
),
or the event has been closed (see CudaEvent.close()
)Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2013, 2023 IBM Corp. and others.