NCCL Send/Recv Ring Test
A minimal, self-contained NCCL point-to-point benchmark that measures send/recv latency and bandwidth across GPUs in a ring topology
View on GitHubOverview
The NCCL Send/Recv Ring Test is a minimal NCCL point-to-point benchmark that measures send/recv latency and bandwidth across GPUs arranged in a ring topology. It is designed to run on AWS SageMaker HyperPod clusters with Slurm and EFA.
Why this exists
The repository already includes micro-benchmarks/nccl-tests/, which wraps NVIDIAβs nccl-tests suite (including sendrecv_perf). This standalone benchmark is a minimal, self-contained alternative β no nccl-tests build dependency, a single C file, and easy to modify. It is intended as a starting point for users who want to understand or extend NCCL send/recv patterns without pulling in the full suite.
What it does
Each MPI rank sends a 64 MB buffer to its right neighbour and receives from its left neighbour in a ring pattern using ncclSend/ncclRecv grouped calls. After a warm-up phase, it runs 100 timed iterations and reports average latency and bandwidth.
Prerequisites
- CUDA toolkit
- NCCL library
- MPI (OpenMPI is pre-installed on HyperPod at
/opt/amazon/openmpi) - At least 2 GPUs
Building
The Slurm script builds automatically before running. To build manually:
make
Override paths if needed:
make CUDA_HOME=/usr/local/cuda NCCL_HOME=/usr MPI_HOME=/opt/amazon/openmpi
The default paths and Makefile variable names are defined in the upstream
Makefile,
which is the source of truth for build configuration.
Running on SageMaker HyperPod (Slurm)
Submit the job:
sbatch run_nccl_test.sbatch
Monitor output:
squeue -u $USER
tail -f nccl_test_<jobid>.out
Customizing the Slurm job
Edit run_nccl_test.sbatch to adjust:
| Parameter | Default | Description |
|---|---|---|
--nodes | 2 | Number of nodes |
--ntasks-per-node | 8 | MPI ranks per node (one per GPU) |
--gpus-per-node | 8 | GPUs per node (8 for p4d/p5, 4 for p3dn) |
--partition | not set | Add if your cluster uses named partitions |
Running locally with mpirun
make
mpirun -np 2 ./nccl_sendrecv_test
Configuration
Compile-time constants in nccl_sendrecv_test.c:
| Define | Default | Description |
|---|---|---|
MSG_SIZE | 64 MB | Buffer size per send/recv |
ITERATIONS | 100 | Timed iterations |
WARMUP_ITERATIONS | 10 | Untimed warm-up iterations |
Example output
The values below are illustrative and will vary based on instance type, message size, and network conditions. This block reproduces the sample output shown in the upstream
README.md.
---------- NCCL Send/Recv Ring Test ----------
Ranks : 16
Message size : 67108864 bytes (64 MB)
Iterations : 100
Avg latency : 2.450 ms
Algo BW (1-dir) : 27.39 GB/s
Bidir throughput : 54.78 GB/s
-----------------------------------------------
Source
The filenames and defaults on this page match the upstream source directory
micro-benchmarks/nccl-sendrecv:
run_nccl_test.sbatch(--nodes=2,--ntasks-per-node=8,--gpus-per-node=8).Makefile(definesCUDA_HOME,NCCL_HOME, andMPI_HOME ?= /opt/amazon/openmpi).README.md, which documents theMSG_SIZE = 64 MB,ITERATIONS = 100, andWARMUP_ITERATIONS = 10compile-time constants and provides the illustrative example output reproduced above.