Skip to main content

Module node

Module node 

Source
Expand description

One-call node bring-up.

Joining a distributed job used to mean hand-wiring a transport (mesh vs. star), resolving peer addresses, and wrapping the result in an Arc<ProcessGroup>. Node collapses that to a builder:

// From env (RANK/WORLD/PEERS or DISCOVER/TOPOLOGY):
let group = Node::from_env()?.connect()?;
// Or explicitly:
let group = Node::new(/*rank*/ 1, /*world*/ 2)
    .topology(Topology::Star)          // worker dials the coordinator
    .peers(["10.0.0.1:29500"])?        // just the coordinator address
    .connect()?;
let _ = group;

The returned ProcessGroup carries every collective (all_reduce, all_reduce_typed, federated_average, broadcast, …). This is the entry point a model runner or an edge worker calls to get on the mesh.

Structs§

Node
Builder that turns minimal config into a connected ProcessGroup.

Enums§

Topology
Wire topology.

Functions§

announce_coordinator
Coordinator side of star discovery: a pure unicast responder on disc_port — a worker sends RLXQ, we reply RLXPORT <data_port>. Runs until stop. Deliberately does NOT broadcast on this socket: a coordinator that both beacons and receives on one socket starves incoming queries (its own zero-latency loopback beacons always win the recv race). LAN zero-config is handled by mDNS instead ([mdns_advertise]); this responder covers a worker that reaches us by name/IP (LAN, host.docker.internal, or a Tailscale MagicDNS name — anything routable).
discover_coordinator
Worker side of star discovery: return the coordinator’s dial address. host = Some(h) (NAT/Docker) unicasts a query to h:disc_port and dials h:port from the reply; None listens for the LAN broadcast and dials the announcing host’s own IP.
discover_peers
UDP-broadcast rendezvous: announce rank → ip:(data_base+rank) on disc_port and collect until all world addresses are known; return them sorted by rank. Zero-config peer discovery on a shared LAN.
local_ip
The default-route local IP (picks the outbound interface); loopback if the probe fails.