最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Docker使用GPU全過程

 更新時間:2024年01月09日 15:16:25   作者:DripBoy  
這篇文章主要介紹了Docker使用GPU全過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

一、docker使用宿主機硬件設(shè)備的三種方式

  • 使用--privileged=true選項,以特權(quán)模式開啟容器
  • 使用--device選項
  • 使用容器卷掛載-v選項

二、docker使用gpu方式演變

docker使用宿主機的gpu設(shè)備,本質(zhì)是把宿主機使用gpu時調(diào)用的設(shè)備文件全部掛載到docker上。

nvidia提供了三種方式的演變,如下是官網(wǎng)的一些介紹

來自 <Enabling GPUs in the Container Runtime Ecosystem | NVIDIA Technical Blog>

NVIDIA designed NVIDIA-Docker in 2016 to enable portability in Docker images that leverage NVIDIA GPUs. It allowed driver agnostic CUDA images and provided a Docker command line wrapper that mounted the user mode components of the driver and the GPU device files into the container at launch. Over the lifecycle of NVIDIA-Docker, we realized the architecture lacked flexibility for a few reasons: Tight integration with Docker did not allow support of other container technologies such as LXC, CRI-O, and other runtimes in the future We wanted to leverage other tools in the Docker ecosystem – e.g. Compose (for managing applications that are composed of multiple containers) Support GPUs as a first-class resource in orchestrators such as Kubernetes and Swarm Improve container runtime support for GPUs – esp. automatic detection of user-level NVIDIA driver libraries, NVIDIA kernel modules, device ordering, compatibility checks and GPU features such as graphics, video acceleration As a result, the redesigned NVIDIA-Docker moved the core runtime support for GPUs into a library called libnvidia-container. The library relies on Linux kernel primitives and is agnostic relative to the higher container runtime layers. This allows easy extension of GPU support into different container runtimes such as Docker, LXC and CRI-O. The library includes a command-line utility and also provides an API for integration into other runtimes in the future. The library, tools, and the layers we built to integrate into various runtimes are collectively called the NVIDIA Container Runtime. Since 2015, Docker has been donating key components of its container platform, starting with the Open Containers Initiative (OCI) specification and an implementation of the specification of a lightweight container runtime called runc. In late 2016, Docker also donated containerd, a daemon which manages the container lifecycle and wraps OCI/runc. The containerd daemon handles transfer of images, execution of containers (with runc), storage, and network management. It is designed to be embedded into larger systems such as Docker. More information on the project is available on the official site. Figure 1 shows how the libnvidia-container integrates into Docker, specifically at the runc layer. We use a custom OCI prestart hook called nvidia-container-runtime-hook to runc in order to enable GPU containers in Docker (more information about hooks can be found in the OCI runtime spec). The addition of the prestart hook to runc requires us to register a new OCI compatible runtime with Docker (using the –runtime option). At container creation time, the prestart hook checks whether the container is GPU-enabled (using environment variables) and uses the container runtime library to expose the NVIDIA GPUs to the container. Figure 1.Integration of NVIDIA Container Runtime with Docker

1、nvidia-docker

nvidia-docker是在docker的基礎(chǔ)上做了一層封裝

通過 nvidia-docker-plugin把硬件設(shè)備在docker的啟動命令上添加必要的參數(shù)。

Ubuntu distributions 
# Install nvidia-docker and nvidia-docker-plugin 
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.0-rc/nvidia-docker_1.0.0.rc-1_amd64.deb 
sudo dpkg -i /tmp/nvidia-docker_1.0.0.rc-1_amd64.deb && rm /tmp/nvidia-docker*.deb # Test nvidia-smi 
nvidia-docker run --rm nvidia/cuda nvidia-smi 
 
Other distributions 
# Install nvidia-docker and nvidia-docker-plugin 
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.0-rc/nvidia-docker_1.0.0.rc_amd64.tar.xz 
sudo tar --strip-components=1 -C /usr/bin -xvf /tmp/nvidia-docker_1.0.0.rc_amd64.tar.xz && rm /tmp/nvidia-docker*.tar.xz 
# Run nvidia-docker-plugin 
sudo -b nohup nvidia-docker-plugin > /tmp/nvidia-docker.log 
# Test nvidia-smi 
nvidia-docker run --rm nvidia/cuda nvidia-smi 
 
