Struct Stream

Source
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§

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.