Deep Learning Setup on Ubuntu 16.04

Introduction

In this post, we will show all steps for installing Ubuntu 16.04 with CUDA, cuDNN, and deep learning framework.

This will be a long post. If you follow exactly step by step, there should be no error.

Hardware

We have a PC with 6 PCIe x16 (mining mainboard), and 6 powerful graphic cards (nVidia 1080).

Step 1: OS and Preparing

We choose Ubuntu 16.04 LTS for getting better performance and bug fixes.

Install all necessary packages for compiling.

Install python

Install openssh server to remote control

Config ssh server

From next time, we can remove monitor and use this server remotely, using tmux to keep ssh session.

Use Ctrl+D to finish session (tmux window closes)
Or Ctrl+B D to temporary detach from session and connect to it again later.

When you are inside tmux anytime you can use Ctrl+B S to see sessions list and switch current to another.

If you want to use VNC for GUI remote working, you can install tightvnc

Then config xstartup:

For automatically starting up VNC server when system boot (and assign to desktop :1), create the service file below

Then edit file:

Then start service:

 

Step 2: Install CUDA driver and toolkit

The best way to install CUDA driver for nVidia card is to download directly from nVidia Repo

If you can’t install following steps above, manually installation guide is below:

Step 3: Install cuDNN

You should register an account and accept term/condition before downloading.

Step 4: Install OpenCV

We need both OpenCV and OpenCV_Contrib

 

Step 5: Install Deep learning frameworks

We will install

  • Tensorflow
  • Keras
  • PyTorch
  • and other support libs for python.

First we need to prepare the environment

Setup python virtual environment

 

Now install DL frameworks for each virtual environment

For python2

 

For python3