As I have been dabbling in machine learning, I decided to build a GPU machine. Over the weekend, I built one for myself. I wanted to share the details with others so that they can make the right choices.

A key part of machine learning is to do lot of mathematical computations. As you are training the neural network, you need to do large number of matrix multiplications. In fact, almost all the computations are on matrices – these transformations are similar in nature to graphics. Say you want to tilt an image? Lighten or darken an image? All of it is matrix operations. Graphics cards (Graphics Processing Unit of GPU) excel in these computations.
So, I wanted to build a high end GPU machine for as little money as possible.

## Getting the parts

The challenge with getting the parts is how do you know which parts work together? How do you know what all you need? Thankfully, www.pcpartpicker.com will come to the rescue (there are some limitations, which I will describe later). If you are impatient, here is my list:
PCPartPicker part list / Price breakdown by merchant

Type Item Price
CPU Intel - Core i5-7600K 3.8GHz Quad-CoreProcessor $211.98 @Amazon CPU Cooler Cooler Master - Hyper 212 EVO 82.9 CFM Sleeve Bearing CPU Cooler$24.88 @OutletPC
Motherboard Gigabyte - GA-Z270X-Ultra Gaming ATX LGA1151 Motherboard $158.88 @OutletPC Memory G.Skill - Ripjaws V Series 64GB (4 x 16GB) DDR4-2400 Memory$511.99 @ Newegg
Storage Samsung - 850 EVO-Series 500GB 2.5″ Solid State Drive $174.99 @ Newegg Video Card EVGA - GeForce GTX 1080 Ti 11GB SC Black Edition Video Card$724.99 @SuperBiiz
Case Corsair - 330R Quiet ATX Mid Tower Case $49.00 Power Supply Rosewill - 600W 80+ Bronze Certified Semi-Modular ATX Power Supply$58.87 @OutletPC
Prices include shipping, taxes, rebates, and discounts
Total (before mail-in rebates) $1935.58 Mail-in rebates -$20.00
Total $1915.58 Generated by PCPartPicker 2017-08-18 22:19 EDT-0400 https://pcpartpicker.com/list/GpFnD8 [Since I built it, I know that this list would work. If I am doing it again, I would get low profile memory, as it was difficult to fix the CPU fan with the these high memory sticks]. ### GPU First, what is the right build for GPU computing? The first and foremost is that you need a good GPU. As of writing this note, it is Nvidia 1080 Ti. Here are the reasons why: 1. Nvidia is the undisputed leader in GPU computing. While AMD is a good brand, the library support for Nvidia is unmatched. It is well-debugged, with full support for many frameworks. 2. Now which card? Within the home buyer’s range, you are looking at GeForce GTX series. The higher the number the better it is. Ti, standing for Titanium offer upto 30% more than the regular version. You can get 970, 980, 980 Ti, 1070, 1080, 1080 Ti – any of them will work. Realistically, these options stand out: 1. 1080 Ti: This is the best one currently. Runs around$700
2. 1080: 30% less than the Ti. Runs around $500 3. 980: You can get them on Ebay – if you are lucky, you get it under$150.

### How to buy

Pcpartpicker does the price comparison and tells you where each component is cheaper. Be aware that you have to add taxes to your price on Amazon or your local retailer. Places like newegg or B&H do not collect taxes, though technically you should pay the taxes by yourself end of the year. Surprisingly, I found www.microcenter.com to be the cheapest. It has a retail store in my neighborhood. I managed to pick up the case in open case price, making it really cheap. The CPU+Mobo was on a combo price deal, saving me another $40. Overall, it was cheaper by$120 – a good 6% than the online companies.

Order all the parts at once so that you can start building immediately. In case there is a problem, it becomes clear immediately. You want to take advantage of one month return policy most merchants have – so, start building immediately.

### Building

I never built a computer. Thanks to Youtube, I found it easy. Here are the videos I used:
https://www.youtube.com/watch?v=T9pShHlCmLc&list=PLc3lzolCKqOOnVDfa6OpbuYX2f28R-31x – this is a three part video series. It makes it really easy to build the PC. If you want a quick no-nonsense video: https://www.youtube.com/watch?v=0bUghCx9iso&t=1428s

In any case, here are the steps:

1. Install the CPU
2. Install the CPU fan
3. Install the memory
4. Install the motherboard into the case, taking care the back plate is placed snugly.
5. Plug the case fans into the motherboard
6. Install the graphics card
7. Install the hard disk
8. Plug the front panel cables into the motherboard
9. Put the PSU in.
10. Plug the power into the motherboard
11. Plug the power into the CPU
12. Plug the power into GPU
13. Plug the power into the SSD and the front panel (and DVD drive, if you have one).
14. Arrange the cables neatly.
15. Now, test the case and close the case.

I am not going to describe these steps in detail, as the videos are very descriptive.

After building the computer, check the BIOS. These are the steps you want to do:

1. Check if the BIOS recognized all the parts.
2. Update the bios, if there is a newer bios.
3. Install the OS.
4. Update the clock speeds.

I am going to describe installing OS only in a little bit of detail, as it may be instructive:

## Installing OS

As you are plugging in the peripherals, you will notice that your monitor can be plugged into the motherboard or the graphics card. By default, if the card is there, you should plug into the graphics card.
If you are installing using the flash drive, you would need to change the booting order. There are some issues installing Linux desktop with XWindows. Instead, my suggestion is to install Linux server – which skips the graphical installation entirely. You can the graphical installation after installing the drivers. You can use rufus (https://rufus.akeo.ie/) on windows to copy the ubuntu ISO to a bootable flash drive.

Once you install it, my suggestion is to follow https://blog.nelsonliu.me/2017/04/29/installing-and-updating-gtx-1080-ti-cuda-drivers-on-ubuntu/ – While I am not able to independently test installation using other methods, this methods worked on my machine.

## How does it fare?

I will tell you the full details later. But, for 2K, I have a GPU server for which I need to pay 70c per hr. Assuming that I run it for 8hrs, it is roughly \$150 per month. At that rate, it pays for itself in an year and half. Of course, I can run bitcoin mining, and make some real money!

## Next part

In the next part, I will tell you how to start with your GPU machine, basic setup, basic tools, and basic steps in GPU computing.