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§
sourcefn 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<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 theDeviceConstRef
inside the closure - after the closure,
&self
will not have changed
§Errors
Returns a CudaError
iff an error occurs inside CUDA
sourcefn 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 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 theDeviceMutRef
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
sourcefn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
self,
inner: F,
) -> Result<O, E>
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>
Object Safety§
This trait is not object safe.