当前位置: 首页 > news >正文

【深度学习环境】windows安装 NVIDIA Docker

摘要

  1. 不要安装 Docker Desktop!我们将在 Ubuntu 中自行安装 Docker。

  2. 请安装 Windows 10 Insider Build 或 Windows 11 (Beta也行)。(稳定发行版无法在 WSL 2 中使用 GPU)

  3. 请安装 WSL 2 w/Ubuntu 20.04 或同等版本。

  4. 请安装 Nvidia CUDA 软件包(不是 Cuda Toolkit)。

  5. 请在 WSL2/Ubuntu 中手动安装 Docker。

  6. 请在 WSL2/Ubuntu 中安装 Nvidia Container Toolkit。

  7. 使用 Tensorflow 运行 N 体模拟 CUDA 示例、Jupyter。

4 安装 Nvidia CUDA 软件包(不是 Cuda Toolkit)

Nvidia 建议使用 Linux 包管理器在 WSL 2 下安装 CUDA(而不是 CUDA Toolkit)。这是因为 CUDA Toolkit 附带了 Nvidia 的 Linux GPU 驱动程序,该驱动程序不得安装在 WSL 2 下。


wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pinsudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda-repo-wsl-ubuntu-11-4-local_11.4.0-1_amd64.debsudo dpkg -i cuda-repo-wsl-ubuntu-11-4-local_11.4.0-1_amd64.debsudo apt-key add /var/cuda-repo-wsl-ubuntu-11-4-local/7fa2af80.pubsudo apt-get updatesudo apt-get -y install cuda

运行 CUDA 应用程序

测试:构建并运行 BlackScholes 示例应用程序:

cd /usr/local/cuda-11.4/samples/4_Finance/BlackScholesthen:sudo make BlackScholesthen:./BlackScholes
[./BlackScholes] - Starting...
GPU Device 0: "Ampere" with compute capability 8.6Initializing data...
...allocating CPU memory for options.
...allocating GPU memory for options.
...generating input data in CPU mem.
...copying input data to GPU mem.
Data init done.Executing Black-Scholes GPU kernel (512 iterations)...
Options count             : 8000000
BlackScholesGPU() time    : 0.125945 msec
Effective memory bandwidth: 635.196316 GB/s
Gigaoptions per second    : 63.519632BlackScholes, Throughput = 63.5196 GOptions/s, Time = 0.00013 s, Size = 8000000 options, NumDevsUsed = 1, Workgroup = 128Reading back GPU results...
Checking the results...
...running CPU calculations.Comparing the results...
L1 norm: 1.741792E-07
Max absolute error: 1.192093E-05Shutting down...
...releasing GPU memory.
...releasing CPU memory.
Shutdown done.[BlackScholes] - Test SummaryNOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.Test passed

6.安装Docker

在 bash shell 中,使用以下 Docker 安装脚本来安装 Docker:

curl https://get.docker.com | sh
然后,确保 Docker 处于活动状态:

docker run hello-worldHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/

7.Nvidia容器工具包

这里的说明是 Ubuntu 的提供程序(单独运行每个命令):

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.listcurl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container-experimental.list | sudo tee /etc/apt/sources.list.d/libnvidia-container-experimental.listsudo apt-get updatesudo apt-get install -y nvidia-docker2

然后,在另一个 WSL 2 窗口中,停止并重新启动 docker 守护进程,如下所示:

sudo service docker stop && sudo service docker start

资源

https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#is-microsoft-windows-supported

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html

https://github.com/NVIDIA/nvidia-docker/issues/665

https://developer.nvidia.com/cuda/wsl

相关文章:

  • 【python】9个python进阶技巧(实用)
  • Outlook如何删除邮箱账户
  • 石英增强光声光谱气体传感技术中的高精密压力控制解决方案
  • Redis学习笔记10:基于spring的Lettuce redis客户端Pipelining管道
  • centos7 yum安装python3.9时报错【没有可用软件包 python3.9。 错误:无须任何处理】
  • 开放领域问答机器人2——开发流程和方案
  • 【避雷选刊】Springer旗下2/3区,2个月录用!发文量激增,还能投吗?
  • 使用matlab实现图像信号的色彩空间转换
  • HslCommunication模拟西门子读写数据
  • 压测必经之路,Jmeter分布式压测教程!
  • 响应式摄影科技传媒网站模板源码带后台
  • 《未来之路:技术探索与梦想的追逐》
  • IntelliJ IDEA 2023.2.1 (Ultimate Edition) 版本 Git 如何找回被 Drop Commit 的提交记录
  • 移植LVGL到单片机的一个demo简单介绍
  • Kubernetes实战(四)-部署docker harbor私有仓库
  • [js高手之路]搞清楚面向对象,必须要理解对象在创建过程中的内存表示
  • angular组件开发
  • Apache的基本使用
  • axios 和 cookie 的那些事
  • AzureCon上微软宣布了哪些容器相关的重磅消息
  • ERLANG 网工修炼笔记 ---- UDP
  • Hibernate最全面试题
  • Java读取Properties文件的六种方法
  • JS数组方法汇总
  • Laravel 中的一个后期静态绑定
  • MaxCompute访问TableStore(OTS) 数据
  • oschina
  • python_bomb----数据类型总结
  • Python学习之路13-记分
  • Redis在Web项目中的应用与实践
  • Work@Alibaba 阿里巴巴的企业应用构建之路
  • 编写高质量JavaScript代码之并发
  • 分享一份非常强势的Android面试题
  • 缓存与缓冲
  • 利用DataURL技术在网页上显示图片
  • 排序(1):冒泡排序
  • 如何使用 JavaScript 解析 URL
  • 如何抓住下一波零售风口?看RPA玩转零售自动化
  • 事件委托的小应用
  • 跳前端坑前,先看看这个!!
  • 吐槽Javascript系列二:数组中的splice和slice方法
  • 7行Python代码的人脸识别
  • 支付宝花15年解决的这个问题,顶得上做出十个支付宝 ...
  • ​LeetCode解法汇总518. 零钱兑换 II
  • ###C语言程序设计-----C语言学习(6)#
  • #单片机(TB6600驱动42步进电机)
  • (1)STL算法之遍历容器
  • (JS基础)String 类型
  • (NO.00004)iOS实现打砖块游戏(九):游戏中小球与反弹棒的碰撞
  • (ros//EnvironmentVariables)ros环境变量
  • (二)linux使用docker容器运行mysql
  • (附源码)计算机毕业设计ssm基于Internet快递柜管理系统
  • (考研湖科大教书匠计算机网络)第一章概述-第五节1:计算机网络体系结构之分层思想和举例
  • (原創) 如何讓IE7按第二次Ctrl + Tab時,回到原來的索引標籤? (Web) (IE) (OS) (Windows)...
  • (转)linux下的时间函数使用