PaddleDetection系列2--NCCL安装及测试

本文详细指导了在CentOS7系统上安装NCCL以及确认处理器架构、CUDA版本的过程,随后介绍了如何在paddle环境下进行多卡训练,确保NCCL的正确安装和使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装paddle 环境,使用多卡训练,需要安装NCCL,注意,需要先安装NCCL,再安装paddle

1 系统信息查看

1.1 查看本机的操作系统和位数信息:

uname -m && cat /etc/*release

我的系统输出为
CentOS Linux release 7.9.2009

1.2 确认处理器架构

python3 -c "import platform;print(platform.architecture()[0]);print(platform.machine())"

我的系统输出为x86_64,代表x86_64架构(或称作 x64、Intel 64、AMD64)架构。

1.3 确认cuda版本

nvcc -V

我的系统输出

Cuda compilation tools, release 11.1, V11.1.105

2 NCCL安装

2.1 根据上面的系统架构以及CUDA版本,进入官网下载匹配的nccl,若想获取旧版本,进入旧版本链接

2.2 选择下图的安装版本和安装方式

在这里插入图片描述

具体命令为

for RedHat/CentOS 7

sudo yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo

For RHEL/Centos:

sudo yum install libnccl-2.8.4-1+cuda11.1 libnccl-devel-2.8.4-1+cuda11.1 libnccl-static-2.8.4-1+cuda11.1

提示如下,证明安装成功

已安装:
  libnccl.x86_64 0:2.8.4-1+cuda11.1              libnccl-devel.x86_64 0:2.8.4-1+cuda11.1              libnccl-static.x86_64 0:2.8.4-1+cuda11.1             

完毕!

2.3 测试

$ git clone https://github.com/NVIDIA/nccl-tests.git
$ cd nccl-tests
$ make
$ ./build/all_reduce_perf -b 8 -e 256M -f 2 -g <ngpus>

# nThread 1 nGpus 4 minBytes 8 maxBytes 268435456 step: 2(factor) warmup iters: 5 iters: 20 agg iters: 1 validation: 1 graph: 0
#
# Using devices
#  Rank  0 Group  0 Pid 200875 on  localhost device  0 [0x3b] Tesla T4
#  Rank  1 Group  0 Pid 200875 on  localhost device  1 [0x5e] Tesla T4
#  Rank  2 Group  0 Pid 200875 on  localhost device  2 [0x86] Tesla T4
#  Rank  3 Group  0 Pid 200875 on  localhost device  3 [0xaf] Tesla T4

输出上面信息证明测试成功

3 paddle安装

paddle对CUDA 11.1支持的版本比较少,因此先进入如下链接
查找能够支持的版本,最终选择2.3.2版本paddle,安装命令如下

python3 -m pip install paddlepaddle-gpu==2.3.2.post111 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

安装后输出如下信息证明安装成功

Installing collected packages: paddlepaddle-gpu
Successfully installed paddlepaddle-gpu-2.3.2.post111

进入python 环境,输入如下命令以及提示信息,证明nccl已安装成功,可以多卡训练。

>>> import paddle
>>> paddle.utils.run_check()

PaddlePaddle works well on 4 GPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CV温故知新

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值