pub enum ReduceMode {
Ring,
Deterministic,
}Expand description
Reduction algorithm + precision for ProcessGroup::all_reduce. Selected
per call, or globally via env (see env_reduce_mode).
Variants§
Ring
Bandwidth-optimal ring, f32 accumulation. Fastest; f32 precision, and the last-ulp result depends on world size. Reproducible run-to-run. Default.
Deterministic
Deterministic + precise, at ring speed. The same bandwidth-optimal ring,
but its reduce-scatter accumulates in f64 (the all-gather stays f32 —
those values are already reduced, so there is no precision left to lose).
The fold order is fixed by the algorithm, so the result is bitwise
reproducible run-to-run; f64 accumulation makes each element the
correctly-rounded exact cross-rank sum, so it neither loses precision nor
biases the gradient and is effectively independent of world size. Only the
reduce-scatter carries an f64 payload (≈1.5× the f32 ring’s bytes) — NOT a
gather-to-root’s O(n·len), so speed is preserved. The mode to pick when
you want reproducible, precise data-parallel training.
Trait Implementations§
Source§impl Clone for ReduceMode
impl Clone for ReduceMode
Source§fn clone(&self) -> ReduceMode
fn clone(&self) -> ReduceMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReduceMode
Source§impl Debug for ReduceMode
impl Debug for ReduceMode
impl Eq for ReduceMode
Source§impl PartialEq for ReduceMode
impl PartialEq for ReduceMode
impl StructuralPartialEq for ReduceMode
Auto Trait Implementations§
impl Freeze for ReduceMode
impl RefUnwindSafe for ReduceMode
impl Send for ReduceMode
impl Sync for ReduceMode
impl Unpin for ReduceMode
impl UnsafeUnpin for ReduceMode
impl UnwindSafe for ReduceMode
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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