research27 min studyLesson 953 in Engineering

Check what a power sensor observes and how often it changes

Identify stale averages, missed bursts, cumulative-counter resets, and incomplete device coverage.

On this page

What you’ll understand

  • Interpret version-scoped NVML power and cumulative-energy contracts.
  • Calculate integration error for an explicit missed-burst fixture.
  • Separate polling frequency from sensor bandwidth and measurement accuracy.

Reading a telemetry API rapidly does not guarantee that it observes rapid power changes. The sensor may update slowly, return a moving average, or cover only part of the machine. A completed API call can therefore repeat old information while a short kernel starts and finishes between observations. Treat the measurement interface as an instrument with a documented contract. Record its scope, update behavior, units, and failure modes before selecting a sampling interval or claiming that a trace resolves individual operations.

Pin the device-query contract

NVIDIA’s NVML R535 reference documents device power in milliwatts and distinguishes architecture-dependent behavior. It describes a one-second average on Ampere other than GA100 and on newer GPUs, while GA100 and older GPUs use the documented instantaneous path. These statements are scoped to that interface version and supported hardware, not a promise about every telemetry tool. The reading covers the GPU and associated circuitry such as memory; it is not whole-node or automatic per-process energy.

The same reference provides a cumulative energy query in millijoules since the last driver reload, with full support on Volta and newer supported devices. Check the API result and device identity instead of treating unsupported output as zero. Counter differences require a continuous counter epoch: a reload, reset, wrap, or device change can invalidate subtraction. A cumulative reading may help integrate activity, but its resolution, accuracy, and coverage still require characterization for the actual device and driver.

EJ=Q1−Q01000E_{\rm J}=\frac{Q_1-Q_0}{1000}
Q0 and Q1 are millijoule counter values from the same supported device and uninterrupted counter epoch, with Q1≥Q0. The difference covers the counter’s electrical scope and the actual read interval. Division by 1000 converts mJ to J; it does not correct sensor error.↔ Scroll wide equations horizontally.

Sampling can miss the structure between points

A sampled trace replaces an unknown continuous curve with observations and an interpolation rule. The trapezoidal rule assumes a straight segment between adjacent observations for the estimate. It is exact for a genuinely piecewise-linear curve at those breakpoints, but no such guarantee follows from printing timestamps. A narrow burst can fit between every pair of observations. Repeating the same phases may miss the same burst on every run, producing a systematic error rather than independent noise.

Lang and Rünger’s original profiling research illustrates why short GPU functions and low-resolution measurement require explicit reconstruction assumptions. Its historical hardware timing is not a current universal NVML specification. For a new experiment, characterize update cadence and phase sensitivity on the actual setup. Oversampling a one-second average creates correlated repeated averages; it does not recover the lost subsecond waveform. Preserve raw observations and describe any smoothing or interpolation rather than presenting a smooth chart as additional information.

E^=∑i=0n−1Pi+Pi+12(ti+1−ti)\widehat E=\sum_{i=0}^{n-1}\frac{P_i+P_{i+1}}{2}(t_{i+1}-t_i)
n≥1, ordered timestamps are seconds with strictly positive adjacent differences, and Pi are watts at the stated measurement scope. The result is joules. It is a trapezoidal estimate, exact for the assumed piecewise-linear interpolation, not a general bound on the unknown true trace.↔ Scroll wide equations horizontally.

Align execution and instrument windows

Synchronize the measurement boundary with actual completion of asynchronous device work. A host launch timestamp and a host return timestamp may bracket only submission overhead. A device event can measure a particular stream interval but does not by itself include CPU preparation or other concurrent work. The synchronization used for measurement may also perturb overlap and execution time, so record it. Warmup and tail activity need a declared treatment, especially when the sensor averages across adjacent windows.

Compare a sufficiently long, repeated workload against a separately instrumented reference when practical, and report how repetition changes cache or thermal conditions. Distinguish calibration uncertainty from integration error and background interference. Do not reuse the R535 accuracy statement for specific older GPU families as a blanket error bound for all modern devices. A well-designed report can say what its instrument cannot resolve, while still providing a valid longer-window energy comparison within the documented boundary.

An unsampled burst survives in the true integral

A fictional instantaneous power trace is 50 W throughout 0–4 seconds except for 250 W on [0.1,0.2) seconds. Samples at integer seconds all read 50 W. An ideal fictional cumulative counter reads 5,000,000 mJ at the start and 5,220,000 mJ at the end.

  1. The 50 W baseline contributes 50×4=200 J. The burst adds (250−50)×0.1=20 J above that baseline, so true energy is 220 J. The burst interval is counted once.

  2. Integer-second samples produce a trapezoidal estimate of 50×4=200 J. The estimate is 20 J low, or 20/220≈9.09% of true energy, even though every sampled value is correct.

  3. The stipulated ideal counter difference is 220,000 mJ, hence 220 J. This fixture demonstrates integration versus point sampling; it does not assert that a real counter is ideal or has this accuracy.

The result

Correct point readings can still give an incorrect integral when unsampled behavior is unconstrained. Instrument bandwidth and integration assumptions matter.

Explore the model

Interactive lab

Interactive lab · function

Compare endpoint rectangles with exact area

Reset, set Coefficient a to 1 and Position x to 1; predict exact area 1/3, versus a manually computed right-endpoint rectangle of 1, before Step. Reset, set a to 1 and x to 2; predict area 8/3 versus rectangle 8 before Step. This exact quadratic supports a coarse-integration comparison; it neither samples power nor estimates general numerical error.

Compare endpoint rectangles with exact areaThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forAn interpolation or quadrature rule needs assumptions about what lies between observations.

Check your understanding

An API returns a one-second averaged power reading, and a program polls it every millisecond. What follows?

Try it yourself

A fictional instantaneous trace has samples (0 s,100 W), (1 s,200 W), and (2 s,100 W). Compute the trapezoidal energy estimate. When is it the exact integral?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Each one-second segment contributes the average of its endpoint powers.

Compare with the solution

The two segments contribute (100+200)/2×1=150 J each, totaling 300 J. This is exact if the true trace is linear between those sample times. Without that shape assumption, unobserved bursts or dips can change the true integral; the samples alone provide no universal error bound.

Take it with you

  • Pin API version, architecture behavior, units, and electrical coverage.
  • A faster polling loop cannot recover information removed by averaging.
  • Counter subtraction requires the same device and a continuous counter epoch.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.