How to Install CUDA Toolkit

Alexander Hill
Alexander Hill
  • Updated

Overview

The NVIDIA CUDA Toolkit provides a development environment for creating high-performance GPU-accelerated applications. It includes GPU-accelerated libraries, debugging and optimization tools, a C/C++ compiler, and a runtime library to deploy your applications. This guide provides step-by-step instructions for installing the CUDA Toolkit on different operating systems.

Prerequisites

  • NVIDIA GPU with CUDA support
  • Supported operating system (Windows, Linux, macOS)
  • Sufficient disk space (approximately 5GB)
  • Administrator/root privileges
  • Compatible NVIDIA GPU driver installed

Steps

1. Access the CUDA Downloads Page

Navigate to the official NVIDIA CUDA Toolkit download page:

 

2. Select Your Operating System

On the CUDA downloads page:

  1. Locate the operating system selection section
  2. Click on your operating system (Linux, Windows, or macOS)

3. Choose Your Architecture

After selecting the operating system:

  1. Select your system's architecture (e.g., x86_64, ARM64, ppc64le)
  2. Most desktop and server systems use x86_64 architecture

4. Select Your Distribution

For Linux systems:

  1. Choose your specific Linux distribution (e.g., Ubuntu, CentOS, RHEL)
  2. For Windows or macOS, this step is not applicable

5. Specify Your Version

Select the version of your operating system:

  1. For Ubuntu, this might be 22.04, 20.04, etc.
  2. For Windows, this might be Windows 10 or Windows 11
  3. For other Linux distributions, select the appropriate version number

6. Choose Installer Type

Select your preferred installation method:

  1. For Linux:
    • Runfile (local): Self-contained installation script
    • deb (network): Uses apt package manager
    • deb (local): Local Debian package installation
    • rpm (network): Uses yum/dnf package manager
    • rpm (local): Local RPM package installation

  2. For Windows:
    • exe (local): Standard Windows installer
    • exe (network): Network-based installer

7. Follow Installation Instructions

The website will display specific installation instructions based on your selections. Follow these instructions carefully.

Example for Ubuntu 22.04 with Runfile (local) installer:

 
wget https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_570.86.10_linux.run 
sudo sh cuda_12.8.0_570.86.10_linux.run --silent --samples --toolkit

Example for Windows with exe (local) installer:

  1. Download the installer executable
  2. Run the downloaded file with administrator privileges
  3. Follow the installation wizard

8. Installation Options

During installation, you'll typically be presented with options:

  1. For Linux Runfile:
    • You can choose to install the NVIDIA driver (skip if already installed)
    • Select CUDA Toolkit components to install
    • Choose installation path
  2. For Windows:
    • Express or Custom installation
    • Installation location
    • Components to install

9. Set Up Environment Variables

After installation, set up the necessary environment variables:

For Linux (add to ~/.bashrc or ~/.bash_profile):

 
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}} 
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

For Windows:

  1. System Properties > Advanced > Environment Variables
  2. Add CUDA_PATH and update PATH to include %CUDA_PATH%\bin

10. Verify Installation

Verify that the CUDA Toolkit has been installed correctly:

 
nvcc --version

This should display the CUDA compiler version information.

 

Additional Tips

Installation Notes

  • During installation, you may be prompted to install the NVIDIA driver. If you already have the latest driver installed, you can skip this step.
  • On Linux, the installation might require you to exit the X server (graphical interface) for driver installation.
  • Some installations might require a system reboot to complete successfully.

Troubleshooting Common Issues

  • Installation fails with insufficient privileges: Ensure you're running the installer with administrator/root privileges
  • CUDA driver version is insufficient: Update your NVIDIA GPU driver to a compatible version
  • Conflicts with existing installations: Consider removing previous CUDA versions completely

Multiple CUDA Versions

If you need multiple CUDA versions on the same system:

  1. Install each version to a different directory
  2. Use environment variables to switch between versions:
 
# For CUDA 11.8 
export CUDA_HOME=/usr/local/cuda-11.8 #

For CUDA 12.8
export CUDA_HOME=/usr/local/cuda-12.8

 

CUDA Samples

Consider installing CUDA Samples to test your installation:

  1. They are usually included in the CUDA Toolkit installation
  2. Build them to verify CUDA functionality:

See our Documentation for: How to install CUDA Samples for Testing

 

System-Specific Notes

For Ubuntu/Debian Systems

If you chose the package manager installation method:

 
# After adding the CUDA repository 
sudo apt-get update
sudo apt-get install cuda

 

For RHEL/CentOS/Rocky Systems

If you chose the package manager installation method:

 
# After adding the CUDA repository
# Centos:
sudo yum clean all
sudo yum install cuda

# Rocky
sudo dnf clean all
sudo dnf install cuda

 

For Windows Systems

  • Ensure Microsoft Visual Studio is installed for complete CUDA development support
  • Install the appropriate Windows SDK if needed for development

Additional Resources

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.