Multi-GPU Training
Single Node, Multiple GPUs (most common setup)
The container reads num_gpus from the config and passes --nproc_per_node=4 to torchrun. Each GPU runs one worker process. PyTorch DDP synchronises gradients across all workers after every mini-batch.
Single GPU
Or with CLI:
How Distributed Training Works
GNN phase:
- WholeGraph partitions the graph across all GPUs. Each GPU owns a shard of node feature tensors.
- During neighbourhood sampling, if a sampled neighbour is on a different GPU, WholeGraph fetches its features transparently over NVLink or PCIe.
- The GNN model is wrapped with PyTorch
DistributedDataParallel. Gradients are all-reduced using NCCL after each mini-batch. - Only rank 0 saves the final model weights.
XGBoost phase:
- XGBoost uses its built-in
RabitTrackerfor tree building. Each process holds a shard of the embedding data. - All GPUs collaborate on each tree (splits are computed across all shards simultaneously).
- Rank 0 saves the final booster to
output_dir/xgboost_fraud.json.
Multi-Node Multi-GPU (MNMG) — Slurm
For clusters managed by Slurm, the training container can be launched with srun across multiple nodes. Save the script below as e.g. slurm_train_ep.sh and submit with sbatch slurm_train_ep.sh.
Key parameters to configure:
How NPROC (workers per node) is resolved — first match wins:
num_gpus in config.yaml is ignored under Slurm. The entrypoint reads GPU count from SLURM_GPUS_ON_NODE (set automatically from --gpus-per-node). For single-node Docker runs, num_gpus is used instead.Submit training job: