昇腾训练建链超时定位策略
使用 torch+mindspeed 训练时,可能出现类似“wait socket establish timeout, role[0] rank[1] timeout[120]”的报错,plog 日志内容如下:

上图中给出以下信息:
1,本端 device id(5)、本端 rank(1)、对端 rank(2)。本端 rank 和对端 rank 表示的是在通信域内的 rank 编号,如果是子通信域,需要注意 device id 和 rank id 无法对应;
2,若为节点间建链,device ip 是 nic ip,若为节点内建链,device ip 是 vnic ip,可根据通信域的信息和两端的 rank 号确认节点间/内场景。
另外还给出了 7 个排查策略,下面分别介绍。
1. the connection between this device and the target device is abnormal
需要检查每个 server 上的防火墙是否关闭,执行下面的命令:
systemctl status firewalld
如果状态时“Active: active(running)”,就需要关闭防火墙:
systemctl stop firewalld
2. an exception occurred at the target devices.
根据对端的 user_rank 找到对端的日志,若对端存在其他报错,需要先排查对端的报错原因。
3.the time difference between the execution of hcom on this device and the target device exceeds the timeout threshold. make sure this by keyworld [Entry-]
需要检查每个节点上下发的算子个数是否一致或者下发的时间间隔是否超过超时时间。具体做法是开启环境变量 export HCCL_ENTRY_LOG_ENABLE=1
,重新执行用例,在每个 rank 的日志中grep -r "Entry-"
查看算子的下发记录,检查是否有未下发或者下发超时的 rank:
grep -r ERROR | grep transport_manager | grep tag
找到报错的算子 tag;grep -r {tag} |grep ranks
根据 tag 查询该通信域下的总 rank 数;grep -rn Entry- | grep {tag}
根据查找到的 tag 在每个 rank 上查询该算子的下发。若下发数与总 rank 数不一致,或者存在下发时间间隔超过了超时时间,需要检查上面的框架层分析下发慢的原因。
4. the behavior of executing the calculation graph on this device and the target device is inconsistent.
需要检查本端和对端的计算图执行流程是否一致。
检查两端的配置是否一致,在 run 目录下检查环境变量配置
grep -r "externalinput.cc" run/
,两端需保持一致;检查两端的 hccs 使能是否一致:
npu-smi info -t topo

如果有节点之间不是 hccs,则会有建链超时报错。
5. The TLS switch is inconsistent, or the TLS certificate expires.
各 rank 的 TLS(安全增强)设置不一致时也会导致建链失败。
日志中排查 TLS 打印。在每个环境上的
/root/ascend/log/run
目录下检查 TLS SWITCH 打印:grep -r "TLS SWITCH" /root/ascend/log/run/device*
。若存在不一致,即有的是 0 有的是 1,则需要将全部 rank 配置成一致;检查环境上的 TLS:
for i in {0..7}; do hccn_tool -i $i -tls -g ; done | grep switch
。如果各个 rank 上的 tls switch 值不同,也会导致失败。建议统一保持 TLS 关闭:for i in {0..7}; do hccn_tool -i $i -tls -s enable 0; done
。
6. If src and dst IP address can be pinged, check whether the device IP address conflicts.
需要检查本端和对端的 device 网口之间是否联通。
找到日志中超时的两个 rank,先通过 hccn_tool 命令查看对应的 ip:
hccn_tool -i {node} -ip -g
也可使用如下命令直接查询当前节点的全部 device ip/link 信息:
for i in {0..7}; do hccn_tool -i $i -ip -g ; done
for i in {0..7}; do hccn_tool -i $i -link -g ; done
接着使用 hccl_tool 命令在其中一个节点 ping 另外一个节点的 device ip,查看超时的两个 link 之间能否 ping 通:
hccn_tool -i {node} -ping -g address {对端ip}
若两个 rank 之间 ping 不通或者有网口是 down 的,需要联系实验室管理员配置设备的网卡 ip。
G8600(16 卡)可能会遇到这种情况,可以通过配置环境变量 export HCCL_INTRA_ROCE_ENABLE=1 来解决。
评论