GTX 1070 + CUDA + cudnn + caffe on Ubuntu 14.04

Just got my GTX 1070 and would like to install on Ubuntu 14.04

Install driver for GTX 1070

First of all, I need to change bios to login Ubuntu using integrated graphic card (not GTX 1070), otherwise, there will be “out of range” error on the display (basically, display is black while you are logging in).

Then when I loggin in to Ubuntu, I will need to do the following:

  1. Remove all existing nvidia drivers
    sudo apt-get purge nvidia*
  2. As suggested here: https://www.abiraf.com/blog/installing-nvidias-proprietary-gtx-1070-and-1080-driver-in-ubuntu-1604-how-to-get-around-the-out-of-range-error-and-a-guide-to-do-a-realtime-monitoring-of-your-gpu we need to install Nvidia driver 367. Because Ubuntu main repository does not have the latest 367 driver yet, the recommended way is to install the driver from the graphics-driver PPA. Run the following commands after you booted up to Ubuntu using your integrated graphics or the already supported dedicated graphics card.
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    sudo apt-get install nvidia-367
  3.  After sucessfully installed the driver, restart computer and change bios to use PCIE graphic card (the GTX 1070) and login to Ubuntu, now you should be able to see the normal login screen.
  4.  To verify we have successfully installed the driver and GTX 1070 is working correctly, lets use nvidia utility:
    nvidia-smi

You should see something like this:
+—————————————————————————–+
| NVIDIA-SMI 367.27 Driver Version: 367.27 |
|——————————-+———————-+———————-+
| 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 On | N/A |
| 0% 47C P8 11W / 230W | 161MiB / 8112MiB | 0% Default |
+——————————-+———————-+———————-+

+—————————————————————————–+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1100 G /usr/bin/X 129MiB |
| 0 1842 G compiz 30MiB |
+—————————————————————————–+

Install CUDA

1. Remove all existing cuda libraries

apt-get purge cuda*

2. Go to nvidia developer site and download cuda 8.0 RC, claimed on the website:

               New in CUDA 8: Pascal Architecture Support

Out of box performance improvements on Tesla P100, supports GeForce GTX 1080 (* and I confirm it also support GTX 1070)

3. Install downloaded cuda 8.0

chmod +x cuda_8.0.27_linux.run
sudo ./cuda_8.0.27_linux.run

Remember when asked if you want to install graphic card driver (something like 361, say NO)

4. Set path for cuda

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

5.  Verify CUDA is successfully installed

cd NVIDIA_CUDA-8.0_Samples/5_Simulations/nbody
make
./nbody -benchmark -numbodies=256000 -device=0

You should see something like follows:

> Windowed mode
> Simulation data stored in video memory
> Single precision floating point simulation
> 1 Devices used for simulation
gpuDeviceInit() CUDA Device [0]: "GeForce GTX 1070
> Compute 6.1 CUDA device: [GeForce GTX 1070]
number of bodies = 256000
256000 bodies, total time for 10 iterations: 2956.918 ms
= 221.636 billion interactions per second
= 4432.724 single-precision GFLOP/s at 20 flops per interaction

Install CUDNN

1. Go to nvidia developer website for CUDNN: https://developer.nvidia.com/rdp/cudnn-download

You will see the following notice when try select version to download:

Please check your framework documentation to determine the recommended version of cuDNN.
If you are using cuDNN with a Pascal (GTX 1080, GTX 1070), version 5 or later is required.

So I choose cuDNN v5 (May 27, 2016), for CUDA 8.0 RC since v5.1 is still not available.

2. Extract the downloaded tgz file cudnn-8.0-linux-x64-v5.0-ga.tgz to the installation path of cuda (see above), and copy cudnn.h to cuda-8.0/include folder and cudnn library files (libcudnn.so, libcudnn.so.5, libcudnn.so.5.0.5, libcudnn_static.a) to cuda-8.0/lib64 folder

Install Caffe

Follow the instruction here:

http://caffe.berkeleyvision.org/installation.html

If you see the following error when make all,

No rule to make target `/usr/include/cudnn.h'

copy the file cudnn.h to the target folder, e.g. /usr/include

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: