TL;DR
This paper provides a deep dive into why popular deep learning frameworks—Caffe-MPI, CNTK, MXNet, and TensorFlow—perform differently on the same GPU hardware. By building mathematical performance models for Synchronous Stochastic Gradient Descent (S-SGD), the authors pinpoint exactly how bottlenecks in I/O, memory transfer, and gradient communication prevent models from scaling linearly across multiple GPUs and nodes.
What Problem Does This Paper Address?
As deep learning models grow in complexity and datasets expand to millions of images, training on a single GPU has become a bottleneck. While many distributed frameworks exist to parallelize this process, they don't all perform equally.
The core challenge is scalability: if you double your GPUs, you ideally want to double your training speed. However, factors like how a framework reads data from a disk, how it moves data to the GPU, and how it synchronizes gradients between machines often get in the way. This paper seeks to move beyond simple "which is faster" benchmarks by creating a performance model that explains why a framework succeeds or fails to scale in single-GPU, multi-GPU, and multi-node environments.
Methods
The researchers developed a performance model that breaks down a single training iteration ($t_{iter}$) into six measurable components:
- $t_{io}$: Time spent reading and preprocessing data.
- $t_{h2d}$: Time to transfer data from CPU (Host) to GPU (Device).
- $t_f$: Forward propagation time.
- $t_b$: Backward propagation time.
- $t_{comm}$: Time spent aggregating gradients across the network.
- $t_u$: Time to update the model parameters.
The authors specifically analyzed how well frameworks "hide" overhead. For example, can a framework start the gradient communication for Layer 5 while it is still calculating the gradients for Layer 4? This "pipelining" is crucial for distributed efficiency.
Hardware Setup: A 4-node cluster, with each node containing four Nvidia Tesla P40 GPUs, connected via a high-speed 56Gbps InfiniBand network.
Datasets
The study utilized the ILSVRC 2012 ImageNet dataset, which contains approximately 1.2 million images. They evaluated performance using three iconic Convolutional Neural Networks (CNNs) of varying depths:
- AlexNet (8 layers): Shallow, but with many parameters (~60 million).
- GoogleNet (22 layers): Medium depth.
- ResNet-50 (50 layers): Deep, with smaller kernels.
Key Insights and Ideas
- The I/O Bottleneck is Real: For shallow networks like AlexNet, the GPUs are so fast that the system can't feed them data quickly enough. CNTK struggled here because it decoded JPEG files on the fly, whereas other frameworks used pre-converted binary formats (like LMDB or TFRecord).
- Communication Hiding: The "Aha!" moment for scalability is overlapping. Caffe-MPI, MXNet, and TensorFlow are designed to parallelize gradient aggregation with backward computation. CNTK (at the time of the study) processed these sequentially, leading to poorer scaling on multiple GPUs.
- Memory Matters: Caffe-MPI and CNTK use "non-pageable" memory for host-to-device transfers, making their data transfers roughly twice as fast as MXNet and TensorFlow, which used standard pageable memory.
- cuDNN Autotuning: Performance varies based on how a framework invokes Nvidia’s cuDNN library. Frameworks that "autotune" (testing different convolution algorithms like FFT or Winograd to find the fastest for a specific layer) saw significant performance gains.
Key Results
- Single-GPU: CNTK generally had the fastest raw computation (forward/backward passes), but Caffe-MPI was the overall winner for AlexNet because it handled I/O more efficiently.
- Multi-GPU Scaling: Caffe-MPI, MXNet, and TensorFlow achieved near-linear scaling within a single node. CNTK lagged behind because it couldn't hide the gradient synchronization time.
- Multi-Node Scaling: Scaling across four machines (16 GPUs) proved difficult for everyone. The inter-node communication via InfiniBand is significantly slower than the internal PCIe bus.
- CNTK achieved 55%–77% efficiency on 4 nodes.
- MXNet achieved 35%–65% efficiency, hampered by its "KVStore" communication overhead.
- TensorFlow showed scaling efficiencies between 50% and 75%, with its gRPC-based communication noted as a high-latency factor.
Limitations and Future Work
The authors acknowledge that deep learning frameworks are moving targets, with frequent updates that may resolve the bottlenecks identified (e.g., CNTK has since improved its communication overlap).
The study focused exclusively on Synchronous SGD; the authors suggest that future work should evaluate Asynchronous SGD and model parallelism. Additionally, they plan to test performance on lower-bandwidth networks (like 1Gbps Ethernet) to see how these frameworks handle more constrained environments.
Summary updated