`NCCL_P2P_DISABLE=“1“` and `NCCL_IB_DISABLE=“1“ 及NCCL 安装方法

修改环境变量看是否能解决问题

使用python 代码前写入

# python代码中添加
import os

os.environ["NCCL_P2P_DISABLE"] = "1"
os.environ["NCCL_IB_DISABLE"] = "1"

or bash写入


echo 'export NCCL_P2P_DISABLE=1' >> ~/.bashrc
echo 'export NCCL_IB_DISABLE=1' >> ~/.bashrc
source ~/.bashrc

发现没有效果,检查是否安装nccl

import torch
#单卡
x = torch.rand(1024, 1024, device='cuda:0')
print(torch.cuda.nccl.is_available(x))
#多卡
x = torch.rand(1024, 1024, device='cuda:0')
y = torch.rand(1024, 1024, device='cuda:1')
print(torch.cuda.nccl.is_available([x, y]))

安装方法:

Download NCCL 2.21.5, for CUDA 12.2, April 3rd, 2024

Local installers (x86)
Network installers (x86)

If not already done, make sure you install the network repository:

Network Installer for Ubuntu20.04

  • $ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
  • $ sudo dpkg -i cuda-keyring_1.0-1_all.deb
  • $ sudo apt-get update

Network Installer for RedHat/CentOS 7

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

then run the following command to installer NCCL:
For Ubuntu: sudo apt install libnccl2=2.21.5-1+cuda12.2 libnccl-dev=2.21.5-1+cuda12.2
For RHEL/Centos: sudo yum install libnccl-2.21.5-1+cuda12.2 libnccl-devel-2.21.5-1+cuda12.2 libnccl-static-2.21.5-1+cuda12.2

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值