pub trait BackendCollective: Backend {
// Provided methods
fn world_size(_ctx: &Self::Context) -> usize { ... }
fn rank(_ctx: &Self::Context) -> usize { ... }
fn all_reduce(
_ctx: &mut Self::Context,
_buf: &mut Self::Buffer,
_len: usize,
_op: ReduceOp,
) { ... }
fn all_gather(
_ctx: &mut Self::Context,
_local: &Self::Buffer,
_global: &mut Self::Buffer,
_local_len: usize,
) { ... }
fn broadcast(
_ctx: &mut Self::Context,
_buf: &mut Self::Buffer,
_len: usize,
_src_rank: usize,
) { ... }
}Expand description
Capability-trait for backends that support multi-rank collective ops.
Single-GPU backends inherit the no-op defaults: world_size = 1,
rank = 0, and the collective ops are identity. Multi-rank backends
(CUDA + NCCL today, AMD + RCCL in the future) override these.
Provided Methods§
fn world_size(_ctx: &Self::Context) -> usize
fn rank(_ctx: &Self::Context) -> usize
fn all_reduce( _ctx: &mut Self::Context, _buf: &mut Self::Buffer, _len: usize, _op: ReduceOp, )
fn all_gather( _ctx: &mut Self::Context, _local: &Self::Buffer, _global: &mut Self::Buffer, _local_len: usize, )
fn broadcast( _ctx: &mut Self::Context, _buf: &mut Self::Buffer, _len: usize, _src_rank: usize, )
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".