Install Cuda 8.0 and Cudnn V6.0 on Ubuntu 16.04 - liuyanqi/caffe GitHub Wiki

Go to the CUDA Website and download the package for specific operating system

Here, I downloaded .deb for ubuntu x86_64. Personally .deb is much more convenient than the sh script, which you have to disable x system

Pre-install requirement

most pre requirement can be found here: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#axzz4qmxFW5nv

most importantly, you should install linux kernal header files by

sudo apt-get install linux-headers-$(uname -r)

Install cuda 8

sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

sudo apt-get update

sudo apt-get install cuda

Install cuDNN library

https://gist.github.com/mjdietzx/0ff77af5ae60622ce6ed8c4d9b419f45

go to the website https://developer.nvidia.com/cudnn to download the library. login is required. Here, I downloaded cuDNN V6.0 developer version.

CUDNN_TAR_FILE="cudnn-8.0-linux-x64-v6.0.tgz"
wget http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/${CUDNN_TAR_FILE}
tar -xzvf ${CUDNN_TAR_FILE}
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-8.0/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-8.0/lib64/
sudo chmod a+r /usr/local/cuda-8.0/lib64/libcudnn*