Struct Stream

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

Represents an NPP stream.

An NPP stream is a thin wrapper around a normal CUDA stream (async_cuda_core::Stream). It manages some additional context information required in NPP to statelessly execute on a user-provided stream.

This struct implements Deref such that it can be used as a normal async_cuda_core::Stream as well.

§Usage

If the caller wants to use a stream context for mixed NPP and non-NPP operations, they should create an NPP stream and pass it as CUDA stream when desired. This should work out-of-the-box since Stream dereferences to async_cuda_core::Stream.

Implementations§

Source§

impl Stream

Source

pub async fn null() -> Self

Create an NPP Stream that represent the default stream, also known as the null stream.

This type is a wrapper around the actual CUDA stream type: async_cuda_core::Stream.

Source

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

Create a new Stream for use with NPP.

This type is a wrapper around the actual CUDA stream type: async_cuda_core::Stream.

Methods from Deref<Target = Stream>§

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.

Trait Implementations§

Source§

impl Deref for Stream

Source§

type Target = Stream

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.