Installing cuDNN on Linux

Prerequisites

For the latest compatibility software versions of the OS, NVIDIA CUDA, the CUDA driver, and the NVIDIA hardware, refer to the cuDNN Support Matrix.

Installing NVIDIA Graphics Drivers

Install up-to-date NVIDIA drivers on your Linux system.

  1. Go to: NVIDIA drivers.

  2. Select the GPU and OS version from the drop-down menus.

  3. Download and install the NVIDIA graphics driver as indicated on that web page. For more information, select the ADDITIONAL INFORMATION tab for step-by-step instructions for installing a driver.

  4. Restart your system to ensure that the graphics driver takes effect.

Installing the CUDA Toolkit for Linux

Refer to the following instructions for installing CUDA on Linux, including the CUDA driver and toolkit: NVIDIA CUDA Installation Guide for Linux.

Installing on Linux

cuDNN can be installed using either distribution-specific packages (RPM and Debian packages), or a distribution-independent package (Tarballs).

The distribution-independent package has the advantage of working across a wider set of Linux distributions, but does not update the distribution’s native package management system. The distribution-specific packages interface with the distribution’s native package management system. It is recommended to use the distribution-specific packages, where possible.

Package Manager Installation

Installation using RPM or Debian packages interfaces with your system’s package management system. If the online network repository is enabled, RPM or Debian packages will be automatically downloaded at installation time using the package manager: apt-get or dnf. When using RPM or Debian local repo installers, the downloaded package contains a repository snapshot stored on the local filesystem in /var/. Such a package only informs the package manager where to find the actual installation packages, but will not install them.

Package Manager Network Installation

Ubuntu/Debian Network Installation
  1. Enable the network repository. Perform the steps described in the NVIDIA CUDA Installation Guide for Ubuntu or the NVIDIA CUDA Installation Guide for Debian.

    For the $distro/$arch noted in the above links, refer to the cuDNN Support Matrix for the $distro/$arch supported versions, as cuDNN’s Support Matrix might differ from CUDA.

    Where $distro/$arch should be replaced by one of the following:

    • ubuntu2004/x86_64

    • ubuntu2004/sbsa

    • ubuntu2004/cross-linux-sbsa

    • ubuntu2004/arm64

    • ubuntu2004/cross-linux-aarch64

    • ubuntu2204/x86_64

    • ubuntu2204/sbsa

    • ubuntu2204/cross-linux-sbsa

    • ubuntu2204/arm64

    • ubuntu2204/cross-linux-aarch64

    • debian11/x86_64

    • debian12/x86_64

    For arm64-sbsa repos:

    • Native: $distro/sbsa

    • Cross: $distro/cross-linux-sbsa

    For aarch64-jetson repos:

    • Native: $distro/arm64

    • Cross: $distro/cross-linux-aarch64

  2. Refresh the repository metadata.

    sudo apt-get update
    
  3. Install the per-CUDA meta-packages.

    To install for CUDA 11, run:

    sudo apt-get -y install cudnn9-cuda-11
    

    To install for CUDA 12, run:

    sudo apt-get -y install cudnn9-cuda-12
    

Note

  • Only one CUDA toolkit version of cuDNN 9 can be installed at a time.

  • On supported platforms, the cudnn9-cross-sbsa and cudnn9-cross-aarch64 meta-packages install all the packages required for cross-platform development to SBSA (arm64-sbsa) and ARMv8 (aarch64-jetson), respectively.

    • Cross arm64-sbsa for CUDA 11:

      sudo apt-get -y install libcudnn9-cross-sbsa-cuda-11
      
    • Cross arm64-sbsa for CUDA 12:

      sudo apt-get -y install cudnn9-cross-sbsa
      
    • Cross aarch64-jetson for CUDA 12:

      sudo apt-get -y install cudnn9-cross-aarch64
      
RHEL 9/Rocky 9 and RHEL 8/Rocky 8 Network Installation
  1. Enable the repository.

    sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-$distro.repo
    sudo dnf clean all
    

    Where $distro/$arch should be replaced by one of the following:

    • rhel8/x86_64

    • rhel8/sbsa

    • rhel9/x86_64

    • rhel9/sbsa

    Note

    For Rocky users, only the following is supported.

    • For Rocky 8, rhel8/x86_64.

    • For Rocky 9, rhel9/x86_64.

  2. Install the per-CUDA meta-packages.

    To install for CUDA 11, run:

    sudo dnf -y install --allowerasing cudnn9-cuda-11
    

    To install for CUDA 12, run:

    sudo dnf -y install --allowerasing cudnn9-cuda-12
    

Note

Only one CUDA toolkit version of cuDNN 9 can be installed at a time.

Package Manager Local Installation

Ubuntu/Debian Local Installation

Note

Before issuing the following commands, you must replace 9.x.y, $distro, and $architecture with your respective cuDNN version, OS distribution, and platform architecture.

Where $distro is one of the following:

  • ubuntu2004

  • ubuntu2204

  • debian11

  • debian12

