Skip to main content

Crate nuvec_distributed

Crate nuvec_distributed 

Source
Expand description

Distributed backends for nuvec: MLX’s TCP ring, and MLX’s JACCL (RDMA over Thunderbolt 5; experimental, feature jaccl).

init reads MLX’s launch environment, connects a backend and makes it the default group of nuvec::distributed’s collectives, as mx.distributed.init(). The ring reads MLX_HOSTFILE (a JSON list with one entry per rank of "host:port" addresses) and MLX_RANK; JACCL reads the variables mlx.launch --backend jaccl writes (jaccl::Config::from_env). init_backend names the backend. Every rank runs the same program; the processes may share one Mac (over loopback) or run on several (over Ethernet or Thunderbolt IP for the ring, Thunderbolt 5 cables for JACCL).

use nuvec_core::{array, distributed};

let group = nuvec_distributed::init(false)?; // size 1 without a hostfile
let x = array![1.0, 2.0];
let total = distributed::all_sum(&x, None); // the sum over every rank
println!("rank {} of {}: {:?}", group.rank(), group.size(), total.to_vec::<f32>()?);

Stability: no promise when this crate is depended on directly; depend on nuvec, whose re-exports are semver-tracked.

Modules§

jaccl
Experimental: MLX’s JACCL backend, RDMA over Thunderbolt 5 (macOS 26.2+), behind the jaccl feature. It is unverified on Thunderbolt 5 hardware; its algorithms are tested on an emulated fabric.

Structs§

Options
Options of init_with.

Enums§

Backend
A distributed backend (MLX’s backend argument).

Functions§

init
Initialises a backend from MLX’s environment and makes it the default group, as mx.distributed.init(): init_backend with Backend::Any.
init_backend
Initialises backend from MLX’s environment and makes it the default group, as MLX’s init(strict, backend). A backend initialised before returns its group (Any: the first group initialised). Without the environment: an error naming the missing variables if strict, else the group of this process alone.
init_with
Connects rank rank of the ring over nodes (per rank its addresses, one connection per address, as MLX’s hostfile) and returns its group (not made the default). A single rank is the group of this process alone.
is_available
Whether backend can run here, as MLX’s is_available(backend): the ring always; JACCL when built in and the system’s RDMA library lists a device.