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) -> 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§
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 Freeze for Stream
impl !RefUnwindSafe for Stream
impl Send for Stream
impl Sync 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,
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