Skip to main content

Crate cobre_comm

Crate cobre_comm 

Source
Expand description

§cobre-comm

Pluggable communication backend abstraction for the Cobre ecosystem.

This crate defines the Communicator and SharedMemoryProvider traits that decouple distributed computations from specific communication technologies. Backend implementations are feature-gated:

  • local — single-process no-op (always available, zero overhead)
  • mpi — MPI collectives via ferrompi
  • tcp — TCP/IP coordinator pattern (no MPI required)
  • shm — POSIX shared memory for single-node multi-process execution

The backend is selected at build time via Cargo feature flags, with optional runtime override through the COBRE_COMM_BACKEND environment variable.

§Design principles

  • Zero-cost static dispatch: generics over Communicator eliminate dynamic dispatch overhead on the hot path.
  • Additive features: multiple backends can coexist in one binary.
  • Orthogonal to the solver: algorithm crates depend on this crate for communication; it does not depend back.

§Status

This crate is in early development. The API will change.

See the repository for the full roadmap.

Structs§

HeapRegion
Shared memory region backed by a heap-allocated Vec<T>.
LocalBackend
Single-process communication backend with identity collective semantics.

Enums§

BackendError
Errors that can occur during backend selection and initialization.
BackendKind
Programmatic backend selector for library-mode callers.
CommError
Errors that can occur during collective communication or shared memory operations.
ReduceOp
Element-wise reduction operations for allreduce.

Traits§

CommData
Marker trait for types that can be transmitted through collective operations.
Communicator
Backend abstraction for collective communication operations.
LocalCommunicator
Object-safe sub-trait of Communicator for intra-node initialization coordination.
SharedMemoryProvider
Backend abstraction for intra-node shared memory region management.
SharedRegion
Handle to a shared memory region holding count elements of type T.

Functions§

available_backends
Returns all backend names compiled into this binary.
create_communicator
Construct the active communication backend (no-feature build).