Skip to content

Instantly share code, notes, and snippets.

@Jongbhin
Last active July 13, 2024 16:04
Show Gist options
  • 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()

@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