Files
leleka/scripts/dev/laptop-turbo.ps1
T
Pavlo RatushnyiandClaude Sonnet 5.5 96484f04f1
Rust port / port-fast (push) Failing after 9s
Linux / keyless-cuda-gate (push) Skipped
Rust port / port-typecheck (push) Failing after 8s
Rust port / port-oracles (push) Failing after 10s
Linux / verify (push) Failing after 16s
Rust port / port-linux-tests (push) Failing after 14s
Linux / keyless-cuda (push) Skipped
Linux / static-cuda-package (push) Skipped
Linux / hosted-cuda-package (push) Skipped
Linux / linux-static-cli (push) Skipped
Linux / linux-cli-container (push) Skipped
Linux / release-cli (push) Skipped
fix: laptop-turbo.ps1 reads enforced.power.limit (power.limit is N/A on the laptop GPU) and tolerates a missing value
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 02:38:22 +01:00

39 lines
2.6 KiB
PowerShell

# Prepares the Windows laptop (ASUS ROG, RTX 3080) for a measurement run. Run it yourself, once, before the run:
# powershell -ExecutionPolicy Bypass -File scripts\dev\laptop-turbo.ps1
# It changes only the Windows power settings of the ASUS "Turbo" scheme (on mains power): activates the scheme and turns off
# the sleep, hibernate, display-off and lock-screen-display-off timeouts. It does not touch the registry, the lock policy, Armoury Crate
# or the GPU. Armoury Crate keeps its own performance mode (the GPU power limit); the script prints that limit so a low value is visible.
# Previous values are printed so they can be restored by hand.
$ErrorActionPreference = 'Stop'
$list = powercfg /list | Out-String
$m = [regex]::Match($list, '(?m)^Power Scheme GUID:\s+([0-9a-f-]{36})\s+\((Turbo)\)')
if (-not $m.Success) { throw "No power scheme named Turbo found; run 'powercfg /list' and pick the ASUS performance scheme by hand." }
$turbo = $m.Groups[1].Value
$battery = Get-CimInstance Win32_Battery -ErrorAction SilentlyContinue
if ($battery -and $battery.BatteryStatus -ne 2) { Write-Warning "The laptop is on battery; plug in the charger first (the AC settings below do not apply on battery)." }
Write-Host "Active scheme before:"; powercfg /getactivescheme
powercfg /setactive $turbo
foreach ($name in 'standby-timeout-ac', 'hibernate-timeout-ac', 'monitor-timeout-ac') {
powercfg /change $name 0
}
# console lock display off timeout (the screen blanking while the session is locked): 0 = never
powercfg /setacvalueindex $turbo SUB_VIDEO VIDEOCONLOCK 0
powercfg /setactive $turbo
Write-Host "`nActive scheme now:"; powercfg /getactivescheme
Write-Host "`nGPU state (the power limit must be above 100 W for a valid measurement):"
# power.limit is [N/A] on this laptop GPU; the enforced limit is what the driver applies. The instantaneous draw sensor is unreliable here, so it is not shown.
$gpu = nvidia-smi --query-gpu=name,enforced.power.limit,power.max_limit,clocks.current.sm,pstate --format=csv,noheader,nounits
Write-Host $gpu
$limit = 0.0
if ([double]::TryParse((($gpu -split ',')[1]).Trim(), [Globalization.NumberStyles]::Float, [Globalization.CultureInfo]::InvariantCulture, [ref]$limit)) {
if ($limit -lt 100) { Write-Warning "GPU power limit is $limit W: Armoury Crate is not in its Turbo/Manual performance mode. Set it there; this script cannot." }
} else {
Write-Warning "The driver did not report the enforced GPU power limit; check 'nvidia-smi -q -d POWER' by hand."
}
Write-Host "`nLeave the lock-screen requirement to Settings > Accounts > Sign-in options (Require sign-in: Never); this script does not change it."