cupy.cuda.Stream¶
-
class
cupy.cuda.
Stream
¶ CUDA stream.
This class handles the CUDA stream handle in RAII way, i.e., when an Stream instance is destroyed by the GC, its handle is also destroyed.
Parameters: - null (bool) – If
True
, the stream is a null stream (i.e. the default stream that synchronizes with all streams). Otherwise, a plain new stream is created. Note that you can also useStream.null
singleton object instead of creating new null stream object. - non_blocking (bool) – If
True
, the stream does not synchronize with the NULL stream.
Variables: ptr (size_t) – Raw stream handle. It can be passed to the CUDA Runtime API via ctypes.
Methods
-
__enter__
(self)¶
-
__exit__
(self, *args)¶
Attributes
-
add_callback
¶ Adds a callback that is called when all queued work is done.
Parameters: - callback (function) – Callback function. It must take three arguments (Stream object, int error status, and user data object), and returns nothing.
- arg (object) – Argument to the callback.
-
done
¶ True if all work on this stream has been done.
-
null
= <cupy.cuda.stream.Stream object>¶
-
record
¶ Records an event on the stream.
Parameters: event (None or cupy.cuda.Event) – CUDA event. If None
, then a new plain event is created and used.Returns: The recorded event. Return type: cupy.cuda.Event See also
-
synchronize
¶ Waits for the stream completing all queued work.
-
use
¶ Makes this stream current.
If you want to switch a stream temporarily, use the with statement.
-
wait_event
¶ Makes the stream wait for an event.
The future work on this stream will be done after the event.
Parameters: event (cupy.cuda.Event) – CUDA event.
- null (bool) – If