NVIDIA/nccl-tests

NCCL Tests

What it is

NVIDIA/nccl-tests is a test suite for NCCL, the GPU communication library these tests exercise. The README says the tests check both the performance and the correctness of NCCL operations.

Building

  • Run make or make -j to build.
  • If CUDA is not in /usr/local/cuda, set CUDA_HOME.
  • If NCCL is not in /usr, set NCCL_HOME.
  • To use MPI for multi-process / multi-node runs, build with MPI=1 and set MPI_HOME.
  • If MPI headers are in a non-standard location, set MPI_INCLUDE.
  • You can add a suffix to generated binaries with NAME_SUFFIX, e.g. NAME_SUFFIX=_mpi produces all_reduce_perf_mpi.

Example:

make MPI=1 MPI_HOME=/path/to/mpi CUDA_HOME=/path/to/cuda NCCL_HOME=/path/to/nccl

How running works

NCCL tests can run with:

  • multiple processes,
  • multiple threads per process,
  • multiple CUDA devices per thread.

The total number of ranks (CUDA devices) is:

(number of processes) × (number of threads) × (number of GPUs per thread)

Quick examples

Single process, 8 GPUs, scanning sizes from 8 bytes to 128 MiB, doubling each step:

./build/all_reduce_perf -b 8 -e 128M -f 2 -g 8

With MPI, 64 processes across 8 nodes, 1 GPU per process:

mpirun -np 64 -N 8 ./build/all_reduce_perf -b 8 -e 8G -f 2 -g 1

Without MPI, you can still launch multiple processes by setting the same NCCL_COMM_ID and giving each process a rank:

NCCL_COMM_ID=node0:45678 NCCL_TESTS_COMM_NRANKS=2 NCCL_TESTS_COMM_RANK=0 ./build/all_reduce_perf -b 8 -e 128M -g 1
NCCL_COMM_ID=node0:45678 NCCL_TESTS_COMM_NRANKS=2 NCCL_TESTS_COMM_RANK=1 ./build/all_reduce_perf -b 8 -e 128M -g 1

NCCL_COMM_ID uses NCCL's native <host>:<port> format. IPv6 addresses use brackets, e.g. [2001:db8::1]:45678.

Some launcher-provided variables are also recognized, such as SLURM_PROCID, PMI_RANK, OMPI_COMM_WORLD_RANK, and RANK/WORLD_SIZE. Explicit NCCL_TESTS_COMM_RANK and NCCL_TESTS_COMM_NRANKS take priority.

There is also a SLURM helper script, scripts/slurm-nccl-tests.sh, and a Kubernetes example in examples/kubernetes.yaml.

Main test arguments

The collective performance tests share a common set of options:

  • GPUs / threads: -t threads per process, -g GPUs per thread.
  • Size scan: -b minimum bytes, -e maximum bytes, -i fixed increment, or -f multiplication factor.
  • NCCL operation: -o reduction operation (sum, prod, min, max, avg, all), -d datatype, -r root.
  • Performance: -n iterations, -w warmup iterations, -m aggregated operations per iteration, -N run cycles, -a averaging mode, -I per-iteration timing.
  • Correctness: -c check iteration count; checking results can be slow on many GPUs.
  • Blocking / graphs: -z blocking mode, -G CUDA graph capture.
  • Output: -J JSON output file, -S timestamps on report lines, -T timeout, -M memory usage report, -U NCCL tuning report.

Defaults are listed in the README; for example, default minimum and maximum size is 32M, default iteration count is 20, and default warmup is 1.

Running multiple operations in parallel

You can split GPUs into smaller groups, each running the same operation, using the NCCL_TESTS_SPLIT environment variable.

Syntax:

<operation><value>

where operation is AND, OR, MOD, or DIV (symbols &, |, %, / also work). Values can be decimal, hex (0x), or binary (0b).

Examples from the README:

  • NCCL_TESTS_SPLIT="AND 0x7" or NCCL_TESTS_SPLIT="MOD 8" — on 8-GPU systems, run 8 parallel operations with 1 GPU per node.
  • NCCL_TESTS_SPLIT="OR 0x7" or NCCL_TESTS_SPLIT="DIV 8" — run one operation per node.
  • NCCL_TESTS_SPLIT="AND 0x1" or NCCL_TESTS_SPLIT="MOD 2" — run two operations, each using every other rank.

NCCL_TESTS_SPLIT_MASK="<value>" is equivalent to NCCL_TESTS_SPLIT="&<value>".

This split mode is currently supported only for MPI launches. Reported bandwidth is per group, so multiply by the number of groups to get total bandwidth.

Other included tools

  • comm_ops_perf — benchmarks NCCL communicator init, split, shrink, and grow latency. Requires MPI=1.
  • device_api/gin — microbenchmarks for NCCL GIN point-to-point device API operations. Requires MPI=1, NCCL 2.30.7 or newer, and exactly 2 ranks.
  • device_api/dsl — CuTe DSL microbenchmarks for GIN put and LSACopy. Requires NCCL4Py, CuPy, MPI, and exactly two ranks.

Each has its own README with full details.

License

NCCL tests are provided under the BSD license. Copyright (c) 2016-2026, NVIDIA CORPORATION.

Related

  • Project
  • Project
  • Project
  • Project
  • Project