A hello world GPU example¶
This guide should show you all the steps required for creating a simple GPU-based application. It is recommended that the reader familiarize themselves with hello-world and the other parts of the User’s Guide before getting started.
Clone the example project:
$ git clone https://github.com/zalando-stups/gpu-hello-world.git $ cd gpu-hello-world
Create this new application using the YOUR TURN web frontend:
Now you will need to create the scm-source.json file that links your Docker image to a specific git revision number (here the scm-source Python package is used):
Build the Docker image
$ docker build -t pierone.stups.example.org/<your-team>/gpu-hello-world:0.1 .
And now see if it is listed locally:
$ docker images
If you have nvidia-docker installed locally, the image can also be run:
$ docker run --rm -it pierone.stups.example.org/<your-team>/gpu-hello-world:0.1
which should show the expected output from nvidia-smi.
Running with docker instead of nvidia-docker will show a /bin/sh: 1: nvidia-smi: not found message as the nvidia-smi tool used is part of the NVIDIA CUDA driver installiation which is not available when running with docker.
If all works, we are ready to login in Pier One and push it.
$ pierone login $ docker push pierone.stups.example.org/<your-team>/gpu-hello-world:0.1
Let’s check if we can find it in the Pier One repository (login needed if your token expired):
$ pierone login $ pierone tags <your-team> gpu-hello-world
Now let’s create the version in YOUR TURN for the application created:
Configure your application’s mint bucket (click on the “Access Control” button on your app’s page in YOUR TURN).
This will trigger the mint worker to write your app credentials to your mint bucket.
The repository contains an example Senza definition that can be used to deploy the Hello World example. If required, you can also add a log provider or other configuration options (like guide).
The Cloud Formation stack can be created by running:
$ senza create --region=eu-west-1 deploy-definition.yaml stackversion pierone.stups.example.org/<your-team>/gpu-hello-world 0.1 example-mint-bucket-eu-west-1
Note that this assumes a stack version of stackversion and a Pier One image version of 0.1.
Once the stack has started up, you should be able to view the output in your log provider (if configured). If not, the instance can be accessed and the contents of the /var/log/application.log checked to confirm that the stack ran as expected.