Considerations when setting up deep learning hardware

dl_considerations_rack_03

In last week’s blog post, I discussed my investment in an NVIDIA DIGITS DevBox for deep learning.

It was quite the investment, weighing in at a staggering (and wallet breaking) $15,000 — more than I ever thought I would spend on a computer that lives in my office (I normally like hardware that exists in the cloud where I don’t need to physically interact with it).

That said, this is an investment that will drive the PyImageSearch blog over the coming months. I’ve made the commitment do to more more deep learning tutorials — specifically tutorials that involve Convolutional Neural Networks and image classification.

In fact, over Memorial Day weekend, I spent two hours inside Trello brainstorming and planning the next year’s worth of tutorials on the PyImageSearch blog.

Most of them involve deep learning.

So, with that said, let’s take a look at some considerations you should keep in mind if you decide to purchase your own DevBox or build your own system for deep learning.

Considerations when setting up deep learning hardware

The NVIDIA DevBox isn’t a “normal” piece of hardware like your laptop or desktop. While you can simply plug it into the wall and boot it up, you really shouldn’t.

Before you even boot your system up for the first time, you need to consider how you are going to handle power surges, battery backup, and where the box is going to “live” in your home or office (this is critical for keeping the system cool).

While I’m writing this blog post in context of the NVIDIA DIGITS DevBox, these same suggestions will apply to you if you decide to build your own deep learning system from the ground up.

Get a UPS — but not just any UPS

First of, you need to get an Uninterruptible Power Supply (UPS). As the name suggests, a UPS provides emergency power to your system(s) when your main power source fails — you can think of a UPS as a large, (very) heavy battery pack to keep your system running when the power goes out. A UPS can even initiate a shutdown sequence once the battery backup levels are critically low.

But before you run down to your local electronics store or hop on Amazon.com, you need to ask yourself one critical question — how much power will my system be drawing?

The microwave test

At max load, the NVIDIA DevBox power consumption can reach 1350W (this is due to the 4 Titan X GPUs in the system).

In the United States, 1350W is comparable to higher-end microwaves, so you should perform what I like to call “the microwave test”.

Check the wattage of your microwave, and if it’s similar to the wattage draw of the deep learning system you’re looking to build, haul the microwave down to the room where you plan on hooking up your deep learning system, turn it on, and let it run for a few minutes.

If you don’t overload the circuit after a few minutes, then you’re probably in a good shape.

I stress the term probably because this isn’t a perfect test. Running a microwave of similar wattage for a few minutes is not the same as running a system for days or even weeks on end at high load. When running your deep learning system, you’ll be drawing more power for longer periods of time.

Therefore, it’s critical to do further research and ensure your home/office is wired properly for this sustained power draw. In some cases, you may need to consult an electrician.

Death by RAID

You know what happens when you have a RAID array (Redundant Array of Independent Disks) running and the power abruptly shuts off and your system immediately shuts down?

Bad things. Bad things will happen.

Your data can be left in an inconsistent, “dirty” state, and your system may need to create the entire array (if it can). As this Why power failures are bad for your data article suggestions, RAID 0 can (potentially) be completed destroyed in a power failure.

Luckily, most modern Unix kernels and RAID tools have built-in precautions to help prevent catastrophic loss during a power failure.

But why take the chance?

Invest in a UPS that can initiate a safe, clean shutdown in the event power goes out and the battery levels are critically low.

Note: Why am I talking about RAID? Because the NVIDIA DIGITS DevBox ships with 3 x 3TB RAID5 disks with a separate SSD cache. The last thing I would want would be to (1) rebuild that array or (2) lose my data due to power failure.

The land hurricane

Figure 1: A derecho, also know as a "land hurricane".

Figure 1: A derecho, also know as a “land hurricane”, nearly destroyed every computer and hard drive I owned back in 2012 [source].

Every hear of the term derecho?

It’s defined as “a widespread, long-lived, straight-line wind storm that is associated with a land-based, fast-moving group of thunderstorms” [Wikipedia].

Derechos are extremely damaging thunderstorms capable of producing hurricane force winds, tornadoes, heavy downpours, and flash floods. Some people even refer to derechos as land hurricanes. These types of storms happen primarily in North America, but have occurred elsewhere in the world with substantially less frequency.

It’s important to understand that these storms develop quickly. In some cases, you may not even hear the thunder as the storm approaches — it’s moving that rapidly. Keep in mind that the storm itself is moving at 60 MPH or higher — most thunderstorms don’t even have gusts that reach 60 MPH.

During my first year of graduate work at UMBC, my home state of Maryland was hit by a historic derecho on Friday, June 29th, 2012. This storm was one of the most destructivedeadly, and fast-moving storms in North American History.

I was alone in my apartment and the time. And to tell you the truth, it was one of the most frightening experiences of my life.

Within minutes, extremely high winds (> 60 MPH with gusts approaching 100 MPH) knocked down power lines and toppled large trees.

Roads flooded.

Brutal ground lighting strikes flashed across the dark, ominous sky, followed by nearly instantaneous, deafening thunder claps that relentlessly continued from 10PM at night to 4AM the next morning.

