How to build a GPU deep learning machine

Socratic Datum
9 min readDec 31, 2016

--

Background

This is Part 1 of 3 in a tutorial series for getting started with GPU-driven deep learning. These tutorials are intended for anyone who is interested in figuring out what it takes to get started with deep learning on a personal machine that costs less than $2000. This assumes you have some familiarity with machine learning and deep learning. This series will cover:

  1. Part 1: How to build a GPU deep learning machine
  2. Part 2: Setting up Ubuntu and Docker for deep learning
  3. Part 3: Using deep learning with style transfer

Recommended Reading

Other Useful References

Using Cloud GPUs

You may be wondering “why would I build my own computer when I can use Amazon Web Services (AWS) GPU instances”. This is a fair question, and depending on your use cases, AWS may be more appropriate than building a computer. I recommend taking a look at the pricing. Some more resources:

Building a GPU-focused Machine

If you haven’t built a PC before, knowing where to begin in building your first GPU-focused machine is a bit of challenge. When I built my machine this past summer, I wanted something that I could use to get my feet wet with deep learning and something that would run an HTC Vive well. Additionally, at that time NVIDIA had just released several new GPUs so I was faced with balancing performance gains of new cards vs. cost. I ended up going with the following build, which I describe in greater detail below.

Intro to Deep Learning Machine (+VR)

Central Processing Unit (CPU)

  • Intel Core i7–6700K 4.0GHz Quad-Core Processor
  • The CPU is not where the bulk of the computation power comes from in deep learning, but it is the central point of processing for the computer generally. It passes data to the GPU for processing, and it handles reading and writing of files. Most deep learning libraries are single-threaded, so having a multi-core CPU isn’t very important, unless you’re using multiple GPUs. In general, you want one CPU core (two threads) for every GPU you have, and you want to reserve a CPU core for the operating system (OS). The CPU is more important for VR.
  • I decided to go with this CPU because I wanted my computer to remain up-to-date for the next several years. Other folks recommend the i5, which is a more economical solution.

CPU Cooler (aka “Heatsink”)

  • CRYORIG H7 49.0 CFM CPU Cooler
  • The CPU gets hot, so it needs some way to stay cool. Some people use water cooling, which has the added benefit of looking cool but is overkill for our purposes since we’re not planning on overclocking our CPUs.

Thermal Paste

Motherboard

  • MSI Z170A GAMING M7 ATX LGA1151 Motherboard
  • The motherboard is the part of the computer that connects all of the other components of the computer.
  • I chose this motherboard because it has three PCI-e 3.0x16 slots for the GPUs, it supports up to 64GB DDR4 RAM, it supports 2-way NVIDIA SLI, it supports the Intel i7 CPU, and it has several USB 3.1 and 2.0 ports.

Graphics Processing Unit (GPU)

  • EVGA GeForce GTX 1070 8GB SC Gaming ACX 3.0 Video Card
  • The GPU is where most of the magic happens for deep learning. The number of cores is important for deep learning, and the clock speed is important for VR.
  • I chose this GPU because I didn’t want to spend $1000+ on a card when I was new to deep learning. I decided I would start off with an economical option and then upgrade to a card more focused for deep learning (e.g., Titan X series) when I became bottlenecked by my card.

Random Access Memory (RAM)

  • Corsair Vengeance LPX 16GB (2 x 8GB) DDR4–3000 Memory
  • RAM temporarily stores batches of data in memory, avoiding some of the costs in time with reading/writing using other media (e.g., hard disks).
  • As a rule of thumb, for every 1GB of memory on your GPU you want 2GB of memory in RAM. Since my GPU had 8GB of memory, I got 16GB of RAM. At the time I was considering getting two 16GB sticks (32GB total) of RAM. Looking back, I wish I had gotten this instead so that I would have a surplus of RAM available for multi-tasking while running deep learning models and for the addition of another GPU.

Solid State Drive (SSD)

  • Sandisk Ultra II 960GB 2.5" Solid State Drive
  • Samsung 850 EVO-Series 500GB 2.5" Solid State Drive
  • SSDs store your data, and they’re a lot faster than traditional hard drives.
  • Right now I have Windows (for HTC Vive) running on my 500GB SSD, and I have Ubuntu 14.04 (for deep learning) running on a 960GB SSD. For this tutorial, I will be installing Ubuntu 16.04 on an extra 960 GB SSD I have. Eventually, if I ever want to set up a RAID10 configuration then I can purchase another SSD or two. The Sandisk 960GB SSDs go on sale periodically at a price comparable to the 500GB SSD.

Power Supply Unit (PSU)

  • Corsair RMx 850W 80+ Gold Certified Fully-Modular ATX PSU
  • The PSU is responsible for supplying power to all of the components of the computer. Different grades of PSUs provide varying amounts of power at varying levels of efficiency. You determine the minimum PSU power needed by calculating the estimated total wattage of your build.
  • I chose this PSU since it would support a much “beefier” deep learning build if I needed to upgrade down the road.
  • Great power supply calculator.

