Skip to content

nvidia_power trace collector has no way to sample GPU memory consumption during a run #7245

Open

Description

@shreyaskommuri

Describe the Improvement

perfkitbenchmarker/traces/nvidia_power.py already runs a background nvidia-smi
collector for the whole RUN stage of any benchmark (hooked via events.before_phase/
after_phase on stages.RUN, so it's benchmark-agnostic), and already supports sampling
power draw, p-state, utilization percentage, temperature, and clock speeds at a configurable
interval (--nvidia_power_selections).

It has no way to sample actual GPU memory consumption (memory.used/memory.total) during a
run. QUERY_TABLE/QUERY_GROUPS (lines 55-138) have an utilization.memory entry, but that's
percent-of-memory-bus-busy, not MiB consumed. The only other GPU-memory-related function in the
codebase, nvidia_driver.GetGpuMem(), only queries memory.total once at install time (static
capacity), never memory.used during the run.

This gap matters most for memory-sensitive workloads (LLM inference with growing KV cache,
large batch training, etc.), where watching live memory consumption over the course of a run
is one of the more basic things you'd want from a GPU benchmark, and the collection mechanism
to do it is already built and already wired into every benchmark's lifecycle — it's just
missing two entries in a declarative table.

Evidence

  • perfkitbenchmarker/traces/nvidia_power.py: QUERY_TABLE (lines 55-128) and QUERY_GROUPS
    (lines 130-138) are fully declarative; _NvidiaPowerResults, _CollectorRunCommand, and
    Analyze are all driven generically off these tables, with no per-metric special-casing.
  • perfkitbenchmarker/linux_packages/nvidia_driver.py:GetGpuMem() confirms memory.total is
    already a known-good nvidia-smi --query-gpu= field elsewhere in this codebase; memory.used
    is its standard sibling field.
  • Searched the issue tracker for "nvidia_power memory", "gpu memory telemetry", "peak gpu
    memory" — no existing issue or PR addresses this.

Proposed Change

Add memory.used and memory.total as two new QUERY_TABLE entries and a new 'memory'
QUERY_GROUPS selection, following the exact same shape as the existing power/utilization/
temperature/clocks entries. No changes needed to parsing, collection, or analysis code,
since those are already fully table-driven — confirmed by reading _NvidiaPowerResults,
_CollectorRunCommand, and Analyze end to end.

Purely additive: --nvidia_power_selections still defaults to 'power', unaffected; 'all'
would also pick up the new 'memory' group automatically.

I already have this implemented and tested locally (a synthetic-CSV-fixture unit test
mirroring the existing testParseNvidiaPowerResult, since I don't have real GPU hardware to
validate against) and am happy to open a PR for it.

AI was used for context and guidance while investigating and drafting this improvement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions