Skip to main content
Extend DistributedWorker and implement load(), generate(), and reset(). Pass your worker class to DistributedRunner. The runner creates the workers and coordinates their calls. The base class declares typed rank, world_size, and device attributes for editor completion. It also provides is_leader for rank-0 checks.
Development preview. See availability.

Attributes

The runner sets rank, world_size, and device before load(). The base class computes is_leader from rank: Use is_leader for work that only rank 0 performs. Do not use it to skip collectives that require all ranks to participate. All ranks must enter matching collectives in the same order.

Required worker methods

Implement all three methods in your subclass: If ranks produce separate parts of the output, gather them onto rank 0 inside generate() before returning. The runner returns only rank 0’s result and does not assemble outputs from other ranks. The base implementations raise NotImplementedError. The worker needs a no-argument constructor. Keep client commands, tracks, and sessions in the application.