4.7.1.
Using Native GPU Support
Here is some information about using native GPU support.
Use docker run
--gpus
‣
Example using all GPUs
$ sudo docker run --gpus all ...
‣
Example using two GPUs
$ sudo docker run --gpus 2 ...
‣
Examples using specific GPUs
$ sudo docker run --gpus '"device=1,2"' ...
$ sudo docker run --gpus '"device=UUID-ABCDEF,1"' ...
4.7.2.
Using the NVIDIA Container Runtime for
Docker
Currently, the DGX OS also includes the NVIDIA Container Runtime for Docker (nvidia-
docker2) which lets you run GPU-accelerated containers in one of the following ways.
‣
Use docker run and specify runtime=nvidia.
$ docker run --runtime=nvidia ...
‣
Use nvidia-docker run.
$ nvidia-docker run ...
The nvidia-docker2 package provides backward compatibility with the previous nvidia-
docker package, so you can run GPU-accelerated containers using this command and the
new runtime will be used.
‣
Use docker run with nvidia as the default runtime.
You can set nvidia as the default runtime, for example, by adding the following line to the
etc/docker/daemon.json
"default-runtime": "nvidia",
Here is an example of how the added line appears in the JSON file. Do not remove any pre-
existing content when making this change.
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
You can then use docker run to run GPU-accelerated containers.
$ docker run ...
CAUTION: If you build Docker images while
the build scripts executed by the Dockerfile specify the GPU architectures that the container
will need. Failure to do so might result in the container being optimized only for the GPU
architecture on which it was built.
NVIDIA DGX A100
to run GPU-enabled containers.
configuration file as the first entry.
nvidia
Quick Start and Basic Operation
is set as the default runtime, make sure
DU-09821-001 _v01 | 27
/