Debian 12 bookworm
Sponsored Link

NVIDIA : Container Toolkit インストール2023/07/14

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

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

root@dlp:~#
sed -i -e "s/^deb/deb \[signed-by=\/etc\/apt\/keyrings\/nvidia-docker.key\]/g" /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 12.1 コンテナーイメージを Pull して [nvidia-smi]

root@dlp:~#
docker run --gpus all nvidia/cuda:12.1.1-runtime-ubuntu22.04 nvidia-smi

==========
== CUDA ==
==========

CUDA Version 12.1.1

Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.

Fri Jul 14 07:04:37 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.1     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:05:00.0 Off |                  N/A |
|  0%   49C    P8     6W / 120W |      1MiB /  6144MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

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

root@dlp:~#
docker run --gpus all -it nvidia/cuda:11.8.0-runtime-ubuntu22.04 /bin/bash

root@811c15909563:/#
nvidia-smi

Fri Jul 14 07:08:41 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.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  NVIDIA GeForce ...  On   | 00000000:05:00.0 Off |                  N/A |
|  0%   48C    P8     6W / 120W |      1MiB /  6144MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

root@811c15909563:/# exit 

root@dlp:~#
docker images

REPOSITORY    TAG                          IMAGE ID       CREATED       SIZE
nvidia/cuda   11.8.0-runtime-ubuntu22.04   af0cef3d3ee9   3 weeks ago   2.65GB
nvidia/cuda   12.1.1-runtime-ubuntu22.04   9b0ef067f6b4   3 weeks ago   2.24GB
関連コンテンツ