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 new_with_device(device: CudaDevice) -> Self
pub fn new_with_device(device: CudaDevice) -> Self
Create a new stream on the specified device, at priority 0.
Sourcepub fn get_current_stream() -> Self
pub fn get_current_stream() -> Self
Get the current stream on the current device.
Sourcepub fn get_current_stream_on_device(device: CudaDevice) -> Self
pub fn get_current_stream_on_device(device: CudaDevice) -> Self
Get the current stream on the specified device.
Sourcepub fn set_current_stream(stream: &Stream)
pub fn set_current_stream(stream: &Stream)
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)
pub fn wait_event(&self, event: &mut Event)
Make all future work submitted to this stream wait for an event.
Sourcepub fn wait_stream(&self, stream: &Stream)
pub fn wait_stream(&self, stream: &Stream)
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>) -> Event
pub fn record_event(&self, event: Option<Event>) -> Event
Record an event on this stream. If no event is provided one will be created.
Sourcepub fn synchronize(&self)
pub fn synchronize(&self)
Wait for all kernels in this stream to complete.
pub fn stream(&self) -> cudaStream_t
Trait Implementations§
impl Send for Stream
impl Sync for Stream
Auto Trait Implementations§
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Unpin 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
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>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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