diff --git a/tools/ca3-v4-amend/pc1-v4-efficiency.ps1 b/tools/ca3-v4-amend/pc1-v4-efficiency.ps1 index b9eaacd1a..40ef57e99 100644 --- a/tools/ca3-v4-amend/pc1-v4-efficiency.ps1 +++ b/tools/ca3-v4-amend/pc1-v4-efficiency.ps1 @@ -245,10 +245,15 @@ function Bench([string] $pk, [int] $n, [string] $variant = 'base') { if (-not $res -or $rc -ne 0) { $e = ($lines | Where-Object { $_ -match 'FAIL|error|MISMATCH' } | Select-Object -First 1); $err = if ($e) { ($e -replace '\s+', ' ') } else { "exit $rc, no RESULT line" } } return [pscustomobject]@{ pack = $pk; t0 = $t0; t1 = $t1; rc = $rc; fp = $fp; mhs = $mhs; check = $check; err = $err; res = $res; batches = $n; dev = $dev; variant = $variant; race = $race; served = $served; sparse = $sparse } } +# the step budget (8 October 2026: the third 5090 pass sized every step's batch count from the unlocked rate, so the 500 MHz step ran +# 155 s instead of 60 and the 45 min cap killed the script before its restore): the batch count follows the last rate read for the pack, +# and a step that would end within four minutes of the cap is not started, so the reset and the drift check run inside it +$lastMhs = @{} function Step([string] $label, [string] $lockNote) { foreach ($pk in $packOrder) { foreach ($variant in $variants) { - if ((Get-Date) -gt $deadline) { "RESULT STEP card=$cardName pack=$pk lock=$label variant=$variant error=budget spent"; continue } + if ((Get-Date) -gt $deadline.AddMinutes(-4)) { "RESULT STEP card=$cardName pack=$pk lock=$label variant=$variant error=budget spent (four minutes kept for the restore)"; continue } $n = if ($ca4) { 250 } else { $nb[$pk] } + if (-not $ca4 -and $lastMhs[$pk]) { $n = [math]::Max(20, [math]::Min(2000, [int][math]::Ceiling($stepSeconds * $lastMhs[$pk] * 1e6 / 16777216.0))) } $b = Bench $pk $n $variant if ($b.err) { "RESULT STEP card=$cardName pack=$pk lock=$label variant=$variant error=$($b.err) lock_note=$lockNote race=[$($b.race)]"; continue } $w = ReadWindow $b.t0.AddSeconds(8) $b.t1 @@ -266,7 +271,7 @@ function Step([string] $label, [string] $lockNote) { $lab = if ($ca4) { 'ca4-research' } else { 'efficiency' } $vfail = if ($ca4 -and $variant -ne 'base' -and ($b.served -eq 'base' -or $b.race -match 'variant_not_installed')) { ' variant_row=FAILED' } else { '' } "RESULT STEP card=$cardName pack=$pk lock=$label variant=$variant served=$($b.served) sparse_blocks=$($b.sparse)$vfail label=$lab sm_mhz=$sm mem_mhz=$mem watts=$watts watts_instant=$wInst watts_average=$wAvg temp_max=$tmax throttle=$thr mhs=$($b.mhs) mh_per_w=$eff fingerprint=$($b.fp) match=$match expected=$want check=$($b.check) batches=$n wall_s=$wall samples=$($w.Count) device=$($b.dev) lock_note=$lockNote alone=$alone race=[$($b.race)]" - if ($variant -eq 'base') { $script:rows += [pscustomobject]@{ pack = $pk; lock = $label; sm = $sm; watts = $watts; mhs = $b.mhs; eff = $eff; match = $match } } + if ($variant -eq 'base') { $script:rows += [pscustomobject]@{ pack = $pk; lock = $label; sm = $sm; watts = $watts; mhs = $b.mhs; eff = $eff; match = $match } }; if ($b.mhs) { $script:lastMhs[$pk] = $b.mhs } } } } try { @@ -293,7 +298,7 @@ try { foreach ($c in $locks) { foreach ($pk in $packOrder) { "RESULT STEP card=$cardName pack=$pk lock=$c error=no lock path (not elevated, no helper task)" } } } else { foreach ($c in $locks) { - if ((Get-Date) -gt $deadline) { "RESULT STEP card=$cardName pack=* lock=$c error=budget spent"; continue } + if ((Get-Date) -gt $deadline.AddMinutes(-4)) { "RESULT STEP card=$cardName pack=* lock=$c error=budget spent (four minutes kept for the restore)"; continue } $note = SetLock $c $lockState = "locked $c" if ($note -match 'no helper.log') { foreach ($pk in $packOrder) { "RESULT STEP card=$cardName pack=$pk lock=$c error=lock $note" }; "RESULT locks stopped at $c MHz: the helper gave no answer (a lock under the driver's floor hangs its nvidia-smi call); the remaining locks are skipped and the task is restarted for the reset"; RestartHelper | Out-Null; break }