Singularity: Planet-Scale, Preemptive and Elastic Scheduling of AI Workloads

Dharma Shukla, Muthian Sivathanu, Srinidhi Viswanatha, Bhargav S. Gulavani, Rimma Nehme, Amey Agrawal, Chen Chen, Nipun Kwatra, Ramachandran Ramjee, Pankaj Sharma, Atul Katiyar, Vipul Modi, Vaibhav Sharma, Abhishek Singh, Shreshth Singhal, Kaustubh Welankar, Lu Xun, Ravi Anupindi, Karthik Elangovan, Hasibur Rahman, Zhou Lin, Rahul Seetharaman, Cheng Xu, Eddie Ailijiang, Suresh Krishnappa, Mark RussinovicharXiv 2022

TL;DR

Singularity is a novel system that makes deep learning workloads transparently preemptible, migratable, and elastic by default, without requiring any code changes from users. This allows for significantly higher utilization of AI accelerators, leading to reduced costs and improved reliability, with negligible impact on performance.

What Problem Does This Paper Address?

Deep learning workloads, especially training, are notoriously resource-intensive and long-running. Cloud providers face the challenge of maximizing the utilization of expensive AI accelerators (like GPUs) to reduce costs, while users need reliable and efficient execution of their models. Existing solutions for checkpointing, migration, and elasticity often require significant user effort (modifying code, using custom libraries), making them impractical for widespread adoption. This leaves a gap where the vast majority of deep learning jobs are not easily preemptible or resizable, leading to underutilized resources and costly restarts upon failure.

Methods

Singularity introduces a "workload-aware scheduler" with two core primitives:

  1. Transparent Preemption and Migration: Singularity can checkpoint, preempt, and migrate any deep learning job across nodes, clusters, or even entire data centers. This is achieved by transparently intercepting device API calls (like CUDA) via a "device-proxy" component. This proxy decouples the job's execution from specific hardware, allowing it to be resumed from its exact state on different hardware.
  2. Transparent Elasticity (Resizing): Jobs can be dynamically scaled up or down to use a variable number of accelerators. This is enabled by "replica splicing," a technique that allows multiple job "workers" (ranks) to time-slice a single GPU. This is done without affecting the job's "world size" (number of ranks), making it transparent to the user.

Key to these mechanisms is the device-proxy, which intercepts GPU calls, manages memory, and facilitates communication. It uses techniques like domain-specific interception, hardware abstraction layers, and a novel distributed barrier algorithm for consistent checkpointing. For elasticity, it employs "replica splicing" which involves intelligent memory sharing and selective operation squashing to minimize overhead.

Datasets

The paper does not mention specific datasets used for training models. However, it evaluates its system using a variety of established deep learning models across different domains and parallelism strategies. These include:

  • NLP: BERT-MRPC, GPT-2, InternalQ, InternalT
  • CV: DenseNet169, PyramidNet, ResNet50

These models were run on NVIDIA DGX-2 servers with 8 V100 GPUs.

Key Insights and Ideas

  • Transparency is Key: The most significant insight is that making preemption, migration, and elasticity transparent to the user (no code changes) is crucial for widespread adoption and enabling robust SLAs.
  • Decoupling Job from Hardware: The device-proxy acts as a crucial intermediary, abstracting away hardware specifics and enabling the scheduler to treat the entire fleet as a single logical cluster.
  • Work-conserving by Default: Singularity's approach ensures that jobs resume exactly where they left off, avoiding the costly restarts common in traditional checkpointing.
  • Elasticity as a First-Class Citizen: By making elasticity a default feature, Singularity unlocks opportunistic use of spare capacity and better resource utilization.
  • Domain-Specific Optimizations Pay Off: Leveraging knowledge of deep learning workloads (e.g., parameter updates, communication patterns) allows for significant optimizations like "replica splicing" and "squashing" that minimize overhead.

Key Results

  • Negligible Performance Overhead: The steady-state performance overhead of the device-proxy and its mechanisms (interception, distributed barrier, time-slicing) was found to be negligible, typically below 3% for most models.
  • Efficient Elasticity: Replica splicing achieved time-slicing with less than 3% overhead for most models, even in scaled-down scenarios (e.g., 4-way time-slicing). In some cases, optimizations even led to a slight performance gain over scaled-up execution.
  • Manageable Checkpoint Sizes: Singularity's checkpoint sizes were comparable to user-level checkpoints. Temporal deduplication significantly reduced the size of subsequent checkpoints.
  • Reasonable Migration Latency: End-to-end migration and resizing latencies were in the tens of seconds, with a significant portion attributed to data transfer. The authors are working on peer-to-peer transfer to reduce this.
  • Robustness: The system demonstrated robustness across multiple versions of PyTorch and CUDA, indicating good maintainability.

Limitations and Future Work

  • Data Transfer Latency: While migration and resizing are efficient in terms of computation, the time taken for uploading and downloading checkpoint data to/from remote storage is a significant factor. The authors are exploring peer-to-peer transfer mechanisms to mitigate this.
  • Pathological Models: While the system is designed to be robust, there's a mention of potential silent corruption or incorrect execution if a model violates the assumptions made for "squashing" operations. The system conservatively disables squashing in such cases, potentially impacting performance but not correctness.
  • Custom Launchers: For jobs using custom rank assignment policies, an API is provided to communicate rank-to-topology mapping, but this requires some user interaction.
  • Future Work: The paper mentions ongoing work on peer-to-peer transfer for faster migration and exploring more advanced techniques for handling complex parallelism strategies and optimizing checkpointing further.

Summary updated

BibTeX
@misc{shukla2022singularity,
  author = {Dharma Shukla and Muthian Sivathanu and Srinidhi Viswanatha and Bhargav S. Gulavani and Rimma Nehme and Amey Agrawal and Chen Chen and Nipun Kwatra and Ramachandran Ramjee and Pankaj Sharma and Atul Katiyar and Vipul Modi and Vaibhav Sharma and Abhishek Singh and Shreshth Singhal and Kaustubh Welankar and Lu Xun and Ravi Anupindi and Karthik Elangovan and Hasibur Rahman and Zhou Lin and Rahul Seetharaman and Cheng Xu and Eddie Ailijiang and Suresh Krishnappa and Mark Russinovich},
  title = {{Singularity: Planet-Scale, Preemptive and Elastic Scheduling of AI Workloads}},
  year = {2022},
  eprint = {2202.07848},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.07848},
}
Figure