This is a tutorial to help you get the Caffe deep learning framework up and running on a GPU-powered AWS instance running inside a Docker container.
Architecture
Setup host
Before you can start your docker container, you will need to go deeper down the rabbit hole.
You’ll first need to complete the steps here:
Setting up an Ubuntu 14.04 box running on a GPU-enabled AWS instance
After you’re done, you’ll end up with a host OS with the following properties:
- A GPU enabled AWS instance running Ubuntu 14.04
- Nvidia kernel module
- Nvidia device drivers
- CUDA 6.5 installed and verified
Install Docker
Once your host OS is setup, you’re ready to install docker. (version 1.3 at the time of this writing)
Setup the key for the docker repo:
1
|
|
Add the docker repo:
1 2 |
|
Install docker:
1
|
|
Run the docker container
Find your nvidia devices
1
|
|
You should see:
1 2 3 |
|
You’ll have to adapt the DOCKER_NVIDIA_DEVICES
variable below to match your particular devices.
Here’s how to start the docker container:
1 2 |
|
It’s a large docker image, so this might take a few minutes, depending on your network connection.
Run caffe test suite
After the above docker run
command completes, your shell will now be inside a docker container that has Caffe installed.
You’ll want run the Caffe test suite and make sure it passes. This will validate your environment, including your GPU drivers.
1 2 |
|
Expected Result: ... [ PASSED ] 838 tests.
Run the MNIST LeNet example
A more comprehensive way to verify your environment is to train the MNIST LeNet example:
1 2 3 4 5 |
|
This will take a few minutes.
Expected output:
1 2 3 4 5 |
|
Congratulations, you’ve got GPU-powered Caffe running in a docker container — celebrate with a cup of Philz!
References
- tleyden5iwx/caffe-gpu-master Caffe Docker image (GPU)
- tleyden5iwx/caffe-cpu-master Caffe Docker image (CPU-only)
- Docker on AWS GPU Ubuntu 14.04 / CUDA 6.5
- CUDA 6.5 on AWS GPU Instance Running Ubuntu 14.04