pub struct Stream { /* private fields */ }Expand description
Wrapper around a CUDA stream.
A CUDA stream is a linear sequence of execution that belongs to a specific
device, independent from other streams. See the documentation for
torch.cuda.Stream for more details.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn clone_ref(&self, py: Python<'_>) -> Self
pub fn clone_ref(&self, py: Python<'_>) -> Self
Clone this stream reference. Requires holding the GIL.
Sourcepub fn new_with_device(device: CudaDevice) -> PyResult<Self>
pub fn new_with_device(device: CudaDevice) -> PyResult<Self>
Create a new stream on the specified device, at priority 0.
Sourcepub fn get_current_stream() -> PyResult<Self>
pub fn get_current_stream() -> PyResult<Self>
Get the current stream on the current device.
Sourcepub fn get_current_stream_on_device(device: CudaDevice) -> PyResult<Self>
pub fn get_current_stream_on_device(device: CudaDevice) -> PyResult<Self>
Get the current stream on the specified device.
Sourcepub fn set_current_stream(stream: &Stream) -> PyResult<()>
pub fn set_current_stream(stream: &Stream) -> PyResult<()>
Set the provided stream as the current stream. Also sets the current device to be the same as the stream’s device.
Sourcepub fn wait_event(&self, event: &mut Event) -> PyResult<()>
pub fn wait_event(&self, event: &mut Event) -> PyResult<()>
Make all future work submitted to this stream wait for an event.
Sourcepub fn wait_stream(&self, stream: &Stream) -> PyResult<()>
pub fn wait_stream(&self, stream: &Stream) -> PyResult<()>
Synchronize with another stream.
All future work submitted to this stream will wait until all kernels submitted to a given stream at the time of call entry complete.
Sourcepub fn record_event(&self, event: Option<Event>) -> PyResult<Event>
pub fn record_event(&self, event: Option<Event>) -> PyResult<Event>
Record an event on this stream. If no event is provided one will be created.
Sourcepub fn query(&self) -> PyResult<bool>
pub fn query(&self) -> PyResult<bool>
Check if all work submitted to this stream has completed.
Sourcepub fn synchronize(&self) -> PyResult<()>
pub fn synchronize(&self) -> PyResult<()>
Wait for all kernels in this stream to complete.
Trait Implementations§
Source§impl<'__derive_more_into> From<&'__derive_more_into Stream> for &'__derive_more_into Py<PyAny>
impl<'__derive_more_into> From<&'__derive_more_into Stream> for &'__derive_more_into Py<PyAny>
Auto Trait Implementations§
impl !RefUnwindSafe for Stream
impl Freeze for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnsafeUnpin for Stream
impl UnwindSafe for Stream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].