使用并查集维护当前的通信域,同时维护每个通信域的卡数和总负载的奇偶性。
对于操作 1:
某训练集群共有 n 张计算卡,编号为 1 到 n。第 i 张卡有一个整数负载 wi。为了做梯度同步,系统会把若干张卡划进同一个通信域。
规则如下:
In following contests:
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.