pub struct Communicator { /* private fields */ }Expand description
Mock communicator for collective operations In production, this would use NCCL or MPI
Implementations§
Source§impl Communicator
impl Communicator
Sourcepub fn new(
world_size: usize,
rank: usize,
) -> Result<Communicator, ParallelError>
pub fn new( world_size: usize, rank: usize, ) -> Result<Communicator, ParallelError>
Create a new communicator
Sourcepub fn all_reduce(
&self,
tensor: &ParallelTensor,
op: ReduceOp,
) -> Result<ParallelTensor, ParallelError>
pub fn all_reduce( &self, tensor: &ParallelTensor, op: ReduceOp, ) -> Result<ParallelTensor, ParallelError>
All-reduce operation
Sourcepub fn all_gather(
&self,
tensor: &ParallelTensor,
) -> Result<ParallelTensor, ParallelError>
pub fn all_gather( &self, tensor: &ParallelTensor, ) -> Result<ParallelTensor, ParallelError>
All-gather operation
Sourcepub fn reduce_scatter(
&self,
tensor: &ParallelTensor,
op: ReduceOp,
) -> Result<ParallelTensor, ParallelError>
pub fn reduce_scatter( &self, tensor: &ParallelTensor, op: ReduceOp, ) -> Result<ParallelTensor, ParallelError>
Reduce-scatter operation
Sourcepub fn barrier(&self) -> Result<(), ParallelError>
pub fn barrier(&self) -> Result<(), ParallelError>
Barrier synchronization
Sourcepub fn world_size(&self) -> usize
pub fn world_size(&self) -> usize
Get world size
Trait Implementations§
Source§impl Clone for Communicator
impl Clone for Communicator
Source§fn clone(&self) -> Communicator
fn clone(&self) -> Communicator
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 moreAuto Trait Implementations§
impl Forget for Communicator
impl Freeze for Communicator
impl Move for Communicator
impl RefUnwindSafe for Communicator
impl Send for Communicator
impl Sync for Communicator
impl Unpin for Communicator
impl UnsafeUnpin for Communicator
impl UnwindSafe for Communicator
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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