pub struct ManagedBuffer<T: DeviceRepr> { /* private fields */ }Expand description
Unified managed-memory buffer — allocated via cudaMallocManaged.
Accessible from both host and device without explicit copies.
Implementations§
Source§impl<T: DeviceRepr> ManagedBuffer<T>
impl<T: DeviceRepr> ManagedBuffer<T>
Sourcepub fn new(len: usize) -> Result<Self>
pub fn new(len: usize) -> Result<Self>
Allocate len managed elements with the default attach (GLOBAL).
Sourcepub fn with_flags(len: usize, flags: u32) -> Result<Self>
pub fn with_flags(len: usize, flags: u32) -> Result<Self>
Allocate with explicit attach flags (see
baracuda_cuda_sys::runtime::types::cudaMemAttach).
pub fn is_empty(&self) -> bool
pub fn as_mut_ptr(&mut self) -> *mut T
Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Access as a host slice (synchronizes through device cache on access).
pub fn as_mut_slice(&mut self) -> &mut [T]
Trait Implementations§
Source§impl<T: DeviceRepr> Debug for ManagedBuffer<T>
impl<T: DeviceRepr> Debug for ManagedBuffer<T>
Source§impl<T: DeviceRepr> Drop for ManagedBuffer<T>
impl<T: DeviceRepr> Drop for ManagedBuffer<T>
impl<T: DeviceRepr + Send> Send for ManagedBuffer<T>
impl<T: DeviceRepr + Sync> Sync for ManagedBuffer<T>
Auto Trait Implementations§
impl<T> Freeze for ManagedBuffer<T>
impl<T> RefUnwindSafe for ManagedBuffer<T>where
T: RefUnwindSafe,
impl<T> Unpin for ManagedBuffer<T>where
T: Unpin,
impl<T> UnsafeUnpin for ManagedBuffer<T>
impl<T> UnwindSafe for ManagedBuffer<T>where
T: RefUnwindSafe + UnwindSafe,
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