Running GPU applications on Nimbus

This page:

As mentioned here, the Nimbus vGPU images have NVIDIA CUDA drivers installed, so that your vGPU instances are ready to go. To run your GPU applications on the vGPU instances, it is recommended that you install the required packages in the form of containers. Below are two examples of such use - one with Docker containers and another with Singularity containers. Either can be run on any of the current Pawsey vGPU instances.

Docker GPU containers


Various GPU-accessible applications have Docker containers built using the NVIDIA Container Toolkit to automatically configure them to leverage NVIDIA GPUs that you can use on your vGPU instance. These containers operate with nvidia-docker, which are pre-installed on all Nimbus vGPU images. Note that some containers may need to be executed with their appropriate runtime flag. For example, when using a TensorFlow container, the runtime flag is --runtime=nvidia

>sudo docker run -it --rm --runtime=nvidia tensorflow/tensorflow:latest-gpu python

>>> import tensorflow as tf 
>>> gpus = tf.config.list_physical_devices('GPU') 
>>> print("TensorFlow ", tf._version_, " - ", gpus) 

Tensorflow  2.6.0  -  [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
  • '/physical_device:GPU:0' indicates that the GPU has been recognised by TensorFlow 2.6.0

Singularity GPU containers


Singularity also allows users to make use of NVIDIA GPUs within containers, by adding the runtime flag --nv. If you have a Docker image that you would like to convert to a Singularity container, see instructions here. Here's an example of running Gromacs, a popular molecular dynamics package, among the ones that have been optimised to run on GPUs through NVIDIA containers, using Singularity:

# Run Gromacs preliminary step with container
>sudo singularity exec --nv gromacs_2018.2.sif gmx grompp -f pme.mdp

# Run Gromacs MD with container
>sudo singularity exec --nv gromacs_2018.2.sif \
    					   gmx mdrun -ntmpi 1 -nb gpu -pin on -v \
                           -noconfout -nsteps 5000 -s topol.tpr -ntomp 1
  • gromacs_2018.2.sif is the name of the Singularity container

For more help on Singularity containers and GPU usage, see the Singularity documentation here.