Habitat: A Runtime-Based Computational Performance Predictor for Deep Neural Network Training

Geoffrey X. Yu, Yubo Gao, Pavel Golikov, Gennady Pekhimenko

TL;DR

This paper introduces Habitat, a novel tool that predicts the training time of deep neural networks (DNNs) on different GPUs. By leveraging runtime measurements on an existing GPU and a hybrid approach of "wave scaling" and pre-trained MLPs, Habitat achieves an average prediction error of just 11.8%, empowering users to make informed, cost-efficient hardware choices.

What Problem Does This Paper Address?

Deep learning researchers and practitioners often face a "paradox of choice" when selecting GPUs for training DNNs. The market is flooded with options, each with varying costs, performance characteristics, and availability. Traditional methods for making these decisions, like direct measurement or consulting benchmarks, have significant drawbacks: direct measurement requires access to the hardware beforehand, and benchmarks are often limited to specific models and GPUs, failing to cover custom DNNs or less common hardware. This leaves users struggling to balance computational performance with cost, especially when choosing between different hardware tiers (workstation, private cluster, cloud) or deciding which specific GPU to rent or purchase.

Methods

Habitat tackles this problem by predicting the execution time of a single DNN training iteration. The core idea is that characterizing a single iteration is sufficient to understand the performance of the entire training process due to the repetitive nature of DNN training. Habitat employs a hybrid approach:

  • Runtime Measurement: It first measures the execution time of each operation within a training iteration on a user's existing GPU.
  • Wave Scaling: For "kernel-alike" operations (those using the same GPU kernels across different GPUs), Habitat scales the execution time using ratios of compute units, memory bandwidth, and clock frequencies between the origin and destination GPUs. This technique is informed by the kernel's "memory bandwidth boundedness" estimated using a roofline model.
  • MLP Predictors: For "kernel-varying" operations (where kernels differ across GPUs, like convolutions), Habitat uses pre-trained multilayer perceptrons (MLPs). These MLPs take GPU hardware specifications and operation parameters as input to predict execution time.

Habitat is implemented as a Python library that works with PyTorch and is designed to be easy to use.

Datasets

The paper does not introduce new benchmarks but evaluates Habitat on existing, well-known DNN models and datasets.

  • Models: ResNet-50, Inception v3, the Transformer, GNMT, and DCGAN.
  • Datasets: Standard datasets associated with these models were used, such as ImageNet for image classification, WMT'16 for machine translation, and LSUN for image generation. For experiments, synthetic data was often used to ensure consistent batch sizes and control.

Key Insights and Ideas

  • Repetitive Computation is Key: The core insight is that DNN training is highly repetitive. This allows us to characterize the entire training process by accurately predicting the performance of a single iteration.
  • Hybrid Approach is Necessary: Neither wave scaling nor MLPs alone are sufficient. Wave scaling works well for many operations but fails for kernel-varying ones, while MLPs require significant training data. The combination covers a broader range of operations effectively.
  • Runtime Information is Powerful: Leveraging runtime measurements on an "available" GPU (even if not the most powerful) is a practical way to gather the necessary data for predictions, as users often have a local GPU for development.
  • Cost-Efficiency is Not Always Obvious: The case studies highlight that the most powerful GPU isn't always the most cost-efficient, and sometimes a less powerful, cheaper GPU can offer comparable or better value for specific models.

Key Results

  • High Prediction Accuracy: Habitat achieves an average end-to-end iteration execution time prediction error of 11.8% across five DNN models and six different GPU architectures.
  • Broad Applicability: Predictions are accurate across different GPU generations (Pascal, Volta, Turing) and classes (desktop, workstation, server).
  • Effective for Diverse Architectures: Habitat works well for convolutional, recurrent, and attention-based DNN architectures.
  • MLP vs. Wave Scaling Contribution: While wave scaling is used for 95% of unique operations, MLPs predict 54% of the execution time, indicating that kernel-varying operations, though fewer, are often computationally significant.

Limitations and Future Work

  • Distributed Training: Predicting execution time for distributed training setups (data, model, or pipeline parallelism) is a significant area for future work, requiring prediction of communication times and overlap.
  • Larger Batch Sizes: Habitat currently requires the origin GPU to run the desired batch size. Extrapolating to larger batch sizes using linear regression is suggested.
  • Other Frameworks: While Habitat is PyTorch-based, its principles are general and could be extended to frameworks like TensorFlow and MXNet by extracting computation graphs.
  • Hardware Accelerators: Extending Habitat to predict performance on other accelerators like TPUs and AWS Trainium presents challenges due to differing architectures and the role of tensor compilers, but the core idea of leveraging runtime information remains promising.
  • Kernel-Varying Operations: While MLPs handle kernel-varying operations, training them requires effort. The paper notes that only a few operations are typically kernel-varying.

Summary updated

BibTeX
@inproceedings{yu2021habitat,
  author = {Geoffrey X. Yu and Yubo Gao and Pavel Golikov and Gennady Pekhimenko},
  title = {{Habitat: A Runtime-Based Computational Performance Predictor for Deep Neural Network Training}},
  booktitle = {USENIX ATC},
  year = {2021},
  url = {https://openreview.net/forum?id=tMPEN2AO9q},
}
Figure