How to check which CUDA version is installed on Linux ? (CUDA version)

How to check which CUDA version is installed on Linux ? (CUDA version)

如何检查 Linux 上安装的 CUDA 版本?

http://arnon.dk/
http://arnon.dk/check-cuda-installed/

There are several ways and steps you could check which CUDA version is installed on your Linux box.
您可以通过多种方法和步骤来检查 Linux 机箱上安装的 CUDA 版本。

1. 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.

yongqiang@strong-sys:~$ which nvcc
/usr/local/cuda-9.0/bin/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:

yongqiang@strong-sys:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176
yongqiang@strong-sys:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176
yongqiang@strong-sys:~$ 

This means that we have CUDA version 9.0.176 installed.

2. Identify CUDA version from CUDA code

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

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

yongqiang@strong-sys:~$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  390.48  Thu Mar 22 00:42:57 PDT 2018
GCC version:  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 
yongqiang@strong-sys:~$
yongqiang@strong-sys:~$ cat /usr/local/cuda/version.txt
CUDA Version 9.0.176
yongqiang@strong-sys:~$ 
yongqiang@strong-sys:~$ whereis cuda
cuda: /usr/local/cuda

4. 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.
使用 nvidia-smi 是我发现的最佳方式,可以全面了解所有内容 - 包括 GPU 卡型号和驱动程序版本。

holistic [həʊ'lɪstɪk; hɒ-]:adj. 整体的,全盘的

The driver version is 390.48 as seen below, and the cards are four GeForce 1080 Ti.

yongqiang@strong-sys:~$ nvidia-smi
Fri Oct 26 17:32:47 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48                 Driver Version: 390.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  GeForce GTX 108...  Off  | 00000000:02:00.0  On |                  N/A |
| 29%   27C    P8    11W / 250W |     51MiB / 11177MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 108...  Off  | 00000000:03:00.0 Off |                  N/A |
| 29%   29C    P8     8W / 250W |      2MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   2  GeForce GTX 108...  Off  | 00000000:82:00.0 Off |                  N/A |
| 29%   25C    P8     8W / 250W |      2MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   3  GeForce GTX 108...  Off  | 00000000:83:00.0 Off |                  N/A |
| 29%   34C    P8     9W / 250W |      2MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1276      G   /usr/lib/xorg/Xorg                            49MiB |
+-----------------------------------------------------------------------------+
yongqiang@strong-sys:~$

Troubleshooting (解决问题)

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.
安装新版本的 CUDA 后,在某些情况下需要重新启动计算机才能正确加载驱动程序版本。我建议在执行 kernel-headers 升级/安装过程后重新启动,并在安装 CUDA 之后 - 验证是否所有内容都已正确加载。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值