TensorPlay

Latest development documentation · Updated 2026-09-08. A documentation snapshot for package 1.0.0.dev20260909 is not available.

On this page

Classes 3

#

Event

classFull reference ↗
class tensorplay.cuda.streams.Event(enable_timing=False, blocking=False, interprocess=False, external=False)[source]

Wrapper around a CUDA event.

CUDA events are synchronization markers that can be used to monitor the device’s progress, to accurately measure timing, and to synchronize CUDA streams.

Parameters:
  • enable_timing (bool, optional) – indicates if the event should measure time (default: False)

  • blocking (bool, optional) – if True, wait() will be blocking (default: False)

  • interprocess (bool) – if True, the event can be shared between processes (default: False)

elapsed_time(end_event: Event)[source]

Return the time elapsed.

Time reported in milliseconds after the event was recorded and before the end_event was recorded.

Parameters:

end_event (Event) – the end event.

classmethod from_ipc_handle(device, handle)[source]

Reconstruct an event from an IPC handle on the given device.

ipc_handle()[source]

Return an IPC handle of this event.

query()[source]

Check if all work currently captured by event has completed.

record(stream: Stream | None = None)[source]

Record the event in a given stream.

Parameters:

stream (Stream, optional) – Uses tensorplay.cuda.current_stream() if no stream is specified.

synchronize() None[source]

Wait for the event to complete.

wait(stream: Stream | None = None) None[source]

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

Parameters:

stream (Stream, optional) – Uses tensorplay.cuda.current_stream() if no stream is specified.

#

ExternalStream

classFull reference ↗
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.

#

Stream

classFull reference ↗
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.

Search documentation

Search all 1,743 documentation pages.

Keyboard shortcuts

Global

  • /Focus search
  • ?This dialog
  • ,Open settings
  • jAI assistant

Search

  • Navigate results
  • Open result
  • escClose

Package

  • mMain information
  • dDocs
  • .Code
  • -Changelog
  • tTimeline
  • sStats
  • vVersions