mex-docs

Deploying GPU

MobiledgeX allows you to deploy docker containers to GPU enabled hardware in one of two ways, via a docker image or via a docker compose file. Note that GPU support for docker and docker-compose is relatively immature, so these instructions may change over time as the technology develops.

GPU Enabled Flavors

In all regions with GPUs deployed there will be a set of specific flavors that allow you to use a GPU. These flavors will contain the string gpu; for example, m4.small-gpu.

Deploying a GPU Enabled Docker Image

This is the easiest way to deploy a GPU enabled container; the only additional step required outside of the standard workflow (Link to how to deploy docker images), which is simply to ensure that you select a GPU enabled flavor for the application if you plan on using auto-clustering, or for the cluster when you create it manually.

Deploying a GPU Enabled Docker Compose File

The process for deploying a GPU enabled container using docker-compose is very similar to the standard workflow (Link to how to deploy using compose). However, there are a few key differences that you need to be aware of.

  1. You must use compose version 2.3.
  2. You muse specify the option runtime: nvidia in your service definition.
  3. You must add NVIDIA_VISIBLE_DEVICES=all to your environment section.

Sample Compose File

This sample compose file shows the correct use of arguments to enable GPU support, using the MobiledgeX ComputerVision Application (Link to application).

version: '2.3'
services:
  compvision:
    image: docker.mobiledgex.net/mobiledgex/images/computervision-gpu:2020-09-15
    network_mode: "host"
    restart: unless-stopped
    runtime: nvidia
    environment:
     - NVIDIA_VISIBLE_DEVICES=all

Troubleshooting

  1. Be sure that you are specifing the correct arguments in the yaml file, as shown above.
  2. Be sure that you are using a GPU enabled flavor.
  3. If you receive errors indicating that “no host is available” the cloudlet you are attempting to use may not have any free GPU resources available. Try deploying to a different cloudlet.

In all cases, please contact support if your problems persist.