pub struct ParallelConfig {
pub parallelism_type: ParallelismType,
pub devices: Vec<Device>,
pub tensor_parallel_size: usize,
pub pipeline_parallel_size: usize,
pub enable_memory_optimization: bool,
pub communication_backend: String,
pub max_chunk_size: usize,
pub overlap_communication: bool,
}Expand description
Parallel execution configuration
Fields§
§parallelism_type: ParallelismTypeType of parallelism to use
devices: Vec<Device>Devices to use for parallel execution
tensor_parallel_size: usizeNumber of tensor parallel ranks
pipeline_parallel_size: usizeNumber of pipeline parallel stages
enable_memory_optimization: boolWhether to enable memory optimization
communication_backend: StringCommunication backend (nccl, gloo, etc.)
max_chunk_size: usizeMaximum chunk size for all-reduce operations
overlap_communication: boolEnable overlapping communication with computation
Implementations§
Source§impl ParallelConfig
impl ParallelConfig
Sourcepub fn single_gpu(device: Device) -> Self
pub fn single_gpu(device: Device) -> Self
Create config for single GPU
Sourcepub fn tensor_parallel(devices: Vec<Device>) -> Self
pub fn tensor_parallel(devices: Vec<Device>) -> Self
Create config for tensor parallelism
Sourcepub fn pipeline_parallel(devices: Vec<Device>) -> Self
pub fn pipeline_parallel(devices: Vec<Device>) -> Self
Create config for pipeline parallelism
Sourcepub fn data_parallel(devices: Vec<Device>) -> Self
pub fn data_parallel(devices: Vec<Device>) -> Self
Create config for data parallelism
Sourcepub fn hybrid(devices: Vec<Device>, tp_size: usize, pp_size: usize) -> Self
pub fn hybrid(devices: Vec<Device>, tp_size: usize, pp_size: usize) -> Self
Create hybrid config (tensor + pipeline)
Sourcepub fn world_size(&self) -> usize
pub fn world_size(&self) -> usize
Get the world size (total number of ranks)
Sourcepub fn is_parallel(&self) -> bool
pub fn is_parallel(&self) -> bool
Check if parallelism is enabled
Sourcepub fn device_for_rank(&self, rank: usize) -> Option<&Device>
pub fn device_for_rank(&self, rank: usize) -> Option<&Device>
Get device for a specific rank
Trait Implementations§
Source§impl Clone for ParallelConfig
impl Clone for ParallelConfig
Source§fn clone(&self) -> ParallelConfig
fn clone(&self) -> ParallelConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ParallelConfig
impl Debug for ParallelConfig
Source§impl Default for ParallelConfig
impl Default for ParallelConfig
Source§impl<'de> Deserialize<'de> for ParallelConfig
impl<'de> Deserialize<'de> for ParallelConfig
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 ParallelConfig
impl RefUnwindSafe for ParallelConfig
impl Send for ParallelConfig
impl Sync for ParallelConfig
impl Unpin for ParallelConfig
impl UnsafeUnpin for ParallelConfig
impl UnwindSafe for ParallelConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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