10.11.2016 Views

Learning Data Mining with Python

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 11<br />

Getting your code to run on a GPU can be a frustrating experience. It depends<br />

greatly on what type of GPU you have, how it is configured, your operating system,<br />

and whether you are prepared to make some low-level changes to your computer.<br />

There are three main avenues to take:<br />

• The first is to look at your computer, search for tools and drivers for your<br />

GPU and operating system, explore some of the many tutorials out there,<br />

and find one that fits your scenario. Whether this works depends on what<br />

your system is like. That said, this scenario is much easier than it was a few<br />

years ago, <strong>with</strong> better tools and drivers available to perform GPU-enabled<br />

computation.<br />

• The second avenue is to choose a system, find good documentation on<br />

setting it up, and buy a system to match. This will work better, but can be<br />

fairly expensive—in most modern computers, the GPU is one of the most<br />

expensive parts. This is especially true if you want to get great performance<br />

out of the system—you'll need a really good GPU, which can be very<br />

expensive.<br />

• The third avenue is to use a virtual machine, which is already configured for<br />

such a purpose. For example, Markus Beissinger has created such a system<br />

that runs on Amazon's Web Services. The system will cost you money to<br />

run, but the price is much less than that of a new computer. Depending on<br />

your location, the exact system you get and how much you use it, you are<br />

probably looking at less than $1 an hour, and often much, much less. If you<br />

use spot instances in Amazon's Web Services, you can run them for just a few<br />

cents per hour (although, you will need to develop your code to run on spot<br />

instances separately).<br />

If you aren't able to afford the running costs of a virtual machine, I recommend that<br />

you look into the first avenue, <strong>with</strong> your current system. You may also be able to<br />

pick up a good secondhand GPU from family or a friend who constantly updates<br />

their computer (gamer friends are great for this!).<br />

Running our code on a GPU<br />

We are going to take the third avenue in this chapter and create a virtual machine<br />

based on Markus Beissinger's base system. This will run on an Amazon's EC2 service.<br />

There are many other Web services to use, and the procedure will be slightly<br />

different for each. In this section, I'll outline the procedure for Amazon.<br />

[ 259 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!