AHC

Description

When the cluster network has hierarchical characteristics and bandwidth convergence exists between layers, collective communication faces two technical challenges: First, the performance of the traditional single-layer collective communication algorithm deteriorates due to bandwidth convergence between different regions. Second, the conventional hierarchical algorithm is no longer applicable because the number of compute units in different regions is different (that is, the number of devices is asymmetric). For example, in a cluster, a communicator may span two supernodes with different numbers of devices (for example, one supernode has 64 devices and the other has 128 devices). This poses great challenges to the performance of the collective communication algorithm.

Figure 1 Implementing the AllReduce process of AHC based on logical devices with the same ID (five ranks, 2+3 groups)

The core idea of this algorithm is to regroup NPUs in a communicator and data on each NPU based on the topology. The high-speed network bandwidth is fully utilized within a group, and asymmetric combination based on logical devices with the same ID is implemented between groups. For details about the process, see the preceding figure. The implementation consists of the three steps:

  1. Group compute units based on the physical topology. Adjacent NPUs are grouped into one group. The number of NPUs in each group does not need to be the same. The bandwidth between groups may be converged compared with that within a group.
    1. Calculate the least common multiple (LCM) of all groups. If the number of groups is G, the data is divided into LCM × G chunks. As shown in the preceding figure, if the groups are 2 and 3, the LCM is 6 and G is 2. The data is divided into 12 chunks.
    2. The standard ReduceScatter is executed in parallel in each group.
  2. Divide logical devices with the same ID and implement inter-group AllReduce based on these logical devices.
    1. The data on which the Reduce operation is to be performed in each group is divided based on the data boundary between NPUs in the group to form several uneven data blocks.
    2. Each piece of data in a group has a corresponding piece of data of the same size in all other groups. According to the data mapping, NPUs in different groups also have a mapping relationship. The NPUs that have a mapping relationship are called "logical devices with the same ID."
    3. The AllReduce operation is performed between logical devices with the same ID.
  3. The AllGather operation is performed among NPUs in each group.

The implementation algorithm of the intra-group and inter-group ReduceScatter, AllGather, and AllReduce operations can be any known algorithm, such as NB, NHR, and Ring. Currently, the AHC algorithm selects a stitching algorithm with better performance based on the scenario and policy.

Required Time Calculation

When the NB algorithm is used for both intra-group and inter-group operations, the time required by the AllReduce operator is as follows.

Table 1 Time required by the AHC algorithm

Operation

Time Required

AllReduce

In the formula, m indicates the minimum number of groups, m+d indicates the maximum number of groups, G indicates the number of groups, and C indicates the convergence ratio of the inter-group bandwidth to the intra-group bandwidth.