Blame Arnon

How to check which CUDA version is installed on Linux

There are several ways and steps you could check which CUDA version is installed on your Linux box

Identify the CUDA location and version with NVCC

Run which nvcc to find if nvcc is installed properly.
You should see something like /usr/bin/nvcc. If that appears, your NVCC is installed in the standard directory.

~ $ which nvcc

If you have installed the CUDA toolkit but which nvcc returns no results, you might need to add the directory to your path.

You can check nvcc --version to get the CUDA compiler version, which matches the toolkit version:

~ $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

This means that we have CUDA version 8.0.61 installed.

Identify CUDA version from CUDA code

Use the cudaDriverGetVersion() API call. You can find an example of using cudaDriverGetVersion() here.

Identifying which CUDA driver version is installed and active in the kernel

~ $ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  367.48  Sat Sep  3 18:21:08 PDT 2016
GCC version:  gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

Identifying which GPU card is installed and what version

Using nvidia-smi is the best way I’ve found to get a holistic view of everything – both GPU card model and driver version.

The driver version is 367.48 as seen below, and the cards are two Tesla K40m.

~ $ nvidia-smi
Tue Jun  6 12:43:17 2017
| NVIDIA-SMI 367.48                 Driver Version: 367.48                    |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  Tesla K40m          On   | 0000:04:00.0     Off |                   0* |
| N/A   48C    P0    67W / 235W |  12MiB / 11439MiB    |      0%      Default |
|   1  Tesla K40m          On   | 0000:42:00.0     Off |                   0* |
| N/A   54C    P0    68W / 235W |  0MiB / 11439MiB     |      0%      Default |

| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |


After installing a new version of CUDA, there are some situations that require rebooting the machine to have the driver versions load properly. It is my recommendation to reboot after performing the kernel-headers upgrade/install process, and after installing CUDA – to verify that everything is loaded correctly.

Leave a Reply