dlrover icon indicating copy to clipboard operation
dlrover copied to clipboard

straggler-detection

Open alex337 opened this issue 1 year ago • 5 comments

请问一下对节点分组计算 elapsed time 时是怎么计算的,如果node1和node2一组运行ddp,那这两个节点的 elapsed time 不应该是一样的吗?

alex337 avatar May 22 '24 11:05 alex337

我们采用的多节点两两分组测试。举个例子,假设job 有6个节点,{0,1,2,3,4,5},首先dlrover 的 elasticjob master 会把这6个节点分为3组,每组两个节点,即[{0,1}, {2,3}, {4,5}],每个组内的节点执行 GEMM 和 allreduce。每个节点都收集elapsed time 并上报给 elasticjob master。比如各节点的执行耗时为[5.1, 5.2, 5.6, 5.9, 10.2, 10.3] (单位秒),虽然每个组内的两个节点的elapsed time 差不多,但是不同组的 elapsed time 可能相差很大。上面的例子中,节点 4, 5 可能就是慢节点。

然后 elasticjob master 会根据 节点的 elapsed time 重新把节点两两分组,让上一轮 elapsed time 最慢的和最快的在一组,上述例子就是[{0, 5},{1, 2},{2, 3}],各节点再执行 GEMM 和 allreduce,并收集 elapsed time,假设结果为 [10.1, 10.2, 5.5, 5.6, 5.1 5.3]。可以看出节点5 和最快的节点0一起执行 AllGather,耗时也很长,节点4和节点2一起执行变快了。说明节点5就是straggler。

节点分组的代码可以看:

https://github.com/intelligent-machine-learning/dlrover/blob/77977a794f999f7d9deb169d1734eed11b2635c1/dlrover/python/master/elastic_training/rdzv_manager.py#L408-L454

workingloong avatar May 23 '24 02:05 workingloong

大佬,两个问题:

  1. 每个组内的节点执行 allreduce 时,两个节点之间会通信吗,如果节点之间通信的话两个节点的耗时应该是一样的吧
  2. 这种检测可以检测出具体的是慢节点或者故障节点上的哪个网卡有问题吗,看了一下代码好像没有指定网卡的操作 感谢回复

alex337 avatar May 23 '24 03:05 alex337

  1. 节点间会通信,耗时基本一样,但是也有微小差别,主要是还有 GEMM 的耗时可能不一样,而且 cuda launch 啥的时间也会有点区别。
  2. 具体网卡检测不出来,只能定位到哪个节点有问题。

workingloong avatar May 23 '24 07:05 workingloong

大佬,跑了一下example,同一个组内的节点执行 all_gather 的耗时好像是不一样的,这个是因为 all_gather 只是节点内部执行的吗,那节点间通信用的什么呀,感谢解答

alex337 avatar May 23 '24 08:05 alex337

应该相差不大吧,完全一样那肯定不可能。 这是我们在两个节点上的测试,每个节点2个 rank。 worker-0

[2024-05-23 17:09:10,658] [INFO] [utils.py:41:wrapper] Time to execute bm_allreduce on local rank 1 is 5.369s.
[2024-05-23 17:09:10,659] [INFO] [utils.py:41:wrapper] Time to execute bm_allreduce on local rank 0 is 5.366s.

worker-1

[2024-05-23 17:09:10,659] [INFO] [utils.py:41:wrapper] Time to execute bm_allreduce on local rank 1 is 5.373s.
[2024-05-23 17:09:10,663] [INFO] [utils.py:41:wrapper] Time to execute bm_allreduce on local rank 0 is 5.38s.

你可以用最新的代码跑下,最新的代码改了计时的逻辑。https://github.com/intelligent-machine-learning/dlrover/blob/a9359aa30b0d6f0554f2f809e2cae3e54e1ad342/dlrover/trainer/torch/node_check/utils.py#L88-L111

workingloong avatar May 23 '24 10:05 workingloong