問(wèn)題描述:
1、使用A30顯卡,使用分布式并行Distributed Data Parallel,運(yùn)行程序時(shí)顯卡顯存充滿,卡在設(shè)置local_rank處,并未啟動(dòng)進(jìn)程組
2、如圖:
解決方案:
0、最新解決方案,針對(duì)Supermicro主板:BIOS->Advanced->NB Configuration->IOMMU->Disabled
==其它型號(hào)的主板的BIOS可能還需要禁用ACS:
https://zhuanlan.zhihu.com/p/607203976
https://www.supermicro.com/support/faqs/faq.cfm?faq=20264
https://www.supermicro.com/support/faqs/faq.cfm?faq=22226
后面的1-4可不看了~
1、更換后端為“Gloo”,正常執(zhí)行shell命令運(yùn)行程序。
torch.distributed.init_process_group(backend="Gloo")
python -m torch.distributed.launch --nproc_per_node=7 --master_port 8888 main.py
2、仍舊使用“NCCL”后端,但需要更改環(huán)境變量,在shell命令前加入禁用P2P。
torch.distributed.init_process_group(backend="NCCL")
NCCL_P2P_DISABLE=1 python -m torch.distributed.launch --nproc_per_node=7 --master_port 8888 main.py
3、仍舊使用“NCCL”后端,但需要更改環(huán)境變量,永久更改環(huán)境設(shè)置,正常執(zhí)行shell命令運(yùn)行程序。
torch.distributed.init_process_group(backend="NCCL")
vim ~/.bashrc
export NCCL_P2P_DISABLE=1
source ~/.bashrc.
python -m torch.distributed.launch --nproc_per_node=7 --master_port 8888 main.py
4、建議使用第3個(gè)方案,據(jù)我測(cè)試,Gloo后端沒(méi)有NCCL后端通信速度快,程序運(yùn)行速度NCCL較快。另外,每次加上修改環(huán)境變量的命令也挺煩的,修改bash環(huán)境變量一勞永逸。
bug分析:
NCCL_P2P_DISABLE=1將禁用GPU之間直接通信(如使用NVlink或者PCIe),鑒于NVDIA官網(wǎng)顯示A30支持NVlink或者PCIe,因此判斷可能是硬件故障或者是軟件版本不匹配導(dǎo)致P2P通信受阻,使得進(jìn)程阻塞,程序掛起。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-413937.html
參考:
1:https://zhuanlan.zhihu.com/p/60054075
2:https://github.com/pytorch/pytorch/issues/23074文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-413937.html
到了這里,關(guān)于Pytorch 分布式并行DDP 卡死 掛起的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!