Scaling LLM Training to 16 China-Made GPUs Across Two Nodes: A Practical Walkthrough
This article describes how a two-node, 16-accelerator setup ran a 400-step large model training job. It covers topology planning, environment consistency, parallelism choices, launch configuration, stability safeguards, validation steps, and common troubleshooting approaches.
1. Background and Goals
When large model training scales from a single machine to multiple machines, the bottleneck is usually not the model itself. It lies in communication between nodes, differences in environments, and failure recovery. Getting the training pipeline to run end to end means that environment setup, job launch, data loading, model saving, and log output all run reliably. A single forward pass does not meet that standard.
This practice ran training on two servers with eight accelerator cards each, for 16 cards in total. The goal was to run the job continuously for 400 steps and confirm that training was stable, reproducible, and recoverable.
2. Hardware and Network Topology Planning
Topology is the first step in multi-node training. Accelerator cards within one machine communicate over high-speed interconnects, while cross-machine communication depends on network bandwidth and latency. The performance gap between these two types of links is often large, so the parallelism strategy should keep communication-heavy operations within a single machine.
During planning, confirm the following:
- The number of accelerator cards per machine, their memory capacity, and how the cards are interconnected;
- The network interface type, bandwidth, and topology between nodes, including whether a switch could become a bottleneck;
- Whether the storage mount paths are the same on every node, and whether all nodes can access the data and checkpoints;
- Whether the node clocks are synchronized. Without synchronization, log timelines are hard to align.
3. Software Environment Consistency
Most failures in multi-node training come from inconsistent environments. If two machines differ in driver version, communication library version, or dependency package version, the job may hang during initialization, time out during communication, or produce inconsistent results.
We recommend the following practices:
- Deploy all nodes from the same image or the same dependency manifest;
- Before launch, check the driver version, runtime version, and key library versions on each node;
- Fix random seeds and data loading order so that results from different runs can be compared;
- Record a complete environment snapshot, including environment variables and launch arguments, to use as a reference for later debugging.
4. Parallelism Strategy
At a scale of 16 cards, training usually combines several parallelism methods:
- Data parallelism: Each card holds a full copy of the model, processes a different batch of data, and synchronizes gradients after backpropagation. Gradient synchronization across machines is the main communication cost.
- Tensor parallelism: The weights of a single layer are split across multiple cards for computation. Communication is frequent, so it is best placed among cards within the same machine.
- Pipeline parallelism: The model is split by layers across different devices, and micro-batches keep the pipeline filled. This suits models with many layers that do not fit on a single card, but it introduces pipeline bubble overhead.
A common approach is to use tensor parallelism within each machine and data parallelism across machines. With two machines of eight cards each, the tensor parallel degree can be set to 8 and the data parallel degree to 2. The exact configuration needs repeated validation based on the model architecture, memory usage, and network bandwidth.
5. Launch Configuration Example
Multi-node launch depends on assigning each process a globally unique rank and telling every process the address of the master node. The following configuration uses environment variables. Run it once on each of the two machines:
# Node 0 (master node)export NNODES=2export GPUS_PER_NODE=8export NODE_RANK=0export MASTER_ADDR=10.0.0.1export MASTER_PORT=29500export WORLD_SIZE=$((NNODES * GPUS_PER_NODE))# Node 1export NODE_RANK=1# All other variables stay the same as on Node 0
The training script can read these variables to initialize the process group:
import osdef build_dist_config():world_size = int(os.environ["WORLD_SIZE"])node_rank = int(os.environ["NODE_RANK"])gpus_per_node = int(os.environ["GPUS_PER_NODE"])master_addr = os.environ["MASTER_ADDR"]master_port = os.environ["MASTER_PORT"]config = {"world_size": world_size,"master_addr": master_addr,"master_port": master_port,"gpus_per_node": gpus_per_node,"node_rank": node_rank,}assert world_size == config["gpus_per_node"] * int(os.environ["NNODES"]), \"WORLD_SIZE does not match the number of nodes times the number of cards per node"return config
An assertion check before launch exposes configuration errors early and prevents the job from hanging for a long time during initialization.
6. Training Stability Safeguards
During a 400-step run, stability matters more than the speed of any single step. The following mechanisms should be designed in advance.
Checkpoint strategy: Save the model parameters, optimizer state, and data reading position at a fixed step interval. Write checkpoints to storage that all nodes can access, and keep several recent versions so that an interrupted write does not leave a corrupted file.
Resumable training: When resuming, restore both the random state and the data iteration position. Otherwise, the data order after resuming will differ from the original run, and the results cannot be compared.
Anomaly detection: Monitor whether the loss becomes NaN or spikes suddenly, whether the gradient norm behaves abnormally, and whether the time per step fluctuates noticeably. When an anomaly appears, stop the job immediately and preserve the state for investigation instead of continuing to consume compute.
Logging and monitoring: Each node writes its own log, and every entry carries the node ID and process ID. Monitoring metrics include memory usage per card, the share of time spent on communication, and data loading wait time.
7. 400-Step Validation Method
Validation should confirm that the training pipeline is complete and controllable, not just that the job finished. Check the following dimensions:
- Launch phase: Whether all 16 processes finish initialization, and whether any process waits for an unusually long time;
- Training phase: Whether the loss curve decreases within a reasonable range, and whether NaN values or abnormal jumps appear;
- Resource phase: Whether memory usage on each card stays stable, and whether the load is noticeably unbalanced;
- Wrap-up phase: Whether checkpoints are fully written, and whether training can resume normally from an intermediate checkpoint.
To compare the efficiency of different configurations, keep the batch size, sequence length, and dataset fixed, change only one variable at a time, and run each configuration several times. This prevents random fluctuations from being mistaken for real differences.
8. Common Issues and Troubleshooting
- Hanging during initialization: Usually the master node address or port is unreachable, or an environment variable is not set on one of the nodes. Check network connectivity with basic tools first, then review the launch parameters.
- Communication timeouts: These can result from network jitter, a faulty card, or uneven load across nodes. Test communication performance on each node separately to identify the slow node.
- Out-of-memory errors: Check the batch size, the activation recomputation settings, and how the optimizer state is sharded.
- Inconsistent results: Verify the random seeds, data order, and floating-point precision settings, and confirm that every run receives identical inputs.
9. Summary
Getting the training pipeline to run across multiple machines and multiple cards depends on three things: topology planning that matches communication characteristics, environment configuration that stays consistent across all nodes, and stability mechanisms that cover checkpoints, resumable training, and anomaly detection. Completing 400 steps of continuous training is itself a meaningful test of the full pipeline. From here, the next steps include adding performance benchmarks, scaling up the cluster, and improving automated monitoring, so that a one-time practice becomes a stable training workflow.
