warp.ScopedStream#

class warp.ScopedStream(stream, sync_enter=True, sync_exit=False)[source]#

A context manager to temporarily change the current stream on a device.

Parameters:
  • stream (wp.Stream | None)

  • sync_enter (bool)

  • sync_exit (bool)

stream#

The stream that will temporarily become the device’s default stream within the context.

Type:

Stream or None

saved_stream#

The device’s previous current stream. This is restored as the device’s current stream on exiting the context.

Type:

Stream

sync_enter#

Whether to synchronize this context’s stream with the device’s previous current stream on entering the context.

Type:

bool

sync_exit#

Whether to synchronize the device’s previous current with this context’s stream on exiting the context.

Type:

bool

device#

The device associated with the stream.

Type:

Device

__init__(stream, sync_enter=True, sync_exit=False)[source]#

Initializes the context manager with a stream and synchronization options.

Parameters:
  • stream (Stream | None) – The stream that will temporarily become the device’s default stream within the context.

  • sync_enter (bool) – Whether to synchronize this context’s stream with the device’s previous current stream on entering the context.

  • sync_exit (bool) – Whether to synchronize the device’s previous current with this context’s stream on exiting the context.

Methods

__init__(stream[, sync_enter, sync_exit])

Initializes the context manager with a stream and synchronization options.