报错 ncclCommInitRank failed.
环境
- 4 GeForce GTX 1080 GPUS
- docker image
nnabla/nnabla-ext-cuda-multi-gpu:py36-cuda102-mpi3.1.6-v1.14.0
代码
- 从仓库nnabla-ext-cuda-multi-gpu拉取镜像
docker pull nnabla/nnabla-ext-cuda-multi-gpu:py36-cuda102-mpi3.1.6-v1.14.0
- 运行
docker run -it --rm --gpus all nnabla/nnabla-ext-cuda-multi-gpu:py36-cuda102-mpi3.1.6-v1.14.0
- 添加
test.py
import nnabla.communicators as C
from nnabla.ext_utils import get_extension_context
extension_module = "cudnn"
ctx = get_extension_context(extension_module)
comm = C.MultiProcessCommunicator(ctx)
comm.init()
print(f'sizes={comm.size}, divice_id={comm.rank}')
- 运行
mpiexec -np 4 python test.py
将会抛出异常。(异常只发生在使用GPU数大于2时)
bug
抛出异常如下:
Traceback (most recent call last):
File "test.py", line 6, in <module>
comm.init()
File "communicator.pyx", line 121, in nnabla.communicator.Communicator.init
RuntimeError: target_specific error in init
/home/gitlab-runner/builds/g9zRZKFe/2/nnabla/builders/all/nnabla-ext-cuda/src/nbla/cuda/communicator/multi_process_data_parallel_communicator.cu:358
ncclCommInitRank failed.
使用NCCL_DEBUG=INFO
查看详细信息mpiexec -np 4 -x NCCL_DEBUG=INFO python test.py
...
0db89117f3b2:87:87 [2] include/shm.h:28 NCCL WARN Call to posix_fallocate failed : No space left on device
0db89117f3b2:87:87 [2] NCCL INFO include/shm.h:41 -> 2
0db89117f3b2:87:87 [2] include/shm.h:48 NCCL WARN Error while creating shared memory segment nccl-shm-recv-6d2dacd576938b74-0-3-2 (size 9637888)
...
可以看到没有多余的共享内存,但是使用nvidia-smi
查看GPU情况,发现内存并没有过多使用。
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.36.06 Driver Version: 450.36.06 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 1080 On | 00000000:01:00.0 Off | N/A |
| 27% 30C P8 5W / 180W | 815MiB / 8119MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GTX 1080 On | 00000000:02:00.0 Off | N/A |
| 27% 33C P8 6W / 180W | 4MiB / 8119MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 2 GeForce GTX 1080 On | 00000000:03:00.0 Off | N/A |
| 28% 35C P8 5W / 180W | 4MiB / 8119MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 3 GeForce GTX 1080 On | 00000000:04:00.0 On | N/A |
| 28% 34C P8 6W / 180W | 4MiB / 8118MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
原因
异常原因是NCCL不能在/dev/shm
创建共享内存文件。因为docker默认的/dev/shm
文件的大小为64MB太小了,所以当使用GPU数大于2时,会显示内存不够。
之前版本不出现这个错误,原因是nccl从2.6升级到2.7后,GPU之间的通信方式从p2p改为使用共享内存片段,所以如果使用nccl2.7以下版本将不会出现这个问题。
解决
有3中方式:
- 在
/etc/nccl.conf
或~/.nncd.conf
文件中,添加配置NCCL_SHM_DISABLE=1
。不适用共享内存,但是使用运行效率会降低。 - 可以映射宿主机上的
/dev/shm
,即docker run -v /dev/shm:/dev/shm ...
,但是这样会在宿主机上留下脏文件。 - 运行时,修改容器共享内存的大小,即
docker run --shm-size=256m ...
。
参考
- NCCL配置
- https://github.com/NVIDIA/nccl/issues/290
- https://github.com/PaddlePaddle/Paddle/pull/28484
- https://github.com/horovod/horovod/issues/2395
- https://github.com/NVIDIA/nccl/issues/406(使用
NCCL_SHM_DISABLED=1
可能会降低效率)
报错 ncclCommInitRank failed.的更多相关文章
- svn报错cleanup failed–previous operation has not finished; run cleanup if it was interrupted的解决办法
今天在svn提交的时候它卡顿了一下,我以为已经提交完了,就按了一下,结果就再也恢复不了,也继续不了了... 报错 cleanup failed–previous operation has not f ...
- docker报错:Failed to restart docker.service: Unit not found.
前言:我之前安装好docker了,但是关机重启后,发现docker就没了 报错:Failed to restart docker.service: Unit not found. 解决方法: 1. ...
- 报错:Failed on local exception: Host Details : local host is: "master/192.168.52.26"; dest
报错现象 Failed on local exception: com.google.protobuf.InvalidProtocolBufferException: Protocol message ...
- ionic报错: Failed to load resource
隔了一天,才发现是代码写错了 出错的原因是在ts 文件中使用这样的定义 data: [] = ['高新区', '经开区', '其他园区']; 错误在于这个定义的类型,不能是 [],修改成 any就没有 ...
- ionic 打包 报错Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt
在platform --> android目录下找到build.gradle文件,打开并在def promptForReleaseKeyPassword() {...}函数前加入以下内容: 完整 ...
- Nginx反向代理上传大文件报错(failed to load resource : net :: ERR_CONNECTION_RESET)
转自: https://blog.csdn.net/kinginblue/article/details/50753271?locationNum=14&fps=1 Nginx反向代理上传大文 ...
- git push报错error: failed to push some refs to 'git@github.com'
git push报错error: failed to push some refs to 'git@github.com' $ git push -u origin master To git@git ...
- 解决Eclipse启动报错【Failed to create the Java Virtual Machine】
电脑:2G内存,WIN7 32位. 启动adt-bundle-windows-x86-20140702\eclipse\eclipse.exe时,报错[Failed to create the Jav ...
- 【spring boot】spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date]
spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [jav ...
随机推荐
- Kafka入门之consumer
offset存放在_consumer_offsets这个topic下 并且从0-49划分了50个分区: consumer会在kafka集群的所有broker中选择一个broker作为consumer ...
- Istio 之ServiceEntry
使用服务条目资源(ServiceEntry)可以将条目添加到 Istio 内部维护的服务注册表中.添加服务条目后,Envoy 代理可以将流量发送到该服务,就好像该服务条目是网格中的服务一样.通过配置服 ...
- IEEE浮点数标准
IEEE浮点数标准 阅读笔记:Computer System : A Programmmer's Perspective 基本概念 IEEE浮点数标准采用 \[V=(-1)^s\times M\tim ...
- Linux下的MediaWiki的部署启动遇到的问题与解决方案
1. MySQL安装不成功 解决方案:https://bbs.csdn.net/topics/394377536 2. no space left on device ubuntu 解决方案:http ...
- Spring Boot 2.4发布了,但Spring Cloud用户不推荐着急升级
前段时间Spring Boot发布了本年度最后一个重要更新版本:Spring Boot 2.4.0. 最近在社群里也开始有讨论关于Spring Boot 2.4的一些使用问题.我发现有很多Spring ...
- 创建实验楼课程app模块以及配置图片路径
1.创建course模型 1.1 创建用户模型course python ../manage.py startapp course # 创建course模型 1.2 在setting.py中注册cou ...
- java.util.UnknownFormatConversionException: Conversion = 'j' || Conversion = 'D' || Conversion = 'Y'
执行内容: String a = "select * from j_question j where j.status = %s and j.title like '%java%'" ...
- Hangfire&Autofac与ASP.NET CORE注入失败
Hangfire.Autofac与ASP.NET CORE注入失败 项目里面使用了Hangfire,因为之前没用过吧,遇到了个问题,就是使用了ico容器后,再用Hangfire总是注入不上对象,总是后 ...
- 精品工具【音乐下载器(可下载VIP音乐)】
工具信息 更新时间:2020年5月26日00点07分更新内容:1. 增加快捷键2. 细分下载列表清除功能一款可以下载付费音乐的音乐下载器 下载链接:https://nitian1207.lanzous ...
- CF1439C Greedy Shopping
题解 尝试做一下,感觉是每次取一段前缀和,这样就相当于让我们证明在 \(a_i\le 10^{12}\) 时,不可能构造出隔一个取一个的情况(\(n=10^5\)). a[i]: 1, 2, 3, 5 ...