pub struct TensorParallelism { /* private fields */ }Expand description
Tensor parallelism coordinator
Implementations§
Source§impl TensorParallelism
impl TensorParallelism
Sourcepub fn new(
config: TensorParallelismConfig,
global_rank: usize,
world_size: usize,
tensor_group: Arc<dyn ProcessGroup>,
) -> Result<Self>
pub fn new( config: TensorParallelismConfig, global_rank: usize, world_size: usize, tensor_group: Arc<dyn ProcessGroup>, ) -> Result<Self>
Create a new tensor parallelism coordinator
Sourcepub fn partition_tensor(
&mut self,
tensor_name: &str,
tensor_shape: &[usize],
strategy: Option<TensorPartitioningStrategy>,
) -> Result<Vec<TensorPartition>>
pub fn partition_tensor( &mut self, tensor_name: &str, tensor_shape: &[usize], strategy: Option<TensorPartitioningStrategy>, ) -> Result<Vec<TensorPartition>>
Partition a tensor across devices
Sourcepub fn execute_operation(
&self,
operation: &TensorOperation,
inputs: &HashMap<String, Tensor>,
) -> Result<HashMap<String, Tensor>>
pub fn execute_operation( &self, operation: &TensorOperation, inputs: &HashMap<String, Tensor>, ) -> Result<HashMap<String, Tensor>>
Execute a distributed tensor operation
Sourcepub fn get_statistics(&self) -> TensorParallelismStatistics
pub fn get_statistics(&self) -> TensorParallelismStatistics
Get tensor parallelism statistics
Sourcepub fn config(&self) -> &TensorParallelismConfig
pub fn config(&self) -> &TensorParallelismConfig
Get configuration
Sourcepub fn get_local_partitions(&self, tensor_name: &str) -> Option<&Vec<usize>>
pub fn get_local_partitions(&self, tensor_name: &str) -> Option<&Vec<usize>>
Get local partitions for a tensor
Sourcepub fn get_tensor_partitions(
&self,
tensor_name: &str,
) -> Option<&Vec<TensorPartition>>
pub fn get_tensor_partitions( &self, tensor_name: &str, ) -> Option<&Vec<TensorPartition>>
Get tensor partitions
Auto Trait Implementations§
impl Freeze for TensorParallelism
impl !RefUnwindSafe for TensorParallelism
impl Send for TensorParallelism
impl Sync for TensorParallelism
impl Unpin for TensorParallelism
impl UnsafeUnpin for TensorParallelism
impl !UnwindSafe for TensorParallelism
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> 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