Trait rust_cuda::lend::LendToCuda

source ·
pub trait LendToCuda: RustToCuda {
    // Required methods
    fn lend_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
        &self,
        inner: F,
    ) -> Result<O, E>
       where Self: Sync;
    fn lend_to_cuda_mut<O, E: From<CudaError>, F: FnOnce(HostAndDeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
        &mut self,
        inner: F,
    ) -> Result<O, E>
       where Self: Sync + SafeMutableAliasing;
    fn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
        self,
        inner: F,
    ) -> Result<O, E>
       where Self: Send + RustToCuda<CudaRepresentation: StackOnly, CudaAllocation: EmptyCudaAlloc>;
}
Available on crate feature host only.

Required Methods§

source

fn lend_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>( &self, inner: F, ) -> Result<O, E>
where Self: Sync,

Lends an immutable borrow of &self to CUDA:

  • code in the CUDA kernel can only access &self through the DeviceConstRef inside the closure
  • after the closure, &self will not have changed
§Errors

Returns a CudaError iff an error occurs inside CUDA

source

fn lend_to_cuda_mut<O, E: From<CudaError>, F: FnOnce(HostAndDeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>( &mut self, inner: F, ) -> Result<O, E>
where Self: Sync + SafeMutableAliasing,

Lends a mutable borrow of &mut self to CUDA iff Self is SafeMutableAliasing:

  • code in the CUDA kernel can only access &mut self through the DeviceMutRef inside the closure
  • after the closure, &mut self will reflect the changes from the kernel execution
§Errors

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

source

fn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>( self, inner: F, ) -> Result<O, E>
where Self: Send + RustToCuda<CudaRepresentation: StackOnly, CudaAllocation: EmptyCudaAlloc>,

Moves self to CUDA iff Self is StackOnly.

§Errors

Returns a CudaError iff an error occurs inside CUDA

Object Safety§

This trait is not object safe.

Implementors§