Set Up A New Deep Learning Server

15 June 2018

Updates: I found that CUDA and cuDNN can be installed through Anaconda, and it has a lot of benifits (e.g install different versions of CUDA and cuDNN in different environment). So I ended up switching to this method and we don’t need to install them globally anymore.

Here are some useful notes I wrote down when I was setting up my deep learning server. It covers the installation of the following packages:

  • Nvidia Driver
  • Anaconda
  • CUDA Toolkit
  • cuDNN

1. Install Nvidia Driver

Remove older nvidia driver and add graphics driver PPA.

sudo apt-get purge nvidia*
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update

Install Nvidia Driver (Change the driver version accordingly)

sudo apt-get install nvidia-384

Reboot and type the following command to check if the installation was successful. You should be able to see the status of your graphic card.

nvidia-smi

2. Install Anaconda

Get the download link for the latest version of anaconda at https://www.anaconda.com/download/. We use the linux version as an example.

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

Install Anaconda:

chmod +x Anaconda3-5.2.0-Linux-x86_64.sh
./Anaconda3-5.2.0-Linux-x86_64.sh

Follow the instruction and finish installation.

3. Install CUDA Toolkit and cuDNN

First, we are going to create a conda environment.

conda create -n [your_env_name] python=[python_version]

Replace [your_env_name] with the name of your new environment, and set [python_version] to the one you would like to use. For example, the following command will create a new environment called “deeplearning” with python 3.6:

conda create -n deeplearning python=3.6

Once you created your environment, activate it by using “source activate” command. For example:

source activate deeplearning

CUDA Toolkit and cuDNN now can be installed using Anaconda. We can start by searching the available version of the packages.

user@server:~$ conda search cudatoolkit
Loading channels: done
# Name                  Version           Build  Channel
cudatoolkit              5.5rc1              p0  pkgs/pro
cudatoolkit               5.5.1              p0  pkgs/pro
cudatoolkit                 6.0              p0  pkgs/pro
cudatoolkit                 7.0               1  pkgs/pro
cudatoolkit                 7.5               0  pkgs/free
cudatoolkit                 7.5               2  pkgs/free
cudatoolkit                 8.0               1  pkgs/free
cudatoolkit                 8.0               3  pkgs/free
cudatoolkit                 9.0      h13b8566_0  pkgs/main

user@server:~$ conda search cudnn
Loading channels: done
# Name                  Version           Build  Channel
cudnn                       5.1               0  pkgs/free
cudnn                    5.1.10       cuda7.5_0  pkgs/free
cudnn                    5.1.10       cuda8.0_0  pkgs/free
cudnn                       6.0               0  pkgs/free
cudnn                    6.0.21       cuda7.5_0  pkgs/free
cudnn                    6.0.21       cuda8.0_0  pkgs/free
cudnn                     7.0.5       cuda8.0_0  pkgs/main
cudnn                     7.1.2       cuda9.0_0  pkgs/main

Now we can choose whichever version we want to install using “conda install” command. Here we will use the newest version of CUDA 9.0 and cuDNN 7.1.2 as an example. The order of installation should not matter but I found that by installing cuDNN you will get the corresponding CUDA automatically.

conda install cudnn==7.1.2

Finally, we can check all the packages we installed in this environment by using:

conda list

You should be able to find CUDA and cuDNN inside.