GTX 1070 on Ubuntu 16.04 with Cuda 8.0 and Theano

I finally upgraded from my previous GTX 980 Ti to GTX 1070 last week, unfortunately that meant revisiting some of my previous issues with ubuntu and various incompatibilities among the graphics drivers and cuda components.  In any case I decided this time I will document some of this stuff more cleanly so I can refer to it later.

My Setup:

My previous primary desktop currently re-purposed for machine learning and docker experiments etc..


  • Intel(R) Core(TM) i7-3770K CPU
  • ASUS MAXIMUS IV GENE-Z Motherboard
  • Nvidia GTX 1070


  • Ubuntu 16.04
  • Nvidia driver 367.35
  • CUDA 8.0 RC
  • Anaconda/Theano/Keras native and as docker containers


After replacing the 980 ti card with 1070 I reloaded the machine and it just went into a crash and backtrace loop as the previous nvidia driver nvidia-352 did not support the GTX 1070.

Step one was recovering the system, load into recovery mode, load networking (optional), drop into root shell.

sudo apt-get purge nvidia-*
sudo apt-get autoremove
sudo reboot

This will remove the previous nvidia drivers and dependencies and allow you to do a fresh install of the drivers.

if you haven’t done already make sure you are running  gcc 4.9 to avoid compile errors with Theano

sudo apt-get install gcc-4.9 g++-4.9
sudo ln -s  /usr/bin/gcc-4.9 /usr/bin/gcc -f
sudo ln -s  /usr/bin/g++-4.9 /usr/bin/g++ -f

Download CUDA 8.0 RC, download the runfile(local), when installing cuda 8.0 decline on installing NVIDIA drivers. then reboot.

Install NVIDIA 365.35 drivers

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-367
sudo reboot

At this point you should be able to run nvidia-smi and get some results like this

Thu Aug 4 01:19:40 2016
| NVIDIA-SMI 367.35 Driver Version: 367.35 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce GTX 1070 Off | 0000:01:00.0 Off | N/A |
| 0% 40C P8 11W / 166W | 103MiB / 8112MiB | 0% Default |

| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 4921 C ...y/anaconda3/envs/keras104_py27/bin/python 101MiB |

At this point make sure you have the binary and library path’s setup correctly and that nvcc is working fine, adding the following to your .bashrc should do the trick.

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

nvcc -V should give you

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Wed_May__4_21:01:56_CDT_2016
Cuda compilation tools, release 8.0, V8.0.26

and you should be able to run the example here and get “Used the gpu” as output.

My several hours of research in a 10min post 🙂


  1. Hello Jay. Thanks for your documentation. This might be a newbie question. Could you explain how “export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}” works? I know adding a directory to PATH in this way “export PATH=$PATH:~/opt/bin”, but I did not quite get how your command works.


Leave a Reply