0%·12 min left
GPU

How to Measure and Improve GPU Utilization in Kubernetes

June 1, 202512 min read
How to Measure and Improve GPU Utilization in Kubernetes

GPU utilization looks simple until you try to measure it. A dashboard shows 100 percent, the inference server still misses its throughput target, and half the GPU memory is unused. Another workload shows low utilization even though it finishes jobs as fast as the input pipeline can feed them.

The problem is the metric. "GPU utilization" is not one number. You need several signals to tell whether a GPU is doing useful work, waiting on memory, starved by the CPU or storage layer, or holding an idle model in memory.

This guide shows how to collect those signals with NVIDIA Data Center GPU Manager (DCGM), read them in context, and choose an optimization that fits the workload. The goal is more useful work per GPU without hurting latency, throughput, reliability, or model quality, rather than a higher percentage on a chart.

Why Kubernetes GPU capacity goes unused#

Conventional scheduling assigns devices, not fractions#

With the conventional NVIDIA device plugin, Kubernetes exposes GPUs as extended resources such as nvidia.com/gpu. A pod requests one or more advertised devices. Kubernetes does not infer that a container needs 20 percent of the compute capacity or 8 GiB of framebuffer memory.

That default provides predictable access, but it can strand capacity. Sharing requires an explicit mechanism such as Multi-Instance GPU (MIG), time-slicing, CUDA Multi-Process Service (MPS), vGPU, or a compatible Dynamic Resource Allocation driver. The Kubernetes GPU scheduling documentation describes the conventional extended-resource model.

The GPU waits for the rest of the pipeline#

Training alternates between GPU work and host-side work such as data loading, preprocessing, checkpoint writes, and synchronization. Inference has similar gaps when traffic is sparse, batches are too small, or CPU tokenization cannot keep up.

A low activity metric does not automatically mean that the GPU is oversized. The bottleneck may sit in storage, networking, CPU preprocessing, collective communication, or the application itself.

Demand changes over time#

Interactive notebooks, development environments, batch jobs, and inference endpoints rarely have flat demand. Teams often keep spare capacity because provisioning a GPU node can take longer than a traffic spike or because an interrupted training run is expensive.

Fixing that waste is as much an operational problem as a technical one. Teams need checkpointing, safe scaling policies, and enough telemetry to tell idle capacity apart from intentional headroom.

GPU utilization is a set of signals#

NVIDIA DCGM exposes both coarse device counters and profiling counters. The profiling fields are interval averages. They help locate an underused or imbalanced GPU, but they do not identify a particular kernel or source line. Use Nsight Systems or Nsight Compute when the investigation needs application-level attribution.

The following metrics answer different questions:

MetricWhat it tells youImportant limitation
DCGM_FI_DEV_GPU_UTILPercentage of the sample period during which one or more kernels ranA small continuous kernel can push it to 100 percent. Treat it as a coarse activity signal, not proof of efficient compute.
DCGM_FI_PROF_GR_ENGINE_ACTIVEFraction of time the graphics or compute engine was activeMore precise than the coarse utilization counter, but still does not measure application throughput.
DCGM_FI_PROF_SM_ACTIVEFraction of time at least one warp was active on an SM, averaged across SMsA warp waiting on memory still counts as active. High values do not prove that arithmetic units are busy.
DCGM_FI_PROF_SM_OCCUPANCYResident warps relative to the maximum supported by an SMHigher occupancy is not always better. Its meaning depends on registers, shared memory, block size, and the bottleneck.
DCGM_FI_PROF_DRAM_ACTIVEFraction of cycles with device-memory trafficHigh activity suggests pressure on device memory, but one metric alone cannot prove that a workload is memory-bound.
DCGM_FI_DEV_MEM_COPY_UTILPercentage of the sample period during which device memory was read or writtenThis is an activity measure, not a direct percentage of peak memory bandwidth.
DCGM_FI_PROF_PIPE_TENSOR_ACTIVEFraction of cycles in which the tensor pipe was activeUseful only for workloads expected to use Tensor Cores. A low value may be correct for other kernels.
DCGM_FI_DEV_FB_USED and DCGM_FI_DEV_FB_FREEFramebuffer memory in use and availableAllocated memory can remain high while compute is idle. Memory residency is not utilization.
DCGM_FI_DEV_POWER_USAGEBoard power drawUseful supporting context, but power alone does not measure useful work or efficiency.

These definitions follow NVIDIA's DCGM profiling documentation and exporter metric configuration.

Deploy DCGM Exporter in Kubernetes#

If the NVIDIA GPU Operator already manages the cluster's GPU software, use its DCGM Exporter deployment and configure metrics through the Operator. Do not install a second exporter or edit an Operator-owned DaemonSet.

