SuperNeurons: Dynamic GPU Memory Management for Training Deep Neural Networks

Linnan Wang, Jinmian Ye, Yiyang Zhao, Wei Wu, Ang Li, Shuaiwen Leon Song, Zenglin Xu, Tim Kraska

Abstract

SuperNeurons is a dynamic GPU memory management runtime designed to overcome the "memory wall" in deep learning. By integrating tensor recycling, CPU offloading, and strategic recomputation, SuperNeurons enables the training of networks significantly deeper than physical VRAM limits—such as a 10,000-layer ResNet on a 12GB GPU—surpassing the depth limits of mainstream frameworks by over 3x while maintaining high computational performance.

Introduction

The pursuit of higher accuracy in deep learning has led to increasingly "deeper and wider" neural network architectures. However, GPU DRAM remains a finite and expensive resource, creating a "memory wall" for researchers. For instance, state-of-the-art models like Inception v4 can require upwards of 44GB of memory for training, while common professional GPUs of the same era, such as the NVIDIA K40, provide only 12GB.

Existing deep learning frameworks, including Caffe and TensorFlow, typically rely on static memory allocation. These approaches struggle with the complex, non-linear data dependencies—characterized by "fans" and "joins"—found in modern architectures. When memory is exhausted, practitioners are often forced to reduce batch sizes, which can negatively impact model accuracy and stability, or distribute the model across multiple GPUs, introducing significant communication overhead. SuperNeurons addresses this by providing a dynamic runtime that manages memory at the layer level.

Methodology

SuperNeurons employs a dynamic scheduler that coordinates three core memory-saving primitives to maximize efficiency without sacrificing training speed:

  1. Liveness Analysis: Similar to compiler optimizations, the runtime tracks the lifecycle of every tensor. Memory is immediately recycled once a tensor is no longer needed for subsequent calculations in the backpropagation pass.
  2. Unified Tensor Pool (UTP): This mechanism treats CPU RAM as an extension of GPU memory. It identifies "checkpoints" (typically compute-intensive layers like Convolutions) and asynchronously offloads their tensors to the CPU. The system "hides" the data transfer latency behind the ongoing computation.
  3. Cost-Aware Recomputation: For "cheap" layers such as Pooling, Activation, or Batch Normalization, which have low computational costs but significant memory footprints, SuperNeurons deletes forward-pass results and recomputes them on-the-fly during the backward pass.
Dynamic scheduling and memory management across linear, join, and fan network topologies.

Furthermore, SuperNeurons features Dynamic Convolution Workspace Allocation. High-performance libraries like cuDNN require additional "workspace" memory for their fastest algorithms (e.g., FFT-based convolution). SuperNeurons utilizes the memory saved by its primitives to provide the largest possible workspaces, often resulting in faster execution than frameworks that lack such aggressive memory management.

Evaluation and Results

The authors evaluated SuperNeurons using standard benchmarks, including ImageNet (ILSVRC), across various architectures: AlexNet, VGG-16/19, Inception v4, and ResNet configurations ranging from ResNet-50 to an experimental ResNet-2500.

Extreme Depth and Efficiency

SuperNeurons successfully trained a ResNet-2500, comprising approximately 10,000 layers, on a single 12GB K40c GPU. Compared to mainstream frameworks like TensorFlow, MXNet, or Torch, SuperNeurons enabled the training of networks at least 3.24x deeper. In terms of raw capacity, it handled models up to 19.8x larger than Caffe's limit by reducing peak memory usage to the requirements of a single layer.

Performance Gains

Despite the potential overhead of CPU offloading and recomputation, SuperNeurons maintained or exceeded the training speeds of competing frameworks. This is largely attributed to its optimized convolution workspace management, which allows the GPU to utilize faster, memory-intensive mathematical kernels.

Memory allocation and speedup metrics for various deep learning architectures using SuperNeurons.

Conclusion

SuperNeurons demonstrates that dynamic memory management can effectively break the memory wall in deep learning. By intelligently trading space for speed and utilizing CPU RAM as a secondary tier, it allows researchers to explore ultra-deep architectures on existing hardware. While limited by PCIe bandwidth in extreme cases, the system provides a scalable path for training the next generation of deep neural networks.

Summary updated

BibTeX
@inproceedings{wang2018superneurons,
  author = {Linnan Wang and Jinmian Ye and Yiyang Zhao and Wei Wu and Ang Li and Shuaiwen Leon Song and Zenglin Xu and Tim Kraska},
  title = {{SuperNeurons: Dynamic GPU Memory Management for Training Deep Neural Networks}},
  booktitle = {ACM SIGPLAN Notices},
  year = {2018},
  doi = {10.1145/3200691.3178491},
}
Figure