NVIDIA : Install Container Toolkit2022/08/29 |
Install NVIDIA Container Toolkit to use GPU on your Computer from Containers.
|
|
[1] | |
[2] | |
[3] | Install NVIDIA Container Toolkit. |
root@dlp:~#
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
apt update root@dlp:~# apt -y install nvidia-container-toolkit root@dlp:~# systemctl restart docker |
[4] | This is how to use [nvidia-smi] from Containers. |
# pull Cuda 11.5 image and run [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 | +-----------------------------------------------------------------------------+ # pull Cuda 10.2 image and connect to the interactive session, then run [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 |
Sponsored Link |
|