pub struct DevicePtr { /* private fields */ }Expand description
A reference-counted pointer into a DeviceBuffer. The buffer cannot be constructed directly, instead it can only be created by allocating a new DevicePtr with DevicePtr::alloc.
The inner DeviceBuffer is automatically freed when there are no DevicePtr any more that refer to it. Since the memory may be shared all accessor methods are marked unsafe.
Cloning this type does not copy the underlying memory, but only increases the reference count.
Implementations§
source§impl DevicePtr
impl DevicePtr
pub fn alloc(device: CudaDevice, len_bytes: usize) -> Self
pub fn device(&self) -> CudaDevice
pub fn offset_bytes(self, offset: isize) -> DevicePtr
pub unsafe fn ptr(&self) -> *mut c_void
The number of DevicePtr sharing the underlying buffer that are still alive.
pub unsafe fn copy_linear_from_host(&self, buffer: &[u8])
pub unsafe fn copy_linear_from_host_async( &self, buffer: &PinnedMem, stream: &CudaStream )
pub unsafe fn copy_linear_to_host(&self, buffer: &mut [u8])
pub unsafe fn copy_linear_to_host_async( &self, buffer: &mut PinnedMem, stream: &CudaStream )
pub unsafe fn copy_linear_from_device( &self, other: &DevicePtr, len_bytes: usize )
Trait Implementations§
source§impl PartialEq for DevicePtr
impl PartialEq for DevicePtr
impl Eq for DevicePtr
impl StructuralPartialEq for DevicePtr
Auto Trait Implementations§
impl RefUnwindSafe for DevicePtr
impl Send for DevicePtr
impl Sync for DevicePtr
impl Unpin for DevicePtr
impl UnwindSafe for DevicePtr
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
Mutably borrows from an owned value. Read more