pub trait Communicator: Send + Sync {
// Required methods
fn rank(&self) -> usize;
fn size(&self) -> usize;
fn all_reduce(
&self,
op: AllReduce,
dtype: DType,
data: &mut [u8],
) -> Result<()>;
fn all_gather(&self, input: &[u8], output: &mut [u8]) -> Result<()>;
fn send(&self, dst: usize, data: &[u8]) -> Result<()>;
fn recv(&self, src: usize, data: &mut [u8]) -> Result<()>;
// Provided method
fn split(&self, color: i32, key: i32) -> Result<Arc<dyn Communicator>> { ... }
}Expand description
The transport of a Group: every rank of the group calls the same operations in the
same order. Buffers are row-contiguous elements; a failure names the peer.
Required Methods§
Sourcefn all_reduce(&self, op: AllReduce, dtype: DType, data: &mut [u8]) -> Result<()>
fn all_reduce(&self, op: AllReduce, dtype: DType, data: &mut [u8]) -> Result<()>
Reduces data (elements of dtype) with every rank’s data, in place; every rank
gets the same bits.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".