Establishing Large Model Training Pipelines on Emerging Hardware Accelerators: A 2-Node, 16-Card Setup

    Migrating large model training to alternative hardware accelerator platforms often presents challenges in driver compatibility, operator support, and distributed communication stability. This article details the engineering practice of establishing a complete training pipeline across a 2-node, 16-card setup. It covers overall architecture design, environment preparation, software stack adaptation, and distributed training configuration. By defining clear verification milestones—specifically a stable 400-step training run—this guide provides a systematic approach to troubleshooting and validating multi-node training links on new accelerator platforms.

    I. Background and Challenges

    Large model training has long relied on a few dominant hardware ecosystems. When teams migrate training tasks to other accelerator platforms, they typically encounter three types of problems.

    First, compatibility of underlying drivers and runtimes. The accelerator driver version, device runtime, and container images must match. Any version deviation can lead to device recognition failures or difficult-to-locate runtime anomalies.

    Second, completeness of operator and framework support. Training relies on numerous operators, including matrix multiplication, normalization, attention computation, and mixed-precision conversion operators. If an operator lacks an efficient implementation, training may degrade to an inefficient path or fail directly.

    Third, stability of distributed communication. In dual-node scenarios, inter-node network topology, communication library configurations, and process group partitioning affect whether training can successfully enter multi-step iterations. Single-node success does not guarantee multi-node viability, a fact often underestimated during migration.

    Therefore, the term “making it work” needs a clear engineering definition. This article breaks it down into three verifiable milestones: the device can be scheduled normally, single-step forward and backward computations can be completed stably, and multi-node, multi-card training runs without interruption for a specified number of steps while maintaining a complete training workflow.

    II. Overall Architecture Design

    This practice utilizes a topology of two compute nodes and a total of 16 accelerator cards. With 8 cards per node, the global process count is 16, with each process bound to a single card.

    The entire pipeline is divided into four layers:

    • Infrastructure Layer: Physical nodes, high-speed interconnect network, shared storage.
    • Runtime Layer: Accelerator drivers, device runtime, communication libraries.
    • Framework Layer: Deep learning training framework and adaptation plugins, responsible for operator scheduling and distributed parallel strategies.
    • Application Layer: Data loading, model definition, training loop, checkpoint saving, and log output.

    During design, versions at each layer should be independently locked. Locking versions narrows down problem localization to a single layer. For example, if numerical anomalies occur around step 200, the team can first roll back the application layer’s learning rate scheduler, then investigate the framework layer’s mixed-precision logic, rather than modifying multiple layers simultaneously.

    III. Environment Preparation and Driver Stack Verification

    Environment preparation is the most time-consuming yet most rewarding phase of migration. Verification should proceed in the following order.

    1. Device Visibility Check

    On each node, confirm that all accelerator cards are recognized by the system, and check device status, memory capacity, and temperature. If individual cards are missing, investigate physical connections and driver loading first, rather than modifying training code directly.

    1. # Example: Check accelerator card count and status node by node
    2. for node in node01 node02; do
    3. ssh "$node" "accel-smi --list && accel-smi --status"
    4. done

    Here, accel-smi is a placeholder command; the actual tool name depends on the management command provided by the platform.

    2. Version Matrix Recording

    Compile driver versions, runtime versions, communication library versions, framework versions, and image tags into a table. Update this table with every change and archive it alongside training logs. The version matrix is the foundational material for reproducing issues.

    3. Single-Card Smoke Test

    Run a minimal-scale model on a single card, executing several forward and backward passes to confirm that output values are finite and contain no illegal values. Single-card tests eliminate most communication-related interference, making them an ideal first checkpoint.

    4. Dual-Node Connectivity Test

    Perform basic network probing between the two nodes and run the collective communication test program included with the communication library. Tests should cover common operations like all-reduce, all-gather, and broadcast, recording bandwidth and latency to provide a baseline for subsequent performance analysis.

    IV. Software Stack Adaptation

    The core of software stack adaptation is enabling the training framework to correctly call the target accelerator’s operator implementations. In practice, this can be advanced in three steps.

    Operator Inventory Compilation

    Start from the model structure and list the operators actually used during training. Export operator call records through a complete forward and backward trace. For each operator, mark its support status: natively supported, requires replacement with an equivalent implementation, or requires custom implementation.

    Precision Strategy Alignment

    Mixed-precision training is sensitive to numerical ranges. If the target platform’s support for a specific low-precision format differs from the reference platform, adjust the initial value and growth strategy of loss scaling, and retain higher precision for critical layers. This adjustment should be verified through comparative experiments rather than empirical settings.

    Kernel Fallback Mechanism

    When an operator lacks an efficient implementation on the target platform, a fallback path can be designed: attempt the platform-specific kernel first, switch to a generic implementation upon failure, and log the fallback event. The frequency of fallback events is a crucial metric for evaluating migration quality. Frequent fallbacks indicate that corresponding operators need to be prioritized for completion.

    V. Distributed Training Configuration

    Configuring a 2-node, 16-card training setup involves parallel strategies and process topology.

    Parallel Strategy Selection

    For large-scale models, combining data parallelism and model parallelism is typically required. Data parallelism distributes different batches of data to each process, while model parallelism splits the parameters of a single layer or module across multiple cards. The combination ratio of these two strategies determines the balance between communication volume and memory usage.

    Taking 16 cards as an example, a common partitioning method is using 8 cards as a model parallel group, with data parallelism between the two groups. This concentrates intra-group communication on high-speed links within the node, and cross-node communication only occurs during the gradient synchronization phase of data parallelism, reducing cross-machine communication pressure.

    Launch Parameters Example

    The following script illustrates the basic structure for dual-node launch. Environment variables and parameter names are generic conventions; specific values should be filled according to the actual cluster.

    1. #!/bin/bash
    2. # Node 0 is the master node, Node 1 is the worker node
    3. export MASTER_ADDR=10.0.0.10
    4. export MASTER_PORT=29500
    5. export WORLD_SIZE=16
    6. export NNODES=2
    7. export NPROC_PER_NODE=8
    8. # Execute on each node, set NODE_RANK to 0 and 1 respectively
    9. export NODE_RANK=${NODE_RANK:-0}
    10. python train.py \
    11. --model-config configs/model.yaml \
    12. --train-data /shared/data/train \
    13. --global-batch-size 256 \
    14. --micro-batch-size 4 \
    15. --max-steps 400 \
    16. --checkpoint-dir /shared/ckpt \
    17. --log-interval 10

    The global batch size and micro-batch size in the script must be evenly divisible. If they do not match, the gradient accumulation steps will yield fractional values, causing training to fail at startup.

    Initialization Order

    The process group should be initialized before model construction. The recommended initialization logic is as follows, with function names used as placeholders:

    1. def main():
    2. # 1. Determine global rank and local device number based on environment variables
    3. rank, world_size, local_rank = read_dist_env()
    4. # 2. Bind to the local accelerator card to prevent multiple processes from competing for the same card
    5. bind_device(local_rank)
    6. # 3. Establish the process group and wait for all nodes to be ready
    7. init_distributed_group(rank=rank, world_size=world_size)
    8. # 4. Build the model and wrap it as a parallel module
    9. model = build_model(config)
    10. model = wrap_parallel(model, tp_size=8, dp_size=2)
    11. # 5. Enter the training loop
    12. train_loop(model, max_steps=400)

    The device binding step is easily overlooked. If multiple processes point to the same card, the program may fail during memory allocation, often with unintuitive error messages that require reverse-engineering through device numbers in the logs.

    VI. Training Stability and 400-Step Verification

    Whether training can progress to 400 steps depends on three aspects: numerical stability, continuous communication availability, and checkpoint reliability.

    Numerical Monitoring

    Record the loss value, gradient norm, and learning rate at fixed step intervals. If the loss becomes non-finite or the gradient norm suddenly amplifies by several orders of magnitude within a short period, pause training immediately and save the state. A normal training curve should generally trend downward, allowing for minor fluctuations but without cliff-like jumps.

    Communication Health Check

    Set periodic synchronization points in the training loop to verify that all processes arrive on time. If a process on a node is unresponsive for an extended period, it usually indicates network jitter, device hang, or process deadlock. It is recommended to set a timeout threshold; upon timeout, log the latest progress of each node to facilitate locating the slow node.

    Checkpoint Strategy

    Save checkpoints at steps 100, 200, 300, and 400, and record the corresponding random seeds and data read positions. Checkpoint saving should use atomic writes—writing to a temporary file first, then renaming it upon completion—to avoid corrupted files due to interruptions.

    Verification Criteria

    After reaching 400 steps, the following conditions must be met simultaneously: all processes exit normally, no unhandled exceptions exist in the logs, checkpoints can be reloaded, and the forward computation output after reloading matches the output before saving. Only when all four conditions are satisfied can the training pipeline be considered closed-loop.

    VII. Common Issue Troubleshooting

    Most issues encountered during migration fall into the following categories.

    Device Initialization Failure

    Usually caused by mismatched driver and runtime versions. Check the version matrix first to confirm they are within the officially supported compatibility range, then verify that device mapping inside and outside the container is complete.

    Multi-Node Startup Hang

    In most cases, this is due to incorrect master node address or port configuration, or a firewall blocking inter-process communication. Test the connectivity of the master node port from the worker node using basic network tools before launching training.

    Out of Memory (OOM)

    Try the following in order: reduce the micro-batch size, enable activation recomputation, adjust the model parallelism split ratio, and enable gradient checkpointing. Change only one item at a time and record the memory usage changes.

    Numerical Anomalies Mid-Training

    Prioritize checking whether learning rate warmup is sufficient, whether the loss scaling for mixed precision is too large, and whether anomalous samples exist in the data. Data issues are often overlooked; a statistical check of the data before training is recommended.

    VIII. Summary and Recommendations

    Completing 2-node, 16-card training on a new accelerator platform requires breaking down “making it work” into verifiable stages and establishing clear inspection standards for each stage.

    The following recommendations can be followed in practice:

    • Record the version matrix from day one and update it with every change.
    • Verify progressively from single-card to single-node to dual-node; do not skip any level.
    • Manage operator support status explicitly; count fallback events and include them in evaluations.
    • Use atomic writes for checkpoints and perform periodic reload verifications.
    • Save training logs to shared storage uniformly to facilitate cross-node timeline alignment.

    Advancing 2-node, 16-card training to 400 steps indicates that the main components of the training pipeline are connected. Subsequent work can focus on throughput optimization, long-term stability testing, and scaling to larger sizes. Every step should be judged based on measured data, avoiding configuration adjustments based solely on experience.