And $architecture is one of the following:

  • For Ubuntu 22.04/20.04:

    • amd64

    • arm64

  • For Debian 11/12:

    • amd64

  1. Download the Debian package either from the developer website or through wget.

    1. The local Debian package is available at https://developer.nvidia.com/cudnn. Click on the green buttons that describe your target platform and choose Deb (local) as the installer type.

    2. Or, run:

      wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-$distro-9.x.y_1.0-1_$architecture.deb
      

      Note

      For Ubuntu users, the following commands are specific to the SBSA (arm64-sbsa) and ARMv8 (aarch64-jetson) platforms.

      • Native arm64-sbsa:

        wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-$distro-9.x.y_1.0-1_arm64.deb
        
      • Cross arm64-sbsa:

        wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-cross-sbsa-$distro-9.x.y_1.0-1_all.deb
        
      • Native aarch64-jetson:

        wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-tegra-repo-$distro-9.x.y_1.0-1_arm64.deb
        
      • Cross aarch64-jetson:

        wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-cross-aarch64-$distro-9.x.y_1.0-1_all.deb
        
  2. Navigate to your downloads directory containing the cuDNN Debian local installer file.

  3. Enable the local repository.

    sudo dpkg -i cudnn-local-repo-$distro-9.x.y_1.0-1_$architecture.deb
    

    Note

    For Ubuntu users, the following commands are specific to the SBSA (arm64-sbsa) and ARMv8 (aarch64-jetson) platforms.

    • Native arm64-sbsa:

      sudo dpkg -i cudnn-local-repo-$distro-9.x.y_1.0-1_arm64.deb
      
    • Cross arm64-sbsa:

      sudo dpkg -i cudnn-local-repo-cross-sbsa-$distro-9.x.y_1.0-1_all.deb
      
    • Native aarch64-jetson:

      sudo dpkg -i cudnn-local-tegra-repo-$distro-9.x.y_1.0-1_arm64.deb
      
    • Cross aarch64-jetson:

      sudo dpkg -i cudnn-local-repo-cross-aarch64-$distro-9.x.y_1.0-1_all.deb
      
  4. Import the CUDA GPG key.

    sudo cp /var/cudnn-local-*/cudnn-*-keyring.gpg /usr/share/keyrings/
    
  5. Refresh the repository metadata.

    sudo apt-get update
    
  6. Install the per-CUDA meta-packages.

    To install for CUDA 11, run:

    sudo apt-get -y install cudnn9-cuda-11
    

    To install for CUDA 12, run:

    sudo apt-get -y install cudnn9-cuda-12
    

Note

  • Only one CUDA toolkit version of cuDNN 9 can be installed at a time.

  • For Ubuntu users, the following commands are specific to the SBSA (arm64-sbsa) and ARMv8 (aarch64-jetson) platforms.

    • Cross arm64-sbsa for CUDA 11:

      sudo apt-get -y install libcudnn9-cross-sbsa-cuda-11
      
    • Cross arm64-sbsa for CUDA 12:

      sudo apt-get -y install cudnn9-cross-sbsa
      
    • Cross aarch64-jetson for CUDA 12:

      sudo apt-get -y install cudnn9-cross-aarch64
      
RHEL 9/Rocky 9 and RHEL 8/Rocky 8 Local Installation

Note

Before issuing the following commands, you must replace 9.x.y, $distro, and $architecture with your respective cuDNN version, OS distribution, and platform architecture.

Where $distro is one of the following:

  • For RHEL 9/Rocky 9:

    • rhel9

  • For RHEL 8/Rocky 8:

    • rhel8

And $architecture is one of the following:

  • For RHEL 9:

    • x86_64

    • aarch64

  • For Rocky 9:

    • x86_64

  • For RHEL 8:

    • x86_64

    • aarch64

  • For Rocky 8:

    • x86_64

  1. Download the RPM package either from the developer website or through wget.

    1. The local RPM package is available at https://developer.nvidia.com/cudnn. Click on the green buttons that describe your target platform and choose RPM (local) as the installer type.

    2. Or, run:

      wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-$distro-9.x.y-1.0-1.$architecture.rpm
      

      Note

      For RHEL users, the following command is specific to the SBSA (arm64-sbsa) platform.

      • Native arm64-sbsa:

        wget https://developer.download.nvidia.com/compute/cudnn/9.x.y/local_installers/cudnn-local-repo-$distro-9.x.y-1.0-1.aarch64.rpm
        
  2. Navigate to your downloads directory containing the cuDNN RPM local installer file.

  3. Enable the local repository.

    sudo rpm -i cudnn-local-repo-$distro-9.x.y-1.0-1.$architecture.rpm
    

    Note

    For RHEL users, the following command is specific to the SBSA (arm64-sbsa) platform.

    • Native arm64-sbsa:

      sudo rpm -i cudnn-local-repo-$distro-9.x.y-1.0-1.aarch64.rpm
      
  4. Refresh the repository metadata.

    sudo dnf clean all
    
  5. Install the per-CUDA meta-packages.

    To install for CUDA 11, run:

    sudo dnf -y install --allowerasing cudnn9-cuda-11
    

    To install for CUDA 12, run:

    sudo dnf -y install --allowerasing cudnn9-cuda-12
    

Note

