NHR

Description

On a large-scale network with a large number of communication ranks, the number of communication steps for the Ring algorithm is positively correlated with the number of communication ranks. Therefore, a large delay may occur. The Ring algorithm is more suitable for scenarios with large data packets instead of small data packets. If the cluster scale is not an integral power of 2, using the RHD algorithm will introduce extra communication steps and overheads. As a result, the communication performance of an (N – 1)-scale cluster is worse than that of an N-scale cluster. In addition, the objects in each communication phase of the RHD algorithm change, causing the communication link to change. In heavy-traffic scenarios, this may cause traffic conflicts on switches, resulting in bandwidth decrease.

The Nonuniform Hierarchical Ring (NHR) algorithm constructs N spanning trees for N ranks to build the optimal communication relationship. The tree depth (that is, the number of communication steps) is , and data chunks are sent in an aggregated manner after being rearranged to ensure the optimal theoretical performance of the communication algorithm.

The maximum communication traffic of this algorithm is concentrated between ranks that are close to each other in physical locations. This effectively utilizes the performance advantages brought by the physical distance and reduces traffic conflicts. In addition, the NHR algorithm can fully utilize link resources regardless of whether the cluster scale is a power of 2. For small-data-packet communication, the NHR algorithm is further optimized to construct only one tree for N ranks. In this way, the number of data packets on the network and the number of tasks concurrently executed by the chip are reduced, improving communication efficiency.

When the rank size is an integral power of 2 (for example, 4), the communication process of the NHR algorithm is shown in the following figure. In each step, the number of received data copy and the number of sent data copy are both 1 because data chunks with consecutive addresses can be sent consecutively.

Figure 1 Communication process of the NHR algorithm when the rank size is 4

If the rank size is not an integral power of 2 (for example, 5), the communication process of the NHR algorithm is shown in the following figure. Most data chunks can be sent and received consecutively, and only data chunks between a few devices are discrete.

Figure 2 Communication process of the NHR algorithm when the rank size is 5

The NHR algorithm is also applicable to the star or fat-tree topology. The time complexity of the algorithm is .

Required Time Calculation

NHR is an unbalanced hierarchical ring algorithm. When the cluster scale is an integral power of 2 or not an integral power of 2, the time complexity of the algorithm is . If the number of nodes is , the number of required communication times is . For the ReduceScatter operator, data is exchanged in the first step, and the data size is halved upon each communication. In the last step, one copy of data is exchanged. The sending and receiving relationship of the AllGather operator is completely opposite with those of ReduceScatter.

Table 1 Time required for each operation in the NHR algorithm

Operation

Time Required

ReduceScatter

AllGather

The time required is the same as that of ReduceScatter, and there is no γ-related part.

AllReduce

The implementation is ReduceScatter+AllGather:

Scatter

Broadcast

The implementation is Scatter+AllGather: