TensorPlay
API symbolscuda
Copy
View MarkdownDownload .md

Stream

class tensorplay.cuda.streams.Stream(device=None, priority=0, **kwargs)[source]

Wrapper around a CUDA stream.

A CUDA stream is a linear sequence of execution that belongs to a specific device, independent from other streams. It supports with statement as a context manager to ensure the operators within the with block are running on the corresponding stream. See the CUDA semantics documentation for details.

Parameters:
  • device (tensorplay.Device or int, optional) – a device on which to allocate the stream. If device is None (default) or a negative integer, this will use the current device.

  • priority (int, optional) – priority of the stream, which can be positive, 0, or negative. A lower number indicates a higher priority. By default, the priority is set to 0.

query() bool[source]

Check if all the work submitted has been completed.

record_event(event: Event | None = None)[source]

Record an event.

Parameters:

event (Event, optional) – event to record. If not given, a new one will be allocated.

Returns:

Recorded event.

synchronize() None[source]

Wait for all the kernels in this stream to complete.

wait_event(event: Event | tensorplay.Event) None[source]

Make all future work submitted to the stream wait for an event.

wait_stream(stream: Stream) None[source]

Synchronize with another stream.

Ask DeepWiki