Deep Learning Machine Build


This blog is about my experience building my first Deep Learning machine. There are plenty of great blogs and videos on how to do this. If you’re interested in how to do this only, skip to the References section, and I put links to all of the blogs / videos that I used.

Acknowledgements

This blog is dedicated to my wife. Without her support, none of this would be possible. My wife told me 6 months ago that I had put a lot of time into machine learning, and I should stick with it. She wouldn’t let change my direction!

Preface

One thing that is ringing true for me lately and with this whole project is:

People can do anything. You might not know how to do it yet but just go for it!

Nobody helped me do this as in writing any actual code or physically assembling things. One person gave me advice on Wifi drivers, thanks Evangelos!, but other than that I figured it out :)

My Story

Okay, so the story…

I got into PyTorch. I had tried Keras and Tensorflow as well, but for some reason PyTorch stuck and I really liked the API. It has pretty much the same API as numpy but with GPU support and for machine learning.

I went to the Pytorch Developer Conference October 2, 2018, and had just been excited since.

I had been using Paperspace for running models on a GPU that I rented hourly at $0.50 an hour plus $8 per month for persistent storage. This worked okay, but my monthly costs were going up as I was getting more into PyTorch, so it started to feel like it was the right time to invest in my own machine. I started at $15 a month, and the last month was $34. The astute will notice this is $360 a year. So, if I can make a $1800 DL machine build last 5 years, then I break even at my current usage, with only power as an additional cost, plus I can use the machine any amount on top of that.

I decided to build the machine myself instead of paying someone to assemble it. I followed a great YouTube video. It’s also in the References section.

Installing the USB Wifi Adapter was probably the hardest part. I did a separate blog on it.

Installing the CUDA drivers was pretty easy, following Nvidia’s very thorough documentation. There’s a link in the References.

Some things I learned

Assempling the DL machine scared me. In the YouTube video they say to be careful at every point or you coulld bend a pin or break something. I was super careful, and didn’t break anything, it just took longer.

Coming from a software background and doing unit testing, it scared me that the feedback loop for assembling the DL machine and to know if it was successful was super long. Once assembled though, small teaks and confirming that things were powered on worked. Things that I had to test and tweak were:

  • the hdmi input - if you have a GPU the hdmi has to be plugged in to the GPU hdmi port, not the motherboard hdmi port
  • what usb ports are available. The command lsusb will tell you this

The whole build was a learning experience. I didn’t know anything about setting up a Wifi adapter. I learned a lot and did a separate blog about it here

I learned to follow the directions that come with the Motherboard. I was Googling for what goes where and a diagram, but there was instructions in the box that I didn’t look at until I thought to check the box!!

Same for the power supply, there’s instructions in the box.

RAM is CPU specific. There’s a list of supported RAM sticks that work with the specific CPU. I first ordered RAM, and it said Intel on it, but my CPU is AMD. I didn’t install it, did some research, and had to return it and get the right RAM. Lucky for me, Newegg has a great return policy.

“You will need a monitor, keyboard, and maybe mouse”. I first thought, no I just plug my Macbook into the DL machine. This was maybe me not thinking it through. It might be possible, but for the simplist install, use these things.

An ethernet cable is needed to set up the USB Wifi Adapter. Most motherboards don’t come with Wifi. I had to purchase this separately later once I realized that I needed it.

Parts list

Here is my parts list for the build:

Miscellaneous

Build Decisions

There were a lot of decisions to make along. Here’s a list of some of them and why I chose what I did.

GPU

I chose to go with a used Nvidia GTX 1080Ti because these go for $500 on eBay, compared to $800 for a RTX 2080 or $1k+ for an RTX 2080Ti. I was using a Nvidia p4000 with 8GB memory on Paperspace, so when comparing specs, the GTX 1080Ti performs better than the p4000 and has 11GB memory, so this would be an upgrade.

CPU

I was comparing the Intel 8700k or the Ryzen 2700x. Ryzen has more cores and more cache memory. Both are 3.7 GHz clockspeed. Here is a comparison.

RAM

Paperspace did give me 30GB RAM. I went with 16GB RAM. Not sure if I need up to 30GB. I never hit this limit on Paperspace. The motherboard has 4 RAM slots, so this could be upgraded.

Power supply

The suggested power supply is minimum 650w with this setup. I chose a 1000w power supply to future proof myself in case I wanted to get another GPU. The case has room for another, and this is Jeremy Howard of https://www.fast.ai/’s recommendation. One for running training jobs and a second for developing. I can only hope to get to that level someday.

Images

DL Machine

Imgur

All the boxes

Imgur

Jupyter Notebook

I’m putting a section for this so I remember!

First, port forwarding must be setup for the 8888 port for the Wifi Home network to port forward to the DL machine.

Launch Jupyter on the server

jupyter notebook --no-browser --port=8888

On the client setup port forwarding

ssh -N -f -L localhost:8888:localhost:8888 -i ~/.ssh/my.pem  username@hostname

Go to localhost:8888 in the browser and Jupyter should be loaded.

Useful commands

To see which ssh processes are running, this will show ssh port forwarding

ps aux | grep ssh

Kill a process by PID

kill -9 <pid>

List all Process PIDs accessing a Port

lsof -ti:<port>

Kill all processes accessing a port

lsof -ti:<port> | xargs kill -9

wget in background

wget -bqc url

Wifi Interface setup and commands

Make sure that the driver is downloaded. I used this Github repo for my driver rtl8812AU

Follow the README.md installation instructions:

# cd /usr/src/rtl8812au
# sudo make clean
# sudo make
# sudo make install
# sudo modprobe -a rtl8812au

Then check ifconfig -a to see if interface is present.

iwconfig - will show wifi interfaces

If the interface is present, from here run one of the following to register an ip address to the interface:

sudo ip link set wlp3s0 down
sudo ip link set wlp3s0 up

Or restart machine:

sudo shutdown -r

Check if it’s working

ping -c3 192.168.0.1

If you’re using port forwarding, the IP address may have changed, so check the new IP address and adjust if needed.

References

Nvidia official CUDA Toolkit Documentation:

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation

Nvidia CUDA Downloads Page:

https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

Setup DL Machine Tutorials:

Gaming PC Build YouTube video

https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-18-04-bionic-beaver-linux

Medium - Build your own deep learning machine

The $1700 great Deep Learning box: Assembly, setup and benchmarks

Get fresh articles in your inbox

If you liked this article, you might want to subscribe. If you don't like what you get, unsubscribe with one click.