If you are reading this post means you wish to run CUDA environment and has tried installing CUDA with less success or running cuda for the first time.
Dont worry I have got all covered in this blog post.
To Install CUDA and run NVIDIA drivers follow the below steps: -
- Find the version of Linux installed using uname -r command or cat /etc/*-release command
- Find already existing default drivers from NVIDIA - sudo apt-cache search nvidia
- Install the building dependencies first using sudo apt-get install linux-headers-$(uname -r)
- Install the nvidia driver For example use always one driver version before latest to be on the safe side. So if you plan to install nvidia-352 driver use the command : - sudo apt-get install nvidia-352
- Ensure that novaeu driver is black listed.
- Reboot the pc using command sudo reboot
- Now, launch the terminal and type nvidia-smi => this should display an output something like nvidia driver version and the jobs/process running as no process running in the output in terminal
- Congratulations, now you have nvidia driver installed properly
- Download CUDA 8.0RC. In order to download the installers, you need to login or register(free) first. Choose Linux -> x86_64 -> Ubuntu -> 16.04 -> runfile(local). Download both Base Installer and Patch 1. Run command:
- Download link is
wget http://developer.download.nvidia.com/compute/cuda/*sudo sh cuda_7.5.27_linux.run
- Set up the development environment by modifying the
LD_LIBRARY_PATHvariables, also add them to the end
of the .bashrc file
Source the bashrc file using source ~/.bashrc
- Now type nvcc -V to check that Cuda is installed or not
- Install cudnn library : - Download cudnn library from NVIDIA website: - https://developer.nvidia.com/cudnn
- tar -zxvf cudnn-7.5-linux-x64-v5.1.tgz
- cd cuda/
- sudo cp include/* /usr/local/cuda-7.5/include/
- sudo cp lib64/* /usr/local/cuda-7.5/lib64/
- sudo chmod a+r /usr/local/cuda-7.5/lib64/libcudnn*
- Check whether cudnn is installed now or not
- cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
- If the above command does not give any error - congratulations you have installed cudnn.