Install gIB NCCL plugins

This page describes how to install NCCL/gIB with either Debian Software Packages (.deb) or the Red Hat Package Manager (.rpm). This installation lets you run NCCL workloads on A4X Max, A4X, A4, and A3 Ultra instances.

(For A4X Max) Update userspace libraries

On A4X Max, you must install the latest userspace libraries before running your NCCL workloads. If you're logged in as a root user, then omit sudo where it occurs to run the commands directly.

Debian 12+/Ubuntu 20.04+ (.deb package)

sudo apt update
sudo apt install curl

# Fetch DOCA OFED userspace and SDK libraries
export DOCA_URL="https://linux.mellanox.com/public/repo/doca/latest/ubuntu22.04/arm64-sbsa/"
export BASE_URL="https://linux.mellanox.com/public/repo/doca"
sudo mkdir -m 0755 -p /etc/apt/keyrings
sudo curl -fsSL "${BASE_URL}/public_keys/nvidia-doca-debian-gpg-public-key.gpg" -o /etc/apt/keyrings/nvidia-doca-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/nvidia-doca-keyring.gpg] ${DOCA_URL} ./" | sudo tee /etc/apt/sources.list.d/doca.list

# Prioritize DOCA packages over CUDA repo pins (such as mft)
printf 'Package: *\nPin: origin "linux.mellanox.com"\nPin-Priority: 700\n' | sudo tee /etc/apt/preferences.d/doca-pin-700

sudo apt update
sudo apt install doca-ofed-userspace libdoca-sdk-gpunetio-dev

# Upgrade to latest NCCL for best compatibility
sudo apt install --only-upgrade --allow-change-held-packages libnccl2 libnccl-dev

Install NCCL/gIB

Depending on where you run your workloads, you install NCCL/gIB in either the compute instance or the container image.

The nccl-gib package is bundled with an unmodified NVidia NCCL library (libnccl2.so) and headers. All NCCL/gIB content is installed to the /usr/local/gib directory, and the plugin libraries are also installed into system folder (under /usr/lib). Some dependencies are also fetched through the distribution's repositories.

Debian 12+/Ubuntu 20.04+ (.deb package)

# If on an image not from Google, trust the Google Cloud signing key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/cloud.google.gpg

# Add gpudirect-gib-apt repo
echo 'deb https://packages.cloud.google.com/apt gpudirect-gib-apt main' | sudo tee /etc/apt/sources.list.d/nccl-gib.list

sudo apt update
sudo apt install nccl-gib

RockyLinux/CentOS/RHEL 9+ (.rpm package)

# Add gpudirect-gib-rpm repo
sudo tee -a /etc/yum.repos.d/nccl-gib.repo << EOL
[gpudirect-gib-rpm]
name=NCCL/gIB
baseurl=https://packages.cloud.google.com/yum/repos/gpudirect-gib-rpm
enabled=1
repo_gpgcheck=0
gpgcheck=0

sudo dnf makecache
sudo dnf install nccl-gib

Install NCCL plugins

If you want to use your own custom version of NCCL Core instead of the NCCL library bundled in nccl-gib, then install the nccl-gib-plugins package. This package installs only Google's NCCL/gIB plugins and conflicts with nccl-gib, so installing one package automatically removes the other. If you use the NCCL version bundled with nccl-gib, then you don't need to install nccl-gib-plugins.

To install only the gIB NCCL plugins, install the nccl-gib-plugins package:

Debian 12+/Ubuntu 20.04+ (.deb package)

# If on an image not from Google, trust the Google Cloud signing key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/cloud.google.gpg

# Add gpudirect-gib-apt repo
echo 'deb https://packages.cloud.google.com/apt gpudirect-gib-apt main' | sudo tee /etc/apt/sources.list.d/nccl-gib.list

sudo apt update
sudo apt install nccl-gib-plugins

RockyLinux/CentOS/RHEL 9+ (.rpm package)

# Add gpudirect-gib-rpm repo
sudo tee -a /etc/yum.repos.d/nccl-gib.repo << EOL
[gpudirect-gib-rpm]
name=NCCL/gIB
baseurl=https://packages.cloud.google.com/yum/repos/gpudirect-gib-rpm
enabled=1
repo_gpgcheck=0
gpgcheck=0

