Generally, each rank has only one RDMA network port. If the Mesh algorithm is used on the RDMA link to complete AllToAll, data is received from and sent to multiple ranks at the same time. Multiple streams contend for resources on the same link, which may deteriorate the overall performance.
The Pairwise algorithm is a step-by-step execution version of the Mesh algorithm. Through proper planning, communication is divided into multiple steps. In each step, data is received from and sent to only one rank. For example, for a rank whose rankid is i, the first step is to receive data from the (i – 1) rank and send data to the (i + 1) rank. The second step is to receive data from the (i – 2) rank and send data to the (i + 2) rank. This rule also applies to other cases.

The size of data that rank i needs to send to rank j is defined as nij.
In step k, rank i sends data of size ni,i+k to rank i+k. The time required for step k is as follows.

The time required for completing the entire Pairwise operation is as follows.
