How to check CUDA version

If you are wondering How to check CUDA version, this article will help you through it. CUDA by NVIDIA is a parallel computing platform as well as a programming model for general-purpose computing on GPUs (graphics processing units). CUDA enables you to leverage the power of GPUs for accelerating various applications, such as machine learning, image processing, scientific computing, and more.

In this article, we will learn what CUDA is, how to use it, and how to check the CUDA version in Python3.

What do you mean by CUDA?

Before learning How to check CUDA version, let’s learn what is CUDA. CUDA also known as Compute Unified Device Architecture, a software layer allowing programmers to access NVIDIA GPUs’ hardware features.

CUDA provides a set of libraries, tools, and APIs that helps you to write code that is compatible to run on GPUs and CPUs. CUDA also supports multiple programming languages like C, C++, Fortran, Java, Python, and more.

CUDA is designed to exploit the parallelism of GPUs, which have thousands of cores that can execute multiple threads simultaneously. Using CUDA, you can achieve significant application speedups, as GPUs can perform many operations faster than CPUs. For example, CUDA can accelerate deep learning frameworks like TensorFlow, PyTorch, Keras, and more.

How to Use CUDA?

Another aspect that you consider before How to check cuda version is how to use it. To use CUDA, you must have a compatible NVIDIA GPU and install the CUDA Toolkit, including the CUDA driver, runtime, libraries, and tools. You can download the CUDA Toolkit from the official website. You also need to install the appropriate GPU driver for your system, which you can find on the driver download page.

After installing the CUDA Toolkit and the GPU driver, you can start writing CUDA code using your preferred programming language and IDE (integrated development environment).

You can use the NVIDIA Nsight tools to debug and optimize your CUDA code and the NVIDIA Visual Profiler to analyze the performance of your CUDA applications.

To use CUDA in Python, you must install a package that supports CUDA, such as Numba, CuPy, PyCUDA, or CUDA Python. These packages allow you to write Python code that can run on GPUs and CPUs using CUDA. You can also use these packages to interact with other CUDA libraries, such as cuBLAS, cuFFT, cuDNN, and more.

How to Check CUDA Version?

To check the CUDA version in Python, you can use one of the following methods:

Using the nvcc Command

The nvcc command is the NVIDIA CUDA Compiler, a tool that compiles CUDA code into executable binaries. You can use the nvcc command to check the CUDA version. To do so you can run the following command in your terminal:

nvcc --version

This will output something like this:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Mar_22_23:07:46_PDT_2023
Cuda compilation tools, release 12.0, V12.0.81

The output shows the CUDA version, which is 12.0 in this case, as well as the build date and the compiler version.

For Linux:

Use the following to find the path for cuDNN:

$ whereis cuda
cuda: /usr/local/cuda

Then use this to get the version from the header file,

$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

For Windows:

For Windows first you need to find the path for cuDNN for that you can use the following code:

C:\>where cudnn*
C:\Program Files\cuDNN7\cuda\bin\cudnn64_7.dll

Then use this to dump the version from the header file,

type "%PROGRAMFILES%\cuDNN7\cuda\include\cudnn.h" | findstr CUDNN_MAJOR

There might be instances where you will be getting two different versions for CUDA on Windows which can be nvcc and NVIDIA-smi.

For Ubuntu

You need to find the location of the download where you will find the version of the CUDA that exist.

Now open the file with any text editor or run:

cat version.txt

For Anaconda

To check CUDA installation by Conda use the following command:

conda list cudatoolkit

And to check the CUDNN version installed by conda use the following command :

conda list cudnn

To install/update CUDA and CUDNN through CONDA, you can use the following commands:

conda install -c anaconda cudatoolkit
conda install -c anaconda cudnn

For Tensorflow

You can use the following code to install CUDA to tensorflow.

import tensorflow as tf
from tensorflow.python.platform import build_info as build
print(f"tensorflow version: {tf.__version__}")
print(f"Cuda Version: {build.build_info['cuda_version']}")
print(f"Cudnn version: {build.build_info['cudnn_version']}")

Using the CUDA Module

The CUDA module is a Python package that provides access to the CUDA driver API. You can use the CUDA module to check the CUDA version by running the following code in your Python interpreter:

!pip install pycuda
import pycuda

This will output something like this:

(12, 0)

The output shows the How to check CUDA version as a tuple, where the first element is the major version and the second is the minor version. In this case, the CUDA version is 12.0.


How do my GPU support CUDA?

You can check the list of CUDA-enabled GPUs from the official website. You can also use the Nvidia-smi command to check your system’s GPU model and driver version.

How do I update the CUDA Toolkit or the GPU driver?

For latest version of the CUDA Toolkit you can download it from the official website. You can also use the cuda-install-samples-<version>.sh script to install the CUDA samples and verify the installation. For latest version of the GPU driver go to the driver download page.


In this article, we learned what CUDA is, how to use it, and how to check the CUDA version in Python3. We also answered some common questions about CUDA and Python. Hope that this article has all the information that you required.


  1. CUDA
  2. cudnn

To learn more about some common errors follow Python Clear’s errors section.

Leave a Comment