LoginSignup
0
1

More than 5 years have passed since last update.

Install CUDA8.0 and cuDNN5.1 to Ubuntu16.04LTS

Last updated at Posted at 2017-02-09

Install CUDA8.0

Download CUDA8.0 from https://developer.nvidia.com/cuda-downloads
Execute the following commands to install CUDA.
@terminal
sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
sudo apt update
sudo apt install cuda

Setting the path

write into .bashrc file as below
@terminal
echo -e "\n## CUDA and cuDNN paths" >> ~/.bashrc
echo 'export PATH=/usr/local/cuda-8.0/bin:${PATH}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc

.bashrc will be like this
export PATH=/usr/local/cuda-8.0/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:${LD_LIBRARY_PATH}

check whether the path of CUDA is passed through

echo $PATH             # is the path "/usr/local/cuda-8.0/bin" included?
echo $LD_LIBRARY_PATH  # is the path "/usr/local/cuda-8.0/lib64" included?
which nvcc             # is the path "/usr/local/cuda-8.0/bin/nvcc" outputed?
nvidia-smi             # is the information of nvidia's GPU displayed?

Install cuDNN

Download cuDNN 5.1 for CUDA 8.0 from
https://developer.nvidia.com/rdp/cudnn-download

1.Execute the following commands on the terminal at the directory where you just saved the downloaded cuDNN.
2.Copy lib of cuDNN into the directory where CUDA as installed.
3.Setting the symbolic link.
@terminal
tar xzvf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp -a cuda/lib64/* /usr/local/cuda-8.0/lib64/
sudo cp -a cuda/include/* /usr/local/cuda-8.0/include/
sudo ldconfig

Check the operation

Execute the sample of CUDA to check the operation.
Because the shell script which is used to copy the sample code to the home directory(cuda-install-samples-8.0.sh) is in /usr/local/cuda-8.0/bin/, so if CUDA path is passed through,you can execute the sample by only assigning the filename.
@terminal
cuda-install-samples-8.0.sh ~ # copy the sample code to home directory
cd ~/NVIDIA_CUDA-8.0_Samples/
make
cd bin/x86_64/linux/release # move to the directory where the executable file of the sample is in.
./smokeParticles

cudnn_cuda_test_screen.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1