Ubuntu 20.04
Sponsored Link

NVIDIA Container Toolkit インストール2020/07/24

 
NVIDIA Container Toolkit をインストールすると、コンテナーから GPU を容易に利用可能となります。
[1]
[2]
[3] NVIDIA Container Toolkit をインストールします。
root@dlp:~#
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -

OK
root@dlp:~#
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu20.04/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list
root@dlp:~#
apt update

root@dlp:~#
apt -y install nvidia-container-toolkit

root@dlp:~#
systemctl restart docker

[4] コンテナーからの [nvidia-smi] コマンドの利用方法です。
# Cuda 10.1 コンテナーイメージを Pull して [nvidia-smi]

root@dlp:~#
docker run --gpus all nvidia/cuda:10.1-base nvidia-smi

Fri Jul 24 06:31:53 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   42C    P8     8W / 180W |     15MiB /  8119MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

# Cuda 10.0 コンテナーイメージを Pull して 対話セッションから [nvidia-smi]

root@dlp:~#
docker run -it --gpus all nvidia/cuda:10.0-base bash

root@799e9d112525:/#
nvidia-smi

Fri Jul 24 06:32:31 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   42C    P8     8W / 180W |     15MiB /  8119MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

root@799e9d112525:/# exit 

root@dlp:~#
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nvidia/cuda         10.0-base           841d44dd4b3c        7 months ago        110MB
nvidia/cuda         10.1-base           3b55548ae91f        7 months ago        106MB
関連コンテンツ