【paddlecls】多机多卡-linux

news/2024/10/19 23:28:43/

1. 安装docker(引擎):

(https://docs.docker.com/engine/install/ubuntu/)
Install Docker Engine on Ubuntu

To get started with Docker Engine on Ubuntu, make sure you meet the prerequisites, and then follow the installation steps.
Prerequisites
OS requirements

To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

Ubuntu Lunar 23.04
Ubuntu Kinetic 22.10
Ubuntu Jammy 22.04 (LTS)
Ubuntu Focal 20.04 (LTS)
Ubuntu Bionic 18.04 (LTS)

Docker Engine is compatible with x86_64 (or amd64), armhf, arm64, and s390x architectures.
Uninstall old versions

Before you can install Docker Engine, you must first make sure that any conflicting packages are uninstalled.

Distro maintainers provide an unofficial distributions of Docker packages in APT. You must uninstall these packages before you can install the official version of Docker Engine.

The unofficial packages to uninstall are:

docker.io
docker-compose
docker-doc
podman-docker

Moreover, Docker Engine depends on containerd and runc. Docker Engine bundles these dependencies as one bundle: containerd.io. If you have installed the containerd or runc previously, uninstall them to avoid conflicts with the versions bundled with Docker Engine.

Run the following command to uninstall all conflicting packages:

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

apt-get might report that you have none of these packages installed.

Images, containers, volumes, and networks stored in /var/lib/docker/ aren’t automatically removed when you uninstall Docker. If you want to start with a clean installation, and prefer to clean up any existing data, read the uninstall Docker Engine section.
Installation methods

You can install Docker Engine in different ways, depending on your needs:

Docker Engine comes bundled with Docker Desktop for Linux. This is the easiest and quickest way to get started.Set up and install Docker Engine from Docker’s apt repository.Install it manually and manage upgrades manually.Use a convenience scripts. Only recommended for testing and development environments.

Install using the apt repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
Set up the repository

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

sudo apt-get update

sudo apt-get install ca-certificates curl gnupg

Add Docker’s official GPG key:

sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg

Use the following command to set up the repository:

 echo \"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullNoteIf you use an Ubuntu derivative distro, such as Linux Mint, you may need to use UBUNTU_CODENAME instead of VERSION_CODENAME.

Install Docker Engine

Update the apt package index:

sudo apt-get update

Install Docker Engine, containerd, and Docker Compose.

Latest
Specific version

To install the latest version, run:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify that the Docker Engine installation is successful by running the hello-world image.

sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.

查看docker版本

docker version

输出以下内容:

Client: Docker Engine - CommunityVersion:           20.10.9API version:       1.41Go version:        go1.16.8Git commit:        c2ea9bcBuilt:             Mon Oct  4 16:08:29 2021OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer: Docker Engine - CommunityEngine:Version:          20.10.9API version:      1.41 (minimum version 1.12)Go version:       go1.16.8Git commit:       79ea9d3Built:            Mon Oct  4 16:06:37 2021OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.4.11GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8runc:Version:          1.0.2GitCommit:        v1.0.2-0-g52b36a2docker-init:Version:          0.19.0GitCommit:        de40ad0

2.安装Nvidia Docker

curl https://get.docker.com | sh
sudo systemctl start docker
sudo systemctl enable docker

设置稳定存储库和GPG密钥:

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.list

在更新包列表后安装nvidia-docker2包(和依赖项)

sudo apt-get update
sudo apt-get install -y nvidia-docker2

设置默认运行时间后,重新启动Docker守护程序完成安装:

sudo systemctl restart docker

3.重要!!!(必须)

docker守护进程启动的时候,会默认赋予名字为docker的用户组读写Unix socket的权限,因此只要创建docker用户组,并将当前用户加入到docker用户组中,那么当前用户就有权限访问Unix socket了,进而也就可以执行docker相关命令

sudo groupadd docker     #添加docker用户组 默认情况下好像已经被创建了
sudo gpasswd -a $USER docker     #将登陆用户加入到docker用户组中
newgrp docker     #更新用户组
docker ps    #测试docker命令是否可以使用sudo正常使用

4.拉取 PaddlePaddle 镜像(根据paddle官网提供的命令)

nvidia-docker pull paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4
输出如下:

2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4: Pulling from paddlepaddle/paddle
40dd5be53814: Pulling fs layer 
69761e853747: Pulling fs layer 
fc447ee06ac9: Pulling fs layer 
e1cfed2c8b10: Waiting 
35a8d68b06ce: Waiting 
7f2a3dc7d39e: Waiting 
c9834390d290: Waiting 
d73edacf489a: Waiting 
c7971ce47315: Pulling fs layer 
2da8291b2566: Pulling fs layer 
aa9433893559: Waiting 
fa914a76149f: Waiting 
a443c08ceb94: Waiting 
2f9f5dd4c70b: Pull complete 
37406ea94abb: Pull complete 
5aff29297311: Pull complete 
4d7ae3fb3473: Pull complete 
1d41e39f7395: Pull complete 
cc048442b162: Pull complete 
bb4f413d8b59: Pull complete 
98ebfdbbea64: Pull complete 
52ea893ab1d4: Pull complete 
02aefb1947a7: Pull complete 
6fd17bb6f094: Pull complete 
2c4562ce23fd: Pull complete 
c6e1729af58d: Pull complete 
50e9bbaccda2: Pull complete 
2ea7b26cbb13: Pull complete 
3b7745091648: Pull complete 
fd62cd917be7: Pull complete 
5be733668b3f: Pull complete 
71b603065b2a: Pull complete 
db72094d1c13: Pull complete 
18d85b154f03: Pull complete 
49d3f45b5952: Pull complete 
a421ef67ed02: Pull complete 
84a204ec15dd: Pull complete 
f8712675e95b: Pull complete 
4d6221659c44: Pull complete 
3d896a810942: Pull complete 
0a7898386676: Pull complete 
599deae959f2: Pull complete 
761c1aec740d: Pull complete 
6705817a2b30: Pull complete 
9560fe759bba: Pull complete 
2917473e87a2: Pull complete 
2d48f565abbc: Pull complete 
0865327c0f8a: Pull complete 
d22ed4f9eaa3: Pull complete 
ec44ef4c6197: Pull complete 
Digest: sha256:ad251d0bd9ba4258f70e964d7745cc2c50dbba2c0106feaed06d3b4bd64be4de
Status: Downloaded newer image for paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4
docker.io/paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4

5. 构建并进入 docker 容器(根据paddle官网提供的命令)

nvidia-docker run --name paddle_docker -it -v $PWD:/paddle registry.baidubce.com/paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4 /bin/bash

    --name paddle_docker:设定 Docker 的名称,paddle_docker 是自己设置的名称;-it:参数说明容器已和本机交互式运行;-v $PWD:/paddle:指定将当前路径(PWD 变量会展开为当前路径的绝对路径)挂载到容器内部的 /paddle 目录;registry.baidubce.com/paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4,指定需要使用的 image 名称。可以通过sudo docker images命令查看镜像。/bin/bash 是在 Docker 中要执行的命令

在这里插入图片描述

输出如下:
在这里插入图片描述

(base) uvtec@uvtec-MS-7B98:~$ sudo nvidia-docker run --name paddle_docker -it -v $PWD:/paddle registry.baidubce.com/paddlepaddle/paddle:2.4.2-gpu-cuda11.7-cudnn8.4-trt8.4 /bin/bashλ e04f655ec148 /home 

6. Docker 删除容器步骤

sudo docker ps -a(查看现在运行的docker 容器)

结果如下图:
如图在这里插入图片描述

sudo docker stop 容器的ID(停止该容器镜像)

例如:
在这里插入图片描述

sudo docker rm 容器的ID(删除容器)

例如:
此时查看,就发现没有啦!

docker常用命令

启动(已经停止的)容器

docker start 《容器id or 容器名称》

创建并运行新的容器

docker run (选项)《镜像名称》


http://www.ppmy.cn/news/107093.html

相关文章

内置数据类型

Oracle内置数据类型 一.Varchar(size)和NVarchar(size)变长数据类型 size:最多可容纳的字符数。默认值和最小值都是1,最大值为400字符。size必须定义。 二.Char(size)和NChar&…

Ubantu docker学习笔记(十一)k8s基本操作

文章目录 一、K8s介绍二、容器编排2.1 部署应用2.2 了解应用2.3 公开暴露应用2.4 扩缩应用2.4 滚动更新 三、Kubernetes 对象 相信大家在前面的安装过程中,我们的k8s已经完成了一个超级具体的安装【是不是还是有点难度】,今天我们就在前面已经安装好的基…

【OneNet】| stm32+esp8266-01s—— OneNet初体验 | 平台注册及设备创建 | demo使用

系列文章目录 失败了也挺可爱,成功了就超帅。 文章目录 前言1. OneNet平台注册2. 创建多协议接入设备3. 硬件连接4. 下载并运行Demo4.1 Demo下载4.2 运行Demo本小节结束 前言 最近准备耍下 Onenet平台 。下载了官方demo 遇到几个问题 1、创建接入设备 因为平台网页…

软件测试面试了一个00后,让我见识到了什么是内卷届的天花板

公司前段缺人,也面了不少测试,结果竟然没有一个合适的。一开始瞄准的就是中级的水准,也没指望来大牛,提供的薪资也不低,面试的人很多,但平均水平很让人失望。令我印象最深的是一个00后测试员,他…

PackML 学习笔记

PackML 的官网 上如此描述PackML--- PackML是由OMAC开发并由ISA采用的自动化标准TR88.00.02,可以更轻松地传输和检索一致的机器数据。PackML的主要目标是鼓励整个工厂车间的通用“外观和感觉”,并支持和鼓励行业创新。 优点 这里的重点是通用“外观和感…

花6个月面过京东软件测试岗,拿个20K不过分吧?

背景介绍 计算机专业,代码能力一般,之前有过两段实习以及一个学校项目经历。第一份实习是大二暑期在深圳的一家互联网公司做软件测试,第二份实习由于大三暑假回国的时间比较短(小于两个月),于是找的实习是在…

【JavaSE】Java基础语法(三十五):多线程实战

文章目录 1. 多线程入门1.1 多线程相关概念1.2 什么是多线程1.3 多线程的创建方式1.3.1 继承 Thread 的方式1.3.2 实现 Runnable 接口的方式1.3.3 实现 Callable 接口的方式1.3.4 Thread 类中常用方法1.3.5 sleep() 方法 和 wait() 方法区别: 2. 线程安全2.1 线程安…

【MyBatis】MyBatis中#{}与${}的区别是什么?

文章目录 前言一、彻底理解SQL注入二、关于 # { }三、关于$ { }四、Mybatis中#{}与${}的区别五、代码案例使用#{}案例使用$ {}案例 前言 在开发中使用Mybatis经常使用到#{}与${},二者区别是?来总结一下。 在mybatis中动态 sql 是其主要特性之一&#x…