This post details the setup required to run code written with OpenCL and Boost.Compute on Amazon EC2.
Currently, Amazon offers two different NVIDIA-based GPU instance types (G2 and CG1). The G2 instances come with a Kepler GK104 GPU while the CG1 instances have an older Tesla M2050. I went with the G2 instance. In my nearest zone (US West), rates ran ~70 cents/hour.
Surprisingly (compared with the last time I used EC2 a couple years ago) its comes with fairly recent software including GCC 4.8 and Boost 1.53. This makes setup much easier than it used to be.
First, install the necessary dependencies from the package manager:
sudo yum install gcc48-c++ cmake git boost-devel
Then, clone Boost.Compute:
git clone https://github.com/kylelutz/compute.git
Next, create a build directory:
mkdir compute-build && cd compute-build
And then run cmake:
Now run make to compile everything:
If successful, running the list_devices example should show the NVIDIA GPU:
Platform 'NVIDIA CUDA'
GPU Device: GRID K520
All in all, it was a fairly painless process to get up and running (and much cheaper than buying a Kepler-class Tesla card!).