Struct cudarc::driver::safe::CudaStream
source · pub struct CudaStream {
pub stream: CUstream,
/* private fields */
}
Expand description
A wrapper around sys::CUstream that safely ensures null stream is synchronized upon the completion of this streams work.
Create with CudaDevice::fork_default_stream.
The synchronization happens in code order. E.g.
ⓘ
let stream = dev.fork_default_stream()?; // 0
dev.launch(...)?; // 1
dev.launch_on_stream(&stream, ...)?; // 2
dev.launch(...)?; // 3
drop(stream); // 4
dev.launch(...) // 5
- 0 will place a streamWaitEvent(default work stream) on the new stream
- 1 will launch on the default work stream
- 2 will launch concurrently to 1 on
&stream
, - 3 will launch after 1 on the default work stream, but potentially concurrently to 2.
- 4 will place a streamWaitEvent(
&stream
) on default work stream - 5 will happen on the default stream after the default stream waits for 2
Fields§
§stream: CUstream
Implementations§
source§impl CudaStream
impl CudaStream
sourcepub fn wait_for_default(&self) -> Result<(), DriverError>
pub fn wait_for_default(&self) -> Result<(), DriverError>
Record’s the current default streams workload, and then causes self
to wait for the default stream to finish that recorded workload.
Trait Implementations§
source§impl Debug for CudaStream
impl Debug for CudaStream
Auto Trait Implementations§
impl RefUnwindSafe for CudaStream
impl !Send for CudaStream
impl !Sync for CudaStream
impl Unpin 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