Skip to content

Instantly share code, notes, and snippets.

@manoelhortaribeiro
Forked from antonior92/gpu_guide.md
Created August 7, 2018 19:21
Show Gist options
  • Save manoelhortaribeiro/1d373df425b719ac449da5d805787b4b to your computer and use it in GitHub Desktop.
Save manoelhortaribeiro/1d373df425b719ac449da5d805787b4b to your computer and use it in GitHub Desktop.

How to install the GPU Drivers on Linux (or How I learned to stop worrying and love NVIDIA)

Authors: Antônio H. Ribeiro and Manoel H. Ribeiro

This is a guide containing practical steps to install nvidia gpu drivers and tensorflow which combines successful steps from previous (troublesome) experiences. We currently use nvidia cuda toolkit v9.0 and cudnn v7.0.5. This methodology has worked for Ubuntu v16.04 and for graphic cards GTX 980Tiand GTX 1080Ti.

Install Nvidia Driver

  1. Add repository for downloading nvidia graphic drivers:

    sudo add-apt-repository ppa:graphics-drivers
    sudo apt update
    
  2. Check which driver is appropriate for your GPU here.

  3. Install driver via apt-get install, for the appropriate driver:

     sudo apt install nvidia-*
    

Install CUDA toolkit

  1. Download CUDA toolkit 9.0 from this website.

  2. Install the toolkit by running:

    sudo sh cuda_9.0.*_linux.run
    
  3. On the installation prompt, do not let the installation to include the graphical driver.

  4. Add the cuda location to the path, in the end of the ~/.bashrc:

    export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    

Install cuDNN

  1. Download the .deb files from here, remember that the password require a capital letter:

    cuDNN v7.0.5 Runtime Library for Ubuntu16.04 (Deb)
    cuDNN v7.0.5 Developer Library for Ubuntu16.04 (Deb)
    cuDNN v7.0.5 Code Samples & User Guide for Ubuntu16.04 (Deb)
    
  2. Go to the download folder and in the terminal perform the following:

     sudo dpkg -i libcudnn7_7.0.5.*+cuda9.0_amd64.deb
     sudo dpkg -i libcudnn7-dev_7.0.5.*+cuda9.0_amd64.deb
     sudo dpkg -i libcudnn7-doc_7.0.5.*+cuda9.0_amd64.deb
    
  3. Verify the installation as follows:

     cp -r /usr/src/cudnn_samples_v7/ $HOME
     cd  $HOME/cudnn_samples_v7/mnistCUDNN
     make clean && make
     ./mnistCUDNN
    

Install Miniconda

  1. Download Miniconda here.

  2. Run installation script on terminal:

     bash Miniconda3-latest-Linux-x86_64.sh
    
  3. Follow the prompt on the installer screens. Upon finishing, close and open your terminal again.

  4. Test your installation by running conda list.

Install Tensorflow on appropriate conda enviroment

  1. Create a new conda enviroment

    conda create --name neural python=3.6
    
  2. Activate enviroment

    source activate neural
    
  3. Install required packages

    pip install numpy 
    
  4. Install tensorflow, getting tfBinaryURL from here:

    pip install --ignore-installed --upgrade tfBinaryURL
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment