Two-Node, 16-Accelerator Distributed Training: An End-to-End 400-Step Workflow
A practical guide to setting up a two-node, 16-accelerator training workflow for a 400-step run. It covers hardware and network validation, software consistency, parallelism, process launch, data loading, checkpoint recovery, and the metrics needed to assess training stability.
1. Background and Objectives
Large-model training typically requires multiple accelerators working together. When a single machine cannot provide enough compute or device memory for model parameters, optimizer states, and activations, training must scale across multiple nodes.
This exercise targets a complete training workflow on two nodes with 16 accelerators in total, with the goal of running stably for 400 training steps.
A successful run means more than simply avoiding errors. It must meet four requirements:
- All processes initialize successfully and enter the training loop.
- Data is loaded and partitioned as intended.
- Loss and throughput remain within reasonable ranges.
- Checkpoints can be saved and restored.
Without all four, the training run is difficult to reproduce or validate.
2. Validate the Hardware Topology and Network
Start by confirming the hardware topology. Each node has eight accelerators, and intra-node accelerator interconnects provide substantially higher bandwidth than the inter-node network. This difference directly influences how parallelism should be arranged.
Check the following before launching training:
- Both nodes have the same accelerator count, memory capacity, and device model.
- All intra-node accelerator links are operational, verified device by device using the relevant device-status tools.
- Actual inter-node bandwidth, latency, and packet loss have been measured with benchmarks rather than inferred from nominal link speeds.
- System clocks are synchronized across both nodes. Large clock offsets make log correlation and timeout diagnosis more difficult.
Networking is easy to underestimate in multi-node training. If inter-node communication becomes the bottleneck, adding accelerators will not deliver linear speedups and may increase the time spent waiting at each step.
3. Standardize the Software Environment
Multi-node training requires greater environment consistency than single-node training. Differences in drivers, runtimes, collective communication libraries, or training frameworks can cause initialization hangs, communication timeouts, or inconsistent numerical results.
Use the following preparation steps:
- Deploy both nodes from the same container image or environment specification.
- Compare component versions after deployment and record them in the experiment log.
- Define dependency paths and environment variables in the launch script rather than relying on user-specific login-session settings.
- Before starting training, run a small collective-communication test to verify that all 16 accelerators can communicate successfully.
These checks may seem tedious, but they can catch many problems before training begins.
4. Choose a Parallelism Strategy
How the 16 accelerators are organized determines where communication occurs. Three common approaches are:
- Data parallelism: Each accelerator holds a complete model replica and processes different data. Gradients are synchronized across replicas. This is straightforward to implement, but a large model may not fit in a single accelerator’s memory.
- Tensor parallelism: Weight matrices within a layer are partitioned across multiple accelerators. Communication is required during each layer’s forward and backward passes, making this approach well suited to high-bandwidth intra-node interconnects.
- Pipeline parallelism: The model is divided into groups of layers assigned to different accelerators, with activations passed between stages. This can work across nodes, but it introduces idle periods known as pipeline bubbles.
For two nodes with eight accelerators each, a common arrangement is eight-way tensor parallelism within each node and two-way data parallelism across nodes.
The rationale is to keep frequent, high-volume tensor-parallel communication on the faster intra-node links. Data-parallel gradient synchronization takes place at each training step and is generally better suited to the higher latency of an inter-node network. The final choice should still depend on the model architecture and measured performance.
The product of the parallelism dimensions must equal the total accelerator count:
# Illustrative configuration; use the parameter names documented by your framework.nodes: 2gpus_per_node: 8world_size: 16tensor_parallel_size: 8pipeline_parallel_size: 1data_parallel_size: 2 # 8 * 1 * 2 = 16
5. Launch and Manage Processes
The central requirement of a multi-node launch is that every process knows its identity: its global rank, local rank, master-node address, and communication port. Incorrect rank or connection settings often leave some processes waiting indefinitely for others.
The following schematic launch setup is run on both nodes, with only NODE_RANK differing:
# Set NODE_RANK to 0 on node 0 and 1 on node 1.export MASTER_ADDR=<master_node_private_ip>export MASTER_PORT=<verified_available_port>export NNODES=2export NODE_RANK=<0_or_1>export NPROC_PER_NODE=8<training_launch_command> --config train.yaml
Keep these points in mind:
- Use the master node’s private network address and verify that the selected port is reachable between nodes.
- Allow the required port through firewall rules.
- Launch both nodes within a short time window and configure a reasonable initialization timeout.
- Save logs in separate files by process rank so failures can be traced to a specific accelerator.
6. Design the Data Pipeline
Data-pipeline efficiency directly affects training-step time.
- Preprocess offline where possible. Complete tokenization and other preprocessing before training so the training job only needs to read prepared samples.
- Partition data along the data-parallel dimension. Each data-parallel replica should receive non-overlapping samples to avoid unintentionally training on the same batch more than once.
- Tune data-loader worker counts. Base the worker count on each node’s CPU cores and available memory. Too many workers consume excessive memory; too few leave accelerators waiting for data.
- Record reproducibility information. Fix random seeds and record data-file checksums to support reproduction and comparison.
7. Save Checkpoints and Test Recovery
Although 400 steps is a relatively short training run, it is long enough to expose problems in checkpoint recovery.
Design checkpointing around the following requirements:
- Choose a save interval. Saving every 100 steps is one example. Adjust the interval based on step duration and storage write speed.
- Save the complete training state. Include model parameters, optimizer state, learning-rate scheduler state, random-number generator states, and the current step. Missing state can cause the resumed training trajectory to diverge from the original.
- Validate checkpoint integrity. If a write is interrupted, retain the previous usable checkpoint rather than overwriting it directly.
- Check loss continuity after recovery. The first resumed step should be consistent with the loss trend before the interruption.
8. Monitor Training Stability
Track the following metrics throughout the run:
| Metric | What to Watch | Warning Signs |
|---|---|---|
| Loss | Overall trend and step-to-step variation | NaNs or sudden jumps |
| Gradient norm | Whether gradients exceed the clipping threshold | Persistently frequent clipping |
| Step time | Time spent on computation, communication, and data loading | An unusual increase in one component’s share |
| Device memory usage | Peak usage and remaining headroom | Peak usage approaching capacity |
