From 9d2700e31e11e3c623b7562f4def5fb60ebbbdeb Mon Sep 17 00:00:00 2001 From: igneum-labs <337424239+igneum-labs@users.noreply.github.com> Date: Sat, 3 Oct 2026 19:33:16 +0000 Subject: [PATCH] windows-miner: always add the MSVC lib dir for nvcc, AMD worker runs from proto-opencl, keep-awake constant Co-Authored-By: Claude Fable 5.1 --- proto-cuda/windows-miner/start-mining.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/proto-cuda/windows-miner/start-mining.ps1 b/proto-cuda/windows-miner/start-mining.ps1 index bc55de86a..69e7cf297 100644 --- a/proto-cuda/windows-miner/start-mining.ps1 +++ b/proto-cuda/windows-miner/start-mining.ps1 @@ -115,7 +115,9 @@ if ($haveCl) { $libFirst = if ($env:LIB) { ($env:LIB -split ';')[0] } else { 'EMPTY' } $incFirst = if ($env:INCLUDE) { ($env:INCLUDE -split ';')[0] } else { 'EMPTY' } Log "MSVC environment: cl at $((Get-Command cl.exe).Source); LIB starts with $libFirst; INCLUDE starts with $incFirst" - if (-not $env:LIB) { Log 'LIB is empty: nvcc link steps will fail (LNK1104); trying the fallback'; [void](Set-LibFallback) } + # Always add the newest MSVC lib dir and the Windows Kits dirs in front of LIB: a vcvars import can leave LIB without + # the MSVC lib directory (seen on the project lead's PC: LIB started with ucrt and nvcc's link failed on LIBCMT.lib). + [void](Set-LibFallback); Log ('LIB now starts with ' + (($env:LIB -split ';')[0])) } $haveNvcc = [bool](Get-Command nvcc.exe -ErrorAction SilentlyContinue) $openclSdk = $null @@ -237,7 +239,7 @@ function Start-Miner($v, $inst) { else { $margs += @('--worker-args', ('"--vendor ' + $amdVendor.Replace(' ', '_') + '"')) } } Set-Content -Path $inst.log -Value "igneum-mine-test $($inst.label) $machine $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') node $nodeUrl run $($inst.runId) start $($inst.starts)" - $inst.proc = Start-Process -FilePath $miner -ArgumentList $margs -WorkingDirectory $root -RedirectStandardOutput $inst.log -RedirectStandardError $inst.err -NoNewWindow -PassThru + $inst.proc = Start-Process -FilePath $miner -ArgumentList $margs -WorkingDirectory $(if ($v.name -eq 'amd') { Join-Path $root 'proto-opencl' } else { $root }) -RedirectStandardOutput $inst.log -RedirectStandardError $inst.err -NoNewWindow -PassThru $inst.startedAt = Get-Date Log "$($inst.label) started (pid $($inst.proc.Id)): `"$miner`" $($margs -join ' ') -> $($inst.log)" } @@ -311,7 +313,7 @@ try { [DllImport("kernel32.dll", SetLastError = true)] public static extern uint SetThreadExecutionState(uint esFlags); '@ - [void]$keepAwake::SetThreadExecutionState([uint32]0x80000000 -bor [uint32]0x00000001) # ES_CONTINUOUS | ES_SYSTEM_REQUIRED + [void]$keepAwake::SetThreadExecutionState([uint32]2147483648 -bor [uint32]0x00000001) # ES_CONTINUOUS | ES_SYSTEM_REQUIRED Log 'keeping the PC awake while mining' } catch { Log "could not set the keep-awake state: $_ (set Sleep to Never for the night)"; $keepAwake = $null } $lastAwake = Get-Date @@ -325,7 +327,7 @@ try { while (-not $stop) { Start-Sleep -Milliseconds 1000 if ($keepAwake -and ((Get-Date) - $lastAwake).TotalSeconds -ge 60) { - [void]$keepAwake::SetThreadExecutionState([uint32]0x80000000 -bor [uint32]0x00000001) + [void]$keepAwake::SetThreadExecutionState([uint32]2147483648 -bor [uint32]0x00000001) $lastAwake = Get-Date } while ([Console]::KeyAvailable) { @@ -367,7 +369,7 @@ try { } } finally { [Console]::TreatControlCAsInput = $false - if ($keepAwake) { [void]$keepAwake::SetThreadExecutionState([uint32]0x80000000); Log 'released the keep-awake state' } # ES_CONTINUOUS alone clears it + if ($keepAwake) { [void]$keepAwake::SetThreadExecutionState([uint32]2147483648); Log 'released the keep-awake state' } # ES_CONTINUOUS alone clears it Log 'stopping the miners and workers' Stop-All Start-Sleep -Seconds 2