sudo dnf makecache
sudo dnf install nccl-gib-plugins

If you use standard OS images, then you must also install the latest NVIDIA DOCA-OFED driver. You don't need to install this driver if you use Google's accelerator-optimized images, such as Container-Optimized OS or accelerator-optimized Ubuntu or Rocky Linux OS images.

To prevent compute instances from running mismatched versions of the NCCL/gIB package, update NCCL/gIB before you run your workloads and disable automatic package updates, such as unattended-upgrades on Ubuntu or Debian.

Upgrade NCCL Core on existing installations

If your VMs have an earlier nccl-gib package installed and you need a later NCCL Core version to support CUDA 13 or a specific framework version, then first check the x86 release notes or ARM64 release notes to see if the latest nccl-gib package includes the NCCL version that you need. If the latest nccl-gib package meets your requirements, then upgrade nccl-gib directly across all nodes.

If your workload requires a specific NCCL Core version that isn't bundled in nccl-gib, then perform the following steps on every node in your cluster so that all nodes run the exact same NCCL version:

  1. Install or upgrade your target NCCL Core packages from the NVIDIA CUDA repository and switch from nccl-gib to nccl-gib-plugins so that future package updates don't reinstall the bundled NCCL library. If your VM uses a standard OS image that doesn't include the NVIDIA CUDA repository, then add the repository first by following the NVIDIA NCCL installation guide.

    Debian 12+/Ubuntu 20.04+ (.deb package)

    sudo apt update
    sudo apt install -y nccl-gib-plugins libnccl2 libnccl-dev
    
    # If libnccl2 and libnccl-dev are held at an earlier version:
    sudo apt install --only-upgrade --allow-change-held-packages -y libnccl2 libnccl-dev

    RockyLinux/CentOS/RHEL 9+ (.rpm package)

    sudo dnf install --allowerasing -y nccl-gib-plugins libnccl libnccl-devel
    
    # If libnccl and libnccl-devel are already installed:
    sudo dnf upgrade -y libnccl libnccl-devel
  2. If your environment still has bundled libnccl.so* files in /usr/local/gib/lib64 or /usr/local/gib/lib from an earlier nccl-gib installation or container mount, then remove only those bundled libnccl.so* files so that they don't take priority over your upgraded NCCL Core library:

    sudo rm -f /usr/local/gib/lib*/libnccl.so*
    
  3. Verify your environment configuration and active NCCL version:

    • If LD_LIBRARY_PATH in your workload environment includes /usr/local/gib/lib64 or /usr/local/nvidia/lib64, then verify that those directories don't contain an earlier libnccl.so.2 file, or prepend your system library path, such as /usr/lib/x86_64-linux-gnu or /usr/lib64, to LD_LIBRARY_PATH.

    • If your custom NCCL Core version is earlier than 2.28.7, then source /usr/local/gib/scripts/set_nccl_env.sh before you run your workload, because the automatic environment plugin loads only on NCCL 2.28.7 or later.

    • Check the logged NCCL and gIB versions to confirm that your upgraded NCCL Core library and the NET/gIB plugin initialize together.

Enable NCCL/gIB

Starting from NCCL/gIB v1.1.2, if you installed nccl-gib or nccl-gib-plugins, NCCL/gIB should be automatically enabled in your workloads.

In previous versions, to enable NCCL/gIB in your workloads, ensure the following:

  • /usr/local/gib/scripts/set_nccl_env.sh is sourced in your runtime environment. The source file includes all the necessary environment variables for NCCL/gIB and Google expects to update them in future NCCL/gIB releases.
  • The /usr/local/gib/lib64 directory is in your LD_LIBRARY_PATH.

To verify NCCL/gIB is enabled, check that the following NCCL INFO level log entries are present:

# A sample log entry from NCCL core
vm-0:606:642 [6] NCCL INFO Using network gIB

# A sample log entry from the gIB network plugin
vm-0:606:642 [6] NCCL INFO NET/gIB : Initializing gIB v1.1.2

What's next