基于Docker配置多用户GPU环境(仅为个人备注)

Nvidia driver

https://zhuanlan.zhihu.com/p/115758882

timeshift

https://blog.csdn.net/lovely_yoshino/article/details/107288684
timeshift backup 1

CUDA 11.2

https://zhuanlan.zhihu.com/p/122286055

cudnn 8

https://blog.csdn.net/wanzhen4330/article/details/81699769

timeshift backup 2

Anaconda 3

https://blog.csdn.net/qq_15192373/article/details/81091098

Pycharm

https://blog.csdn.net/qq_15192373/article/details/81091278
https://blog.csdn.net/qq_20515461/article/details/90745100

Install torch-gpu

https://blog.csdn.net/hello_dear_you/article/details/84677743
timeshift backup 3

issue:https://github.com/pytorch/pytorch/issues/51080
solution:conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch

Docker

https://blog.csdn.net/BigData_Mining/article/details/87868711
https://blog.csdn.net/hangvane123/article/details/88639279
timeshift backup 3
docker swarm install
使用Portainer的Agent模式管理DockerSwarm集群

#添加docker用户组
sudo groupadd docker
#将登陆用户加入到docker用户组中
sudo gpasswd -a $USER docker
#更新用户组
newgrp docker
#测试docker命令是否可以使用sudo正常使用
docker ps

中文输入法

先设置 系统语言为中文

Shipyard

https://www.fcwys.cc/archives/145.html

shipyard 操作
http://valleylord.github.io/post/201601-docker-shipyard/

GPU 共用

Weave 遠程桌面

https://blog.csdn.net/greenwoodp/article/details/104533384?spm=1001.2014.3001.5501
創建容器注意清華源與系統對應和基礎鏡像與cuda,ubuntu版本對應

https://blog.csdn.net/hangvane123/article/details/88639279
deepo

SSH 登錄不上(密碼正確)#號注釋去掉
PermitRootLogin yes #允许root用户ssh登录

Deepo

一體式的深度學習鏡像

容器內miniconda 安裝

https://www.jianshu.com/p/0511decff9f8

怎麼遠程jupyter, Vscode

jupyter 調試docker 內容器

vscode 找不到管道
设置系统环境变量和vscode sshPath

sudo nvidia-docker run -dit --restart=always -v /home/docker-common-dir:/home/common-dir -p6003:8888 --name=vm_wjm1 -h=LAB_WJM deepo-ssh:1.0 /home/startup.sh

SSH 路由器环境下外网访问

https://segmentfault.com/a/1190000012365747

新建项目

1.拉取镜像

docker pull image_name
  1. 新建ubuntu容器
    新建ubuntu容器是为了能在jupyter 或vscode中远程调试,如果容器内有ubuntu系统则直接新建对应容器
nvidia-docker run -dit -v local-path:path-in-container  -p 10089:8889 -p 10022:22 --name=container-name -h=hostname-of-container image-name comand-line 

nvidia-docker run -dit -v $PWD:/data -p10089:8889 -p10022:22 --name=robosat_wjm_p2289 deepo-pytorch-ssh-jupyter:1.0 /home/startup.sh
-d:后端运行
-it:伪终端
--name:容器名称,双杠
  1. 进入容器
    检查ssh 是否开启
    可 shipyard管理平台进入终端
    可docker exec container 命令
service ssh start
  1. vscode 编程
    ssh root@ip -p 10022
    确定容器的系统,然后输入root用的密码
    文件-打开文件夹
    运行-终端(输入命令行)
git clones https://github.com/mapbox/robosat.git

安装依赖

cd robosat/
pip install -r requirements.txt

Could not find libspatialindex_c library file
apt install python3-rtree

pyproj.exceptions.CRSError: Invalid projection: esri:54009 +type=crs: (Internal Proj Error: proj_create: crs not found)
更新pyproj

训练
配置toml 文件

./rs train --model ./config/model-unet.toml --dataset …/dataset-building-weights.toml

RuntimeError: NCCL Error 2: unhandled system error
os.environ[“CUDA_VISIBLE_DEVICES”]=‘0’
设置单gpu,目前不知如何多显卡
保存为镜像 重新创建容器 设置可用的显卡
nvidia-docker run -dit -v $PWD:/data -p10089:8889 -p10022:22 --name=robosat_wjm -e NVIDIA_VISIBLE_DEVICES=0,1 robosat_eviron:1.0 /home/startup.sh
启动时停在“recovering journal”错误,画面不变后 ctr+alt+f1, 删除多余文件

Linux死机安全重启指令reisub

远程桌面

https://www.cnblogs.com/xuliangxing/p/7642650.html
https://www.cnblogs.com/xuliangxing/p/7560723.html

代码同步

github 与vscode 同步:https://www.cnblogs.com/pxuan/p/12536747.html
github建立仓库,
本地建目录,git init
git config --global user.email (user.name)
生成ssh key 放到github关联
ssh-keygen -t rsa -C “myname@mymail.com”
将本地仓库与github仓库关联
git remote add mycode git@github.com:myname/myrepo.git

然后将代码放到本地仓库目录中
先添加文件
git add -A
提交本地仓库
git commit -a
push 到github
git push --force mycode master

Gitlab

使用gitlab_docker 搭建本地仓库
docker下安装gitlab出现权限问题Permission denied (publickey)

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Docker 17中使用GPU,您需要确保您的系统满足以下要求: 1. 安装适当的NVIDIA驱动程序:您需要安装与您的GPU兼容的最新NVIDIA驱动程序。您可以从NVIDIA官方网站下载并安装适合您的GPU型号的驱动程序。 2. 安装NVIDIA Container Toolkit:NVIDIA提供了一个称为NVIDIA Container Toolkit的工具集,用于在Docker容器中使用GPU。您可以按照NVIDIA官方文档的说明安装和配置NVIDIA Container Toolkit:https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html 安装和配置完成后,您可以按照以下步骤在Docker容器中使用GPU: 1. 创建一个包含GPU支持的Docker镜像:您需要在Dockerfile中添加适当的指令,以便在构建镜像时包含GPU支持。以下是一个示例Dockerfile: ``` FROM nvidia/cuda:11.0-base # 安装所需的软件包和依赖项 RUN apt-get update && apt-get install -y \ <your-package-dependencies> # 设置环境变量 ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES compute,utility # 设置您的应用程序启动命令 CMD ["<your-command>"] ``` 2. 构建镜像:使用以下命令在Dockerfile所在目录中构建镜像: ``` docker build -t <your-image-name> . ``` 3. 运行容器:使用以下命令在Docker容器中运行您的应用程序,并将GPU设备映射到容器中: ``` docker run --gpus all <your-image-name> ``` 请注意,上述命令中的`--gpus all`选项指示Docker使用所有可用的GPU设备。您还可以指定特定的GPU设备,例如`--gpus device=0,1`。 希望这可以帮助您在Docker 17中配置和使用GPU!如果有任何进一步的问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值