swCaffe: A Parallel Framework for Accelerating Deep Learning Applications on Sunway TaihuLight

Liandeng Li, Jiarui Fang, Haohuan Fu, Jinlei Jiang, Wenlai Zhao, Conghui He, Xin You, Guangwen Yang

TL;DR

This paper introduces swCaffe, a highly optimized deep learning framework designed specifically for the Sunway TaihuLight supercomputer. By redesigning core neural network layers to exploit the unique SW26010 many-core processor and implementing a topology-aware parameter synchronization scheme, the authors successfully scale deep neural network (DNN) training to 1,024 nodes, achieving performance competitive with GPU clusters.

What Problem Does This Paper Address?

Mainstream deep learning frameworks like Caffe are heavily optimized for CPU-GPU hybrid architectures. However, the Sunway TaihuLight supercomputer—once the fastest in the world—uses a radically different processor: the SW26010.

The SW26010 features a heterogeneous many-core architecture with 4 core-groups, each containing 1 Management Processing Element (MPE) and an 8x8 grid of Computing Processing Elements (CPEs). Instead of traditional hardware-managed caches, CPEs use explicitly managed Scratch Pad Memory (Local Directive Memory, or LDM). Furthermore, the processor has a massive compute capacity but relatively low memory bandwidth, resulting in an extremely high flop-to-byte ratio. Straightforward ports of existing frameworks to this architecture yield abysmal performance because they cannot handle the explicit memory management, the register-level communication between cores, or the specific hierarchical network topology of the supercomputer.

Methods

To bridge this gap, the authors built swCaffe by redesigning Caffe’s core components based on four hardware-specific principles:

  1. Offloading to the CPE Mesh: Computation-intensive tasks are pushed to the 8x8 CPE clusters, exploiting data-level (SIMD) and instruction-level parallelism.
  2. Explicit LDM Management: Direct main-memory access from CPEs is avoided; LDM is strictly used as an intermediary cache.
  3. Large Data Block Transfers: To maximize Direct Memory Access (DMA) bandwidth, data is transferred in large, continuous blocks.
  4. Register-Level Communication (RLC): To bypass memory bottlenecks, the authors use the SW26010’s unique ability to pass data directly between the registers of CPEs in the same row or column.

Layer-Level Optimizations: The authors optimized Matrix-Multiplication (GEMM) using RLC to share matrix tiles across CPEs. For Convolutional layers, they implemented both explicit (im2col/col2im) and implicit GEMM transformations, allowing the framework to dynamically choose the best strategy based on the layer's dimensions.

Distributed Scaling: To scale to thousands of nodes, they replaced the default MPI All-Reduce with a topology-aware binomial-tree All-Reduce algorithm. The Sunway network has high bandwidth but high latency, making standard ring-based algorithms inefficient. Their custom algorithm minimizes cross-supernode traffic by keeping heavy communication localized within a supernode. They also optimized parallel I/O by increasing disk array stripe sizes to prevent read-bandwidth bottlenecks during data loading.

Datasets

  • ImageNet (1000-way): Used to train and evaluate standard CNN architectures including AlexNet, VGG-16, VGG-19, ResNet-50, and GoogleNet.

Key Insights and Ideas

  • The Flop-to-Byte Mismatch: The SW26010 has a theoretical flop-to-byte ratio of 26.5 (compared to ~14 for GPUs). This means DNN training on TaihuLight is severely memory-bandwidth bound. Optimizing compute is secondary to optimizing data movement.
  • Register-Level Communication is a Game Changer: By broadcasting data directly across the registers of the 8x8 CPE grid, the authors drastically reduced the need to fetch data from the LDM or main memory, artificially inflating the effective memory bandwidth for GEMM operations.
  • Network Topology Matters for Gradients: Standard MPI routines are "topology-blind." By mapping the logical distance of the All-Reduce algorithm to the physical hierarchical topology of TaihuLight, the authors avoided over-subscribing the network links between supernodes, drastically cutting communication overhead.

Key Results

  • Single-Node Performance: Compared to a 12-core Intel CPU, swCaffe is 3.04x to 7.84x faster across various DNNs. Compared to an NVIDIA K40m GPU, swCaffe achieves 23% to 119% of the GPU's performance. (It outperforms the GPU on AlexNet by 1.19x, but lags on ResNet-50 at 0.21x due to memory-bound small channel sizes).
  • Multi-Node Scalability: The framework scales exceptionally well. On 1,024 nodes, swCaffe achieved a 928x speedup for ResNet-50 (batch size 32) and a 715x speedup for AlexNet (batch size 256) compared to single-node performance.
  • Communication Overhead: Thanks to the topology-aware All-Reduce, communication time accounted for only ~10-19% of total training time for ResNet-50 on 1,024 nodes.

Limitations and Future Work

  • Small Channel Inefficiency: The framework struggles with layers that have small channel dimensions (e.g., the first few convolutional layers of a network). These layers don't provide enough data to fully utilize the compute-bounded blocked GEMM operations, leaving the processor starved for data.
  • Batch Size Limits: The current synchronous SGD approach limits the maximum batch size before accuracy degrades. The authors note that TaihuLight's massive scale would benefit greatly from emerging large-batch training algorithms (e.g., LARS), which could push scalability even further.

Summary updated

BibTeX
@inproceedings{li2018swcaffe,
  author = {Liandeng Li and Jiarui Fang and Haohuan Fu and Jinlei Jiang and Wenlai Zhao and Conghui He and Xin You and Guangwen Yang},
  title = {{swCaffe: A Parallel Framework for Accelerating Deep Learning Applications on Sunway TaihuLight}},
  booktitle = {CLUSTER},
  year = {2018},
  doi = {10.1109/cluster.2018.00087},
}
Figure