CentOS 7
Sponsored Link

NVIDIA Container Toolkit インストール
2020/07/24
 
NVIDIA Container Toolkit をインストールすると、コンテナーから GPU を容易に利用可能となります。
[1]
[2]
[3] NVIDIA Container Toolkit をインストールします。
[root@dlp ~]#
curl https://nvidia.github.io/nvidia-docker/centos7/nvidia-docker.repo > /etc/yum.repos.d/nvidia-docker.repo

[root@dlp ~]#
yum -y install nvidia-container-toolkit

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

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

Fri Jul 24 02:23:14 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.57       Driver Version: 450.57       CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:05:00.0 Off |                  N/A |
| 27%   38C    P5    24W / 180W |      0MiB /  8119MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

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

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

root@5a73e714b81b:/#
nvidia-smi

Fri Jul 24 02:25:26 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.57       Driver Version: 450.57       CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:05:00.0 Off |                  N/A |
| 27%   38C    P5    25W / 180W |      0MiB /  8119MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

root@81ccbb753393:/# exit 

[root@dlp ~]#
docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nvidia/cuda         11.0-base           935f106b7c30        2 days ago          122MB
nvidia/cuda         10.0-base           841d44dd4b3c        7 months ago        110MB
関連コンテンツ