Chris Hager
Programming, Technology & More

Machine Learning on Amazon AWS GPU Instances

Machine learning algorithms regularly utilize GPUs to parallelize computations, and Amazon AWS GPU Instances provide cheap and on-demand access to capable virtual servers with NVIDIA GPUs.

GPU Instances come in two flavors: G2.2xlarge and G2.8xlarge:

ModelGPUsvCPUMem (GiB)SSD Storage (GB)
g2.2xlarge18151 x 60
g2.8xlarge432602 x 120

The GPU instances feature Intel Xeon E5-2670 (Sandy Bridge) Processors and NVIDIA GPUs with 1,536 CUDA cores and 4GB of video memory each.


Tips & Tricks

Several machine learning frameworks such as Torch and Theano as well as Amazon itself provide AMIs (Amazon Machine Images) with pre-installed dependencies and NVIDIA kernel drivers:

Use spot instances - they’re much cheaper for GPU instances!

  • Pick a price that has been steady for a while
  • $0.10/hr often gets you a g2.xlarge instance, even for a few days continuously
  • You can view price graphs for the instance type in the AWS console.

Spot instances get a 2 minute notice before being shut down. You can use boto (AWS SDK for Python) to check the timestamp for when that will occur.

Make sure to snapshot your models, otherwise you might lose training time and have to start over. You can save the snapshots to S3 (depending on the size of the model).

Create an AMI with all dependencies pre-installed so you don’t waste time installing those when the instance spins up.

For very large datasets use their Elastic Block Storage (EBS). It’s basically an on-demand SSD you can attach to instances when they spin up.


References


If you have suggestions, feedback or ideas, reach out to @metachris!


David Beazley - Python Concurrency From the Ground Up (LIVE @PyCon 2015)

Great talk and engaging live coding session “Python Concurrency From the Ground Up” by David Beazley at PyCon 2015! Recommended 47 minutes watch.

A few selected quotes:

The fact that he walked in and did this demo from scratch while keeping the packed room engaged was incredible.

A more comprehensive quote:

David Beazley's 2015 PyCon talk on concurrency was one of my favorite talks of the conference, and it was almost all just live coding.

Part of what made that talk compelling was that it took a concept that lots of people find complex/intimidating (how the internals of an asynchronous IO library work) and in ~30 minutes created a full working example in front of a live audience. Writing the code live in front of the audience helps to nail down the central theme of "this stuff isn't actually as scary as it looks".

And another one:

Being in the crowd during this talk was seriously like being at a rock concert.

Beazley was 'playing' the keyboard like an instrument. Every square inch of floor space had someone sitting or standing. The crowd was incredibly invested - nary an eye nor ear wavered. Even Guido looked on with a hawk eye.

I was in a small circle on the floor of people who had just smoked some amazing herb before the talk. I was hanging on his every word and every expression. I've rarely felt so engaged by a conference talk. I'll never forget this one.

He received a raucous standing ovation that is not evident from the conference video.

Reach out to me via @metachris.


How to install NodeJS 5.x on CentOS and Ubuntu/Debian

NodeJS v5.x is deprecated. Take a look at the current instructions on how to install NodeJS 6.x Long-Term Support (LTS) and NodeJS 7.x.


NodeJS v5.0.0 (stable) was released today, just a month after the v4.x long-term-support (LTS) release! Here is a quick and easy way to install the current NodeJS 5.x (including npm) on CentOS and Ubuntu/Debian.


Installing NodeJS 5.x on CentOS 7

The easiest way is to install the latest NodeJS 5.x from the official RPM repository with the standard package manager, which has the advatage of automatically being able to get updates to NodeJS:

# Install the Repository
rpm -Uvh https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm

# Install NodeJS
yum install nodejs

This is basically the short version of running the official CentOS/Fedora/RHEL install script: https://rpm.nodesource.com/setup_5.x


Installing NodeJS 5.x on Ubuntu and Debian

This is the official way to install NodeJS 5.x on Ubuntu, Debian, Linux Mint, Linux Mint Debian Edition (LMDE) and elementaryOS :

# Installing NodeJS 5.x on Ubuntu / Debian
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Enjoy NodeJS 5.x, and reach out to me on Twitter @metachris

See also:

Blog Archive
swirl