28 people died during the storm as large trees fell onto their homes, crushing them underneath.

When the storm was over, most of my home city of Catonsville, MD didn’t have power for over 6 days. Some parts of Maryland didn’t have power for weeks — an unheard of time living in the modern day United States.

So, why am I telling you this?

During the storm, one of the electrical lines outside my apartment building was struck by lighting. The surge traveled through the line, to the apartment, and into my UPS.

My APC UPS died that night…

…but my electronics didn’t.

My laptops and hard drives were safe.

Ever since that night, I’ve always, always bought APC — and I’ve made damn sure that any type of sensitive equipment or important data are behind a UPS.

Sure, if the surge is strong enough, no surge protector can save you. But you might as well do your damnedest to ensure you don’t lose your equipment (or more importantly, the data) during a thunderstorm (or any other freak act of nature).

In this case, I only lost my UPS — I could have lost a lot more.

But not just any UPS will do

So, as I mentioned above, you should be utilizing a UPS that has:

  1. Battery backup
  2. Surge protection

That’s all fine and good, but you also need to consider the wattage that you’re drawing.

Most consumer level UPS’ cap out at 900W — in fact, I have this exact UPS that I use for my laptops and external hard drives that caps out a 865W.

Considering that I would need to draw up to 1350W at maximum load, I clearly need an industrial, server-level UPS.

After doing a bunch of research, I found a bunch of UPS’ that can easily handle higher wattage and amps. I ended up going with the APC SMT2200RM2U UPS, which is actually 2x the price of other UPS’ I was looking at — but as I said, I have a trust and affinity with APC, so I decided to spend the extra money.

This rack mount UPS can handle 1980W and 2200VA, more than enough for my NVIDIA DevBox.

Racking it all up

After I received my UPS, I performed a quick test to ensure that the NVIDIA DevBox would work with it. Sure enough, it did (although this image is almost embarrassing to post):

Figure 2: Testing my NVIDIA DevBox with UPS backup.

Figure 2: Testing my NVIDIA DevBox with UPS backup.

When I posted this image in a Slack channel with a few of my other entrepreneur colleagues, my friend Nick Cook of SysDoc.io nearly shit a brick.

Nick quickly pointed out the problems of having a UPS sitting directly on top of carpet, followed by the DevBox sitting on top of the UPS. He was absolutely right — I needed to rack it all up to help with cooling and to keep the equipment safe.

So again, I went to do my research and ended up purchasing the Tripp Lite 18U SmartRack. I could have gone with a smaller rack, but I decided to:

  1. Allow myself to expand and include new systems in the future, if I so desire.
  2. Give the NVIDIA DevBox a little more “breathing room” for cooling.

Note: The NVIDIA DIGITS DevBox is not made to be rack mountable. Instead, I bought a heavy-duty shelf, racked the shelf, and then set the DevBox on top of the shelf.

The rack itself was delivered in quite the large cardboard container:

Figure 3: My rack, still in the box.

Figure 3: My rack, still in the box.

Compared to my UPS and DevBox, the rack could easily include both, leaving room for growth:

Figure 4: The rack itself is more than large enough to house both the UPS and DevBox.

Figure 4: The rack itself is more than large enough to house both the UPS and DevBox.

I then spent the afternoon racking the UPS and DevBox:

Figure 5: Fitting the UPS and DevBox into the rack.

Figure 5: Fitting the UPS and DevBox into the rack.

Which looks quite nice in the space:

Figure 6: The rack, all locked up.

Figure 6: The rack, all locked up.

The DevBox will also serve as a nice heater during the winter months:

Figure 7: My office, now that the NVIDIA DIGTS DevBox, UPS, and rack have been fully installed.

Figure 7: My office, now that the NVIDIA DIGTS DevBox, UPS, and rack have been fully installed.

Summary

In this blog post, I detailed considerations and suggestions you should keep in mind when setting up deep learning hardware. Regardless if you are using the NVIDIA DIGITS DevBox, or building a custom solution, make sure you:

  1. Determine if your house, apartment, or office is correctly wired to draw the required amps/wattage.
  2. Invest in a UPS to protect your investment, especially if you’re using RAID configured drives.
  3. If necessary, rack it all up.

Now that the deep learning environment is all ready to go, I’ll spend next week detailing how to install the CUDA Toolkit for deep learning and cuDNN so you can take advantage of GPUs for speedy training.

Note: The NVIDIA DevBox already comes with CUDA and cuDNN installed, so I’ll be setting up an Amazon EC2 instance from scratch. You’ll be able to use these instructions to stand up your own deep learning machine so you can follow along with future tutorials.

Be sure to sign up for the PyImageSearch Newsletter using the form below to be notified when future blog posts are published!

, , , ,

