Install NVIDIA Container Toolkit2020/07/27 |
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/ubuntu20.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 Containres. |
# pull Cuda 10.1 image and run [nvidia-smi] root@dlp:~# docker run --gpus all nvidia/cuda:10.1-base nvidia-smi Fri Jul 24 06:31:53 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 1070 Off | 00000000:04:00.0 Off | N/A | | 0% 42C P8 8W / 180W | 15MiB / 8119MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| +-----------------------------------------------------------------------------+ # 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@799e9d112525:/# nvidia-smi
Fri Jul 24 06:32:31 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1070 Off | 00000000:04:00.0 Off | N/A |
| 0% 42C P8 8W / 180W | 15MiB / 8119MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
root@799e9d112525:/# exit
root@dlp:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nvidia/cuda 10.0-base 841d44dd4b3c 7 months ago 110MB nvidia/cuda 10.1-base 3b55548ae91f 7 months ago 106MB |