Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (46 sloc) 3.05 KB

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 :ref:`hello-world` and the other parts of the :ref:`user-guide` before getting started.

Clone the example project:

$ git clone
$ cd gpu-hello-world

Create this new application using the :ref:`yourturn` web frontend:

Now you will need to create the :ref:`scm-source-json` file that links your Docker image to a specific git revision number (here the scm-source Python package is used):

$ scm-source

Build the Docker image

$ docker build -t<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<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 :ref:`pierone` and push it.

$ pierone login
$ docker push<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 :ref:`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 :ref:`guide <spot-pricing>`).

The Cloud Formation stack can be created by running:

$ senza create --region=eu-west-1 deploy-definition.yaml stackversion<your-team>/gpu-hello-world 0.1 example-mint-bucket-eu-west-1

Note that this assumes a stack version of stackversion and a :ref:`pierone` 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.