THEMIS: Fair and Efficient GPU Cluster Scheduling — Detailed Summary

Kshiteej Mahajan, Arjun Balasubramanian, Arjun Singhvi, Shivaram Venkataraman, Aditya Akella, Shuchi Chawla (University of Wisconsin–Madison); Amar Phanishayee (Microsoft Research) | 17th USENIX Symposium on Networked Systems Design and Implementation (NSDI '20), Feb 25–27 2020, Santa Clara, CA | ISBN 978-1-939133-13-7

Per-section summary organized by the paper's own headings, with paragraph-level bullets and exact quantitative results where the paper provides them. Numbers appearing only inside un-labeled figures are not reconstructed; only values the paper states in text or tables are reported.


Abstract


1. Introduction


2. Motivation

2.1 Preliminaries

2.2 Characterizing Production ML Apps

2.3 Our Goal

"We were scheduling with a balanced approach ... with guidance to 'play nice'. Without firm guard rails, however, there were always individuals who would ignore the rules and dominate the capacity."

"Even with existing fair sharing schemes, we do find users frustrated with the inability to get their work done in a timely way... The frustration frequently reaches the point where groups attempt or succeed at buying their own hardware tailored to their needs."


3. Finish-Time Fair Allocation

3.1 Fair Sharing Concerns for ML Apps

3.1.1 ML Task Durations

3.1.2 Placement Preferences

Table 1 — Effect of GPU resource allocation on job throughput:

Allocation VGG16 Inception-v3
4 P100 GPUs on 1 server 103.6 images/sec 242 images/sec
4 P100 GPUs across 2 servers 80.4 images/sec 243 images/sec

Theorem 3.1. Existing fair schemes (DRF, LAS) ignore placement preferences and violate SI, PE, EF for ML apps.

3.2 Metric: Finish-Time Fairness

Table 2 — Example table of bids sent from apps to the scheduler:

G⃗ [0,0] [0,1] = [1,0] [1,1]
r r_old 200/400 = 1/2 100/400 = 1/4

3.3 Mechanism: Partial Allocation Auctions

3.3.1 One-Shot Auction

Pseudocode 1 — Finish-Time Fair Policy:

AUCTION({A_i}, {r_i(.)}, R⃗):
  G⃗_i,pf   = arg max Π_i 1/r_i(G⃗_i)            # proportional-fair alloc per app i
  G⃗^-i_j,pf = arg max Π_{j≠i} 1/r_j(G⃗_j)       # pf alloc per app j without app i
  c_i = ( Π_{j≠i} 1/r_j(G⃗_j,pf) ) / ( Π_{j≠i} 1/r_j(G⃗^-i_j,pf) )
  G⃗_i = c_i * G⃗_i,pf                          # final allocation per app i
  L⃗   = Σ_i (1 - c_i) * G⃗_i,pf                # aggregate leftover resource
  return {G⃗_i}, L⃗

ROUNDBYROUNDAUCTIONS({A_i}, {r_i(.)}):
  while True:
    ON RESOURCE-AVAILABLE EVENT R⃗':
      {A_i^sort}   = SORT({A_i}) on r_i^current
      {A_i^filter} = top (1-f) fraction of apps from {A^sort}
      {r_i^filter} = updated r(.) from apps in {A_i^filter}
      {G⃗_i^filter}, L⃗ = AUCTION({A_i^filter}, {r_i^filter(.)}, R⃗')
      {A_i^unfilter}  = {A_i} - {A_i^filter}
      allocate L⃗ to {A_i^unfilter} at random

Theorem 3.2. The one-shot partial allocation auction guarantees SP, PE and EF, but does not provide SI.

3.3.2 Multi-round Auctions

Theorem 3.3. Round-by-round auctions preserve the PE, EF and SP properties of partial auctions and maximize SI.


4. System Design

4.1 Design Requirements

4.2 THEMIS Scheduler Architecture

4.2.1 Need for a New Scheduling Architecture

4.2.2 Two-Level Semi-Optimistic Scheduling

                      +----------------------------+
                      |      THEMIS ARBITER        |
                      |  (module in YARN RM)       |
                      +----------------------------+
  VISIBILITY PHASE      |  (1) ask all apps for r estimates
                        v
        (2) offer available GPUs to worst-r fraction (1-f) of apps
                        |
                        v
   +---------+     +---------+          +---------+
   | AGENT   |     | AGENT   |   ...    | AGENT   |
   | +App1   |     | +App2   |          | +Appn   |
   +---------+     +---------+          +---------+
        |  (3) each app examines offer in parallel,
        |      replies with ONE bid = r(.) valuation table
        v
  ALLOCATION PHASE
        (4) ARBITER picks winning bids via partial allocation
            + leftover allocation; notifies each AGENT
        (5) AGENT propagates allocation to app-scheduler,
            which divides GPUs among its constituent jobs

4.3 AGENT and AppScheduler Interaction

4.3.1 Single-Job ML Apps

Equation 1:

r(G⃗)          = Tsh(G⃗) / Tid
Tsh            = (Tcurrent - Tstart) + iter_left * iter_time(G⃗)
Tid            = Tcluster * Navg
iter_time(G⃗)  = iter_time_serial * S(G⃗) / min(||G⃗||_1, job_demand_max)
Tcluster       = iter_total * iter_serial_time / min(R_C, job_demand_max)

4.3.2 Generalizing to Multiple-Job ML Apps

Successive Halving:

Equation 2:

Tsh(i)   = max_j { T(G⃗_j) }
Tsh      = Σ_i Tsh(i)
Tcluster = B / min(R_C, app_demand_max)
Tid      = Tcluster * Navg

Figure 7 — API between AGENT and hyperparameter optimizer:

class JobInfo(int itersRemaining,
              float avgTimePerIter,
              float localitySensitivity);

// Successive Halving
List<JobInfo> getJobsInPhase(int phase, List<Int> gpuAlloc);
int getNumPhases();

// Performance Curve
List<JobInfo> getJobsRemaining(List<Int> gpuAlloc);

Performance Curve Stopping:

4.3.3 End-to-End Example

Table 3 — Example of bids submitted by AGENT:

‖G⃗‖₁ 0 1 2 4 8 16
r r_old 4 2 1 0.5 0.34

5. Implementation


6. Evaluation

6.1 Experimental Setup

Component Value
Testbed 64 GPUs, 20 machines, Microsoft Azure NC-series
Testbed composition 8 × NC12 (2 Tesla K80 each) + 12 × NC24 (4 Tesla K80 each)
Simulator cluster Heterogeneous 256 GPU cluster (unless stated otherwise)
Simulator locality model 4-level hierarchical locality; GPUs fit onto slots on machines occupying different racks
Simulator machine mix (footnote) 16 × 8-GPU machines (4 slots, 2 GPUs/slot), 6 × 4-GPU machines (4 slots, 1 GPU/slot), 16 × 1-GPU machines
Simulator assumption Loss-function curve estimates known ahead of time, so total iterations per job are predictable
Fairness knob f 0.8
Lease 10 minutes

Table 4 — Models used in the trace:

Share Model Type Dataset
10% Inception-v3 CV ImageNet
AlexNet CV ImageNet
ResNet50 CV ImageNet
VGG16 CV ImageNet
VGG19 CV ImageNet
60% Bi-Att-Flow NLP SQuAD
LangModel NLP PTB
GNMT NLP WMT16
Transformer NLP WMT16
30% WaveNet Speech VCTK
DeepSpeech Speech CommonVoice

Baselines — each is the best possible baseline for one objective:

Baseline Represents Implemented behavior
Gandiva Ideal efficiency Packs jobs on as few machines as possible; introspectively profiles execution to infer placement preferences and migrates jobs. On resource availability, apps report placement preferences and resources go greedily highest-preference-first, maximizing average placement preference. Time-slicing and GPU packing are not modeled, since those system-level techniques could integrate with THEMIS too and would benefit both equally.
Tiresias Ideal fairness Service metric = aggregate GPU-time per job; allocates by Least Attained Service so all jobs get equal service over time. On availability, apps report their service metric and the resource goes to the least-served app.
Optimus Ideal aggregate throughput Throughput scaling metric = ratio of new to old job throughput with and without an extra GPU; allocation is highest-throughput-scaling-first.
SLAQ Ideal aggregate model quality Greedy scheme for aggregate model quality; apps report the decrease in loss with the available resources and allocation is greedy highest-loss-first.
SRTF Ideal avg app completion time (efficiency secondary) Apps report remaining time with the available resource; allocation is shortest-remaining-time-first. Efficiency is secondary since better GPU packing shortens remaining times.
SRSF Ideal avg app completion time (fairness secondary) Service-based metric approximating the Gittins index policy from Tiresias; assumes accurate knowledge of remaining service and allocates one GPU at a time by shortest-remaining-service-first. Fairness is secondary since shorter-service apps are preferred and longer apps can make up for short-term unfairness.

Metrics:

6.2 Macrobenchmarks

6.2.1 Sources of Improvement

Table 5 — Details of 2 jobs to understand the benefits of THEMIS [TESTBED]:

Job Type GPU Time # GPUs r_THEMIS r_Tiresias
Long Job ~580 mins 4 ~1 ~0.9
Short Job ~83 mins 2 ~1.2 ~1.9

6.2.2 Effect of Contention

6.2.3 Systems Overheads

Overhead Median 95th percentile
AGENT time to compute bids 29 ms 334 ms
ARBITER partial-allocation computation (Gurobi) 354 ms 1398 ms
AGENT container add/remove after new allocation ~35 s ~50 s
Same, as fraction of app duration 0.2% 2%
Checkpointing model parameters before relinquishing resources 5–10 s on average (model dependent, driven largely by HDFS checkpoint overhead)

6.3 Microbenchmarks

Placement preferences:

Error analysis:

Truth-telling:

6.4 Sensitivity Analysis



8. Conclusion


Appendix — Proofs


Cross-Cutting Empirical Take-Aways

Take-away Derived from
ML tasks are far longer than analytics tasks (median 3.75 GPU hours; median app 11.5 GPU days), so instantaneous fairness (DRF) is the wrong abstraction Sec. 2.2, Sec. 3.1.1
Placement sensitivity is model-dependent, not universal: VGG16 drops 103.6 → 80.4 images/sec across servers; Inception-v3 is flat at 242 → 243 Table 1
Fairness metrics ignoring placement (dominant resource share, attained service) provably violate SI, PE, and EF Theorem 3.1 + Appendix
A single-shot truthful auction cannot deliver sharing incentive, because hidden payments leave GPUs unallocated Theorem 3.2
Repeating the auction with filtering converts per-round efficiency-favoring decisions into long-term fairness Sec. 3.3.2, Theorem 3.3
Auctions need multi-app visibility with single-app allocation — neither Mesos-style pessimistic nor Omega-style optimistic control provides this Sec. 4.2.1–4.2.2
Fairness and efficiency trade off through f and lease: fairness improves up to f = 0.8 then worsens ~1.5X; efficiency falls monotonically with f; short leases help fairness but cost checkpoint overhead Sec. 6.4
The mechanism is robust to bid error: ±20% error changes max fairness by only 10.76% Sec. 6.3
Lying is punished, not rewarded: a lying app gains nothing and loses resources sharply beyond X > 34% Sec. 6.3
Benefits grow with the network-intensive fraction: ~1.24–1.77X on max fairness, ~8.1% on GPU time vs. Gandiva at 100% network-intensive Sec. 6.3

Limitations