Building My Personal Deep Learning Box

In the need for some computing power, I decided to dedicate my semi-old gaming rig for some computational mayhem.

GPU: Asus GTX 1060
CPU: i7-2700K
Memory: Corsair Vengeance Blue 16GB
Operating System: Ubuntu 16.04 LTS

Initially I experienced some issues with the installer using my graphics card, as the output of my graphics card would not respond (due to lacking drivers). Some users were able to solve this using the nodemodeset parameter, but unfortunately it didn’t work for me. I resolved the issue by simply removing my graphics card, relying on the built-in graphics card during installation instead.

Prior to starting, let’s install VIM, as we will do some text editing.

sudo apt-get install vim

Install Nvidia Drivers

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

After installing the drivers, make sure to put your graphics card back into the computer. I experienced some issues continuing to use the built-in graphics card after installing the external drivers.

Install CUDA

sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda

Edit the .bashrc in order to finalize our CUDA setup.

export CUDA_HOME=/usr/local/cuda-8.0
export PATH

Install cuDNN

tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

Now could be a good time to check that everything is good so far with our GPU running the nvidia-smi command.

Install OpenBLAS

OpenBLAS enables us to do linear algebra faster than Atlas.

git clone
sudo apt-get install gfortran
make FC=gfortran -j $(($(nproc) +1))
sudo make PREFIX=/usr/local install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc

Setup Virtual Environment

Create an virtual environment, where we will install all of our packages.

sudo apt-get install python-pip python-dev python-virtualenv
virtualenv --system-site-packages -p python3 ~/tensorflow-gpu-p3
source ~/tensorflow-gpu-p3/bin/activate

Install Tensorflow

Following the official guide found here. This makes use of an virtual environment, where we will install all of our packages.

pip install --upgrade tensorflow-gpu

Install Dependencies

Following the instructions from here.

pip install numpy markupsafe h5py nltk nose nose-parameterized pycuda

Install Theano (optional)

Following the instructions from here.

pip install Theano

# cuda 7.5 don't support the default g++ version. Install an supported version and make it the default.</span>
sudo apt-get install g++-4.9

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

# Work around a glibc bug
echo -e "\n[nvcc]\nflags=-D_FORCE_INLINES\n" >> ~/.theanorc

Check that everything looks fine!

python -c "import theano; theano.test()"

Let’s configure .theanoorc





Install Keras (optional)

pip install keras

Install Libs (optional)

pip install jupyter matplotlib opencv-python sckikit-image scikit-learn

Install Teamviewer (optional)

Let’s setup Teamviewer for graphical remote access.

sudo apt-get install -f
sudo dpkg -i teamviewer_12.0.71510_i386.deb

Setup SSH Server (optional)

Setup port-forwarding on your routher, then run the following command on your server to start jupyter on port 8888.

sudo apt-get install openssh-server
jupyter notebook --no-browser --port=8888

And the following command on your local machine.

ssh -NL 8157:localhost:8888 username@external_ip

If everything worked out fine, you should be able to access the server @ localhost:8157.

Now, you should be all set! Good luck 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *