igneum/tools/ca3-pc1-amd/pc1-amd-flag-amd1.ps1

69 lines
4.9 KiB
PowerShell

# Counter ASIC 3.0, PC 1 AMD flag job (a copy of the identities job): the entry amd:1:gfx1201 back to enabled true, identities 2, as it stood before the watts job posted it off at 17:51Z.
# The original header follows.
# Counter ASIC 3.0, PC 1 AMD identities job (6 October 2026, main's go at 17:0x UTC): ONE POST to the installed app's
# api/cards for the RX 9070 XT's live entry, {key: amd:gfx1201, enabled: true, identities: 8}, because job 1's restore
# (15:56Z) posted another entry's identities (2) to every key form and the reset job's read (16:55Z) showed the app
# running the card under amd:gfx1201 with identities 2 where it ran 8 before. Reads the app's state before, posts once,
# waits for the card's worker to settle, reads the state after, and prints the rate before and after (18.92 MH/s at
# 2 identities is the number to beat). Beside the miners; the only write is that one POST (it restarts that card's
# worker, nothing else). Never quits, pauses, resumes or updates the installed app; never writes settings.json. Every
# result line starts with RESULT; a `SUMMARY {json}` line closes the report; status failed unless the live key reads
# identities 8 and state mining after the settle.
$ErrorActionPreference = 'Continue'
$jobName = 'pc1-amd-flag-amd1'
$started = Get-Date
function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') }
function Summary([string] $status, [hashtable] $extra) {
$o = [ordered]@{ job = $jobName; status = $status; duration_s = [int]((Get-Date) - $started).TotalSeconds; finished_at = (Stamp) }
foreach ($k in $extra.Keys) { $o[$k] = $extra[$k] }
'SUMMARY ' + ($o | ConvertTo-Json -Compress -Depth 4)
}
"RESULT start $(Stamp) job=$jobName machine=$env:COMPUTERNAME app_version=$env:IGNEUM_APP_VERSION"
$appDir = if ($env:IGNEUM_APP_DIR) { $env:IGNEUM_APP_DIR } else { Join-Path $env:LOCALAPPDATA 'igneum\app' }
$urlFile = Join-Path $appDir 'app.url'
$base = $null
if (Test-Path $urlFile) { $base = (Get-Content -LiteralPath $urlFile -Raw).Trim().TrimEnd('/') }
if (-not $base) { "RESULT identities error=no app.url under ${appDir}: nothing posted"; Summary 'failed' @{ reason = 'no app.url' }; exit 1 }
$wantKey = 'amd:1:gfx1201' # the stale entry the watts job posted off (enabled before it); the app runs the card under amd:gfx1201
$wantIdent = 2
function ReadLive {
# the 9070 XT's live entry from api/state: the object only (a function's every output joins its return value in
# PowerShell, so the RESULT line is printed by the caller, never inside here)
try {
$st = Invoke-RestMethod -Uri "$base/api/state" -Method GET -TimeoutSec 10
$cards = $st.mining.cards; if (-not $cards) { $cards = $st.cards }
foreach ($c in @($cards)) { if ($c.vendor -eq 'amd' -and ("$($c.key)" -match 'gfx1201')) { return $c } }
return $null
} catch { return $null }
}
function LiveLine([string] $tag, $c) {
if ($c) { "RESULT live_$tag key=$($c.key) enabled=$($c.enabled) identities=$($c.identities) state=$($c.state) pid=$($c.pid) mhs_now=$($c.hash_now) mhs_avg=$($c.hash_avg) watts=$($c.power_w) at=$(Stamp)" }
else { "RESULT live_$tag error=no gfx1201 card in api/state (or api/state answered nothing)" }
}
$before = ReadLive
LiveLine 'before' $before
if ($before -and "$($before.key)" -ne $wantKey) { "RESULT identities note=the live key is $($before.key), not $wantKey; posting to $wantKey as main ordered, the live key read after decides" }
# the one POST
$body = @{ cards = @(@{ key = $wantKey; enabled = $true; identities = $wantIdent }) } | ConvertTo-Json -Depth 5 # the app's shape: a cards array (server.rs /api/cards), as the g1-shadow job posts it
try {
Invoke-RestMethod -Uri "$base/api/cards" -Method POST -Body $body -ContentType 'application/json' -TimeoutSec 10 | Out-Null
"RESULT posted key=$wantKey enabled=true identities=$wantIdent at=$(Stamp)"
} catch { "RESULT posted error=$($_.Exception.Message)"; Summary 'failed' @{ reason = 'post failed' }; exit 1 }
# settle: the card's worker restarts under the new count; the rate needs its first STATUS window
"RESULT settle 120 s"
Start-Sleep -Seconds 120
$after = ReadLive
LiveLine 'after' $after
$ok = $false
if ($after) { $ok = ($after.state -eq 'mining') } # the live card is amd:gfx1201 at 8 identities; this job restores a second entry's flag, so the card mining is the pass
if ($before -and $after) { "RESULT rate before=$($before.hash_now) MH/s at identities $($before.identities); after=$($after.hash_now) MH/s at identities $($after.identities) (avg $($after.hash_avg)); the number to beat is 18.92 at 2" }
if (-not $ok) { "RESULT flag error=the card is not mining after the settle (reads identities=$($after.identities) state=$($after.state))" }
"RESULT end $(Stamp)"
Summary $(if ($ok) { 'done' } else { 'failed' }) @{ key = $wantKey; identities_before = "$($before.identities)"; identities_after = "$($after.identities)"; mhs_before = "$($before.hash_now)"; mhs_after = "$($after.hash_now)" }
exit $(if ($ok) { 0 } else { 1 })