简体   繁体   English

我可以仅将 nvidia-drivers 用于基于 docker 的系统的主机吗?

[英]Can I use only nvidia-drivers for host machine of docker based system?

I have problem understanding cuda and docker ecosystem.我无法理解 cuda 和 docker 生态系统。

On a host (ubuntu 22.04) server I want to spawn multiple Machiene Learning Jupyter notebooks.在主机(ubuntu 22.04)服务器上,我想生成多个 Maciene Learning Jupyter 笔记本。

Is it enough if I install in the host ubuntu ONLY Nvidia drivers like this:如果我只在主机 ubuntu 中安装这样的 Nvidia 驱动程序就足够了吗:

sudo apt-get install linux-headers-$(uname -r)
DISTRIBUTION=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
echo $DISTRIBUTION
wget https://developer.download.nvidia.com/compute/cuda/repos/$DISTRIBUTION/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-drivers

sudo reboot

#After reboot verify if the CUDA driver is installed:
nvidia-smi

and then install cuda in containers like this:然后在容器中安装cuda ,如下所示:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda

I think the purest way is to install only required packages on host systems and enrich the containers with all the necessary packages.我认为最纯粹的方法是在主机系统上只安装所需的包,并用所有必要的包丰富容器。 That is why I wonder if this approach is reasonable.这就是为什么我想知道这种方法是否合理。

  1. Do I understand correctly that the container will then use the drivers from host system?我是否正确理解容器将使用主机系统中的驱动程序?
  2. Is installing cuda enough to be installed in the conatiners, or I shall install cuda-toolkit as it contains more additional packages?安装cuda是否足以安装在容器中,或者我应该安装cuda-toolkit ,因为它包含更多额外的包?

Do I understand correctly that the container will then use the drivers from host system?我是否正确理解容器将使用主机系统中的驱动程序?

Yes, the container will use the drivers from the host system.是的,容器将使用来自主机系统的驱动程序。 If you are building your own container, do not install the drivers in the container .如果您正在构建自己的容器,请不要在容器中安装驱动程序

Is installing cuda enough to be installed in the conatiners, or I shall install cuda-toolkit as it contains more additional packages?安装 cuda 是否足以安装在容器中,或者我应该安装 cuda-toolkit,因为它包含更多额外的包?

You might not ever want to install cuda in this scenario.在这种情况下,您可能永远不想安装cuda You can install cuda (which will also install the drivers mentioned in your question 1) in the host machine .您可以在主机中安装cuda (它还将安装问题 1 中提到的驱动程序)。 That is acceptable.这是可以接受的。 In the container, if you are building it yourself, you don't want to install cuda , at most the cuda-toolkit .在容器中,如果您自己构建它,您不想安装cuda ,最多安装cuda-toolkit

Can I use only nvidia-drivers for host machine of docker based system?我可以仅将 nvidia-drivers 用于基于 docker 的系统的主机吗?

There are generally 3 items needed in the host machine, beyond the linux OS install, to make it ready for CUDA-enabled container usage:除了 linux 操作系统安装之外,主机中通常需要 3 个项目,以使其为启用 CUDA 的容器使用做好准备:

  1. The GPU drivers GPU 驱动程序
  2. A recent docker version最近的 docker 版本
  3. The NVIDIA container toolkit (see above link for install instructions) NVIDIA 容器工具包(有关安装说明,请参见上面的链接)

It is not necessary to install the CUDA toolkit (ie the items beyond the GPU driver install) in the host machine.无需在主机中安装 CUDA 工具包(即 GPU 驱动程序安装之外的项目)。 These will usually be installed in the container if they are needed in the container.如果容器中需要它们,它们通常会安装在容器中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以在Docker容器内映射主机(Windows)的gpu驱动程序吗? - Can I map gpu drivers of host machine (windows) inside docker container? 使用 Virtualbox 驱动程序创建 Docker 机器主机时出错 - Error creating Docker Machine host with Virtualbox drivers 我可以基于主机文件系统构建一个docker容器吗? - Can I build a docker container based on the host file system? 如何使用 docker-machine 和 VirtualBox 创建基于 ubuntu 的 docker 主机? - How can I create ubuntu based docker host by using docker-machine with VirtualBox? 设置docker-machine主机后如何在本地使用docker-compose? - How can I use docker-compose locally after setting up a docker-machine host? 如何从Docker Machine设置的主机上运行的容器中使用Docker守护进程? - How can I use the docker daemon from a container running on a host provisioned by Docker Machine? docker安装后无法使用主机互联网 - Can't use host machine internet after docker installation 来自主机 Windows 的 docker 中 ubuntu 上的 nvidia 驱动程序支持 - “在您的系统上找不到 NVIDIA 驱动程序”错误 - nvidia driver support on ubuntu in docker from host windows - 'Found no NVIDIA driver on your system' error 如何使用来自主机映像的docker映像中的shell? - How can I use the shell from a docker image on files from the host machine? 如何让 Docker 识别 NVIDIA 驱动程序? - How to get Docker to recognize NVIDIA drivers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM