NVIDIA : Install Container Toolkit2024/06/21 |
Install NVIDIA Container Toolkit to use GPU on your Computer from Containers. |
|
[1] | |
[2] | |
[3] | Install NVIDIA Container Toolkit. |
root@dlp:~#
root@dlp:~# curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-toolkit.gpg root@dlp:~# curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | tee /etc/apt/sources.list.d/nvidia-toolkit.list root@dlp:~# sed -i -e "s/^deb/deb \[signed-by=\/usr\/share\/keyrings\/nvidia-toolkit.gpg\]/g" /etc/apt/sources.list.d/nvidia-toolkit.list
systemctl restart docker |
[4] | This is how to use [nvidia-smi] from Containers. |
root@dlp:~# docker pull nvidia/cuda:12.3.0-runtime-ubuntu22.04 root@dlp:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nvidia/cuda 12.3.0-runtime-ubuntu22.04 3f746cb1865b 7 months ago 2.2GBroot@dlp:~# docker run --gpus all nvidia/cuda:12.3.0-runtime-ubuntu22.04 nvidia-smi ========== == CUDA == ========== CUDA Version 12.3.0 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 Jun 21 08:20:55 2024 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 550.90.07 Driver Version: 550.90.07 CUDA Version: 12.4 | |-----------------------------------------+------------------------+----------------------+ | 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 RTX 3060 Off | 00000000:05:00.0 Off | N/A | | 30% 41C P0 34W / 170W | 1MiB / 12288MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ +-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | No running processes found | +-----------------------------------------------------------------------------------------+root@dlp:~# docker run --gpus all -it nvidia/cuda:12.3.0-runtime-ubuntu22.04 /bin/bash root@ec3fddf598a8:/# nvidia-smi
Fri Jun 21 08:23:59 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.90.07 Driver Version: 550.90.07 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| 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 RTX 3060 Off | 00000000:05:00.0 Off | N/A |
| 30% 41C P0 N/A / 170W | 1MiB / 12288MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
root@ec3fddf598a8:/# exit
|
Sponsored Link |