pub struct ProcessGroup { /* private fields */ }Expand description
A group of processes that can communicate with each other.
Implementations§
Source§impl ProcessGroup
impl ProcessGroup
Sourcepub fn new(backend: Arc<dyn Backend>) -> ProcessGroup
pub fn new(backend: Arc<dyn Backend>) -> ProcessGroup
Creates a new process group with all ranks.
Sourcepub fn with_ranks(backend: Arc<dyn Backend>, ranks: Vec<usize>) -> ProcessGroup
pub fn with_ranks(backend: Arc<dyn Backend>, ranks: Vec<usize>) -> ProcessGroup
Creates a process group with specific ranks.
Sourcepub fn mock() -> ProcessGroup
pub fn mock() -> ProcessGroup
Creates a mock process group for testing.
Sourcepub fn world_size(&self) -> usize
pub fn world_size(&self) -> usize
Returns the world size.
Sourcepub fn all_reduce_tensor(&self, tensor: &mut Tensor<f32>, op: ReduceOp)
pub fn all_reduce_tensor(&self, tensor: &mut Tensor<f32>, op: ReduceOp)
Performs all-reduce on a tensor.
Sourcepub fn broadcast_tensor(&self, tensor: &mut Tensor<f32>, src: usize)
pub fn broadcast_tensor(&self, tensor: &mut Tensor<f32>, src: usize)
Broadcasts a tensor from a source rank.
Sourcepub fn all_gather_tensor(&self, send_tensor: &Tensor<f32>) -> Tensor<f32>
pub fn all_gather_tensor(&self, send_tensor: &Tensor<f32>) -> Tensor<f32>
Performs all-gather on tensors.
Sourcepub fn reduce_scatter_tensor(
&self,
send_tensor: &Tensor<f32>,
op: ReduceOp,
) -> Tensor<f32>
pub fn reduce_scatter_tensor( &self, send_tensor: &Tensor<f32>, op: ReduceOp, ) -> Tensor<f32>
Performs reduce-scatter on a tensor.
Sourcepub fn send_tensor(&self, tensor: &mut Tensor<f32>, dst: usize)
pub fn send_tensor(&self, tensor: &mut Tensor<f32>, dst: usize)
Sends a tensor to a destination rank.
Trait Implementations§
Source§impl Clone for ProcessGroup
impl Clone for ProcessGroup
Source§fn clone(&self) -> ProcessGroup
fn clone(&self) -> ProcessGroup
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 moreAuto Trait Implementations§
impl Freeze for ProcessGroup
impl !RefUnwindSafe for ProcessGroup
impl Send for ProcessGroup
impl Sync for ProcessGroup
impl Unpin for ProcessGroup
impl UnsafeUnpin for ProcessGroup
impl !UnwindSafe for ProcessGroup
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