pub trait Backend: Send + Sync {
Show 13 methods
// Required methods
fn name(&self) -> &str;
fn rank(&self) -> usize;
fn world_size(&self) -> usize;
fn all_reduce(&self, data: &mut [f32], op: ReduceOp);
fn broadcast(&self, data: &mut [f32], src: usize);
fn all_gather(&self, send_data: &[f32], recv_data: &mut [f32]);
fn reduce_scatter(
&self,
send_data: &[f32],
recv_data: &mut [f32],
op: ReduceOp,
);
fn gather(&self, send_data: &[f32], recv_data: &mut [f32], dst: usize);
fn scatter(&self, send_data: &[f32], recv_data: &mut [f32], src: usize);
fn reduce(
&self,
send_data: &[f32],
recv_data: &mut [f32],
dst: usize,
op: ReduceOp,
);
fn barrier(&self);
fn send(&self, data: &[f32], dst: usize, tag: usize);
fn recv(&self, data: &mut [f32], src: usize, tag: usize);
}Expand description
Trait for distributed communication backends.
Required Methods§
Sourcefn world_size(&self) -> usize
fn world_size(&self) -> usize
Returns the total world size.
Sourcefn all_reduce(&self, data: &mut [f32], op: ReduceOp)
fn all_reduce(&self, data: &mut [f32], op: ReduceOp)
Performs all-reduce operation.
Sourcefn all_gather(&self, send_data: &[f32], recv_data: &mut [f32])
fn all_gather(&self, send_data: &[f32], recv_data: &mut [f32])
Performs all-gather operation.
Sourcefn reduce_scatter(&self, send_data: &[f32], recv_data: &mut [f32], op: ReduceOp)
fn reduce_scatter(&self, send_data: &[f32], recv_data: &mut [f32], op: ReduceOp)
Performs reduce-scatter operation.
Sourcefn gather(&self, send_data: &[f32], recv_data: &mut [f32], dst: usize)
fn gather(&self, send_data: &[f32], recv_data: &mut [f32], dst: usize)
Performs gather operation.
Sourcefn scatter(&self, send_data: &[f32], recv_data: &mut [f32], src: usize)
fn scatter(&self, send_data: &[f32], recv_data: &mut [f32], src: usize)
Performs scatter operation.