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:
- Locate the operating system selection section
- Click on your operating system (Linux, Windows, or macOS)
3. Choose Your Architecture
After selecting the operating system:
- Select your system's architecture (e.g., x86_64, ARM64, ppc64le)
- Most desktop and server systems use x86_64 architecture
4. Select Your Distribution
For Linux systems:
- Choose your specific Linux distribution (e.g., Ubuntu, CentOS, RHEL)
- For Windows or macOS, this step is not applicable
5. Specify Your Version
Select the version of your operating system:
- For Ubuntu, this might be 22.04, 20.04, etc.
- For Windows, this might be Windows 10 or Windows 11
- For other Linux distributions, select the appropriate version number
6. Choose Installer Type
Select your preferred installation method:
-
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
-
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:
- Download the installer executable
- Run the downloaded file with administrator privileges
- Follow the installation wizard
8. Installation Options
During installation, you'll typically be presented with options:
-
For Linux Runfile:
- You can choose to install the NVIDIA driver (skip if already installed)
- Select CUDA Toolkit components to install
- Choose installation path
-
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:
- System Properties > Advanced > Environment Variables
- 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:
- Install each version to a different directory
- 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:
- They are usually included in the CUDA Toolkit installation
- 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
Comments
0 comments
Please sign in to leave a comment.