Only one CUDA toolkit version of cuDNN 9 can be installed at a time.

Additional Package Manager Capabilities

Meta-Packages

Meta-packages are RPM and Debian packages that contain no (or few) files but have multiple dependencies. They are used to install many cuDNN packages when you may not know the details of the packages you want.

cuDNN Meta-Packages

Meta-Package Name

cuDNN Version

CUDA Version

Intended Use Case

cudnn

9.1.0

12.4

Installs the latest available cuDNN for the latest available CUDA version.

cudnn9

9.1.0

12.4

Installs the latest available cuDNN 9 for the latest available CUDA version.

cudnn-cuda-12

9.1.0

12.4

Installs the latest available cuDNN for the latest available CUDA 12 version.

cudnn9-cuda-12

9.1.0

12.4

Installs the latest available cuDNN 9 for the latest available CUDA 12 version.

cudnn-cuda-11

9.1.0

11.8

Installs the latest available cuDNN for the latest available CUDA 11 version.

cudnn9-cuda-11

9.1.0

11.8

Installs the latest available cuDNN 9 for the latest available CUDA 11 version.

cudnn-cross-sbsa

9.1.0

12.4

Installs the latest available cuDNN for the latest available CUDA version meant for cross-platform development to SBSA.

cudnn9-cross-sbsa

9.1.0

12.4

Installs the latest available cuDNN 9 for the latest available CUDA version meant for cross-platform development to SBSA.

cudnn-cross-aarch64

9.1.0

12.4

Installs the latest available cuDNN for the latest available CUDA version meant for cross-platform development to ARMv8.

cudnn9-cross-aarch64

9.1.0

12.4

Installs the latest available cuDNN 9 for the latest available CUDA version meant for cross-platform development to ARMv8.

Note

The above table is true only when cuDNN 9.1.0 is the latest cuDNN. When 9.1.0 is no longer the latest, pin the cudnn9* package version to 9.1.0 explicitly to install cuDNN 9.1.0.

Tarball Installation

In an effort to meet the needs of a growing customer base requiring alternative installer packaging formats, as well as a means of input into community CI/CD systems, Tarballs are available for download.

Redist Archive

Tarballs are provided at https://developer.download.nvidia.com/compute/cudnn/redist/.

These .tar.xz archives do not replace existing packages such as .deb, .rpm, and are not meant for general consumption, as they are not installers.

For each release, a JSON manifest is provided such as redistrib_9.x.y.z.json, which corresponds to the cuDNN 9.x.y.z release label which includes the release date, the name of each component, license name, relative URL for each platform, and checksums.

Details on parsing these JSON files are described in Parsing Redistrib JSON.

Python Wheels - Linux Installation

NVIDIA provides Python Wheels for installing cuDNN through pip, primarily for the use of cuDNN with Python. With this installation method, the cuDNN installation environment is managed via pip. Additional care must be taken to set up your host environment to use cuDNN outside the pip environment.

Note

Before issuing the following commands, you must replace 9.x.y.z with your respective cuDNN version. On Linux, only x86_64 and aarch64 architectures are supported.

Prerequisites

If your pip and wheel Python modules are not up-to-date, then use the following command to upgrade these Python modules. If these Python modules are out-of-date, then the commands which follow later in this section may fail.

python3 -m pip install --upgrade pip wheel

Installing cuDNN with Pip

To install cuDNN for CUDA 11, run:

python3 -m pip install nvidia-cudnn-cu11

To install cuDNN for CUDA 12, run:

python3 -m pip install nvidia-cudnn-cu12

To install cuDNN for a specific release version, include the release version in the command. For example, to install for CUDA 11, run:

python3 -m pip install nvidia-cudnn-cu11==9.x.y.z

To install for CUDA 12, run:

python3 -m pip install nvidia-cudnn-cu12==9.x.y.z

Note

Only one CUDA toolkit version of cuDNN 9 can be installed at a time.

Verifying the Install on Linux

To verify that cuDNN is installed and is running properly, compile the mnistCUDNN sample located in the /usr/src/cudnn_samples_v9 directory in the Debian file.

  1. Install the cuDNN samples.

    sudo apt-get -y install libcudnn9-samples
    

    or

    sudo dnf -y install libcudnn9-samples
    
  2. Go to the writable path.

    cd $HOME/cudnn_samples_v9/mnistCUDNN
    
  3. Compile the mnistCUDNN sample.

    make clean && make
    
  4. Run the mnistCUDNN sample.

    ./mnistCUDNN
    

If cuDNN is properly installed and running on your Linux system, you will see a message similar to the following:

Test passed!

Upgrading From Older Versions of cuDNN to cuDNN 9.x.y

Since cuDNN version 9 can coexist with previous versions of cuDNN, if the user has an older version of cuDNN such as v7 or v8, installing version 9 will not automatically delete an older revision. Therefore, if the user wants the latest version, install cuDNN version 9 by following the installation steps

To upgrade from an older cuDNN version to 9, refer to the Package Manager Installation section and follow the steps for your target platform.

Afterwards, to switch between an older installation to the newer installation, issue sudo update-alternatives --config libcudnn and choose the appropriate cuDNN version.