Ubuntu下 NVIDIA Container Runtime 安装与使用

120次阅读
没有评论

环境要求
已安装 NVIDIA Linux 驱动程序,且版本 >= 418.81.07
内核版本 > 3.10 的GNU/Linux x86_64
Docker >= 19.03
架构 >= Kepler(或计算能力 3.0)的 NVIDIA GPU
开始安装
设置包存储库和 GPG 密钥
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg –dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed ‘s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g’ | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
更新并下载安装 nvidia-docker2
sudo apt-get update
update可能会报错:

sudo apt-get update
E: Conflicting values set for option Signed-By regarding source https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64/ /: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg !=
E: The list of sources could not be read.

解决方案参见官方文档Conflicting values set for option Signed-By error when running apt update

sudo apt-get install -y nvidia-docker2
重启 Docker 守护进程并测试
sudo systemctl restart docker
sudo docker run –rm –gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
看到输出说明安装成功

正文完
 
评论(没有评论)