CNNLab: a Novel Parallel Framework for Neural Networks using GPU and FPGA-a Practical Study with Trade-off Analysis

Liu Liu, Maohua Zhu, Liu Liu 0017, Chao Wang, Yuan XiearXiv 2016 · arXiv

Introduction

The rapid advancement of deep learning has introduced a significant "programming wall" for researchers. While heterogeneous hardware like GPUs and FPGAs offer massive throughput and high power efficiency, respectively, they require vastly different and specialized programming skill sets (e.g., CUDA for GPUs versus OpenCL or HDL for FPGAs). Existing high-level abstractions often lack the expressiveness required for complex neural networks, forcing experts to repeatedly solve low-level hardware scheduling challenges.

CNNLab is introduced as a middleware framework designed to bridge this gap. It provides a uniform programming interface that abstracts away hardware-specific complexities, allowing for optimized neural network deployment based on a quantitative trade-off analysis of performance, power, and energy.

CNNLab Framework Architecture

CNNLab decomposes Neural Networks (NN) into a sequence of abstract layers, providing a uniform programming model. Users define layers using simple parameter tuples (input size, kernel size, stride, etc.), which the framework then maps to optimized computing kernels.

As shown in the infrastructure overview, the framework supports four primary layer types: Convolutional, Normalization, Pooling, and Fully Connected (FC). By maintaining an IP library of optimized kernels—using CUDA (cuDNN/cuBLAS) for GPUs and OpenCL for FPGAs—CNNLab can launch workloads across different hardware backends seamlessly.

Mapping and Trade-off Analysis

A core innovation of CNNLab is its ability to perform runtime analysis to decide where to offload specific tasks. This decision is based on the specific requirements for execution time, throughput, power, and energy consumption.

The CNNLab workflow involves analyzing the neural network model to perform trade-off analysis before mapping layers to either OpenCL (FPGA) or CUDA (GPU).

This mapping process allows the system to exploit the unique strengths of each architecture. For instance, while GPUs are typically favored for raw throughput, FPGAs may be selected for environments where power efficiency is the primary constraint.

Performance Analysis and Key Insights

The framework was evaluated using a representative CNN model (5 Convolutional layers and 3 Fully Connected layers) on an Nvidia K40 GPU and an Altera DE5 FPGA. The study yielded several critical insights into hardware performance:

  • The "Conv vs. FC" Divide: GPUs are significantly more efficient at Fully Connected (FC) layers due to highly optimized matrix multiplication libraries, achieving up to a 1000x speedup over the FPGA in these specific tasks.
  • Performance Density: For Convolutional layers, FPGAs are surprisingly competitive. The GPU achieved 14.12 GFLOPS/W compared to the FPGA’s 10.58 GFLOPS/W, suggesting FPGAs are a viable high-efficiency alternative for specific convolutional workloads.
  • Power vs. Energy: While the FPGA consumes roughly 50x less power (~2.23W vs. ~97W), its longer execution time results in total energy consumption (Joules) that is nearly identical to the GPU for Convolutional layers (~8.67J for GPU vs. ~10.24J for FPGA).
  • Library Optimization: The choice of library is vital; using cuBLAS instead of cuDNN for FC layers on the GPU provided a 1.69x speedup in forward computation and a 24.89x speedup in backpropagation.

Conclusion

CNNLab successfully abstracts the complexities of heterogeneous computing, providing a practical framework for neural network deployment. While the GPU remains the leader in raw throughput (peaking at 1632 GFLOPS), the framework highlights that FPGAs offer comparable energy efficiency for convolutional tasks. Future work will focus on narrowing the performance gap by increasing FPGA clock frequencies and incorporating model compression techniques like pruning and quantization. Additionally, the authors plan to integrate CNNLab with broader ecosystems like Apache Spark and TensorFlow.

Summary updated

Abstract

Designing and implementing efficient, provably correct parallel neural network processing is challenging. Existing high-level parallel abstractions like MapReduce are insufficiently expressive while low-level tools like MPI and Pthreads leave ML experts repeatedly solving the same design challenges. However, the diversity and large-scale data size have posed a significant challenge to construct a flexible and high-performance implementation of deep learning neural networks. To improve the performance and maintain the scalability, we present CNNLab, a novel deep learning framework using GPU and FPGA-based accelerators. CNNLab provides a uniform programming model to users so that the hardware implementation and the scheduling are invisible to the programmers. At runtime, CNNLab leverages the trade-offs between GPU and FPGA before offloading the tasks to the accelerators. Experimental results on the state-of-the-art Nvidia K40 GPU and Altera DE5 FPGA board demonstrate that the CNNLab can provide a universal framework with efficient support for diverse applications without increasing the burden of the programmers. Moreover, we analyze the detailed quantitative performance, throughput, power, energy, and performance density for both approaches. Experimental results leverage the trade-offs between GPU and FPGA and provide useful practical experiences for the deep learning research community.
BibTeX
@misc{liu2016cnnlab,
  author = {Liu Liu and Maohua Zhu and Liu Liu and Chao Wang and Yuan Xie},
  title = {{CNNLab: a Novel Parallel Framework for Neural Networks using GPU and FPGA-a Practical Study with Trade-off Analysis}},
  year = {2016},
  eprint = {1606.06234},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.06234},
}
Figure