pub struct TensorParallelConfig { /* private fields */ }Expand description
Configuration for tensor parallelism.
Implementations§
Source§impl TensorParallelConfig
impl TensorParallelConfig
Sourcepub fn new(world_size: usize) -> Result<Self>
pub fn new(world_size: usize) -> Result<Self>
Create a TP config with the given number of devices.
Returns Err for world_size == 0 rather than panicking: a zero-rank TP
group has no valid shard range, and Fuel’s never-panic rule applies to
config construction as much as to a kernel.
Sourcepub fn world_size(&self) -> usize
pub fn world_size(&self) -> usize
Number of devices in the TP group.
Sourcepub fn shard_range(
&self,
rank: usize,
full_size: usize,
dim: ShardDim,
) -> (usize, usize)
pub fn shard_range( &self, rank: usize, full_size: usize, dim: ShardDim, ) -> (usize, usize)
Compute the [start, end) range for a given rank along a dimension of
size full_size.
Ranges are contiguous and cover 0..full_size exactly; the last rank
absorbs the remainder when full_size does not divide evenly. When
world_size > full_size the leading ranks get empty ranges and the
last rank takes everything — degenerate but still a partition, never
overlapping.
Sourcepub fn make_shard(
&self,
rank: usize,
dim: ShardDim,
original_shape: [usize; 2],
) -> TensorShard
pub fn make_shard( &self, rank: usize, dim: ShardDim, original_shape: [usize; 2], ) -> TensorShard
Create a TensorShard descriptor.
Trait Implementations§
Source§impl Clone for TensorParallelConfig
impl Clone for TensorParallelConfig
Source§impl Debug for TensorParallelConfig
impl Debug for TensorParallelConfig
Source§impl<'de> Deserialize<'de> for TensorParallelConfig
impl<'de> Deserialize<'de> for TensorParallelConfig
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 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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