For a standalone deployment, NVIDIA maintains a Helm chart:

helm repo add gpu-helm-charts https://nvidia.github.io/dcgm-exporter/helm-charts
helm repo update
 
helm install dcgm-exporter gpu-helm-charts/dcgm-exporter \
  --namespace gpu-monitoring \
  --create-namespace

The default installation creates a ServiceMonitor for the Prometheus Operator. If the cluster does not have that custom resource definition, install with:

helm install dcgm-exporter gpu-helm-charts/dcgm-exporter \
  --namespace gpu-monitoring \
  --create-namespace \
  --set serviceMonitor.enabled=false

Verify the rollout and metrics endpoint:

kubectl rollout status daemonset/dcgm-exporter \
  --namespace gpu-monitoring
 
kubectl port-forward \
  --namespace gpu-monitoring \
  service/dcgm-exporter 9400:9400
 
curl --fail http://localhost:9400/metrics

Use the official installation guide for version compatibility, permissions, TLS, workload labels, and upgrade steps. NVIDIA pairs each exporter release with a tested DCGM version, so avoid copying an old image tag into a long-lived manifest.

Add SM activity and occupancy when needed#

The default collector includes several profiling fields, including graphics-engine, tensor-pipe, and DRAM activity. DCGM_FI_PROF_SM_ACTIVE and DCGM_FI_PROF_SM_OCCUPANCY are not enabled in the current default counter file.

Add them to a custom collector when the GPUs support those fields:

DCGM_FI_PROF_SM_ACTIVE, gauge, Fraction of time at least one warp is active on an SM.
DCGM_FI_PROF_SM_OCCUPANCY, gauge, Resident warps relative to the maximum supported by an SM.

With the Helm chart, custom metrics replace the shipped collector rather than extending it. Start with the current default counter file, add the fields you need, and keep the rest of the required rows. Profiling fields also require suitable GPU support and privileges.

Use time windows, not snapshots#

The right query window depends on the workload. A five-minute average may work for a steady inference service but hide short training phases. Compare averages with peaks and align them with job steps, request volume, batch size, and application throughput.

These PromQL examples assume DCGM Exporter is adding Kubernetes workload labels:

# Coarse activity by workload over five minutes
avg by (namespace, pod) (
  avg_over_time(DCGM_FI_DEV_GPU_UTIL[5m])
)
# SM activity by workload over five minutes
avg by (namespace, pod) (
  avg_over_time(DCGM_FI_PROF_SM_ACTIVE[5m])
)
# Peak framebuffer use over fifteen minutes
max by (namespace, pod, gpu) (
  max_over_time(DCGM_FI_DEV_FB_USED[15m])
)

Do not average every GPU in a cluster into one number. Per-GPU views reveal skew, failed replicas, and distributed jobs where one worker holds back the rest.

Read the metric combinations#

No single pattern proves a root cause, but combinations can tell you where to investigate next.

What you seeLikely explanationsWhat to check next
High GPU_UTIL, low SM_ACTIVE, low tensor activityA stream of small kernels, launch overhead, serialized inference, or frequent stallsBatch size, kernel trace, tokens or requests per second, and CPU preprocessing
Low SM_ACTIVE, low DRAM_ACTIVE, visible idle gapsData loading, storage latency, CPU bottlenecks, sparse traffic, or synchronizationData-loader workers, host CPU, queue depth, storage latency, and request arrival rate
High SM_ACTIVE and high DRAM_ACTIVEA workload with substantial compute and memory trafficApplication throughput and a developer profiler before calling it memory-bound
High framebuffer use, low engine activityA resident model or cached tensors with little current workQueue depth, scale-to-zero policy, warm-pool requirements, and model-loading time
Uneven activity across GPUs in one jobLoad imbalance, data skew, communication delay, or a slow workerPer-rank step time, collective communication, network health, and data partitioning
Power remains high while throughput is flatInefficient batching, clocks or thermals, or work that does not improve outputPower limits, clocks, temperature, batch size, and throughput per watt

Always pair infrastructure metrics with an application outcome. Examples include training steps per second, tokens per second, requests per second, job completion time, tail latency, and cost per successful output.

Choose the right optimization#

Feed the GPU more consistently#

When the GPU waits on the input pipeline, changing the GPU type will not fix the bottleneck. Profile data loading and preprocessing first. Common fixes include parallel data-loader workers, pinned host memory, prefetching, larger or dynamic batches, cached preprocessing, and faster local or network storage.

Apply one change at a time and compare end-to-end throughput. A higher utilization graph is not a win if job completion time or serving latency stays the same.

