diff --git a/proto-cuda/windows-miner/README.txt b/proto-cuda/windows-miner/README.txt index 8ba6faa95..96b15f5f3 100644 --- a/proto-cuda/windows-miner/README.txt +++ b/proto-cuda/windows-miner/README.txt @@ -2,4 +2,4 @@ Igneum devnet mining test. Double-click START-MINING.bat; it finds your GPUs, bu It needs CUDA Toolkit 12.8 or newer and Visual Studio with the MSVC v143 (14.30) x64 component; the AMD worker uses the OpenCL headers the CUDA Toolkit ships. The miner (igneum-miner.exe) is prebuilt, no Rust needed. MINERS=8 (top of the bat) starts 8 miner identities per GPU vendor, each with its own worker (about 1.3 GiB of GPU memory each), its own vote key and payout address derived from the PC name and the index (the same on a rerun), and its own random 64-bit nonce start per job, so no two miners repeat work; set MINERS=1 for a single-identity run. Logs are written next to the bat as nvidia--.log, amd--.log and launcher-.log, and uploaded every 60 seconds under the labels nvidia-- and amd--, so the log is already with us. Every hour the program changes (epoch of 3,600 blocks) and once a day the cache seed changes: the miner stops with code 42, the launcher re-exports the pack from the node, rebuilds the worker (about 30 s for CUDA, a few seconds for OpenCL) and restarts it; a worker that dies for any other reason is restarted after 10 s. A status line per worker prints every 30 s. -Stop it in the morning with Ctrl+C in the window: the miners and workers are killed, a summary prints, the logs are uploaded one last time and the window stays open. The Mac side restarts with: cd ~/Projects/igneum/vendor/igneum-node && caffeinate -dims ./target/release/kaspad --devnet --nodnsseed --disable-upnp --enable-unsynced-mining --appdir=/tmp/igneum-devnet/node1 --rpclisten=0.0.0.0:26610 --listen=0.0.0.0:26611 --nologfiles >> /tmp/igneum-devnet/node1.log 2>&1 & +The launcher holds Windows awake while it runs (SetThreadExecutionState, no power plan change); for the night also set Sleep to Never in Settings > System > Power and check that no Windows Update restart is pending. Stop it in the morning with Ctrl+C in the window: the miners and workers are killed, a summary prints, the logs are uploaded one last time and the window stays open. The Mac side restarts with: cd ~/Projects/igneum/vendor/igneum-node && caffeinate -dims ./target/release/kaspad --devnet --nodnsseed --disable-upnp --enable-unsynced-mining --appdir=/tmp/igneum-devnet/node1 --rpclisten=0.0.0.0:26610 --listen=0.0.0.0:26611 --nologfiles >> /tmp/igneum-devnet/node1.log 2>&1 & diff --git a/proto-cuda/windows-miner/start-mining.ps1 b/proto-cuda/windows-miner/start-mining.ps1 index 9b4888ba8..ec1c309aa 100644 --- a/proto-cuda/windows-miner/start-mining.ps1 +++ b/proto-cuda/windows-miner/start-mining.ps1 @@ -238,6 +238,19 @@ function Print-Status { function Stop-All { foreach ($v in $vendors.Values) { Stop-Vendor $v } } +# Keep the PC awake while mining: SetThreadExecutionState is per thread, so the launcher's own loop re-asserts it every +# 60 s and releases it on exit. The power plan is not touched. +$keepAwake = $null +try { + $keepAwake = Add-Type -Name 'KeepAwake' -Namespace 'Igneum' -PassThru -MemberDefinition @' +[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 + 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 + [Console]::TreatControlCAsInput = $true Log 'running. Press Ctrl+C to stop (the summary prints and the logs are uploaded one last time).' $lastStatus = Get-Date @@ -246,6 +259,10 @@ $stop = $false 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) + $lastAwake = Get-Date + } while ([Console]::KeyAvailable) { $k = [Console]::ReadKey($true) if ($k.Key -eq 'C' -and ($k.Modifiers -band [ConsoleModifiers]::Control)) { $stop = $true } @@ -285,6 +302,7 @@ try { } } finally { [Console]::TreatControlCAsInput = $false + if ($keepAwake) { [void]$keepAwake::SetThreadExecutionState([uint32]0x80000000); Log 'released the keep-awake state' } # ES_CONTINUOUS alone clears it Log 'stopping the miners and workers' Stop-All Start-Sleep -Seconds 2