Skip to main content

BackendCollective

Trait BackendCollective 

Source
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§

Source

fn world_size(_ctx: &Self::Context) -> usize

Source

fn rank(_ctx: &Self::Context) -> usize

Source

fn all_reduce( _ctx: &mut Self::Context, _buf: &mut Self::Buffer, _len: usize, _op: ReduceOp, )

Source

fn all_gather( _ctx: &mut Self::Context, _local: &Self::Buffer, _global: &mut Self::Buffer, _local_len: usize, )

Source

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".

Implementors§