Select the GPU or MIG profile by workload#

Do not right-size on framebuffer memory alone. A workload that fits in a smaller device may still need the original GPU's compute throughput, precision support, memory bandwidth, or interconnect.

Evaluate:

  • Peak allocated memory with safety headroom
  • Throughput and tail-latency targets
  • Required numeric formats and software support
  • Memory bandwidth and host-to-device transfer behavior
  • NVLink or other multi-GPU communication needs
  • Availability, interruption risk, and total cost per completed unit of work

MIG can partition supported NVIDIA GPUs into hardware-isolated instances with dedicated memory resources. Supported profiles and the maximum number of instances vary by model. Current support includes selected A30, A100, H100, H200, B200, GB200, and RTX PRO Blackwell products. Consult the NVIDIA MIG User Guide rather than copying an A100 profile list into a hardware-neutral policy.

MIG geometry is an operational decision. NVIDIA's MIG Manager requires the target GPUs to be free of user workloads, terminates GPU pods during reconfiguration, and may require a node reboot in some cloud environments. Plan migration, draining, and rollback before changing a production node. See the GPU Operator MIG guide.

Pick a sharing mechanism deliberately#

MechanismIsolationGood fitMain caveat
MIGHardware memory and fault isolation between instancesMulti-tenant inference, notebooks, and predictable partitions on supported GPUsFixed profiles, model-specific support, and disruptive geometry changes
Time-slicingNo memory or fault isolationBursty, trusted workloads that do not need exclusive accessA replica is shared access, not a guaranteed fraction of compute. Container-level DCGM attribution is limited with the device-plugin approach.
MPSShared address space resources with improved CUDA concurrencyCooperative CUDA processes with compatible security and fault assumptionsWeaker isolation than MIG and additional operational constraints
vGPUVM-oriented virtualization with vendor-supported controlsVirtual-machine environments that require managed GPU virtualizationLicensing and platform compatibility requirements

NVIDIA documents the lack of memory and fault isolation for time-sliced replicas in its GPU sharing guide.

Autoscale from demand, then add schedules where useful#

Use queue depth, request rate, concurrency, latency, or another workload signal to drive replica and node scaling. A schedule can pre-warm capacity before a predictable demand window, but it should not be the only signal unless the workload is genuinely fixed.

GPU nodes often take longer to provision than CPU nodes. Test cold-start time, image pulls, model loading, and minimum capacity before relying on scale-to-zero in a latency-sensitive service.

Use interruptible capacity only with recovery in place#

Spot and preemptible GPUs can reduce cost, but the discount and interruption rate vary by provider, region, and instance type. Treat current price and capacity as inputs to the decision rather than assumptions.

Training workloads need application-level checkpoints that include the model, optimizer, scheduler, random state, and data progress required for a correct resume. Measure checkpoint duration and storage cost. Then run interruption drills to verify that the job resumes successfully and that the checkpoint interval makes economic sense.

A practical rollout sequence#

1. Establish visibility#

Deploy DCGM Exporter on every GPU node, confirm Prometheus targets, and preserve the labels needed for GPU, node, namespace, pod, and container analysis. Record application throughput beside the GPU metrics.

2. Build a representative baseline#

Measure training phases, traffic peaks, quiet periods, deployments, and model loads. Separate allocated time from active time. Flag GPUs that are allocated for long periods with little engine activity, but review intentional warm capacity before taking action.

3. Fix the least disruptive bottlenecks#

Start with abandoned workloads, completed jobs that left resources behind, input-pipeline stalls, bad batch sizes, and scheduling policies that keep development nodes running when nobody needs them.

4. Introduce sharing and new GPU profiles#

Test MIG, time-slicing, MPS, or different GPU types with production-like traffic. Validate latency, throughput, memory headroom, fault behavior, and observability. Roll out by node pool rather than changing the entire fleet at once.

5. Automate with guardrails#

Add workload opt-ins, maintenance windows, minimum capacity, disruption budgets, and rollback criteria. Keep active training and inference jobs protected unless the platform can migrate or recover them safely.

6. Track efficiency as an outcome#

Monitor cost per job, tokens or requests per GPU-second, queue time, completion time, and service-level objectives. Those measures tell you whether the cluster became more efficient. A utilization percentage by itself does not.

Where DevZero fits#

Manual analysis works for a small fleet, but allocation, demand, and workload behavior change continuously. DevZero analyzes GPU allocation and usage across Kubernetes clusters and identifies idle capacity. It applies policy-driven controls and works with existing autoscalers while protecting active training and inference jobs.

Use a free GPU assessment to find the gap between requested, allocated, and active GPU capacity in your clusters.

Sources#

Share: