pub struct FsdpMemoryAnalyzer;Expand description
Memory analyzer for FSDP configurations.
Provides estimates of peak per-rank memory and ratio vs DDP baseline.
Implementations§
Source§impl FsdpMemoryAnalyzer
impl FsdpMemoryAnalyzer
Sourcepub fn peak_memory(config: &FsdpConfig, total_params: usize) -> usize
pub fn peak_memory(config: &FsdpConfig, total_params: usize) -> usize
Estimate peak memory per rank in bytes.
Assumes f32 (4 bytes/param) and Adam optimizer (2× param bytes for m and v). Uses FullShard accounting by default:
- param_bytes / world_size + grad_bytes / world_size + opt_bytes / world_size
Sourcepub fn memory_vs_ddp_ratio(world_size: usize) -> f32
pub fn memory_vs_ddp_ratio(world_size: usize) -> f32
Ratio of per-rank memory vs DDP (no sharding) baseline.
Returns a value in (0.0, 1.0] where 1.0 means same as DDP and
1/world_size means maximum reduction from FullShard.
Auto Trait Implementations§
impl Freeze for FsdpMemoryAnalyzer
impl RefUnwindSafe for FsdpMemoryAnalyzer
impl Send for FsdpMemoryAnalyzer
impl Sync for FsdpMemoryAnalyzer
impl Unpin for FsdpMemoryAnalyzer
impl UnsafeUnpin for FsdpMemoryAnalyzer
impl UnwindSafe for FsdpMemoryAnalyzer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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