pub struct Zero3CpuOffloadConfig {Show 13 fields
pub offload_params: bool,
pub offload_grads: bool,
pub offload_optimizer_states: bool,
pub cpu_memory_budget: usize,
pub gpu_param_memory_budget: usize,
pub max_gpu_memory_mb: usize,
pub max_cpu_memory_mb: usize,
pub prefetch_buffer_size: usize,
pub async_prefetch: bool,
pub overlap_computation: bool,
pub pin_cpu_memory: bool,
pub cpu_compression: CpuCompressionMethod,
pub auto_memory_management: AutoMemoryStrategy,
}Expand description
ZeRO-3 CPU offloading configuration
Fields§
§offload_params: boolEnable parameter offloading to CPU
offload_grads: boolEnable gradient offloading to CPU
offload_optimizer_states: boolEnable optimizer state offloading to CPU
cpu_memory_budget: usizeCPU memory buffer size in bytes
gpu_param_memory_budget: usizeGPU memory budget for parameters in bytes
max_gpu_memory_mb: usizeMaximum GPU memory in MB (for memory pressure calculation)
max_cpu_memory_mb: usizeMaximum CPU memory in MB (for memory pressure calculation)
prefetch_buffer_size: usizePrefetch buffer size (number of parameters to prefetch)
async_prefetch: boolEnable asynchronous parameter prefetching
overlap_computation: boolEnable parameter overlapping (prefetch while computing)
pin_cpu_memory: boolPin CPU memory for faster transfers
cpu_compression: CpuCompressionMethodCompression for CPU-stored parameters
auto_memory_management: AutoMemoryStrategyAutomatic memory management strategy
Implementations§
Source§impl Zero3CpuOffloadConfig
impl Zero3CpuOffloadConfig
Sourcepub fn with_offload_params(self, offload: bool) -> Self
pub fn with_offload_params(self, offload: bool) -> Self
Set parameter offloading option
Sourcepub fn with_offload_grads(self, offload: bool) -> Self
pub fn with_offload_grads(self, offload: bool) -> Self
Set gradient offloading option
Sourcepub fn with_offload_optimizer_states(self, offload: bool) -> Self
pub fn with_offload_optimizer_states(self, offload: bool) -> Self
Set optimizer state offloading option
Sourcepub fn with_cpu_memory_budget(self, budget: usize) -> Self
pub fn with_cpu_memory_budget(self, budget: usize) -> Self
Set CPU memory budget
Sourcepub fn with_gpu_param_memory_budget(self, budget: usize) -> Self
pub fn with_gpu_param_memory_budget(self, budget: usize) -> Self
Set GPU parameter memory budget
Sourcepub fn with_prefetch_buffer_size(self, size: usize) -> Self
pub fn with_prefetch_buffer_size(self, size: usize) -> Self
Set prefetch buffer size
Sourcepub fn with_compression(self, compression: CpuCompressionMethod) -> Self
pub fn with_compression(self, compression: CpuCompressionMethod) -> Self
Set compression method
Sourcepub fn with_memory_strategy(self, strategy: AutoMemoryStrategy) -> Self
pub fn with_memory_strategy(self, strategy: AutoMemoryStrategy) -> Self
Set memory management strategy
Sourcepub fn with_async_prefetch(self, async_prefetch: bool) -> Self
pub fn with_async_prefetch(self, async_prefetch: bool) -> Self
Enable asynchronous prefetching
Sourcepub fn with_overlap_computation(self, overlap: bool) -> Self
pub fn with_overlap_computation(self, overlap: bool) -> Self
Enable computation overlap
Sourcepub fn with_pin_cpu_memory(self, pin: bool) -> Self
pub fn with_pin_cpu_memory(self, pin: bool) -> Self
Enable CPU memory pinning
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Get the effective compression ratio for CPU storage
Sourcepub fn effective_cpu_memory_budget(&self) -> usize
pub fn effective_cpu_memory_budget(&self) -> usize
Get the effective CPU memory budget after compression
Trait Implementations§
Source§impl Clone for Zero3CpuOffloadConfig
impl Clone for Zero3CpuOffloadConfig
Source§fn clone(&self) -> Zero3CpuOffloadConfig
fn clone(&self) -> Zero3CpuOffloadConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Zero3CpuOffloadConfig
impl Debug for Zero3CpuOffloadConfig
Auto Trait Implementations§
impl Freeze for Zero3CpuOffloadConfig
impl RefUnwindSafe for Zero3CpuOffloadConfig
impl Send for Zero3CpuOffloadConfig
impl Sync for Zero3CpuOffloadConfig
impl Unpin for Zero3CpuOffloadConfig
impl UnsafeUnpin for Zero3CpuOffloadConfig
impl UnwindSafe for Zero3CpuOffloadConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more