How to install Nvidia Driver and Cuda 10.0 in Ubuntu 16.04

The post is about to install the latest Nvidia driver and Cuda 10 on Ubuntu 16.04 LTS. Cuda driver have dependency of Nvidia driver so first we will install Nvidia driver.

Download the nvidia driver run file local from below link (it should be around 1.2 Gb).

https://developer.nvidia.com/cuda-10.0-download-archive

Allow permission of downloaded nvidia driver file with chmod command

sudo chmod +x cuda_10.0.130_410.48_linux.run

Create a new folder name nvidia_drivers and extract the cuda run files in this folder.

mkdir nvidia_drivers

./path to cuda_10.0.130_410.48_linux.run –extract=path to nvidia_drivers folder we created above/

Go to nvidia_drivers folder and list the extracted file there should be 3 files Nvidia Driver , cuda run and cuda sample file.

path_to nvidia_drivers folder ls

Install the Nvidia Driver with below command

sudo ./NVIDIA-Linux-x86_64-410.48.run –no-x-check

Restart the system and check the nvidia driver installation

nvidia-smi

We installed the nvidia driver 410 in system now we can install cuda driver.

Install the cuda 10 with below command press d, accept the EULA licensce. After successful installation restart system.

sudo ./cuda-linux.10.0.130-24817639.run

Add the cuda bin and library path to bashrc file.

Open .bashrc file (sudo gedit ~/.bashrc) and add following two lines at end

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}

export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

source ~/.bashrc or close and open new terminal

Check the cuda installation

nvcc –version

That’s it we are done.

All commands together

  1. sudo apt-get purge nvidia-*        (remove old nvidia drivers)
  2. restart system
  3. Download cuda local file   https://developer.nvidia.com/cuda-downloads
  4. sudo chmod +x cuda_10.0.130_410.48_linux.run (allow r/w permission)
  5. mkdir nvidia_drivers ( create new folder)
  6. ./path to cuda_10.0.130_410.48_linux.run –extract=path to nvidia_drivers folder we created above/
  7. sudo ./NVIDIA-Linux-x86_64-410.48.run –no-x-check
  8. restart system
  9. nvidia-smi
  10. sudo ./cuda-linux.10.0.130-24817639.run
  11. export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
  12. export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  13. source ~/.bashrc or close and open new terminal
  14. nvcc –version


Happy learning cheers













Advertisements