From single machine to a fleet
MultiWorkerMirroredStrategy extends MirroredStrategy across multiple machines. Each machine runs a copy of the model on all its GPUs; gradients synchronize across workers AND devices via NCCL all-reduce.
TF_CONFIG is the JSON env variable each worker needs to know its peers and its own role. The cluster field lists all worker addresses; the task field tells this worker its type and index.
Performance recipe before going distributed: always optimize single-GPU first. Profile says <5% input bound? Mixed precision on? XLA on? Batch size as large as memory allows? Each of these can give 2–5× speedup before you add distribution complexity.