pub struct CudaBufferHandle { /* private fields */ }Expand description
1D (flat) CUDA device pointer with byte size.
Implementations§
Source§impl CudaBufferHandle
impl CudaBufferHandle
Sourcepub unsafe fn try_from_raw(
ptr: u64,
size: u64,
uuid: Option<[u8; 16]>,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( ptr: u64, size: u64, uuid: Option<[u8; 16]>, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap a flat CUdeviceptr with an explicit byte size. Borrowing:
the handle is stored non-owningly, this type has no Drop, and
every obligation below extends to each Clone.
§Safety
ptrmust be a liveCUdeviceptraddressing at leastsizecontiguous bytes of currently-allocated device memory. Consumers read and write the whole[ptr, ptr + size)range, so an over-statedsizeis an out-of-bounds device access.ptr == 0is rejected asInvalidHandleError::NullHandleandsize == 0asInvalidHandleError::ZeroSize; neither is a caller obligation.- Context affinity,
uuid, lifetime (no retain, noDrop, must outlive everyClone, discharged bykeep_alive) and thread rules are exactly those ofCudaPtr2D::try_from_raw.
pub fn ptr(&self) -> u64
pub fn size(&self) -> u64
pub fn uuid(&self) -> Option<[u8; 16]>
pub fn keep_alive(&self) -> Option<&KeepAlive>
Trait Implementations§
Source§impl Clone for CudaBufferHandle
impl Clone for CudaBufferHandle
Source§impl Debug for CudaBufferHandle
impl Debug for CudaBufferHandle
impl Send for CudaBufferHandle
impl Sync for CudaBufferHandle
Auto Trait Implementations§
impl !RefUnwindSafe for CudaBufferHandle
impl !UnwindSafe for CudaBufferHandle
impl Freeze for CudaBufferHandle
impl Unpin for CudaBufferHandle
impl UnsafeUnpin for CudaBufferHandle
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