docker容器下安装nccl失败,报错:Failed to init nccl communicator for group

网友投稿 351 2022-10-20

docker容器下安装nccl失败,报错:Failed to init nccl communicator for group

docker 容器内安装 nccl  后,测试是否安装成功:

使用  NVIDIA公司官方提供的测试工具: ​​nccl-tests​​

国内下载地址:

​​make

If CUDA is not installed in /usr/local/cuda, you may specify CUDA_HOME.

Similarly, if NCCL is not installed in /usr, you may specify NCCL_HOME.

默认,cuda的安装位置:/usr/local/cuda

默认,nccl的安装位置:/usr

如果cuda和nccl的安装位置不是默认的,而是手动选择其他地方的,那么需要在make的时候配置路径:

$ make CUDA_HOME=/path/to/cuda NCCL_HOME=/path/to/nccl

CUDA_HOME 为 cuda的安装路径。

NCCL_HOME 为 nccl的安装路径。

make 编译后进行简单的例子进行测试nccl是否安装成功。

Quick examples

Run on 8 GPUs (​​-g 8​​), scanning from 8 Bytes to 128MBytes :

$ ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 8

Run with MPI on 40 processes (potentially on multiple nodes) with 4 GPUs each :

$ mpirun -np 40 ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 4

(该例子假设系统中已经安装了 openmpi)

这里我们需要修改的示例代码的地方为  -g  ,  如果你有一个显卡,那么就是-g 1  , 如果有四个显卡就是 -g 4

需要注意的是如果有显卡内存不够用(被其他进程调用已经占满),那么需要设置环境变量: export CUDA_VISIBLE_DEVICES="0,1,2,3"

CUDA_VISIBLE_DEVICES 变量用来指定可以用来进行测试的显卡,同时修改-g 后的数值。

假设 1 号显卡已经没有显存,那么设置  export CUDA_VISIBLE_DEVICES="0,2,3"

运行:

./build/all_reduce_perf -b 8 -e 128M -f 2 -g 3

mpirun -np 40 ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 3

===========================================================

在容器中安装  nccl 后使用  ​​nccl-tests​​  测试后报错:

Failed to init nccl communicator for group

init nccl communicator for group nccl_world_group

78244:78465 [0] NCCL INFO Call to connect returned Connection timed out, retrying 78244:78466 [1] NCCL INFO Call to connect returned Connection timed out, retrying 78244:78465 [0] NCCL INFO Call to connect returned Connection timed out, retrying 78244:78466 [1] NCCL INFO Call to connect returned Connection timed out, retrying

很大的可能就是建立容器的时候没有设置允许共享内存:  --ipc=host

解决方案:

重新建立容器,在建立时加入设置:   --ipc=host

形式如:   sudo docker run -it --ipc=host   **************************(其他参数这里不表)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:java poi导入纯数字等格式问题及解决
下一篇:分布式部署:第三章:Docker、MySQL、tomcat、Nginx、Redis部署
相关文章

 发表评论

暂时没有评论,来抢沙发吧~