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

source

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for CudaStream

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.