Ubuntu 22.04
Sponsored Link

NVIDIA : Container Toolkit インストール2022/08/29

 
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/ubuntu22.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 11.5 コンテナーイメージを Pull して [nvidia-smi]

root@dlp:~#
docker run --gpus all nvidia/cuda:11.5.2-base-ubuntu20.04 nvidia-smi

Mon Aug 29 06:02:56 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.85.02    Driver Version: 510.85.02    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce ...  Off  | 00000000:05:00.0 Off |                  N/A |
|  0%   50C    P5     9W / 120W |      0MiB /  6144MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

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

root@dlp:~#
docker run -it --gpus all nvidia/cuda:10.2-base-ubuntu18.04 bash

root@08ae46c44932:/#
nvidia-smi

Mon Aug 29 06:04:46 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.85.02    Driver Version: 510.85.02    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce ...  Off  | 00000000:05:00.0 Off |                  N/A |
|  0%   50C    P5    10W / 120W |      0MiB /  6144MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

root@08ae46c44932:/# exit 

root@dlp:~#
docker images

REPOSITORY    TAG                       IMAGE ID       CREATED        SIZE
nvidia/cuda   10.2-base-ubuntu18.04     9ba99482dca2   2 weeks ago    107MB
ubuntu        latest                    df5de72bdb3b   3 weeks ago    77.8MB
nvidia/cuda   11.5.2-base-ubuntu20.04   20e5014a14c9   3 months ago   153MB
関連コンテンツ