Struct rust_cuda::utils::async::Async

source ·
pub struct Async<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T> = NoCompletion> { /* private fields */ }
Available on crate feature host only.

Implementations§

source§

impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Async<'a, 'stream, T, C>

source

pub const fn ready(value: T, stream: Stream<'stream>) -> Self

Wraps a value which is ready on stream.

source

pub fn pending( value: T, stream: Stream<'stream>, completion: C, ) -> CudaResult<Self>

Wraps a still-pending value which is being computed on stream such that its computation can be synchronised on.

§Errors

Returns a rustacuda::error::CudaError iff an error occurs inside CUDA.

source

pub fn synchronize(self) -> CudaResult<T>

Synchronises on this computation to block until it has completed and the inner value can be safely returned and again be used in synchronous operations.

Calling synchronize after the computation has completed, e.g. after calling rustacuda::stream::Stream::synchronize, should be very cheap.

§Errors

Returns a rustacuda::error::CudaError iff an error occurs inside CUDA.

source

pub fn move_to_stream<'stream_new>( self, stream: Stream<'stream_new>, ) -> CudaResult<Async<'a, 'stream_new, T, C>>

Moves the asynchronous data move to a different Stream.

This method always adds a synchronisation barrier between the old and and the new Stream to ensure that any usages of this Async computations on the old Stream have completed before they can be used on the new one.

§Errors

Returns a rustacuda::error::CudaError iff an error occurs inside CUDA.

source

pub unsafe fn unwrap_unchecked(self) -> CudaResult<(T, Option<C>)>

§Safety

The returned inner value of type T may not yet have completed its asynchronous work and may thus be in an inconsistent state.

This method must only be used to construct a larger asynchronous computation out of smaller ones that have all been submitted to the same Stream.

source

pub const fn as_ref(&self) -> AsyncProj<'_, 'stream, &T>

source

pub fn as_mut(&mut self) -> AsyncProj<'_, 'stream, &mut T>

source§

impl<'a, 'stream, T: PortableBitSemantics + TypeGraphLayout, C: Completion<HostAndDeviceConstRef<'a, T>>> Async<'a, 'stream, HostAndDeviceConstRef<'a, T>, C>

source

pub const fn extract_ref( &self, ) -> AsyncProj<'_, 'stream, HostAndDeviceConstRef<'_, T>>

source§

impl<'a, 'stream, T: PortableBitSemantics + TypeGraphLayout, C: Completion<HostAndDeviceMutRef<'a, T>>> Async<'a, 'stream, HostAndDeviceMutRef<'a, T>, C>

source

pub fn extract_ref( &self, ) -> AsyncProj<'_, 'stream, HostAndDeviceConstRef<'_, T>>

source

pub fn extract_mut( &mut self, ) -> AsyncProj<'_, 'stream, HostAndDeviceMutRef<'_, T>>

source§

impl<'a, 'stream, T: RustToCudaAsync<CudaAllocationAsync: EmptyCudaAlloc, CudaAllocation: EmptyCudaAlloc>> Async<'a, 'stream, ExchangeWrapperOnDevice<T>, NoCompletion>

source

pub fn move_to_host_async( self, stream: Stream<'stream>, ) -> CudaResult<Async<'static, 'stream, ExchangeWrapperOnHost<T>, CompletionFnMut<'static, ExchangeWrapperOnHost<T>>>>

Moves the data asynchronously back to the host CPU device.

§Errors

Returns a rustacuda::error::CudaError iff an error occurs inside CUDA

source

pub fn as_ref_async( &self, ) -> AsyncProj<'_, 'stream, HostAndDeviceConstRef<'_, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>>

source

pub fn as_mut_async( &mut self, ) -> AsyncProj<'_, 'stream, HostAndDeviceMutRef<'_, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>>

Trait Implementations§

source§

impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Drop for Async<'a, 'stream, T, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> IntoFuture for Async<'a, 'stream, T, C>

§

type Output = Result<T, CudaError>

The output that the future will produce on completion.
§

type IntoFuture = impl Future<Output = <Async<'a, 'stream, T, C> as IntoFuture>::Output>

Which kind of future are we turning this into?
source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more

Auto Trait Implementations§

§

impl<'a, 'stream, T, C> Freeze for Async<'a, 'stream, T, C>
where T: Freeze, C: Freeze,

§

impl<'a, 'stream, T, C = NoCompletion> !PortableBitSemantics for Async<'a, 'stream, T, C>

§

impl<'a, 'stream, T, C = NoCompletion> !RefUnwindSafe for Async<'a, 'stream, T, C>

§

impl<'a, 'stream, T, C = NoCompletion> !Send for Async<'a, 'stream, T, C>

§

impl<'a, 'stream, T, C = NoCompletion> !StackOnly for Async<'a, 'stream, T, C>

§

impl<'a, 'stream, T, C = NoCompletion> !Sync for Async<'a, 'stream, T, C>

§

impl<'a, 'stream, T, C> Unpin for Async<'a, 'stream, T, C>
where T: Unpin, C: Unpin,

§

impl<'a, 'stream, T, C = NoCompletion> !UnwindSafe for Async<'a, 'stream, T, C>

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> ExtractDiscriminant for T

§

type Discriminant = <T as ExtractDiscriminantSpec<<T as DiscriminantKind>::Discriminant>>::Ty

The type of the discriminant, which must satisfy the trait bounds required by core::mem::Discriminant. 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>,

§

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>,

§

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

impl<T> Erased for T