CUDA & CuDNN - gkgkgk1215/else GitHub Wiki

CUDA install

sudo service lightdm stop
  • Remove previous CUDA before installation
sudo apt-get --purge remove 'cuda*'
sudo apt-get autoremove --purge 'cuda*'
  • Go to the download path and run.
chmod +x cuda_11.8.0_520.61.05_linux.run
sudo ./cuda_11.8.0_520.61.05_linux.run
  • Follow guidelines of CUDA installer

  • Select 'No' when asked to install the graphics driver.

  • Edit .bashrc

export PATH=$PATH:/usr/local/cuda-11.0
export PATH=$PATH:/usr/local/cuda-11.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64 

Verify CUDA

git clone https://github.com/NVIDIA/cuda-samples
cd ~/cuda-samples/Samples/0_Introduction/asyncAPI/
make
./asyncAPI
  • Successfully installed if you can see the below messages.
[./asyncAPI] - Starting...
GPU Device 0: "Ampere" with compute capability 8.6

CUDA device [NVIDIA GeForce RTX 3080 Ti Laptop GPU]
time spent executing by the GPU: 11.00
time spent by CPU in CUDA calls: 5.32
CPU executed 90042 iterations while waiting for GPU to finish
  • or just type nvcc --version' or nvidia-smi`

  • Change configuration of "Software & Updates"

cuDNN Install (Find version that matches with the installed CUDA)

  • cuDNN 9.2.1 is compatible for my laptop.

https://docs.nvidia.com/deeplearning/cudnn/latest/reference/support-matrix.html

Bug report

  • If you are using RTX graphics driver, possibly you encounter "CUDNN_STATUS_INTERNAL_ERROR" or cudnn initialize error. Putting the following in the .bash file would resolve the problem.
export TF_FORCE_GPU_ALLOW_GROWTH=true

Reference

http://www.kwangsiklee.com/2017/07/%EC%9A%B0%EB%B6%84%ED%88%AC-16-04%EC%97%90%EC%84%9C-cuda-%EC%84%B1%EA%B3%B5%EC%A0%81%EC%9C%BC%EB%A1%9C-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0/