pub struct CudaStream { /* private fields */ }Expand description
A CUDA stream obtained from the libtorch stream pool.
RAII: the stream is returned to the pool on drop.
Implementations§
Source§impl CudaStream
impl CudaStream
Sourcepub fn new(device: Device, high_priority: bool) -> Result<Self>
pub fn new(device: Device, high_priority: bool) -> Result<Self>
Create a new CUDA stream from the pool on the given device.
high_priority: if true, uses a high-priority stream that preempts
normal-priority work at SM boundaries.
Sourcepub fn synchronize(&self) -> Result<()>
pub fn synchronize(&self) -> Result<()>
Block the CPU thread until all work on this stream completes.
Sourcepub fn wait_event(&self, event: &CudaEvent) -> Result<()>
pub fn wait_event(&self, event: &CudaEvent) -> Result<()>
Make this stream wait for a recorded event before executing any further work. Does not block the CPU.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Non-blocking check: has all work on this stream completed?
Trait Implementations§
Source§impl Drop for CudaStream
impl Drop for CudaStream
impl Send for CudaStream
Auto Trait Implementations§
impl Freeze for CudaStream
impl RefUnwindSafe for CudaStream
impl !Sync for CudaStream
impl Unpin for CudaStream
impl UnsafeUnpin for CudaStream
impl UnwindSafe for CudaStream
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
Mutably borrows from an owned value. Read more