pub struct MemoryPool { /* private fields */ }Expand description
A stream-ordered memory pool (CUDA 11.2+).
Implementations§
Source§impl MemoryPool
impl MemoryPool
Sourcepub fn new(device_ordinal: i32) -> CudaResult<Self>
pub fn new(device_ordinal: i32) -> CudaResult<Self>
Creates a new memory pool on the given device.
§Errors
Creates an in-process pooling allocator for the given device.
Sourcepub fn raw_handle(&self) -> u64
pub fn raw_handle(&self) -> u64
Sourcepub fn device_ordinal(&self) -> i32
pub fn device_ordinal(&self) -> i32
Returns the device ordinal this pool targets.
Sourcepub fn stats(&self) -> PoolStats
pub fn stats(&self) -> PoolStats
Returns current pool statistics.
The statistics track allocation behaviour over the pool’s lifetime.
Sourcepub fn trim(&mut self, min_bytes: usize) -> CudaResult<()>
pub fn trim(&mut self, min_bytes: usize) -> CudaResult<()>
Trims the pool, releasing unused memory back to the OS.
Attempts to release memory such that the pool retains at most
min_bytes of unused memory.
§Errors
Sourcepub fn set_threshold(&mut self, bytes: usize) -> CudaResult<()>
pub fn set_threshold(&mut self, bytes: usize) -> CudaResult<()>
Sets the threshold at which the pool will automatically release memory back to the OS.
When the pool’s unused memory exceeds bytes, subsequent frees
will trigger automatic trimming.
§Errors
Auto Trait Implementations§
impl Freeze for MemoryPool
impl RefUnwindSafe for MemoryPool
impl Send for MemoryPool
impl Sync for MemoryPool
impl Unpin for MemoryPool
impl UnsafeUnpin for MemoryPool
impl UnwindSafe for MemoryPool
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