To check your CUDA version, the most direct and common method is to use the nvcc
command in your terminal or command prompt.
How Do I Check My CUDA Version?
The most straightforward way to determine your installed CUDA Toolkit version is by executing a simple command in your command-line interface.
Method 1: Using nvcc --version
(CUDA Toolkit Version)
This command provides the exact version of the CUDA Toolkit installed on your system. The CUDA Toolkit is essential for compiling CUDA-accelerated applications and is often what deep learning frameworks like TensorFlow and PyTorch rely on.
Steps:
-
Open your command-line interface:
- Windows: Open Command Prompt, PowerShell, or Anaconda Prompt.
- Linux/macOS: Open Terminal.
-
Execute the command: Type the following command and press Enter:
nvcc --version
If CUDA is correctly installed and its path is configured in your system's environment variables, you will see output similar to this:
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Wed_Nov_22_10:17:15_PST_2023 Cuda compilation tools, release 12.3, V12.3.107 Build cuda_12.3.r12.3/compiler.33567101_0
The line
release 12.3, V12.3.107
indicates that your CUDA Toolkit version is 12.3.
What if nvcc
is not found?
If you receive an error like "nvcc
is not recognized as an internal or external command," it typically means:
- CUDA Toolkit is not installed.
- CUDA Toolkit is installed, but its binary directory (e.g.,
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin
on Windows) is not added to your system'sPATH
environment variable.
Method 2: Using nvidia-smi
(CUDA Driver Version)
While nvcc --version
shows the CUDA Toolkit version, nvidia-smi
(NVIDIA System Management Interface) provides information about your NVIDIA GPU driver and the maximum CUDA API version supported by that driver. This is crucial for ensuring compatibility between your driver and the CUDA Toolkit.
Steps:
-
Open your command-line interface.
-
Execute the command: Type
nvidia-smi
and press Enter.You'll see a table with GPU information. Look for the
CUDA Version:
field in the header.+---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.154.05 Driver Version: 535.154.05 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA GeForce RTX 3090 On | 00000000:01:00.0 Off | N/A | | N/A 47C P2 40W / 350W | 106MiB / 24576MiB | 0% Default | | | | N/A | +-----------------------------------------+----------------------+----------------------+
In this example, the
CUDA Version: 12.2
indicates that your NVIDIA driver supports up to CUDA API version 12.2.
Important Distinction:
nvcc --version
: Shows the version of the CUDA Toolkit installed on your system. This is what you compile your code with.nvidia-smi
: Shows the maximum CUDA API version supported by your GPU driver. Your CUDA Toolkit version should generally be less than or equal to the driver's supported CUDA version for optimal compatibility.
Why is Knowing Your CUDA Version Important?
- Software Compatibility: Deep learning frameworks (like PyTorch, TensorFlow) and other GPU-accelerated applications often require specific CUDA Toolkit versions. Mismatched versions can lead to performance issues or errors.
- Driver Compatibility: Ensuring your NVIDIA driver supports the CUDA Toolkit version you intend to use is critical. Older drivers might not support newer CUDA Toolkits.
- Troubleshooting: When encountering GPU-related errors, knowing your exact CUDA setup is usually the first step in diagnosis.
Summary of Commands
Command | What it checks | Output Example (relevant part) |
---|---|---|
nvcc --version |
CUDA Toolkit version (for compilation) | release 12.3 |
nvidia-smi |
CUDA API version supported by GPU driver | CUDA Version: 12.2 |
By using these commands, you can accurately determine both your installed CUDA Toolkit version and the CUDA version supported by your GPU driver, ensuring your development environment is correctly configured. For the latest CUDA Toolkit downloads and documentation, visit the NVIDIA CUDA Toolkit website.