pub struct Stream { /* private fields */ }
Expand description

CUDA stream.

Implementations§

source§

impl Stream

source

pub fn null() -> Self

Create a Stream object that represent the default stream, also known as the null stream.

Refer to the CUDA documentation for more information regarding the default (“null”) stream:

Prefer owned streams

It is recommended to use owned streams as much as possible, for two reasons:

  • Using streams to separate semanticly unrelated streams of operations allows the GPU to overlap operations and improved parallelism.
  • Using the default stream can incur implicit synchronization, even on other streams, which causes their performance to degrade.

Note that it is not enforced that there is only one Stream object that represents the default stream. This is safe because all operations are serialized anyway.

source

pub async fn new() -> Result<Self, Error>

Create an asynchronous stream.

CUDA documentation

source

pub async fn synchronize(&self) -> Result<(), Error>

Synchronize stream. This future will only return once all currently enqueued work on the stream is done.

CUDA documentation

Behavior

In constrast to most of the API, this future does not become ready eagerly. Instead, a callback is pushed onto the given stream that will be invoked to make the future ready once all work on the stream that was previously queued asynchroneously is completed.

Internally, the future uses cudaStreamAddCallback to schedule the callback on the stream.

source

pub fn inner(&self) -> &Stream

Access the inner synchronous implementation of Stream.

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.