fix(mtp-bench): peak-power summary mis-keyed GPU 0 by timestamp

power.log lines begin '<HH:MM:SS> 0, <W> W, ...', so splitting the first
pipe-field on ', ' yields a[1] = '20:18:00 0' rather than '0'. GPU 0 was
therefore keyed by sample timestamp, emitting one bogus row per sample and
no recoverable peak, while GPUs 1-3 aggregated correctly.

Take the GPU index as the last whitespace-separated token of a[1]. Verified
against a two-sample fixture: the old parser emits a spurious row per
timestamp, the patched one reports 0/1/2/3 once each at the correct peaks.

The end-of-campaign summary is the GPU-side input to the fv-ml1 circuit
budget, so a silently wrong GPU 0 row is a measurement fault, not cosmetic.
The in-flight campaign still runs the old on-host copy (editing a running
bash script corrupts execution by byte offset); its summary will be
recomputed from the raw power.log.
This commit is contained in:
2026-09-13 13:25:44 -07:00
parent 06a68f3f6e
commit 0a9cf58e19
@@ -182,4 +182,4 @@ log "########## CAMPAIGN DONE -- results in $OUT ##########"
# serving the operator's `gen-large` traffic throughout; this campaign only ever
# created and removed `fn-mtp-bench` on GPU 3.
log "peak power draw seen per card:"
awk -F'|' '{for(i=1;i<=NF;i++) if($i ~ /W/){split($i,a,", "); gsub(/^ +/,"",a[1]); gsub(/ W/,"",a[2]); if(a[2]+0>m[a[1]]) m[a[1]]=a[2]+0}} END{for(g in m) printf " GPU %s peak %.0f W\n", g, m[g]}' "$OUT/power.log" | sort | tee -a "$OUT/campaign.log"
awk -F'|' '{for(i=1;i<=NF;i++) if($i ~ /W/){split($i,a,", "); n=split(a[1],b," "); idx=b[n]; gsub(/ W/,"",a[2]); if(a[2]+0>m[idx]) m[idx]=a[2]+0}} END{for(g in m) printf " GPU %s peak %.0f W\n", g, m[g]}' "$OUT/power.log" | sort | tee -a "$OUT/campaign.log"