在NGC集群使用
https://github.com/pytorch/examples/blob/main/imagenet/main.py
跑ImageNet分布式训练,运行命令是
python main.py --dist-url 'tcp://127.0.0.1:8888' --dist-backend 'nccl' --multiprocessing-distributed --world-size 1 --rank 0 --data /mount/imagenet/ImageNet2012/ImageNet2012 --epochs 200 -a resnet50
但是报错,信息如下
File "/code/hyperbox_app/hyperbox_app/distributed/finetune_masks/finetune_imagenet.py", line 188, in main_worker
model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[args.gpu])
File "/opt/conda/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 639, in __init__
dist._verify_params_across_processes(self.process_group, parameters)
RuntimeError: NCCL error in: /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:1248, unhandled system error, NCCL version 2.12.10
ncclSystemError: System call (e.g. socket, malloc) or external library call failed or device error. It can be also caused by unexpected exit of a remote peer, you can check NCCL warnings for failure reason and see if there is connection closure by a peer.
最后实测,在运行命令前面加上如下命令后就可以正常跑了
export NCCL_IB_DISABLE=1; export NCCL_P2P_DISABLE=1; NCCL_DEBUG=INFO python main.py ...
MARSGGBO♥原创
如有意合作,欢迎私戳
邮箱:marsggbo@foxmail.com
2019-12-24 14:29:11