Friday, December 27, 2019

How to check installed CUDA version

The first place you should check is the OS' package management system


$ apt list --installed | grep cuda

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

cuda/unknown,now 10.0.130-1 amd64 [installed]
cuda-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-command-line-tools-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-compiler-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-cublas-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-cublas-dev-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-cudart-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]
cuda-cudart-dev-10-0/unknown,now 10.0.130-1 amd64 [installed,automatic]




Next, try checking  /usr/local/cuda/version.txt


~$ cat /usr/local/cuda/version.txt
CUDA Version 10.0.130




There might be multiple versions of CUDA


$ ls -ld /usr/local/cuda*
lrwxrwxrwx  1 root root   9 Sep 10 16:02 /usr/local/cuda -> cuda-10.0
drwxr-xr-x 16 root root 290 Sep 10 16:01 /usr/local/cuda-10.0
drwxr-xr-x 18 root root 249 Jul 29 11:13 /usr/local/cuda-9.0




If you have cuda-toolkit-x-y (for example, cuda-toolkit-10-0) installed, you can also use this command


 $ /usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130




Finally, within your application, you can call the CUDA API with either of these functions


cudaRuntimeGetVersion()

cudaDriverGetVersion()










No comments:

Post a Comment