Note how to create an NVIDIA Docker environment as of November 4, 2020. Before I knew it, CUDA was not recognized, so I decided to re-install it from the driver.
USER@HOST:~$nvidia-smi
Wed Nov 4 14:41:54 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.64 Driver Version: 430.64 CUDA Version: N/A |
|-------------------------------+----------------------+----------------------+
| 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 108... Off | 00000000:01:00.0 On | N/A |
| 0% 35C P8 12W / 275W | 62MiB / 11175MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1609 G /usr/lib/xorg/Xorg 59MiB |
+-----------------------------------------------------------------------------+
#Uninstall current CUDA
$ sudo apt purge cuda*
$ sudo apt purge nvidia-cuda-*
$ sudo apt purge libcuda*
#Completely deleted
$ sudo apt-get purge nvidia*
$ sudo apt-get autoremove
$ sudo apt-get autoclean
$ sudo rm -rf /usr/local/cuda*
You can install CUDA, Docker, and nvidia-docker2 by following the 3 steps below. Until now, the Nvidia Driver was installed separately, but if you install CUDA, the corresponding driver will also be installed.
Install according to the CUDA Toolkit website (https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=debnetwork)
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-ubuntu1604.pin
$ sudo mv cuda-ubuntu1604.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
$ sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/ /"
$ sudo apt-get update
$ sudo apt-get -y install cuda #(* When specifying the version, cuda-10-Write like 2)
Install according to Docker official installation method
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
After installation, start docker service and set automatic start
$ sudo systemctl start docker && sudo systemctl enable docker
If you want the docker command to be executable without sudo, add the target user to the docker group as follows:
$ sudo usermod -aG docker $USER
Install according to Official installation method
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update
$ sudo apt-get install -y nvidia-docker2
$ sudo systemctl restart docker
$ sudo reboot
$ nvidia-smi
Complete when Nvidia Driver and CUDA Version are displayed.
Reference [What's going on with NVIDIA Docker now? (20.09 version)](https://medium.com/nvidiajapan/nvidia-docker-%E3%81%A3%E3%81%A6%E4%BB%8A%E3%81%A9%E3%81%86 % E3% 81% AA% E3% 81% A3% E3% 81% A6% E3% 82% 8B% E3% 81% AE-20-09-% E7% 89% 88-558fae883f44)
Recommended Posts