From 62485dab155c0f11aa9c7d024cee4e28b7bd3e12 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 22 Oct 2026 23:32:09 +0200 Subject: [PATCH] Probe: read nvidia-smi's exit code after the pipeline drains Select-Object -First 1 closes the pipe early and leaves LASTEXITCODE -1, so every iteration threw and the probe wrote no samples (found on Raven). Co-Authored-By: Claude Opus 5.5 --- scripts/gpu-tenancy-probe.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/gpu-tenancy-probe.ps1 b/scripts/gpu-tenancy-probe.ps1 index c80bf2b..1c95cfd 100644 --- a/scripts/gpu-tenancy-probe.ps1 +++ b/scripts/gpu-tenancy-probe.ps1 @@ -8,8 +8,9 @@ while ($true) { try { $quns = 0 if ([Vili.Shell]::SHQueryUserNotificationState([ref]$quns) -ne 0) { throw 'quns' } - $free = nvidia-smi.exe --query-gpu=memory.free --format=csv,noheader,nounits | Select-Object -First 1 + $smi = @(nvidia-smi.exe --query-gpu=memory.free --format=csv,noheader,nounits) if ($LASTEXITCODE -ne 0) { throw 'smi' } + $free = $smi[0] $sum = (Get-Counter '\GPU Engine(*engtype_3D)\Utilization Percentage' -SampleInterval 1 -MaxSamples 1).CounterSamples | Measure-Object -Property CookedValue -Sum $line = [ordered]@{ quns = [int]$quns; freeMiB = [int]$free; util3d = [math]::Min(100, [math]::Round([double]$sum.Sum, 1)) } | ConvertTo-Json -Compress [Console]::Out.WriteLine($line)