CentOS 7
Sponsored Link

Install NVIDIA Container Toolkit2020/07/24

 
Install NVIDIA Container Toolkit to use GPU on your Computer from Containers.
[1]
[2]
[3] Install 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] This is how to use [nvidia-smi] from Containres.
# pull Cuda 11.0 image and run [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                                                 |
+-----------------------------------------------------------------------------+

# pull Cuda 10.0 image and connect to the interactive session, then run [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
Matched Content