Skip to content

Instantly share code, notes, and snippets.

@Jongbhin
Last active February 10, 2024 23:24
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save Jongbhin/ad9aac8369751dbd84ca6a266a507bc7 to your computer and use it in GitHub Desktop.
Save Jongbhin/ad9aac8369751dbd84ca6a266a507bc7 to your computer and use it in GitHub Desktop.
[Cuda cudnn version check] #cuda #cudnn #nvidia

To check nvidia driver

modinfo nvidia

To check cuda version

cat /usr/local/cuda/version.txt
nvcc  --version

To check cudnn version

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

To check GPU Card info

nvidia-smi

Python (Show what version of tensorflow in your PC.)

  • for Python 2
python -c 'import tensorflow as tf; print(tf.__version__)'  
  • for Python 3
python3 -c 'import tensorflow as tf; print(tf.__version__)'  
gpu check

CUDA_DEVICE_ORDER=PCI_BUS_ID CUDA_VISIBLE_DEVICES=1 python import pytorch torch.cuda.current_device()

@yoojinhwang
Copy link

I am trying to check the cudnn (from the code under 'To Check cudnn version" however I keep getting this error: cat: /usr/local/cuda/include/cudnn.h: No such file or directory

@NERanger
Copy link

I am trying to check the cudnn (from the code under 'To Check cudnn version" however I keep getting this error: cat: /usr/local/cuda/include/cudnn.h: No such file or directory

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

@demdecuong
Copy link

I use the command : cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2
but it prints nothing

This is my cudnn.h
/*

  • 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 <cuda_runtime.h>
#include <stdint.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"

#include "cudnn_backend.h"

#if defined(__cplusplus)
extern "C" {
#endif

#if defined(__cplusplus)
}
#endif

#endif /* CUDNN_H_ */

@bionicles
Copy link

bionicles commented Aug 8, 2020

looks like they moved the header file in 11.0
cat /path/to/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

#define CUDNN_MAJOR 8
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 2
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

@akshaytolwani123
Copy link

Thanks I was able to verify my cudnn installation

@Shijie97
Copy link

looks like they moved the header file in 11.0
cat /path/to/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

#define CUDNN_MAJOR 8
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 2

#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

why is your cudnn.h has head file?

@bionicles
Copy link

dunno, ask nvidia

@pra-dan
Copy link

pra-dan commented May 14, 2021

Thanks @bionicles Works perfectly. @Shijie97 the location of cudnn can be found using $whereis cudnn

@lgg
Copy link

lgg commented Oct 15, 2021

Cuda

cat /usr/local/cuda/version.json

CUDNN

cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

@fahnub
Copy link

fahnub commented Mar 31, 2023

Thanks @lgg @bionicles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment