warp.Stream#
- class warp.Stream(*args, **kwargs)[source]#
- __init__(device=None, priority=0, **kwargs)[source]#
Initialize the stream on a device with an optional specified priority.
- Parameters:
device (Device | str | None) – The CUDA device on which this stream will be created.
priority (int) – An optional integer specifying the requested stream priority. Can be -1 (high priority) or 0 (low/default priority). Values outside this range will be clamped.
cuda_stream (int) – A optional external stream handle passed as an integer. The caller is responsible for ensuring that the external stream does not get destroyed while it is referenced by this object.
- Raises:
RuntimeError – If function is called before Warp has completed initialization with a
devicethat is not an instance ofDevice.RuntimeError –
deviceis not a CUDA Device.RuntimeError – The stream could not be created on the device.
TypeError – The requested stream priority is not an integer.
Methods
__init__([device, priority])Initialize the stream on a device with an optional specified priority.
record_event([event, external])Record an event onto the stream.
wait_event(event[, external])Makes all future work in this stream wait until event has completed.
wait_stream(other_stream[, event, external])Records an event on other_stream and makes this stream wait on it.
Attributes
A boolean indicating whether a graph capture is currently ongoing on this stream.
A boolean indicating whether all work on the stream has completed.
An integer representing the priority of the stream.
- record_event(event=None, external=False)[source]#
Record an event onto the stream.
- Parameters:
- Raises:
RuntimeError – The provided
Eventis from a different device than the recording stream.- Return type:
- wait_event(event, external=False)[source]#
Makes all future work in this stream wait until event has completed.
This function does not block the host thread.
- wait_stream(other_stream, event=None, external=False)[source]#
Records an event on other_stream and makes this stream wait on it.
All work added to this stream after this function has been called will delay their execution until all preceding commands in other_stream have completed.
This function does not block the host thread.
- Parameters:
other_stream (Stream) – The stream on which the calling stream will wait for previously issued commands to complete before executing subsequent commands.
event (Event | None) – An optional
Eventinstance that will be used to record an event ontoother_stream. IfNone, an internally managedEventinstance will be used.external (bool) – Whether this is an external event during graph capture. This argument has no effect outside of graph capture.
- property is_complete: bool[source]#
A boolean indicating whether all work on the stream has completed.
This property may not be accessed during a graph capture on any stream.