jasperzhong / read-papers-and-code

My paper/code reading notes in Chinese
44 stars 3 forks source link

PPoPP '21 | DAPPLE: A Pipelined Data Parallel Approach for Training Large Models #223

Closed jasperzhong closed 2 years ago

jasperzhong commented 3 years ago

https://arxiv.org/pdf/2007.01045.pdf

啊这. 才发现有老板名字.

jasperzhong commented 3 years ago

主要分为profiler, planner, runtime.

schedule策略其实就是gpipe + 1F1B. 和 #206 的Pipedream-Flush是一回事.

planner的分析,我看不懂,但我大受震撼

jasperzhong commented 2 years ago

过了一遍. 首先要衡量一个pipeline latency. 他们是找了一个参照物,叫pivot stage,即bubble time最少的那个stage. 如果模型切分得比较均匀的话,那一般就是最后一个stage. 但如果切分得不均匀的话也可能是前面的某个stage.

确定了pivot stage后,就可以将pipeline分为三个phase: warmup, steady和ending. 然后分别计算这三个phase时间,其累加结果即为pipeline latency L.

image

他们把P2P通信也作为一个stage. 其AR时间为0,而send forward为前向时间,而send backward为反向时间.

如何进行device assignment,他们选择了三种策略:

Planning算法是DP. 说实话没有完全看懂. 他们定义的subproblem是pipeline latency T{PL}(j, m, g),即已经把前j层layers使用m个GPUs(device id set是g)plan好了. 那么目标就是求解T{PL}(N, G, \mathcal{G}). N是总共layers数量,G是GPU数量,\mathcal{G}是GPU set.

image

假设我们已经plan了前j层,并且得到了T_{PL}(j, m, g),那么j层之后的layers形成了stage s'. 下一步是将在stage s'拆成两个新的stage, s_1', s_2'. 假如给s1'分配m'个GPUs(device is set是g'),那么得到T{PL}(j', m+m', g+g’). 同时DAPPLE会枚举s_1'可能的device placement根据上面提到的三个policy.

image

得到T{PL}(j', m+m', g+g’)的关键是需要确定pivot stage在哪里,可能还是和T{PL}(j, m, g)一样,可能是变成了stage s_1'. 这里没有形式化表达出来.

而且这里也没提到咋做replication啊?这就是我没看懂的地方.

最后还提到了replicate跨stage通信需要split concat. 嗯,得根据batch维度做.