Accelerating distributed deep neural network training with pipelined MPI allreduce

Adrián Castelló, Enrique S. Quintana-Ortí, José DuatoClust. Comput 2021

Introduction

In the era of massive deep learning models, distributed training via data parallelism has become the standard for scaling. This approach requires frequent synchronization of gradients across multiple nodes, typically using the MPI_Allreduce communication primitive. However, as models grow to include millions or billions of parameters, this synchronization step becomes a significant performance bottleneck. This paper introduces a pipelined approach to MPI_Allreduce that optimizes large-scale data transfers by overlapping communication with reduction arithmetic.

The Communication Bottleneck

Standard Message Passing Interface (MPI) libraries often struggle with the massive messages typical of deep learning. Two primary issues were identified:

  1. Suboptimal Algorithm Selection: Most libraries use an "AUTO" mode to select algorithms based on message size. However, these are often tuned for traditional scientific simulations with small messages, leading to poor performance for the gigabyte-scale transfers in deep learning.
  2. Blocking Operations: Standard Allreduce calls are often blocking, failing to utilize network bandwidth fully or overlap the time spent on reduction math with data transmission.

Proposed Optimizations

1. Algorithm Selection

The researchers analyzed various MPI algorithms, including Ring (RNG), Recursive Doubling (RDB), and Binomial Tree (BIN). They found that the Ring algorithm is generally superior for the large messages used in deep learning. Manually selecting RNG over the default "AUTO" selection provides an immediate performance boost.

Comparison of MPI algorithms showing the superiority of the Ring (RNG) algorithm for large message sizes.

2. Pipelined MPI_Iallreduce

The core innovation is the Pipelined MPI_Iallreduce. Instead of transmitting a single massive message, the system splits the data into $N$ smaller segments and issues multiple non-blocking calls. This creates a pipeline where the system can begin the arithmetic reduction (summing gradients) for the first chunk while the second chunk is still being transmitted. This is critical because reduction arithmetic can account for 28–37% of total communication time.

Bandwidth performance of pipelined Allreduce across different fixed chunk sizes compared to a non-pipelined baseline.

Experimental Results

The methods were evaluated on an 8-node cluster using standard benchmarks like ImageNet and Cifar10 across various architectures (ResNet, VGG, AlexNet). Key findings include:

  • Throughput Gains: Pipelining increased raw network throughput from approximately 3,500 MB/s to 4,000 MB/s.
  • Training Speedups:
    • ResNet110 (Cifar10): Achieved the highest gains of 50–60% due to its high sensitivity to communication latency.
  • VGG11 and AlexNet: Improved by 20–25%.
  • ResNet50: Showed a modest 5% improvement, as it is already highly optimized for computation-communication overlap.

Conclusion and Future Work

Pipelining MPI_Allreduce offers a significant performance advantage for distributed deep learning by effectively hiding the cost of reduction arithmetic. While the current implementation requires manual tuning of the "degree of concurrency," future work aims to develop an automatic tuner to optimize chunk sizes for different network topologies and scale the approach to thousands of nodes.

Summary updated

BibTeX
@article{castello2021accelerating,
  author = {Adrián Castelló and Enrique S. Quintana-Ortí and José Duato},
  title = {{Accelerating distributed deep neural network training with pipelined MPI allreduce}},
  journal = {Clust. Comput.},
  year = {2021},
  doi = {10.1007/s10586-021-03370-9},
}
Figure