【深度学习环境】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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/141567.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

动态切换 Spring Boot 打包配置:使用 Maven Profiles 管理 JAR 和 WAR

引言 在多环境开发中,我们经常需要根据部署环境来改变 Spring Boot 应用的打包方式。本文将探讨如何使用 Maven Profiles 结合依赖排除来动态地切换 JAR 和 WAR 打包配置。 1. 修改 pom.xml 以支持 WAR 包 转换 Spring Boot 应用从 JAR 到 WAR 时,首先…

数据库恢复技术

事务 含义:用户定义的一个数据库操作序列,这些操作要么全做,要么全不做,是一个不可分割的工作单位 地位:恢复和控制并发的基本单位 区分事务和程序,一个程序中包含多个事务 定义事务 事务的开始与结束…

【华为OD题库-017】矩阵稀疏扫描-Java

题目 如果矩阵中的许多系数都为零,那么该矩阵就是稀疏的。对稀疏现象有兴趣是因为它的开发可以带来巨大的计算节省,并且在许多大的实践中都会出现矩阵稀疏的问题。给定一个矩阵, 现在需要逐行和逐列地扫描矩阵,如果某一行或者某一…

[pytorch]设备选择以及卷积神经网络的应用

0.写在前面: 首先这篇文章还没写完,因为今天要尝试对我之前的一个框架做一个简单的更新迭代,所以目前先更新这么多. 1.关于设备的选择 首先,目前的大多数电脑都是自带一些GPU(图形计算单元,在这里被称之为cuda), 需要安装相关的驱动才能正常使用这些设备和调用他们的具体情况…

介绍 Docker 的基本概念和优势,以及在应用程序开发中的实际应用

Docker是一种基于容器的虚拟化技术,它允许开发者将应用程序及其依赖项打包到一个轻量级容器中,然后在任何可用的开发、测试和生产环境中进行部署和运行。 下面是Docker的基本概念和优势: 容器:Docker容器是一种独立运行的软件包&a…

Rust字符串详解

文章目录 字符串切片String迭代方法基础字符串方法容量操作增删改查 字符串切片 我们所熟知的由双引号括起来的字符串,在Rust中只是个字符串切片,又叫字符串字面值。这种类型一旦创建,则不可更改。但支持索引,从切片中索引出来的…

C#中.NET 6.0控制台应用通过EF访问已建数据库

目录 一、新建.NET 6.0控制台应用并建立数据库连接 二、下载并安装EF程序包 三、自动生成EF模型和上下文 1.Blog类模型 2.Post类模型 3.数据库上下文 四、设计自己的应用 VS2022的.NET6.0、.NET7.0框架下默认支持EF7(版本号7.0.13),除…

基于XML的声明式事务

场景模拟 参考基于注解的声明式事务 修改Spring的配置文件 将Spring配置文件中去掉tx:annotation-driven标签&#xff0c;并添加配置&#xff1a; <?xml version"1.0" encoding"UTF-8"?> <beans xmlns"http://www.springframework.org…

.net6+aspose.words导出word并转pdf

本文使用net6框架&#xff0c;aspose.word破解激活并兼容net6&#xff0c;导出word模板并兼容识别html并给其设置字体&#xff0c;前端直接浏览器下载&#xff0c;后端保存文件并返回文件流&#xff0c;还有批量导出并压缩zip功能 1、安装Aspose.Words的nuget包选择21.8.0 版本…

LeetCode //C - 191. Number of 1 Bits

191. Number of 1 Bits Write a function that takes the binary representation of an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). Note: Note that in some languages, such as Java, there is no unsigned inte…

Labview实现wav音乐播放

准备音频文件&#xff1a;将要播放的声音文件准备好&#xff0c;是.wav格式。 图形化如下&#xff1a; 内部逻辑如下&#xff1a;

如何在thingsboard的规则链中对一个遥测属性进行求平均值

背景 有这样一个需求,一个温度传感器每5秒,上传一次数据。要求算出该设备2分钟内的平均温度,如果超过某个值,则发送告警邮件。 具体操作实现 下面在规则链中实现求平均值。 使用的节点是 配置如下 必填 Timeseries keys,是要求的平均值的属性名。 我这里求的是四个…

【java】idea可以连接但看不到database相关的files

问题 idea右侧有database工具栏&#xff0c;但点击没有在recent files看到数据库相关文件 问题排查 点击 help-> show log in explorer查看日志 发现显示 2023-11-13 10:28:09,694 [1244376] INFO - #c.i.c.ComponentStoreImpl - Saving appDebuggerSettings took 22…

VB.NET三层之用户查询窗体

目录 前言: 过程: UI层代码展示: BLL层代码展示: DAL层代码展示: 查询用户效果图:​ 总结: 前言: 想要对用户进行查询&#xff0c;需要用到控件DataGrideView&#xff0c;通过代码的形式将数据库表中的数据显示在DataGrideview控件中&#xff0c;不用对DatGridView控件…

大模型需要哪种服务器

大型模型通常需要高端的服务器来支持&#xff0c;需要满足以下要求&#xff1a; 高性能的CPU&#xff1a;最好是具备多核心的CPU&#xff0c;例如Intel Xeon或AMD EPYC等服务器级处理器&#xff0c;这些处理器具备更高的计算效率和更大的缓存容量&#xff0c;加快了计算速度。 …

jenkins分步式构建环境(agent)

rootjenkins:~# netstat -antp|grep 50000 tcp6 0 0 :::50000 ::&#x1f617; LISTEN 5139/java 1.52 安装Jenkins rootubuntu20:~# dpkg -i jenkins_2.414.3_all.deb 配置各种类型的Agent的关键之处在于启动Agent的方式 ◼ JNLP Agent对应着“通过Java Web启动代理”这种方…

Pass基础-DevOps

&#xff0c;DevOps是Dev&#xff08;开发&#xff09;和Ops&#xff08;运维/运营&#xff09;的结合&#xff0c;它将人、流程、工具、工程实践等等结合起来应用到IT价值流的实现过程中&#xff0c;是一系列原则、方法、流程、实践、工具的综合体。DevOps面向应用的全生命周期…

mysqldump导出表

很多时候需要导出生产环境的数据库表&#xff0c;而这个时候又没有可视化操作界面&#xff08;navicat&#xff09;&#xff0c;要想导出就必须用mysqldump命令了&#xff0c;下面介绍几种常用的导出命令。 1.导出表&#xff08;包含数据&#xff09; mysqldump -u 用户名 -p…

js编辑只取修改后的对象的属性和值

需求&#xff1a;在el-table的列表编辑操作后&#xff0c; 第一步&#xff1a;获取当前行数据&#xff0c;为对象&#xff1a;{}&#xff0c; 第二步&#xff1a;数据回填 第三步&#xff1a;编辑 第四步&#xff1a;请求后端接口 本文章操作就是在编辑完成后&#xff0c;只取编…