- Jongbhin / check_cuda_cudnn.md
- How to find cuda version in ubuntu?
- 4 Answers 4
- How to Check CUDA Version Easily
- Prerequisite
- What is CUDA?
- Method 1 — Use nvcc to check CUDA version
- What is nvcc?
- Method 2 — Check CUDA version by nvidia-smi from NVIDIA Linux driver
- What is nvidia-smi?
- Method 3 — cat /usr/local/cuda/version.txt
- 3 ways to check CUDA version
Jongbhin / check_cuda_cudnn.md
Maybe your cudnn.h is in another directory, use the following command to check:
sudo updatedb locate cudnn.h
Then replace the path with the path it shows
I use the command : cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
but it prints nothing
- Copyright 1993-2020 NVIDIA Corporation. All rights reserved.
- NOTICE TO LICENSEE:
- This source code and/or documentation («Licensed Deliverables») are
- subject to NVIDIA intellectual property rights under U.S. and
- international Copyright laws.
- These Licensed Deliverables contained herein is PROPRIETARY and
- CONFIDENTIAL to NVIDIA and is being provided under the terms and
- conditions of a form of NVIDIA software license agreement by and
- between NVIDIA and Licensee («License Agreement») or electronically
- accepted by Licensee. Notwithstanding any terms or conditions to
- the contrary in the License Agreement, reproduction or disclosure
- of the Licensed Deliverables to any third party without the express
- written consent of NVIDIA is prohibited.
- NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
- LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
- SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
- PROVIDED «AS IS» WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
- NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
- DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
- NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
- NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
- LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
- SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
- DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- OF THESE LICENSED DELIVERABLES.
- U.S. Government End Users. These Licensed Deliverables are a
- «commercial item» as that term is defined at 48 C.F.R. 2.101 (OCT
- 1995), consisting of «commercial computer software» and «commercial
- computer software documentation» as such terms are used in 48
- C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
- only as a commercial end item. Consistent with 48 C.F.R.12.212 and
- 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
- U.S. Government End Users acquire the Licensed Deliverables with
- only those rights set forth herein.
- Any use of the Licensed Deliverables in individual and commercial
- software must include, in the user documentation and internal
- comments to the code, the above Disclaimer and U.S. Government End
- Users Notice.
*/
/* cudnn : Neural Networks Library
#if !defined(CUDNN_H_)
#define CUDNN_H_
#include «cudnn_version.h»
#include «cudnn_ops_infer.h»
#include «cudnn_ops_train.h»
#include «cudnn_adv_infer.h»
#include «cudnn_adv_train.h»
#include «cudnn_cnn_infer.h»
#include «cudnn_cnn_train.h»
#if defined(__cplusplus)
extern «C» #endif
#if defined(__cplusplus)
>
#endif
How to find cuda version in ubuntu?
I installed cuda 8.0 in my ubuntu 16.04 machine and checked the cuda version using the command «nvcc —version». it shows version as 7.5. How Can I be sure that it is accurate? Are there other commands that I can also use to verify my result?
I downloaded the package from «developer.nvidia.com/compute/cuda/8.0/prod/local_installers/…» and I followed the installation instructions.
4 Answers 4
$ cat /usr/local/cuda/version.json
For cuda-8.0 on Ubuntu16.04, you should be able to read
$ cat /usr/local/cuda/version.txt CUDA Version 8.0.44
I agree with Robert Crovella, you might need to check your PATH
/usr/local/cuda is a symlink to the version you have installed. You can install cuda without the symlink and then this will not work.
Starting from CUDA 8.0, it’s possible to have multiple CUDA versions installed. You can then activate different values for $PATH environment variable that will present you with different CUDA version.
Command to immediately obtain the CUDA version:
$ nvcc --version | grep "release" | awk '' | cut -c2-
You can confirm the result by checking the install status of CUDA libraries:
For installing multiple versions of CUDA, you can refer to this article.
Thank you all. Previously I tried to install cuda8.0 using run file from https://developer.nvidia.com/compute/cuda/8.0/prod/local_installers/cuda_8.0.44_linux-run. After that I tried to check «nvcc —version», but it shows the following error «The program ‘nvcc’ is currently not installed. You can install it by typing: sudo apt-get install nvidia-cuda-toolkit». So I tried the above command. It gave the cuda7.5 version.
Later I tried to install cuda using debian package which by default contained nvcc. Now I am getting correct version.
Follow the directions in the linux getting started guide. When you use a runfile installer, you must update your PATH environment variable. If you don’t do that, you will get the message about nvcc not being installed.
How to Check CUDA Version Easily
Here you will learn how to check NVIDIA CUDA version in 3 ways: nvcc from CUDA toolkit, nvidia-smi from NVIDIA driver, and simply checking a file. Using one of these methods, you will be able to see the CUDA version regardless the software you are using, such as PyTorch, TensorFlow, conda (Miniconda/Anaconda) or inside docker.
Prerequisite
You should have NVIDIA driver installed on your system, as well as Nvidia CUDA toolkit, aka, CUDA, before we start. If you haven’t, you can install it by running sudo apt install nvidia-cuda-toolkit .
What is CUDA?
CUDA is a general parallel computing architecture and programming model developed by NVIDIA for its graphics cards (GPUs). Using CUDA, PyTorch or TensorFlow developers will dramatically increase the performance of PyTorch or TensorFlow training models, utilizing GPU resources effectively.
In GPU-accelerated technology, the sequential portion of the task runs on the CPU for optimized single-threaded performance, while the computed-intensive segment, like PyTorch technology, runs parallel via CUDA at thousands of GPU cores. When using CUDA, developers can write a few basic keywords in common languages such as C, C++ , Python, and implement parallelism.
Method 1 — Use nvcc to check CUDA version
If you have installed the cuda-toolkit software either from the official Ubuntu repositories via sudo apt install nvidia-cuda-toolkit , or by downloading and installing it manually from the official NVIDIA website, you will have nvcc in your path (try echo $PATH ) and its location will be /usr/bin/nvcc (by running which nvcc ).
To check CUDA version with nvcc, run
You can see similar output in the screenshot below. The last line shows you version of CUDA. The version here is 10.1. Yours may vary, and can be either 10.0, 10.1, 10.2 or even older versions such as 9.0, 9.1 and 9.2. After the screenshot you will find the full text output too.
vh@varhowto-com:~$ nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Sun_Jul_28_19:07:16_PDT_2019 Cuda compilation tools, release 10.1, V10.1.243
What is nvcc?
nvcc is the NVIDIA CUDA Compiler, thus the name. It is the key wrapper for the CUDA compiler suite. For other usage of nvcc , you can use it to compile and link both host and GPU code.
Check out nvcc ‘s manpage for more information.
Method 2 — Check CUDA version by nvidia-smi from NVIDIA Linux driver
The second way to check CUDA version is to run nvidia-smi, which comes from downloading the NVIDIA driver, specifically the NVIDIA-utils package. You can install either Nvidia driver from the official repositories of Ubuntu, or from the NVIDIA website.
$ which nvidia-smi /usr/bin/nvidia-smi $ dpkg -S /usr/bin/nvidia-smi nvidia-utils-440: /usr/bin/nvidia-smi
To check CUDA version with nvidia-smi , directly run
You can see similar output in the screenshot below. The version is at the top right of the output. Here’s my version is CUDA 10.2. You may have 10.0, 10.1 or even the older version 9.0 or 9.1 or 9.2 installed.
Importantly, except for CUDA version. There are more details in the nvidia-smi output, driver version (440.100), GPU name, GPU fan percentage, power consumption/capability, memory usage, can also be found here. You can also find the processes which use the GPU at the moment. This is helpful if you want to see if your model or system is using GPU such as PyTorch or TensorFlow.
Here is the full text output:
vh@varhowto-com:~$ nvidia-smi Tue Jul 07 10:07:26 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 | |-------------------------------+----------------------+----------------------+ | 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 1070 Off | 00000000:01:00.0 On | N/A | | 31% 48C P0 35W / 151W | 2807MiB / 8116MiB | 1% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 1582 G /usr/lib/xorg/Xorg 262MiB | | 0 2481 G /usr/lib/xorg/Xorg 1646MiB | | 0 2686 G /usr/bin/gnome-shell 563MiB | | 0 3244 G …AAAAAAAAAAAACAAAAAAAAAA= --shared-files 319MiB | +-----------------------------------------------------------------------------+
What is nvidia-smi?
nvidia-smi (NVSMI) is NVIDIA System Management Interface program. It is also known as NVSMI. nvidia-smi provides monitoring and maintenance capabilities for all of tje Fermi’s Tesla, Quadro, GRID and GeForce NVIDIA GPUs and higher architecture families. For most functions, GeForce Titan Series products are supported with only little detail given for the rest of the Geforce range.
NVSMI is also a cross-platform application that supports both common NVIDIA driver-supported Linux distros and 64-bit versions of Windows starting with Windows Server 2008 R2. Metrics may be used directly by users via stdout, or stored via CSV and XML formats for scripting purposes.
For more information, check out the man page of nvidia-smi .
Method 3 — cat /usr/local/cuda/version.txt
cat /usr/local/cuda/version.txt
Note that if you install Nvidia driver and CUDA from Ubuntu 20.04’s own official repository this approach may not work.
3 ways to check CUDA version
Time Needed : 5 minutes
There are basically three ways to check CUDA version. One must work if not the other.
- Perhaps the easiest way to check a file Run cat /usr/local/cuda/version.txt
Note: this may not work on Ubuntu 20.04