pub struct CollectiveConfig {
pub num_devices: usize,
pub local_all_reduce: AllReduceStrategy,
pub local_reduce: ReduceStrategy,
pub local_broadcast: BroadcastStrategy,
pub num_nodes: Option<usize>,
pub global_all_reduce: Option<AllReduceStrategy>,
pub global_reduce: Option<ReduceStrategy>,
pub global_broadcast: Option<BroadcastStrategy>,
pub tree_threshold_bytes: usize,
pub tree_arity: usize,
pub timeout: Duration,
}Expand description
Configuration for collective operations.
Fields§
§num_devices: usizeNumber of local devices (GPUs).
local_all_reduce: AllReduceStrategyLocal all-reduce strategy.
local_reduce: ReduceStrategyLocal reduce strategy.
local_broadcast: BroadcastStrategyLocal broadcast strategy.
num_nodes: Option<usize>Number of nodes (None = single node).
global_all_reduce: Option<AllReduceStrategy>Global all-reduce strategy.
global_reduce: Option<ReduceStrategy>Global reduce strategy.
global_broadcast: Option<BroadcastStrategy>Global broadcast strategy.
tree_threshold_bytes: usizeThreshold (bytes) below which tree is preferred over ring.
tree_arity: usizeTree arity (branching factor).
timeout: DurationTimeout for collective operations.
Implementations§
Source§impl CollectiveConfig
impl CollectiveConfig
Sourcepub fn single_node(num_devices: usize) -> Self
pub fn single_node(num_devices: usize) -> Self
Create a config for a single node with multiple devices.
Sourcepub fn multi_node(num_devices: usize, num_nodes: usize) -> Self
pub fn multi_node(num_devices: usize, num_nodes: usize) -> Self
Create a config for multi-node training.
Sourcepub fn validate(&self) -> DistributedResult<()>
pub fn validate(&self) -> DistributedResult<()>
Validate the configuration.
Sourcepub fn select_all_reduce(
&self,
buffer_size: usize,
world_size: usize,
) -> AllReduceStrategy
pub fn select_all_reduce( &self, buffer_size: usize, world_size: usize, ) -> AllReduceStrategy
Select the best all-reduce strategy for a given buffer size.
Trait Implementations§
Source§impl Clone for CollectiveConfig
impl Clone for CollectiveConfig
Source§fn clone(&self) -> CollectiveConfig
fn clone(&self) -> CollectiveConfig
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 CollectiveConfig
impl Debug for CollectiveConfig
Source§impl Default for CollectiveConfig
impl Default for CollectiveConfig
Source§impl<'de> Deserialize<'de> for CollectiveConfig
impl<'de> Deserialize<'de> for CollectiveConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CollectiveConfig
impl RefUnwindSafe for CollectiveConfig
impl Send for CollectiveConfig
impl Sync for CollectiveConfig
impl Unpin for CollectiveConfig
impl UnsafeUnpin for CollectiveConfig
impl UnwindSafe for CollectiveConfig
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
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>
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