Struct cust::prelude::DeviceVariable
source · [−]pub struct DeviceVariable<T: DeviceCopy> { /* private fields */ }
Expand description
Wrapper around a variable on the host and a DeviceBox
holding the
variable on the device, allowing for easy synchronization and storage.
Implementations
sourceimpl<T: DeviceCopy> DeviceVariable<T>
impl<T: DeviceCopy> DeviceVariable<T>
sourcepub fn new(var: T) -> CudaResult<Self>
pub fn new(var: T) -> CudaResult<Self>
Create a new DeviceVariable
wrapping var
.
Allocates storage on the device and copies var
to the device.
sourcepub fn copy_htod(&mut self) -> CudaResult<()>
pub fn copy_htod(&mut self) -> CudaResult<()>
Copy the host copy of the variable to the device
sourcepub fn copy_dtoh(&mut self) -> CudaResult<()>
pub fn copy_dtoh(&mut self) -> CudaResult<()>
Copy the device copy of the variable to the host
pub fn as_device_ptr(&self) -> DevicePointer<T>
Trait Implementations
sourceimpl<T: Debug + DeviceCopy> Debug for DeviceVariable<T>
impl<T: Debug + DeviceCopy> Debug for DeviceVariable<T>
sourceimpl<T: DeviceCopy> Deref for DeviceVariable<T>
impl<T: DeviceCopy> Deref for DeviceVariable<T>
sourceimpl<T: DeviceCopy> DerefMut for DeviceVariable<T>
impl<T: DeviceCopy> DerefMut for DeviceVariable<T>
sourceimpl<T: DeviceCopy> DeviceMemory for DeviceVariable<T>
impl<T: DeviceCopy> DeviceMemory for DeviceVariable<T>
sourcefn as_raw_ptr(&self) -> CUdeviceptr
fn as_raw_ptr(&self) -> CUdeviceptr
Get the raw cuda device pointer
sourcefn size_in_bytes(&self) -> usize
fn size_in_bytes(&self) -> usize
Get the size of the memory region in bytes
Auto Trait Implementations
impl<T> RefUnwindSafe for DeviceVariable<T> where
T: RefUnwindSafe,
impl<T> Send for DeviceVariable<T> where
T: Send,
impl<T> Sync for DeviceVariable<T> where
T: Sync,
impl<T> Unpin for DeviceVariable<T> where
T: Unpin,
impl<T> UnwindSafe for DeviceVariable<T> where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more