Bridging underutilization with GPU partitioning
Because default Kubernetes scheduling locks one entire GPU per Pod (leaving many cards around 30% utilized; see Kubernetes GPU Orchestration and NVIDIA GPU Operator), GPU partitioning lets multiple Pods share one physical GPU concurrently (PDF p. 11 / printed slide 11). The lecture frames sharing along a four-layer continuum from microscopic to macroscopic:
- Layer 1 — Orchestrate: Kubernetes & NVIDIA GPU Operator.
- Layer 2 — Software Share: Time-slicing and CUDA Multi-Process Service (MPS).
- Layer 3 — Hardware Slice: Multi-Instance GPU (MIG) and vCS virtualization.
- Layer 4 — Network Compose: Liqid PCIe Fabrics & hardware composability.
Solution 1: Time-Slicing (temporal software sharing)
Time-slicing is the default temporal sharing behavior when multiple CUDA processes target one GPU simultaneously (PDF pp. 12–13 / printed slides 12–13):
- How it works: The GPU scheduler assigns each Pod a short time slice. When a slice expires, it saves the active CUDA context (hundreds of MB of state) and loads the next Pod’s context (PDF pp. 12, 24).
- Kubernetes setup: The Device Plugin advertises multiple virtual “replicas” per physical GPU, tricking the scheduler into oversubscribing the card. Oversubscription lets more Pods schedule, but adds zero extra compute power—tasks simply wait in the hardware queue.
- Limitations:
- No memory or fault isolation: Every Pod sees the full GPU memory, and if one process crashes the GPU context, every Pod sharing that device can be impacted.
- Stale tasks & latency: Equal time shares plus hundreds-of-MB context switches cause high latency for time-sensitive workloads.
Solution 2: MPS — Multi-Process Service (logical software sharing)
Multi-Process Service (MPS) is a client–server implementation of the CUDA API designed to let cooperative processes pack GPU compute cores far more tightly than time-slicing (PDF pp. 14–18 / printed slides 14–18):
- Client–server architecture (PDF pp. 14–15): Normally, only one CUDA context is active at a time, leaving idle Hyper-Q execution gaps when a single app cannot saturate the GPU. MPS runs one MPS Server managing a single CUDA context, and multiple MPS Clients funnel their kernels through it into a unified stream. This lets Hyper-Q hardware execute kernels from different processes simultaneously with software-level QoS.
- Memory limits vs. shared bandwidth (PDF pp. 16–17, 24):
- MPS enforces hard per-client memory capacity limits (exceeding an assigned fraction triggers an
Out of Memoryerror, improving stability and preventing casual cross-client memory access). - Critical limitation — the “Busy Neighbour” problem: While compute threads and memory capacity are partitioned, memory bandwidth and the L2 cache remain shared. Slide 17’s benchmark shows a client with a 12.5% slice dropping from
1.800alone down to755when running next to a busy neighbour, and slide 24 notes performance drops of 30% or more—sometimes making co-execution slower than running memory-heavy tasks sequentially.
- MPS enforces hard per-client memory capacity limits (exceeding an assigned fraction triggers an
- Where MPS shines (PDF p. 25): In compute-intensive workloads without memory pressure, MPS often outperforms MIG because resource sharing is fluid rather than rigidly walled off.
- Kubernetes integration (PDF p. 18): The NVIDIA GPU Operator configures MPS by defining GPU replicas, each receiving a fixed fraction of compute and memory managed by the MPS daemon.
Solution 3: MIG — Multi-Instance GPU (physical hardware isolation)
Multi-Instance GPU (MIG), available on NVIDIA Ampere and newer top-tier datacenter GPUs (such as A30, A100, and H100), physically splits one GPU into standalone mini-GPUs (PDF pp. 19–23 / printed slides 19–23):
- Hardware isolation (PDF pp. 19–21): Partitioning happens at the Graphics Processing Cluster (GPC) level. Each MIG instance receives dedicated Streaming Multiprocessors (SMs), L2 cache, memory controllers, and DRAM bandwidth, eliminating cross-tenant interference and delivering deterministic throughput and latency for multi-tenant environments with strict SLAs.
- Standardized profiles: Profiles use
<compute>g.<memory>gbnaming (visible innvidia-smi), such as3g.20gb(3 compute slices, 20 GB memory). For example, an A30 supports up to 4 memory slices, while an A100 has 7 slices (up to 7 distinct instances, each with 1/8th memory = 5 GB and 1/7th SMs, across 19 valid combinations). - Kubernetes strategies (PDF p. 22):
- Single MIG: Every GPU on a node exposes one uniform MIG profile; Kubernetes schedules uniform
nvidia.com/gpuresources. - Mixed MIG: A node hosts varied MIG sizes simultaneously; Pods must request exact profiles such as
nvidia.com/mig-3g.20gb.
- Single MIG: Every GPU on a node exposes one uniform MIG profile; Kubernetes schedules uniform
- Runtime re-partitioning (PDF p. 23): Instances can be created and destroyed dynamically without disturbing other running instances (e.g., shifting from many small inference instances to one large training instance). The MIG Manager Kubernetes controller watches node labels and coordinates stopping pods, reconfiguring GPU geometry, and restarting services.
- Limitations & hardware eligibility (PDF pp. 24, 27): MIG’s hard resource boundary prevents bursting if a job needs slightly more memory. Furthermore, MIG is reserved for expensive top-tier datacenter GPUs; cost-effective inference/dev cards (L4, L40S, T4, A10) do not support MIG and instead use MPS or Time-Slicing (supporting up to 10 temporal instances via vGPU).
Comparing all three mechanisms + energy tradeoffs
| Feature | MIG | MPS | Time-Slicing |
|---|---|---|---|
| Isolation (PDF p. 26) | Physical (Hardware) | Logical (Software) | Temporal (Software) |
| Memory (PDF p. 26) | Dedicated resources (SMs, L2, DRAM BW) | Capacity limits (shared L2 & BW) | None (Shared) |
| Primary overhead / bottleneck | Rigid hard limit (no bursting) | Busy Neighbour (30%+ drop on shared L2/BW) | Context switching (hundreds of MB) & crash blast radius |
| Best for (PDF p. 26) | Multi-tenant / strict SLA | Cooperative tasks (compute-heavy) | Development / idle workloads |
Energy note (PDF p. 25): Spatial sharing increases instantaneous power draw because more of the chip is active at once, but often reduces total energy consumption by finishing jobs faster—though MIG’s hardware isolation carries an inherent energy cost that must be offset by performance gains (compare Data Center Power Estimation and Component Breakdown).
Common confusions
- MPS capacity limits ≠ bandwidth/cache isolation: MPS prevents one client from allocating beyond its VRAM cap, yet all clients still contend over the shared L2 cache and DRAM bandwidth.
- MPS strength vs. weakness: MPS struggles with memory-heavy neighbors, not compute-heavy cooperative kernels—for compute-bound tasks without memory pressure, MPS can beat MIG.
- Budget GPUs and MIG: Cards like L4, L40S, T4, and A10 cannot run MIG; use MPS or Time-Slicing there.
Retrieval
- Two untrusted customers run memory-intensive AI services on one NVIDIA A100 under strict latency SLAs. Why do both Time-Slicing and MPS fail this requirement, and how does MIG solve it?
Time-Slicing offers zero memory or fault isolation (one crash can break both Pods) plus context-switching delays. MPS adds VRAM capacity caps, but L2 cache and memory bandwidth remain shared, causing 30%+ “Busy Neighbour” slowdowns under memory pressure. MIG isolates SMs, L2 cache, memory controllers, and DRAM bandwidth in hardware, giving deterministic SLA latency. - Compare a Single MIG node configuration with a Mixed MIG configuration from the Pod developer’s perspective.
Under Single MIG, all GPUs on the node expose identical slices, so Pods simply request uniformnvidia.com/gpu. Under Mixed MIG, the node hosts heterogeneous slices, so Pods must explicitly name the profile (for example,nvidia.com/mig-3g.20gb). - When can MPS actually beat MIG in throughput, and what sharing options exist on an NVIDIA L4 or T4 node?
On compute-intensive cooperative tasks without heavy memory pressure, MPS can outperform MIG because sharing is fluid rather than rigidly capped. Because L4, L40S, T4, and A10 GPUs do not support MIG, clusters use MPS or Time-Slicing (up to 10 temporal vGPU instances).
Source: Lecture 17 - AI in Kubernetes, PDF pages 11–27 (printed slides 11–27).