24 Responses to Considerations when setting up deep learning hardware

  1. garret June 13, 2016 at 12:16 pm #

    Hi Adrian

    Really interesting info on the derechos. I had never heard of them before.

    Hey, regarding image classification, when you’re thinking about your tutorials, could you include some on classifying Landcover from aerial photos. That would be excellent!

    Keep up the great work on the blog. Yours is one of my favorite blogs to learn from.

    • Adrian Rosebrock June 15, 2016 at 12:45 pm #

      The term itself was coined in 1888, but I don’t remember hearing it for the first time until the early 2000’s. I’ll also consider doing some landcover tutorials, although I don’t have any type of datasets for that.

  2. Marc-Philippe Huget June 13, 2016 at 12:19 pm #

    Hello Adrian,

    And what about noise? Is it acceptable? How many db? Thanks for your answer

    Cheers,
    mph

    • Adrian Rosebrock June 15, 2016 at 12:44 pm #

      The noise isn’t that bad, but as I mentioned in my reply to “Ted”, I like white noise. I find it soothing, so it doesn’t bother me at all. I don’t have an answer on the number of DB. If anyone has a good recommendation on an iPhone app to measure DB, let me know and I’ll post my results.

  3. Kenny June 13, 2016 at 1:11 pm #

    Cool Adrian 😉 Keep going!

  4. Dave June 13, 2016 at 3:04 pm #

    One thing you might come up against is the recycling of hot air inside the cab.

    I’m not sure what the airflow of the Nvidia box is, but I suspect it’ll work just fine on it’s side.

    This lets to shove more stuff in, but also makes it more simple to put a baffle in at the front.

    You don’t need anything fancy, although metal blanking plates are the best, cardboard works pretty well.

    However, Kudos to you for explaining *why* you need UPS.

    • Adrian Rosebrock June 15, 2016 at 12:43 pm #

      Hey Dave — the DevBox is heavily ventilated, as you can see in this post. The rack itself is also ventilated, so the system can easily “breathe”. Thanks for the suggestion though!

  5. Ted June 13, 2016 at 5:10 pm #

    How can you endure noise if the box is sitting right next to you…

    • Adrian Rosebrock June 15, 2016 at 12:41 pm #

      It’s honestly not that bad. But then again, I’m the type of guy who likes white noise and sleeps with a fan on. So perhaps I’m not the best judge of the “noise level”.

  6. Arif June 13, 2016 at 6:32 pm #

    wow. can’t wait to see what you will do with this thing!

    • Adrian Rosebrock June 15, 2016 at 12:41 pm #

      There will be lots of deep learning tutorials in the future, trust me!

  7. BNP Raju June 13, 2016 at 8:15 pm #

    Very nice explanation reg need of good power protection UPS to the important systems.

    • Adrian Rosebrock June 15, 2016 at 12:41 pm #

      Thanks! 🙂

  8. JC June 13, 2016 at 10:16 pm #

    Why don’t you use Google’s Tensorflow?

    • Adrian Rosebrock June 15, 2016 at 12:40 pm #

      Do you mean why don’t I use Google TensorFlow’s library? Or why don’t I use the Google Vision API?

  9. Tom June 14, 2016 at 4:31 am #

    Fascinating to see how computer vision blog is moving into neural networks! Would be great to read some advice on building our own cv+nn machines, not necessarily 15k usd monsters but some hints about critical considerations are more than welcome.

    • Adrian Rosebrock June 15, 2016 at 12:39 pm #

      Thanks for the feedback Tom. Perhaps by the end of this year some of my cash reservoir will be refilled and I’ll build a second deep learning box, this time from scratch and demonstrate how it’s done.

  10. Dmytro June 14, 2016 at 8:00 am #

    Thanks for suggesting the UPS, I was not sure which one is suitable.
    Also, check this out: https://www.linkedin.com/pulse/diy-deep-learning-devbox-dmytro-prylipko

    • Adrian Rosebrock June 15, 2016 at 12:36 pm #

      Thanks for sharing the DIY DevBox Dmytro! I actually detail why I didn’t build my own in this blog post.

      • Dmytro June 16, 2016 at 4:54 am #

        After having built it by myself I would agree to you considerations 🙂 For me it took around a week (not full-time, but anyway) to build and set it up. But I did not calculate how much nerves did I strain on that 🙂 Of course, after assembling the first one, the second one I build much faster: one day for hardware part, one day to install the required software.

        • Adrian Rosebrock June 18, 2016 at 8:23 am #

          Thanks for the comment Dmytro — and I can certainly see it getting easier after you’ve done it once or twice. I’ll likely end up building a much smaller deep learning box sometime in 2017 for the experience 🙂 But again, I’m just not a hardware guy and have never really enjoyed working with hardware.

  11. Johnny June 22, 2016 at 9:40 am #

    Bad A$$

  12. Siddharth July 4, 2016 at 12:56 pm #

    I had a surge which knocked out my motherboard. Would your original 865W UPS (APC BR1500G) suffice if I only have 1 Titan X (possibly will add one more later on)? At full load subtracting the power of 2 Titan X (1350-700 =~600W). Is there some other consideration I need to keep in mind?

    • Adrian Rosebrock July 5, 2016 at 1:48 pm #

      It’s not just the Titan X that you need to consider. Yes, the GPU can draw a lot of power — but the power is drawn from your power supply. Check the wattage of your power supply, ensure that your GPUs + other system resources won’t extend it, and then purchase a UPS surrounding these decisions.

Leave a Reply