pub struct IdentityComm;Expand description
A single-process “communicator” that passes tensors through unchanged.
Useful for testing parallel code on a single device.
This reduces nothing, and that is correct. With world_size == 1 there
is no peer to combine with, so the identity is the reduction. It is not a
working multi-device collective and must not be read as one — for that, use
DeviceGroup, which holds every shard
and folds them in-graph.
Trait Implementations§
Source§impl Communicator for IdentityComm
impl Communicator for IdentityComm
Source§fn all_reduce(&self, tensor: &Tensor, _op: ReduceOp) -> Result<Tensor>
fn all_reduce(&self, tensor: &Tensor, _op: ReduceOp) -> Result<Tensor>
All-reduce: compute element-wise reduction across all ranks,
distributing the result to every rank.
Source§fn all_gather(&self, tensor: &Tensor, _dim: usize) -> Result<Tensor>
fn all_gather(&self, tensor: &Tensor, _dim: usize) -> Result<Tensor>
All-gather: concatenate tensors from all ranks along
dim.Source§fn reduce_scatter(
&self,
tensor: &Tensor,
_op: ReduceOp,
_dim: usize,
) -> Result<Tensor>
fn reduce_scatter( &self, tensor: &Tensor, _op: ReduceOp, _dim: usize, ) -> Result<Tensor>
Reduce-scatter: reduce across ranks then scatter equal chunks to each rank.
Auto Trait Implementations§
impl Freeze for IdentityComm
impl RefUnwindSafe for IdentityComm
impl Send for IdentityComm
impl Sync for IdentityComm
impl Unpin for IdentityComm
impl UnsafeUnpin for IdentityComm
impl UnwindSafe for IdentityComm
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
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