pub struct StreamOrderedAllocConfig {
pub initial_pool_size: usize,
pub max_pool_size: usize,
pub release_threshold: usize,
pub device: i32,
}Expand description
Configuration for a stream-ordered memory pool.
All sizes are in bytes.
Fields§
§initial_pool_size: usizeInitial pool size in bytes. The pool pre-reserves this amount of device memory when created.
max_pool_size: usizeMaximum pool size in bytes. 0 means unlimited — the pool will grow
as needed (subject to device memory limits).
release_threshold: usizeRelease threshold in bytes. When the pool is trimmed, at least this much memory is kept reserved for future allocations.
device: i32The device ordinal to create the pool on.
Implementations§
Source§impl StreamOrderedAllocConfig
impl StreamOrderedAllocConfig
Sourcepub fn validate(&self) -> CudaResult<()>
pub fn validate(&self) -> CudaResult<()>
Validate that the configuration is internally consistent.
§Rules
initial_pool_sizemust not exceedmax_pool_size(whenmax_pool_size > 0).release_thresholdmust not exceedmax_pool_size(whenmax_pool_size > 0).devicemust be non-negative.
§Errors
Returns CudaError::InvalidValue if any rule is violated.
Sourcepub fn default_for_device(device: i32) -> Self
pub fn default_for_device(device: i32) -> Self
Returns a sensible default configuration for the given device.
initial_pool_size= 0 (grow on demand)max_pool_size= 0 (unlimited)release_threshold= 0 (release everything on trim)
Trait Implementations§
Source§impl Clone for StreamOrderedAllocConfig
impl Clone for StreamOrderedAllocConfig
Source§fn clone(&self) -> StreamOrderedAllocConfig
fn clone(&self) -> StreamOrderedAllocConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamOrderedAllocConfig
impl Debug for StreamOrderedAllocConfig
Source§impl PartialEq for StreamOrderedAllocConfig
impl PartialEq for StreamOrderedAllocConfig
impl Eq for StreamOrderedAllocConfig
impl StructuralPartialEq for StreamOrderedAllocConfig
Auto Trait Implementations§
impl Freeze for StreamOrderedAllocConfig
impl RefUnwindSafe for StreamOrderedAllocConfig
impl Send for StreamOrderedAllocConfig
impl Sync for StreamOrderedAllocConfig
impl Unpin for StreamOrderedAllocConfig
impl UnsafeUnpin for StreamOrderedAllocConfig
impl UnwindSafe for StreamOrderedAllocConfig
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