Install NVIDIA and CUDA in Linux version without any problems.

Hi all,

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: -

  1. Find the version of Linux installed using uname -r command or cat /etc/*-release command
  2. Find already existing default drivers from NVIDIA - sudo apt-cache search nvidia
  3. Install the building dependencies first using sudo apt-get install linux-headers-$(uname -r)
  4. 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
  5. Ensure that novaeu driver is black listed.
  6. Reboot the pc using command sudo reboot
  7. 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
  8. Congratulations, now you have nvidia driver installed properly
  9. 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:
  10. Download link is
    sudo sh
  11. Set up the development environment by modifying the PATH and LD_LIBRARY_PATH variables, also add them to the end of the .bashrc file 
  12. export PATH=/usr/local/cuda-7.5/bin${PATH:+:${PATH}} 
  13. export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH} 
  14. Source the bashrc file using source ~/.bashrc 
  15. Now type nvcc -V to check that Cuda is installed or not
  16. Install cudnn library : - Download cudnn library from NVIDIA website:  -
  17. tar -zxvf cudnn-7.5-linux-x64-v5.1.tgz
  18. cd cuda/
  19. sudo cp include/* /usr/local/cuda-7.5/include/
  20. sudo cp lib64/* /usr/local/cuda-7.5/lib64/
  21. sudo chmod a+r /usr/local/cuda-7.5/lib64/libcudnn*
  22. Check whether cudnn is installed now or not
    1. cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 
  23. If the above command does not give any error - congratulations you have installed cudnn. 
Stay tuned for further updates

No comments:

Post a Comment