pub struct TensorParallelConfig {
pub world_size: usize,
pub rank: usize,
pub device: Device,
pub sequence_parallel: bool,
pub reduce_scatter: bool,
}Expand description
Tensor parallel configuration
Fields§
§world_size: usizeWorld size (number of tensor parallel ranks)
rank: usizeLocal rank in tensor parallel group
device: DeviceDevice for this rank
sequence_parallel: boolWhether to use sequence parallelism
reduce_scatter: boolWhether to reduce scatter for efficiency
Implementations§
Source§impl TensorParallelConfig
impl TensorParallelConfig
Sourcepub fn new(world_size: usize, rank: usize, device: Device) -> Self
pub fn new(world_size: usize, rank: usize, device: Device) -> Self
Create config for a specific rank
Sourcepub fn is_parallel(&self) -> bool
pub fn is_parallel(&self) -> bool
Check if tensor parallelism is enabled
Sourcepub fn shard_size(&self, dim_size: usize) -> usize
pub fn shard_size(&self, dim_size: usize) -> usize
Calculate shard size for a dimension
Sourcepub fn shard_offset(&self, dim_size: usize) -> usize
pub fn shard_offset(&self, dim_size: usize) -> usize
Calculate offset for this rank’s shard
Sourcepub fn shard_range(&self, dim_size: usize) -> (usize, usize)
pub fn shard_range(&self, dim_size: usize) -> (usize, usize)
Get the range for this rank’s shard
Trait Implementations§
Source§impl Clone for TensorParallelConfig
impl Clone for TensorParallelConfig
Source§fn clone(&self) -> TensorParallelConfig
fn clone(&self) -> TensorParallelConfig
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 TensorParallelConfig
impl Debug for TensorParallelConfig
Auto Trait Implementations§
impl Freeze for TensorParallelConfig
impl RefUnwindSafe for TensorParallelConfig
impl Send for TensorParallelConfig
impl Sync for TensorParallelConfig
impl Unpin for TensorParallelConfig
impl UnsafeUnpin for TensorParallelConfig
impl UnwindSafe for TensorParallelConfig
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> 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