Running a 16-GPU Training Job Across Two Nodes: A Complete 400-Step Walkthrough
How to run a full distributed LLM training pipeline across two machines with 16 accelerators. This guide covers environment preflight checks, software stack alignment, parallelism strategies, data pipelines, checkpointing, and a clear set of acceptance criteria for verifying that training actually completes — including a working 400-step run from start to finish.
1. Background and Goals
The hardest part of large language model training usually isn’t single-GPU compute — it’s coordination across multiple machines. Once model parameters and training data exceed what one node can handle, the job must split computation across nodes, synchronize gradients, and persist checkpoints. A failure in any of these steps can halt the entire run at some intermediate step count.
The goal of this exercise was to validate a complete training pipeline on two machines with 16 accelerator cards in total, covering environment checks, distributed launch, data loading, parameter updates, and checkpoint saving — culminating in 400 consecutive training steps. “Running through” here means the workflow forms a closed loop: training executes end to end, state can be saved, and results can be verified. Simply getting the program to launch doesn’t count.
2. Cluster Topology and Environment Preflight Checks
The setup consists of two nodes, each with 8 accelerator cards, for 16 compute devices in total. Before launching training, confirm the following:
- Driver, firmware, and runtime library versions match across both nodes;
- The high-speed interconnect between nodes is bidirectionally reachable, with expected bandwidth and latency;
- Device numbering, visibility settings, and scheduling configuration are consistent on each node;
- Shared storage is mounted at the same path on both machines with identical read/write permissions.
Version mismatch is one of the most common pitfalls in multi-node training. A job that works fine on a single machine but hangs or produces inconsistent results after scaling out is usually a version problem. It’s a good idea to integrate these checks into the launch flow so the job terminates immediately if any check fails.
Example preflight logic (functions are placeholders):
def preflight_check(nodes, expected_driver):for node in nodes:info = query_node_info(node) # read driver and device infoif info["driver"] != expected_driver:raise RuntimeError(f"{node} driver version mismatch: {info['driver']}")if info["device_count"] != 8:raise RuntimeError(f"{node} unexpected device count: {info['device_count']}")check_bidirectional_connectivity(nodes) # verify bidirectional connectivity between nodescheck_shared_path(nodes, "/shared/ckpt") # verify shared path consistencyreturn True
3. Aligning the Software Stack
The software stack for multi-node training includes the deep learning framework, accelerator drivers, the underlying collective communication library, and the training code itself. These components are version-coupled, so choose combinations according to the hardware vendor’s compatibility matrix. Recommended approach:
- Pin versions first — maintain a locked manifest recording the exact version of every component;
- Validate forward computation, backward propagation, and a single optimizer step on one machine, confirming operator outputs and precision behavior are correct;
- Then scale to two nodes, changing only one variable at a time so problems are easy to trace.
Environment variables also need unified management. Distributed launch typically depends on the master node address, communication port, global process count, and process rank. These values should be injected by the launcher rather than hardcoded. This way, the same code runs at different scales, and configuration is easy to audit when troubleshooting.
4. Parallelism Strategy and Process Mapping
How you partition 16 GPUs determines the communication pattern. A common approach combines data parallelism with model parallelism:
| Parallelism | Purpose | Communication pattern |
|---|---|---|
| Data parallel | Different processes handle different samples | Gradient aggregation; volume scales with parameter count |
| Tensor parallel | Splits individual layer weights across cards | Frequent intra-layer communication; requires fast links |
| Pipeline parallel | Splits layers into stages | Activates pass between stages; watch for pipeline bubbles |
Inter-node bandwidth is usually lower than intra-node bandwidth, so a safer mapping is: keep tensor parallelism within the 8 GPUs of a single node, and use only data parallelism or stage-to-stage communication across nodes. Every process should know its global rank, local rank, and parallel group membership, and print a full mapping table at launch to make grouping errors easy to spot.
5. Data Pipeline
Data loading is often overlooked. If data loading can’t keep up with compute, accelerators sit idle waiting for batches and utilization drops noticeably. Three things to watch in practice:
- Each process reads a non-overlapping data shard, so the same samples aren’t trained on repeatedly;
- Data prefetching overlaps with computation; tune prefetch queue depth based on per-step latency;
- Data shuffling seeds derive from the global rank, so sample order is reproducible after a restart.
6. Training Loop and State Saving
The training loop needs to handle three kinds of events: normal parameter updates, anomalous gradients, and periodic saving.
Before and after each update, check that the loss is a finite number. If a non-finite value appears, skip that step and log it, preventing bad values from contaminating the parameters. Checkpoints must save model parameters, optimizer state, learning rate scheduler state, RNG state, and the current step count together. Saving only parameters causes the loss curve to break after a resume and fail to align with the original run.
Example training loop (functions are placeholders):
for step in range(start_step, total_steps):batch = next(data_iter)loss = train_one_step(model, batch, optimizer)if not is_finite(loss):log_warning(step, "non-finite loss, skipping step")continueif step % save_interval == 0 and rank == 0:save_checkpoint(model, optimizer, scheduler, step)barrier() # global sync, ensure all processes move to the next step
7. How to Judge “400 Steps Completed”
“Completed” needs explicit criteria, otherwise the conclusion can’t be verified. This run used four acceptance conditions:
- The step counter increments continuously to 400, with no rollback or skipped steps;
- Every process logs up to step 400, with no process becoming unresponsive;
- Loss values remain finite throughout, with no multiple consecutive steps skipped;
- Checkpoints are written on schedule, and training can resume from an intermediate checkpoint and continue to the same step count.
The first condition alone isn’t sufficient proof that training is healthy. All processes could hang after some step while the counter remains at a stale value. Timeout detection and heartbeat logs are therefore just as important. This article doesn’t report specific throughput or convergence metrics — when reproducing, rely on measurements from your own environment.
8. Troubleshooting Common Issues
Multi-node training failures tend to fall into a few categories:
- Launch hangs: Usually caused by occupied ports, master node address resolution errors, or a process that never started on one node. Check process counts and connectivity on all nodes first.
- Out of memory: Reduce per-GPU micro-batch size, use gradient accumulation to maintain the effective batch size, or enable activation recomputation to trade compute for memory.
- Loss anomalies: Check whether learning rate warmup is reasonable, whether mixed-precision loss scaling is working, and whether anomalous samples have crept into the data.
- Uneven speed: When one node is visibly slower than the others, common causes include thermal throttling, storage read bottlenecks, and network jitter. Benchmark each node individually to isolate the problem.
- Inconsistent results after resume: Most likely the RNG state or data reading position wasn’t fully saved.
Follow one rule when debugging: change only one condition at a time, and keep the original logs for comparison.
9. Engineering Recommendations
- Record environment versions, launch parameters, and code commit hashes together so experiments are reproducible.
- Wrap checks, training, saving, and acceptance into standardized scripts to reduce human-induced variation.
- Set up alerting for long-running jobs, covering training stalls, memory usage, disk space, and node status.
- Before the real long run, do a complete dry run of checkpoint saving and recovery at a smaller step count.
Success in multi-node, multi-GPU training depends largely on how well you control the engineering details. Completing 400 steps is just the starting point — from there, you’ll need systematic evaluation of throughput, stability, and convergence quality.
