[1/4] [Power] feat: validate single-node GPU energy metrics / 校验单节点 GPU 能耗指标 - #2323
[1/4] [Power] feat: validate single-node GPU energy metrics / 校验单节点 GPU 能耗指标#2323edwingao28 wants to merge 9 commits into
Conversation
Integrate per-device telemetry over the formal benchmark window, enforce expected GPU topology, emit auditable validity artifacts, and add best-effort and strict power modes with CPU coverage. 中文:校验单节点 GPU 能耗指标。基于正式基准测试窗口对逐卡遥测数据进行积分,校验预期 GPU 拓扑,输出可审计的有效性产物,并为默认尽力模式和严格功耗模式补充 CPU 测试覆盖。
Treat unparseable timestamps and in-window power values as validation failures so best-effort runs emit power_valid=0 and strict runs fail without publishing Joule metrics. Add regression coverage for both cases. 中文:拒绝格式异常的 GPU 遥测样本。将无法解析的时间戳和窗口内功耗值视为校验失败,使尽力模式输出 power_valid=0,严格模式失败,并避免发布 Joule 指标;同时补充两个回归测试。
Remove an incomplete trailing nvidia-smi CSV row before appending the deterministic post-benchmark sample, preventing row concatenation from silently corrupting energy integration. Add a shell-lifecycle regression test covering the interrupted-write case. 中文:在追加确定性的基准测试后采样前,删除未写完整的 nvidia-smi CSV 末行,避免行拼接静默污染能耗积分;新增覆盖中断写入场景的 shell 生命周期回归测试。
|
Thanks for the contribution! Please reach out to respective companies' CODEOWNER to fill in the latest PR_REVIEW_CHECKLIST.md before pinging core maintainer on Slack for review. In order for the signoff PR check bot to trigger, you must follow the PR_REVIEW_CHECKLIST.md template correctly, including the phrase For PR verification, add the PR authors are responsible for ensuring that after merging, all GitHub Action jobs fully pass. A lot of the time, failures are just flakes and simply re-running the failed jobs will fix it. See GitHub's docs on re-running failed jobs 感谢你的贡献!请联系相应公司的 CODEOWNER 填写最新的 PR_REVIEW_CHECKLIST.md,然后再在 Slack 上联系核心维护者进行审阅。为了触发 signoff PR 检查机器人,你必须正确遵循 PR_REVIEW_CHECKLIST.md 模板,包括保留英文语句 如需进行 PR 验证,请为此 PR 添加 PR 作者有责任确保合并后所有 GitHub Action 任务完全通过。 很多时候失败只是偶发抖动(flake),重新运行失败的任务即可解决。参见 GitHub 关于重新运行失败任务的文档 |
|
Claude finished @edwingao28's task in 10m 22s —— View job Review of PR #2323
SummaryNo blocking issues found. One 🟡 inline comment: Things I verified in depth:
One behavioral note (by design, but worth stating): runs that previously published best-effort The pending H100/H200 strict canary is the right gate before relying on |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2f27fe453
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Beyond the two nits already flagged inline, I checked three other candidate issues and ruled them out. Multinode REQUIRE_POWER failing without writing a validation sidecar is expected, since multi-node telemetry is explicitly out of scope for this PR. REQUIRE_POWER causing the canonical 'Upload result' step to be skipped (it lacks always()) looks intentional — the separate power-audit-bundle step already carries always() and preserves the raw artifacts, while the canonical result is meant to stay unpublished once REQUIRE_POWER flags the run invalid. And a malformed timestamp row invalidating power_valid even when it's far from the benchmark window is unavoidable by construction: an unparseable timestamp can't be classified as far-from-window before it's parsed.
Extended reasoning...
This run re-examined three finder-raised candidates beyond the two nits already posted as inline comments (missing docstrings on new helpers, dead _load_bench_window). For the multinode/REQUIRE_POWER case, process_result.py's multinode branch never calls the aggregator at all, so no sidecar is written when it fails closed — read against the PR description, which explicitly scopes multi-node telemetry out of this PR, that's a deliberate gap rather than a bug. For the 'Upload result' step, benchmark-tmpl.yml shows the canonical bmk artifact upload has no always() guard while the new power-audit-bundle upload does, so a REQUIRE_POWER failure preserves the audit trail but withholds the canonical result — consistent with the PR's stated intent that REQUIRE_POWER runs 'fail after artifacts are written.' For the malformed-timestamp case, integrate_power in utils/aggregate_power.py parses the timestamp before it can apply the far-from-window exemption, so a row with an unparseable timestamp cannot be assessed against the window at all and is conservatively treated as invalid — a reasonable design tradeoff rather than a defect.
|
Hardware canary validation is complete on commit
These are implementation canaries, not a formal H100-vs-H200 performance comparison: the canonical c4 recipes use TP8/EP1 on H100 and TP8/EP8 on H200. 硬件 canary 已在提交
这两次运行用于验证实现,不是正式的 H100 与 H200 性能对比:canonical c4 recipe 在 H100 上使用 TP8/EP1,在 H200 上使用 TP8/EP8。 |
中文:同步最新 main 分支。
Align the telemetry output path with the uploaded artifact, remove the dead benchmark-window loader, document the new helpers, and add a regression test for the workflow contract. 中文:统一遥测输出路径与上传制品路径,删除未使用的基准窗口加载器,为新增辅助函数补充文档字符串,并增加工作流契约回归测试。
|
@claude review |
|
Claude finished @edwingao28's task in 5m 0s —— View job Review of PR #2323 (at
|
There was a problem hiding this comment.
No new issues found. Commit 02fff9e addresses all three items from my prior review round: the audit-bundle path mismatch (GPU_METRICS_CSV default now matches the uploaded relative path), the dead _load_bench_window helper (removed), and the missing docstrings on the six new helpers (added). This remains a substantial feature spanning power-integration math, bash telemetry handling, and CI workflow wiring, so a final human pass is still worthwhile before merge.
What was reviewed this round:
- Confirmed the
GPU_METRICS_CSVdefault fix aligns with the power-audit bundle's relative path and the new workflow-contract regression test covers it. - Confirmed
_load_bench_windowis gone and the six previously-undocumented helpers now have docstrings. - Checked malformed-timestamp handling far outside the benchmark window — only rows within
[start - max_gap, end + max_gap]affect validity, so a bad row elsewhere in the CSV doesn't invalidate the result. - Checked
REQUIRE_POWER=1on multinode —agg_<run>.jsonis already written unconditionally before that check runs, so the failure isn't silently artifact-less; the single-node validation sidecar is simply out of scope there by design.
Extended reasoning...
This PR adds single-node GPU power validation (trapezoidal energy integration, GPU-count/window/gap checks) across utils/aggregate_power.py, utils/process_result.py, benchmarks/benchmark_lib.sh, and three GitHub Actions workflow files, with accompanying pytest coverage and two passing hardware canaries (H100/H200).
No security-sensitive surface is introduced — all inputs are CSV/JSON telemetry files and CI-controlled environment variables, with no auth, crypto, or permission logic touched.
The correct scrutiny level here is moderate-to-high: this is not a mechanical change. It has non-trivial integration math (per-device trapezoidal integration with boundary interpolation), touches CI workflow files (artifact upload paths, new require-power input plumbing across three workflow files), and modifies bash process lifecycle handling (stop_gpu_monitor's truncated-row repair). All three findings from my prior review round were addressed in commit 02fff9e, and this run's bug-hunting pass found nothing new, but the combination of size, cross-language surface (Python/bash/YAML), and CI-affecting changes still merits a human reviewer's final sign-off before merge.
中文:同步最新 main 分支。
Supersedes #2322. This PR was reopened from an upstream branch so repository CI, automated review, and hardware canary workflows can run with the required permissions.
Summary
avg_power_wmeaning and add whole-deploymentavg_total_gpu_power_w,total_gpu_energy_j, J/successful query, and J/input, output, and total token.power_valid=0plus an auditable validation sidecar when telemetry is invalid;REQUIRE_POWER=1makes study/canary jobs fail after artifacts are written.gpu_metrics.csv, aggregate JSON, and validation JSON as an independent power audit bundle.This builds on the measured-power path introduced in #1558. It keeps the single-node aggregation scope separate from the multi-node and role-level work discussed in the closed #1635.
Scope
This PR covers single-node, non-disaggregated fixed-sequence serving, with H100/H200 8k/1k as the initial validation target.
Not included: GB200/GB300 multi-node or disaggregated telemetry, prefill/decode role attribution, srt-slurm changes, MI355X hardware validation, 4P1D/8P1D rack-scale experiments, repeated publication runs, plots, or article work.
Behavior change for AMD: the old best-effort path could publish
avg_power_wfrom amd-smi telemetry. The new validation is strict, and the monitor lifecycle fixes cover NVIDIA only, so AMD runs will typically reportpower_valid=0with no power fields until AMD validation lands in a follow-up.Validation
python -m pytest utils/test_aggregate_power.py utils/test_process_result.py -q— 81 passedpower_valid=true, 8/8 GPUs observed, max sample gap 1.001 s, 0 malformed CSV rows.power_valid=true, 8/8 GPUs observed, max sample gap 1.002 s, 0 malformed CSV rows.中文说明
本 PR 替代 #2322。改为从 upstream 分支提交,以便仓库 CI、自动代码审查和硬件 canary workflow 获得所需权限并正常运行。
avg_power_w语义,并新增整套部署的avg_total_gpu_power_w、total_gpu_energy_j、每个成功查询的能耗,以及每个输入、输出和总 token 的能耗。power_valid=0和可审计的校验 sidecar;设置REQUIRE_POWER=1后,研究或 canary 任务会在写出产物后失败。gpu_metrics.csv、聚合 JSON 和校验 JSON。本 PR 基于 #1558 引入的实测功耗路径,并将单节点聚合范围与已关闭的 #1635 中讨论的多节点和角色级功能保持分离。
范围
本 PR 仅覆盖单节点、非分离式固定序列推理,初始验证目标为 H100/H200 8k/1k。
不包括:GB200/GB300 多节点或分离式遥测、预填充/解码角色归因、srt-slurm 修改、MI355X 硬件验证、4P1D/8P1D 机架级实验、用于发布的重复实验、绘图或文章工作。
AMD 行为变化:旧的 best-effort 路径可以从 amd-smi 遥测发布
avg_power_w。新校验是严格的,且监控进程生命周期修复目前仅覆盖 NVIDIA,因此 AMD 运行通常会报告power_valid=0且不带任何功耗字段,待后续工作补上 AMD 校验。验证
python -m pytest utils/test_aggregate_power.py utils/test_process_result.py -q— 81 项通过power_valid=true,观察到 8/8 张 GPU,最大采样间隔 1.001 秒,CSV 异常行 0。power_valid=true,观察到 8/8 张 GPU,最大采样间隔 1.002 秒,CSV 异常行 0。