代码之家  ›  专栏  ›  技术社区  ›  Shital Shah

错误:某些NCCL操作失败或超时

  •  0
  • Shital Shah  · 技术社区  · 4 年前

    在4个A6000 GPU上运行分布式培训时,我遇到以下错误:

    [E ProcessGroupNCCL.cpp:630] [Rank 3] Watchdog caught collective operation timeout: WorkNCCL(OpType=BROADCAST, Timeout(ms)=1800000) ran for 1803710 milliseconds before timing out.       
                                                                                                                                                            [E ProcessGroupNCCL.cpp:390] Some NCCL operations have failed or timed out. Due to the asynchronous nature of CUDA kernels, subsequent GPU operations might run on corrupted/incomplete data. To avoid this inconsistency, we are taking the entire process down.                                                                                 
    
    terminate called after throwing an instance of 'std::runtime_error'                                                                                                        
    what():  [Rank 2] Watchdog caught collective operation timeout: 
    WorkNCCL(OpType=BROADCAST, Timeout(ms)=1800000) ran for 1804406 milliseconds before timing out.        
    
    [E ProcessGroupNCCL.cpp:390] Some NCCL operations have failed or timed out. Due to the asynchronous nature of CUDA kernels, subsequent GPU operations might run on corrupted/incomplete data. To avoid this inconsistency, we are taking the entire process down.
    

    我使用标准的NVidia PyTorch docker。有趣的是,对于较小的数据集,训练效果很好,但对于较大的数据集,我得到了这个错误。因此,我可以确认培训代码是正确的,并且确实有效。

    任何地方都没有实际的运行时错误或任何其他信息来获取实际的错误消息。

    0 回复  |  直到 4 年前
        1
  •  2
  •   Shital Shah    4 年前

    以下两个解决了这个问题:

    • 将CUDA的默认SHM(共享内存)增加到10g(我认为1g也可以)。可以在docker run命令中通过传递 --shm-size=10g .我也通过了 --ulimit memlock=-1 .
    • export NCCL_P2P_LEVEL=NVL .

    调试技巧

    要检查当前的SHM,

    df -h
    # see the row for shm
    

    要查看NCCL调试消息,请执行以下操作:

    export NCCL_DEBUG=INFO
    

    为GPU到GPU的通信链路运行p2p带宽测试:

    cd /usr/local/cuda/samples/1_Utilities/p2pBandwidthLatencyTest
    sudo make
    ./p2pBandwidthLatencyTest
    

    对于A6000 4 GPU盒,此打印:

    enter image description here

    矩阵显示了每对GPU之间的带宽,而对于P2P,带宽应该很高。