Case

  • Cooler Master HAF 932 Advanced ATX Full Tower Case
  • The case houses all of your hardware innards. The motherboard, PSU, and drives mount to the inside of the case, and the remaining components plug into the motherboard. Some other components, like the GPU, may also mount to the case.
  • This case is kind of a monster, and comes with three 230mm fans and one 140mm rear fan. I chose this case because it would be big enough to support additional components over time. An added benefit is that because it’s so big, it has great airflow. It also comes with attachable wheels, which I love.
  • One drawback to this case is that it’s heavy and difficult to transport. I’ve given many demos on the HTC Vive, so putting my computer in the backseat of my Civic is not uncommon. Looking back, I might have gone with a smaller case that could have made transporting much easier.

Other Items

  • I recommend getting a grounding wrist strap so that you don’t accidentally shock any of your parts while you’re working on them.
  • You’re going to need some screw drivers.
  • You’re going to need a monitor, mouse, and keyboard. Wired peripherals are more reliable than wireless ones.
  • In the build above I don’t include a Wifi card. The motherboard comes with an Ethernet port. I also use this USB Ethernet/USB hub. If you decide to take the ethernet route, you’ll need an ethernet cable.
  • You may want a disc drive. I have an external one I attach via USB.
  • You’ll need at least one USB flash drive for the OS installer.
  • I recommend getting a nice surge protector. I have this Tripp Lite one, which I like even though it buzzes occasionally.

Tips in Picking Your Parts and Ordering

PCPartPicker is a great resource. It provides a centralized way for searching and selecting your computer parts, it shows you prices and reviews of parts, it will check for compatibility issues in the parts that you have selected, and it will tell you the total wattage of your current build.

I wouldn’t advice pricing your machine based on rebates. There are number of hoops you have to jump through to actually submit a form for a rebate, and you often have to wait a while before you receive anything. In the end, depending on how much your time is worth, rebates can be pointless.

Assembling Your Machine

The first time you put together your machine can be a real headache. I assembled and disassembled my computer three times before I finally put it together correctly. The different hardware components provide instructional booklets for how to install their respective parts, but you have to bounce between them to figure everything out. Google search is your friend.

The following video provides clear instructions for assembling your machine, and you can use it in tandem with the directions enumerated below.

Note that the order I suggest varies a bit from the video. Plugging cables into the motherboard becomes more difficult as you have more components in your case. I recommend reading through the assembly instructions completely before beginning assembly. As you build your machine, you’ll find a preferred workflow.

Assembly Instructions

  1. Find a space that’s big enough to set your computer case on its side along with some of the remaining components scattered. You want to have enough room so that you can keep track of your parts and screws. I like to have a completely clean and clear space, and I like assembling my computer at a table that’s comfortable for sitting or standing.
  2. Ground yourself. I recommend wearing clothing that doesn’t generate static electricity. I also recommend getting a grounding wrist strap and attaching it to your case or some other metal device.
  3. Place your motherboard on your working surface.
  4. Insert your RAM into RAM slots on the motherboard.
  5. Following the instructions provided in the CPU booklet, open the CPU cage on the motherboard and place the CPU onto the board, matching up the appropriate corner with the missing pin. Then, close the cage and pull down the retaining lever.
  6. Following the instructions provided with the CPU Cooler, install the cooler plate on the opposite side of the motherboard that the CPU is on.
  7. Mount the PSU in the case. I installed mine in the bottom of my case. KEEP THE PSU UNPLUGGED FROM AN OUTLET WHILE YOUR ARE WORKING ON YOUR MACHINE.
  8. Mount the motherboard in the case.
  9. Apply an even layer of thermal paste onto the CPU. There are other methods that are also recommended.
  10. Mount the cooling fan (heatsink) on top of the CPU, being careful to press down on the CPU evenly.
  11. Following the instructions in the PSU booklet and other booklets, plug the PSU cables into the motherboard and then plug the fans into the appropriate slots in the motherboard. I advise arranging your cables in such a way as to keep the motherboard clear and accessible. I use twisty ties to keep the cables grouped together, and I run many of my cables on the opposite side of the case.
  12. Mount your SSD in a hard drive cage in your case. Using the cables provided with the PSU, plug the SSD into the motherboard with the appropriate cables described in the PSU or SSD manual.
  13. At this point you may install your GPU by inserting the GPU into a PCI-e slot and mounting the GPU with any screws as is appropriate. This install tutorial provides a nice demonstration of this process. Note, you may want to continue with Step 14 before completing this step to ensure that the other components are installed correctly.
  14. Turn your computer the right way up, and plug in a monitor, keyboard, and mouse. Following the instructions in the motherboard manual, power on your computer. If things go well, the BIOS should come up, and you should be able to find that your various hardware components are detected.
Completed build (including GPU)

If you’ve made it this far then you’re ready to set up your deep learning environment by installing Ubuntu 16.04 and Docker! Part 2: Setting up Ubuntu and Docker for deep learning.

This is a living document, subject to change. If you find any inaccuracies or have any comments, reply below!

--

--

Socratic Datum

Artificial Intelligence | Art & Music | Philosophy | Community | Education