Standalone install 
# Install nvidia-docker and nvidia-docker-plugin 
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.0-rc/nvidia-docker_1.0.0.rc_amd64.tar.xz 
sudo tar --strip-components=1 -C /usr/bin -xvf /tmp/nvidia-docker_1.0.0.rc_amd64.tar.xz && rm /tmp/nvidia-docker*.tar.xz 
# One-time setup 
sudo nvidia-docker volume setup 
# Test nvidia-smi 
nvidia-docker run --rm nvidia/cuda nvidia-smi

2、nvidia-docker2

sudo apt-get install nvidia-docker2 sudo apt-get install nvidia-container-runtime sudo dockerd --add-runtime=nvidia=/usr/bin/nvidia-container-runtime [...]

3、nvidia-container-toolkit

docker版本在19.03及以上后

nvidia-container-toolkit進行了進一步的封裝,在參數(shù)里直接使用--gpus "device=0" 即可

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Linux安裝Docker詳細教程

    Linux安裝Docker詳細教程

    這篇文章介紹了Linux安裝Docker的方法,文中通過示例代碼介紹的非常詳細。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-07-07
  • Docker容器中啟用SSH服務(wù)的方法步驟

    Docker容器中啟用SSH服務(wù)的方法步驟

    本文主要介紹了Docker容器中啟用SSH服務(wù)的方法步驟,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-01-01
  • Docker解決容器中文字體亂碼問題的終極方案分享

    Docker解決容器中文字體亂碼問題的終極方案分享

    在騰訊云服務(wù)器使用Docker部署Java后端服務(wù)時,經(jīng)常遇到生成圖片、PDF或報表時中文顯示為方框的問題,這是因為基礎(chǔ)Docker鏡像通常不包含中文字體,下面我們就來看看如何解決吧
    2025-09-09
  • docker centos7 安裝ssh具體步驟

    docker centos7 安裝ssh具體步驟

    這篇文章主要介紹了 docker centos7 安裝ssh相關(guān)資料,這里提供了詳細的具體安裝步驟,需要的朋友可以參考下
    2016-11-11
  • Milvus?docker-compose?部署操作方法

    Milvus?docker-compose?部署操作方法

    本文介紹了使用Docker-compose部署Milvus向量數(shù)據(jù)庫的詳細步驟,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧
    2025-07-07
  • Docker Machine是什么?

    Docker Machine是什么?

    Docker Machine是什么?這篇文章主要介紹了Docker官方提供的一個工具Docker Machine,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • docker拷貝文件到主機及導(dǎo)入導(dǎo)出容器及運行導(dǎo)出容器方式

    docker拷貝文件到主機及導(dǎo)入導(dǎo)出容器及運行導(dǎo)出容器方式

    這篇文章主要介紹了docker拷貝文件到主機及導(dǎo)入導(dǎo)出容器及運行導(dǎo)出容器方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-05-05
  • 關(guān)于docker可視化管理工具-DockerUI的安裝

    關(guān)于docker可視化管理工具-DockerUI的安裝

    這篇文章主要介紹了關(guān)于docker可視化管理工具-DockerUI的安裝,DockerUI是一款開源強大的輕量級Docker管理工具,還不了解這款工具的朋友一起來看看吧
    2023-03-03
  • Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法

    Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法

    這篇文章主要介紹了Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • docker使用volume和bind mount的區(qū)別及說明

    docker使用volume和bind mount的區(qū)別及說明

    文章介紹了Docker中Volume和BindMount兩種數(shù)據(jù)持久化機制的區(qū)別,Volume由Docker管理,支持數(shù)據(jù)共享和加密,而BindMount將宿主機上的文件或目錄直接掛載到容器中,性能較好但依賴于宿主機的文件系統(tǒng)結(jié)構(gòu)
    2024-11-11

最新評論

方城县| 白水县| 衡阳县| 莎车县| 简阳市| 浦北县| 上饶县| 阿坝| 滨州市| 淮北市| 密云县| 城固县| 博白县| 马边| 手机| 龙川县| 浪卡子县| 宁蒗| 阿荣旗| 临夏市| 晴隆县| 若尔盖县| 民乐县| 简阳市| 汝阳县| 濮阳县| 同江市| 乃东县| 庐江县| 中宁县| 区。| 罗田县| 来凤县| 澎湖县| 邵武市| 青海省| 白银市| 伊川县| 崇文区| 汽车| 东港市|