TensorPlay
API symbolscuda
Copy
View MarkdownDownload .md

ExternalStream

class tensorplay.cuda.streams.ExternalStream(stream_ptr, device=None, **kwargs)[source]

Wrapper around an externally allocated CUDA stream.

This class is used to wrap streams allocated in other libraries in order to facilitate data exchange and multi-library interactions.

Note

This class doesn’t manage the stream life-cycle, it is the user responsibility to keep the referenced stream alive while this class is being used.

Parameters:
  • stream_ptr (int) – Integer representation of the cudaStream_t value allocated externally.

  • device (tensorplay.Device or int, optional) – the device where the stream was originally allocated. If device is specified incorrectly, subsequent launches using this stream may fail.

query() bool

Check if all the work submitted has been completed.

record_event(event: Event | None = None)

Record an event.

Parameters:

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

Returns:

Recorded event.

synchronize() None

Wait for all the kernels in this stream to complete.

wait_event(event: Event | tensorplay.Event) None

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

wait_stream(stream: Stream) None

Synchronize with another stream.

Ask DeepWiki