答案1
這不是官方的,但您可以distribution
更改說明頁進入ubuntu20.04
,像這樣:
distribution='ubuntu20.04' \
&& 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 docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
應該會回傳類似這樣的內容:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.51.06 Driver Version: 450.51.06 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 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 34C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
請注意,我只需要使用nvidia-docker
張量流進行一些深度學習,並且我上面給出的解決方案對於訓練和推理沒有問題。
答案2
新增儲存庫:/etc/apt/sources.list.d/nvidia-docker.list
deb https://nvidia.github.io/libnvidia-container/ubuntu18.04/amd64 /
deb https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/amd64 /
deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64 /
和
sudo apt-get update
sudo apt-get install -y nvidia-docker2