pub struct Async<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T> = NoCompletion> { /* private fields */ }
host
only.Implementations§
source§impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Async<'a, 'stream, T, C>
impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Async<'a, 'stream, T, C>
sourcepub const fn ready(value: T, stream: Stream<'stream>) -> Self
pub const fn ready(value: T, stream: Stream<'stream>) -> Self
Wraps a value
which is ready on stream
.
sourcepub fn pending(
value: T,
stream: Stream<'stream>,
completion: C,
) -> CudaResult<Self>
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.
sourcepub fn synchronize(self) -> CudaResult<T>
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.
sourcepub fn move_to_stream<'stream_new>(
self,
stream: Stream<'stream_new>,
) -> CudaResult<Async<'a, 'stream_new, T, C>>
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.
sourcepub unsafe fn unwrap_unchecked(self) -> CudaResult<(T, Option<C>)>
pub unsafe fn unwrap_unchecked(self) -> CudaResult<(T, Option<C>)>
pub const fn as_ref(&self) -> AsyncProj<'_, 'stream, &T>
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>
impl<'a, 'stream, T: PortableBitSemantics + TypeGraphLayout, C: Completion<HostAndDeviceConstRef<'a, T>>> Async<'a, 'stream, HostAndDeviceConstRef<'a, T>, C>
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>
impl<'a, 'stream, T: PortableBitSemantics + TypeGraphLayout, C: Completion<HostAndDeviceMutRef<'a, T>>> Async<'a, 'stream, HostAndDeviceMutRef<'a, T>, C>
pub fn extract_ref( &self, ) -> AsyncProj<'_, 'stream, HostAndDeviceConstRef<'_, T>>
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>
impl<'a, 'stream, T: RustToCudaAsync<CudaAllocationAsync: EmptyCudaAlloc, CudaAllocation: EmptyCudaAlloc>> Async<'a, 'stream, ExchangeWrapperOnDevice<T>, NoCompletion>
sourcepub fn move_to_host_async(
self,
stream: Stream<'stream>,
) -> CudaResult<Async<'static, 'stream, ExchangeWrapperOnHost<T>, CompletionFnMut<'static, ExchangeWrapperOnHost<T>>>>
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
pub fn as_ref_async( &self, ) -> AsyncProj<'_, 'stream, HostAndDeviceConstRef<'_, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>>
pub fn as_mut_async(
&mut self,
) -> AsyncProj<'_, 'stream, HostAndDeviceMutRef<'_, DeviceAccessible<<T as RustToCuda>::CudaRepresentation>>>where
T: SafeMutableAliasing,
Trait Implementations§
source§impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Drop for Async<'a, 'stream, T, C>
impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> Drop for Async<'a, 'stream, T, C>
source§impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> IntoFuture for Async<'a, 'stream, T, C>
impl<'a, 'stream, T: BorrowMut<C::Completed>, C: Completion<T>> IntoFuture for Async<'a, 'stream, T, C>
§type IntoFuture = impl Future<Output = <Async<'a, 'stream, T, C> as IntoFuture>::Output>
type IntoFuture = impl Future<Output = <Async<'a, 'stream, T, C> as IntoFuture>::Output>
source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl<'a, 'stream, T, C> Freeze for Async<'a, 'stream, T, C>
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>
impl<'a, 'stream, T, C = NoCompletion> !UnwindSafe for Async<'a, 'stream, T, C>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> ExtractDiscriminant for T
impl<T> ExtractDiscriminant for T
§type Discriminant = <T as ExtractDiscriminantSpec<<T as DiscriminantKind>::Discriminant>>::Ty
type Discriminant = <T as ExtractDiscriminantSpec<<T as DiscriminantKind>::Discriminant>>::Ty
core::mem::Discriminant
. Read more