From b45bef4b5b11ffa573b6e05ce62a3e4fef3ec520 Mon Sep 17 00:00:00 2001 From: sp00n Date: Thu, 11 Mar 2021 22:03:38 +0100 Subject: [PATCH 01/12] Hopefully really fixed the localized Performance Counters this time. --- script-corecycler.ps1 | 59 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index f3a1604..dd72860 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.7.8.8 + 0.7.8.9 .DESCRIPTION Sets the affinity of the Prime95 process to only one core and cycles through all the cores to test the stability of a Curve Optimizer setting @@ -17,7 +17,7 @@ #> # Global variables -$version = '0.7.8.8' +$version = '0.7.8.9' $curDateTime = Get-Date -format yyyy-MM-dd_HH-mm-ss $settings = $null $logFilePath = $null @@ -37,11 +37,14 @@ $primePath = $processPath + $processName # Used to get around the localized counter names -$counterNameIds = @{ - 'Process' = 230 - 'ID Process' = 784 - '% Processor Time' = 5972 -} +$englishCounterNames = @( + 'Process', + 'ID Process', + '% Processor Time' +) + +# This stores the Name:ID pairs of the english counter names +$counterNameIds = @{} # This holds the localized counter names $counterNames = @{ @@ -207,6 +210,40 @@ function Exit-WithFatalError { } +<## + # This is used to get the Performance Counter IDs, which will be used to get the localized names + # .PARAM Array $englishCounterNames An arraay with the english names of the counters + # .RETURN Hash A hash with Name:ID pairs of the counters + #> +function Get-PerformanceCounterIDs { + param ( + [Parameter(Mandatory=$true)] + [Array] + $englishCounterNames + ) + + $key = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009' + $allCounters = (Get-ItemProperty -Path $key -Name Counter).Counter + $numCounters = $allCounters.Count + $countersHash = @{} + + # The string contains two-line pairs + # The first line is the ID + # The second line is the name + for ($i = 0; $i -lt $numCounters; $i += 2) { + $counterId = [Int]$allCounters[$i] + $counterName = [String]$allCounters[$i+1] + + if ($englishCounterNames.Contains($counterName)) { + $countersHash[$counterName] = $counterId + } + + } + + return $countersHash +} + + <## # Get the localized counter name # Yes, they're localized. Way to go Microsoft! @@ -1003,12 +1040,20 @@ function Test-ProcessUsage { # Get the localized counter names try { + $counterNameIds = Get-PerformanceCounterIDs $englishCounterNames + $counterNames['Process'] = Get-PerformanceCounterLocalName $counterNameIds['Process'] $counterNames['ID Process'] = Get-PerformanceCounterLocalName $counterNameIds['ID Process'] $counterNames['% Processor Time'] = Get-PerformanceCounterLocalName $counterNameIds['% Processor Time'] $counterNames['FullName'] = "\" + $counterNames['Process'] + "(*)\" + $counterNames['ID Process'] $counterNames['SearchString'] = '\\' + $counterNames['ID Process'] + '$' $counterNames['ReplaceString'] = '\' + $counterNames['% Processor Time'] + + # Examples + # English: ID Process + # German: Prozesskennung + # English: % Processor Time + # German: Prozessorzeit (%) } catch { Write-Host 'FATAL ERROR: Could not get the localized Performance Process Counter name!' -ForegroundColor Red From fc0874baf1039b057923c73101cc57f319adc85c Mon Sep 17 00:00:00 2001 From: sp00n Date: Fri, 12 Mar 2021 01:05:28 +0100 Subject: [PATCH 02/12] Fixed FFT detection. However, it only works on Smallest and Small FFT, as Prime95 otherwise randomizes the order of the FFT size. Added a new "Huge" Preset that tests anything above 8192K and which is now the default. --- config.default.ini | 8 +-- script-corecycler.ps1 | 150 ++++++++++++++++++++++++++++-------------- 2 files changed, 106 insertions(+), 52 deletions(-) diff --git a/config.default.ini b/config.default.ini index 851f47e..cebbf62 100644 --- a/config.default.ini +++ b/config.default.ini @@ -13,9 +13,9 @@ mode = SSE # Smallest: Smallest FFT: 4K to 21K - tests L1/L2 caches, high power/heat/CPU stress # Small: Small FFT: 36K to 248K - tests L1/L2/L3 caches, maximum power/heat/CPU stress # Large: Large FFT: 426K to 8192K - stresses memory controller and RAM (although memory testing is disabled here by default!) -# All: All FFT: 4K to 8192K - all of the above -# Default: Small -FFTSize = Small +# All: All FFT: 4K to whatever is the highest FFT (32768K for SSE/AVX, 51200 for AVX2) +# Default: Huge +FFTSize = Huge # Set the runtime per core @@ -31,7 +31,7 @@ runtimePerCore = 360 # If set to 0 (default), the stress test programm will be restarted when an error # occurs and the core that caused the error will be skipped on the next iteration # Default: 0 -stopOnError = 1 +stopOnError = 0 # The number of threads to use for testing diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index dd72860..93efb2e 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -300,8 +300,10 @@ function Get-Settings { # 'Smallest': Smallest FFT: 4K to 21K - tests L1/L2 caches, high power/heat/CPU stress # 'Small': Small FFT: 36K to 248K - tests L1/L2/L3 caches, maximum power/heat/CPU stress # 'Large': Large FFT: 426K to 8192K - stresses memory controller and RAM (although memory testing is disabled here by default!) - # 'All': All FFT: 4K to 8192K - all of the above - FFTSize = 'Small' + # 'Huge': New custom mode: anything above 8192K + # 'All': All FFT: 4K to whatever is the highest FFT (32768K for SSE/AVX, 51200 for AVX2) + # Default: 'Huge' + FFTSize = 'Huge' # Set the runtime per core @@ -949,48 +951,79 @@ function Test-ProcessUsage { # DEBUG # Also add the 5 last rows of the results.txt file - #Write-Text('LAST 5 ROWS OF RESULTS.TXT:') - #Write-Text(Get-Item -Path $primeResultsPath | Get-Content -Tail 5) + #Write-Verbose('LAST 5 ROWS OF RESULTS.TXT:') + #Write-Verbose(Get-Item -Path $primeResultsPath | Get-Content -Tail 5) # Try to determine the last run FFT size # If the results.txt doesn't exist, assume that it was on the very first iteration - if (!$resultFileHandle) { - $lastRunFFT = $minFFTSize + # Note: Unfortunately Prime95 randomizes the FFT sizes for anything above Small FFT sizes + # So we cannot make an educated guess for these settings + if ($maxFFTSize -le $FFTMinMaxValues[$settings.mode]['Small'].Max) { + if (!$resultFileHandle) { + $lastRunFFT = $minFFTSize + } + + # Get the last couple of rows and find the last passed FFT size + else { + $lastFiveRows = $resultFileHandle | Get-Content -Tail 5 + $lastPassedFFTArr = @($lastFiveRows | Where-Object {$_ -like '*passed*'}) + $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self-test (\d+)K passed' + $lastPassedFFT = if ($matches -is [Hashtable] -or $matches -is [Array]) { [Int]$matches[1] } # $matches is a fixed(?) variable name for -match + + # No passed FFT was found, assume it's the first FFT size + if (!$lastPassedFFT) { + $lastRunFFT = $minFFTSize + } + + # If the last passed FFT size is the max selected FFT size, start at the beginning + elseif ($lastPassedFFT -eq $maxFFTSize) { + $lastRunFFT = $minFFTSize + } + + # If the last passed FFT size is not the max size, check if the value doesn't show up at all in the FFT array + # In this case, we also assume that it successfully completed the max value and errored at the min FFT size + # Example: Smallest FFT max = 21, but the actual last size tested is 20K + elseif (!$FFTSizes[$cpuTestMode].Contains($lastPassedFFT)) { + $lastRunFFT = $minFFTSize + } + + # If it's not the max value and it does show up in the FFT array, select the next value + else { + $lastRunFFT = $FFTSizes[$cpuTestMode][$FFTSizes[$cpuTestMode].indexOf($lastPassedFFT)+1] + } + } + + # Educated guess + if ($lastRunFFT) { + Write-ColorText('ERROR: The error likely happened at FFT size ' + $lastRunFFT + 'K') Magenta + } + else { + Write-ColorText('ERROR: No additional FFT size information found in the results.txt') Magenta + } + + Write-Verbose('The last 5 entries in the results.txt:') + Write-Verbose($lastFiveRows -Join ', ') + + Write-Text('') } - - # Get the last couple of rows and find the last passed FFT size else { $lastFiveRows = $resultFileHandle | Get-Content -Tail 5 $lastPassedFFTArr = @($lastFiveRows | Where-Object {$_ -like '*passed*'}) $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self-test (\d+)K passed' - $lastPassedFFT = if ($matches -is [Array]) { [Int]$matches[1] } # $matches is a fixed(?) variable name for -match + $lastPassedFFT = if ($matches -is [Hashtable] -or $matches -is [Array]) { [Int]$matches[1] } # $matches is a fixed(?) variable name for -match - # No passed FFT was found, assume it's the first FFT size - if (!$lastPassedFFT) { - $lastRunFFT = $minFFTSize + if ($lastPassedFFT) { + Write-ColorText('ERROR: The last *passed* FFT size before the error was: ' + $lastPassedFFT + 'K') Magenta + Write-ColorText('ERROR: Unfortunately FFT size fail detection only works for Smallest or Small FFT sizes.') Magenta } - - # If the last passed FFT size is the max selected FFT size, start at the beginning - elseif ($lastPassedFFT -eq $maxFFTSize) { - $lastRunFFT = $minFFTSize + else { + Write-ColorText('ERROR: No additional FFT size information found in the results.txt') Magenta } - # If the last passed FFT size is not the max size, check if the value doesn't show up at all in the FFT array - # In this case, we also assume that it successfully completed the max value and errored at the min FFT size - # Example: Smallest FFT max = 21, but the actual last size tested is 20K - elseif (!$FFTSizes[$cpuTestMode].Contains($lastPassedFFT)) { - $lastRunFFT = $minFFTSize - } + Write-Verbose('The last 5 entries in the results.txt:') + Write-Verbose($lastFiveRows -Join ', ') - # If it's not the max value and it does show up in the FFT array, select the next value - else { - $lastRunFFT = $FFTSizes[$cpuTestMode][$FFTSizes[$cpuTestMode].indexOf($lastPassedFFT)+1] - } - } - - # Educated guess - if ($lastRunFFT) { - Write-ColorText('ERROR: The error likely happened at FFT size ' + $lastRunFFT + 'K') Magenta + Write-Text('') } @@ -1218,14 +1251,17 @@ $FFTSizes = @{ 256, 288, 320, 336, 384, 400, # Large FFT + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes 448, 480, 512, 560, 576, 640, 672, 720, 768, 800, 896, 960, 1024, 1120, 1152, 1200, 1280, 1344, 1440, 1536, 1600, 1680, 1728, 1792, 1920, 2048, 2240, 2304, 2400, 2560, 2688, 2800, 2880, 3072, 3200, 3360, 3456, 3584, 3840, 4096, 4480, 4608, 4800, 5120, 5376, 5600, 5760, 6144, 6400, 6720, 6912, 7168, 7680, 8000, 8192 # Not used in Prime95 presets - # 32768 seems to be the maximum FFT size possible - 8960, 9216, 9600, 10240, 10752, 11200, 11520, 12288, 12800, 13440, 13824, 14336, 15360, 16000, 16384, 17920, 18432, 19200, 20480, 20480, - 21504, 22400, 23040, 24576, 25600, 26880, 27648, 28672, 30720, 32000, 32768 + # Now custom labeled "Huge" + # 32768 seems to be the maximum FFT size possible for SSE + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes + 8960, 9216, 9600, 10240, 10752, 11200, 11520, 12288, 12800, 13440, 13824, 14336, 15360, 16000, 16384, 17920, 18432, 19200, 20480, 21504, + 22400, 23040, 24576, 25600, 26880, 27648, 28672, 30720, 32000, 32768 ) AVX = @( @@ -1242,12 +1278,17 @@ $FFTSizes = @{ 256, 288, 320, 336, 384, 400, # Large FFT + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes 448, 480, 512, 560, 576, 640, 672, 720, 768, 800, 864, 896, 960, 1024, 1152, 1280, 1344, 1440, 1536, 1600, 1680, 1728, 1792, 1920, 2048, 2304, 2400, 2560, 2688, 2880, 3072, 3200, 3360, 3456, 3584, 3840, 4032, 4096, 4480, 4608, 4800, 5120, 5376, 5760, 6144, 6400, 6720, 6912, 7168, 7680, 8000, 8192 # Not used in Prime95 presets - # TODO: after 8192 for AVX + # Now custom labeled "Huge" + # 32768 seems to be the maximum FFT size possible for AVX + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes + 8960, 9216, 9600, 10240, 10752, 11520, 12288, 12800, 13440, 13824, 14336, 15360, 16000, 16128, 16384, 17920, 18432, 19200, 20480, 21504, + 22400, 23040, 24576, 25600, 26880, 28672, 30720, 32000, 32768 ) @@ -1265,12 +1306,22 @@ $FFTSizes = @{ 256, 280, 288, 320, 336, 384, 400, # Large FFT + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes 448, 480, 512, 560, 640, 672, 768, 800, 896, 960, 1024, 1120, 1152, 1280, 1344, 1440, 1536, 1600, 1680, 1792, 1920, 2048, 2240, 2304, 2400, 2560, 2688, 2800, 2880, 3072, 3200, 3360, 3584, 3840, 4096, 4480, 4608, 4800, 5120, 5376, 5600, 5760, 6144, 6400, 6720, 7168, 7680, 8000, 8064, 8192 # Not used in Prime95 presets - # TODO: after 8192 for AVX2 + # Now custom labeled "Huge" + # 51200 seems to be the maximum FFT size possible for AVX2 + # Note: Unfortunately Prime95 seems to randomize the order for larger FFT sizes + 8960, 9216, 9600, 10240, 10752, 11200, 11520, 12288, 12800, 13440, 13824, 14336, 15360, 16000, 16128, 16384, 17920, 18432, 19200, 20480, + 21504, 22400, 23040, 24576, 25600, 26880, 28672, 30720, 32000, 32768, 35840, 38400, 40960, 44800, 51200 + + # An example of the randomization: + # 11200, 8960, 9216, 9600, 10240, 10752, 11520, 11200, 11520, 12288, 11200, 8192, 11520, 12288, 12800, 13440, 13824, 8960, 14336, 15360, + # 16000, 16128, 16384, 9216, 17920, 18432, 19200, 20480, 21504, 9600, 22400, 23040, 24576, 25600, 26880, 10240, 28672, 30720, 32000, 32768, + # 35840, 10752, 38400, 40960, 44800, 51200 ) } @@ -1280,24 +1331,27 @@ $FFTSizes = @{ # depending on the selected test mode (SSE, AVX, AVX2) $FFTMinMaxValues = @{ SSE = @{ - Smallest = @{ Min = 4; Max = 20; } # Originally 4 ... 21 - Small = @{ Min = 40; Max = 240; } # Originally 36 ... 248 - Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 - All = @{ Min = 4; Max = 8192; } # Originally 4 ... 8192 + Smallest = @{ Min = 4; Max = 20; } # Originally 4 ... 21 + Small = @{ Min = 40; Max = 240; } # Originally 36 ... 248 + Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 + Huge = @{ Min = 8960; Max = 32768; } # New addition + All = @{ Min = 4; Max = 32768; } } AVX = @{ - Smallest = @{ Min = 4; Max = 21; } # Originally 4 ... 21 - Small = @{ Min = 36; Max = 240; } # Originally 36 ... 248 - Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 - All = @{ Min = 4; Max = 8192; } # Originally 4 ... 8192 + Smallest = @{ Min = 4; Max = 21; } # Originally 4 ... 21 + Small = @{ Min = 36; Max = 240; } # Originally 36 ... 248 + Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 + Huge = @{ Min = 8960; Max = 32768; } # New addition + All = @{ Min = 4; Max = 32768; } } AVX2 = @{ - Smallest = @{ Min = 4; Max = 21; } # Originally 4 ... 21 - Small = @{ Min = 36; Max = 240; } # Originally 36 ... 248 - Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 - All = @{ Min = 4; Max = 8192; } # Originally 4 ... 8192 + Smallest = @{ Min = 4; Max = 21; } # Originally 4 ... 21 + Small = @{ Min = 36; Max = 240; } # Originally 36 ... 248 + Large = @{ Min = 448; Max = 8192; } # Originally 426 ... 8192 + Huge = @{ Min = 8960; Max = 51200; } # New addition + All = @{ Min = 4; Max = 51200; } } } From 09be795224ef324a688e61e1b3df55f2d14cfb6c Mon Sep 17 00:00:00 2001 From: sp00n Date: Fri, 12 Mar 2021 23:29:17 +0100 Subject: [PATCH 03/12] Added a new skipOnError setting. --- config.default.ini | 6 +++ script-corecycler.ps1 | 116 ++++++++++++++++++++++++++++++------------ 2 files changed, 90 insertions(+), 32 deletions(-) diff --git a/config.default.ini b/config.default.ini index cebbf62..60c3fba 100644 --- a/config.default.ini +++ b/config.default.ini @@ -27,6 +27,12 @@ FFTSize = Huge runtimePerCore = 360 +# Skip a core that has thrown an error on the following iterations +# If set to 0, this will test a core on the next iterations even if has thrown an error before +# Default: 1 +skipOnError = 0 + + # Stop the whole testing process if an error occurred # If set to 0 (default), the stress test programm will be restarted when an error # occurs and the core that caused the error will be skipped on the next iteration diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index 93efb2e..e07a296 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.7.8.9 + 0.7.9.0 .DESCRIPTION Sets the affinity of the Prime95 process to only one core and cycles through all the cores to test the stability of a Curve Optimizer setting @@ -17,7 +17,7 @@ #> # Global variables -$version = '0.7.8.9' +$version = '0.7.9.0' $curDateTime = Get-Date -format yyyy-MM-dd_HH-mm-ss $settings = $null $logFilePath = $null @@ -27,6 +27,7 @@ $process = $null $processCounterPathId = $null $processCounterPathTime = $null $coresWithError = $null +$coresWithErrorsDetails = $null $previousError = $null @@ -315,6 +316,12 @@ function Get-Settings { runtimePerCore = 360 + # Skip a core that has thrown an error on the following iterations + # If set to 0, this will test a core on the next iterations even if has thrown an error before + # Default: 1 + skipOnError = 1 + + # Stop the whole testing process if an error occurred # If set to 0 (default), the stress test programm will be restarted when an error # occurs and the core that caused the error will be skipped on the next iteration @@ -924,6 +931,9 @@ function Test-ProcessUsage { # Store the core number in the array $Script:coresWithError += $coreNumber + # Count the number of errors per core + $Script:coresWithErrorsCounter[$coreNumber]++ + # If Hyperthreading / SMT is enabled and the number of threads larger than 1 if ($isHyperthreadingEnabled -and ($settings.numberOfThreads -gt 1)) { $cpuNumbersArray = @($coreNumber, ($coreNumber + 1)) @@ -1183,6 +1193,14 @@ $expectedUsage = [Math]::Round(100 / $numLogicalCores * $settings.numberOfThread [Int[]] $coresWithError = @() +# Count the number of errors for each cores if the skipOnError setting is 0 +$coresWithErrorsCounter = @{} + +for ($i = 0; $i -lt $numPhysCores; $i++) { + $coresWithErrorsCounter[$i] = 0 +} + + # Check the CPU usage each x seconds # Note: 15 seconds may fail if there was an error and Prime95 was restarted -> false positive # 20 seconds may work fine, but it's probably best to wait for longer on the first check @@ -1415,17 +1433,33 @@ Write-ColorText('--------------------------------------------------------------- Write-ColorText('----------- CoreCycler v' + $version + ' started at ' + $timestamp + ' -----------') Green Write-ColorText('---------------------------------------------------------------------------') Green -# Display the number of logical & physical cores -Write-ColorText('Found ' + $numLogicalCores + ' logical and ' + $numPhysCores + ' physical cores') Cyan -Write-ColorText('Hyperthreading / SMT is: ' + ($(if ($isHyperthreadingEnabled) { 'ON' } else { 'OFF' }))) Cyan +# Verbosity +if ($settings.verbosityMode -eq 1) { + Write-ColorText('Verbose mode is ENABLED: Writing to log file') Cyan +} +elseif ($settings.verbosityMode -eq 2) { + Write-ColorText('Verbose mode is ENABLED: Displaying in terminal') Cyan +} + +# Display some initial information +Write-ColorText('Selected test mode: ....... ' + $settings.mode) Cyan +Write-ColorText('Logical/Physical cores: ... ' + $numLogicalCores + ' logical / ' + $numPhysCores + ' physical cores') Cyan +Write-ColorText('Hyperthreading / SMT is: .. ' + ($(if ($isHyperthreadingEnabled) { 'ON' } else { 'OFF' }))) Cyan Write-ColorText('Selected number of threads: ' + $settings.numberOfThreads) Cyan -Write-ColorText('Number of iterations: ' + $settings.maxIterations) Cyan +Write-ColorText('Runtime per core: ......... ' + (Get-FormattedRuntimePerCoreString $settings.runtimePerCore)) Cyan +Write-ColorText('Number of iterations: ..... ' + $settings.maxIterations) Cyan -# And the selected mode (SSE, AVX, AVX2) -Write-ColorText('Selected mode: ' + $settings.mode) Cyan +# Print a message if we're ignoring certain cores +if ($settings.coresToIgnore.Length -gt 0) { + $settings.coresToIgnoreString = (($settings.coresToIgnore | sort) -join ', ') + Write-ColorText('Ignored cores: ............ ' + $settings.coresToIgnoreString) Cyan +} if ($settings.mode -eq 'CUSTOM') { + Write-ColorText('') Cyan + Write-ColorText('---------------------------------------------------------------------------') Cyan Write-ColorText('Custom settings:') Cyan + Write-ColorText('----------------') Cyan Write-ColorText('CpuSupportsAVX = ' + $settings.customCpuSupportsAVX) Cyan Write-ColorText('CpuSupportsAVX2 = ' + $settings.customCpuSupportsAVX2) Cyan Write-ColorText('CpuSupportsFMA3 = ' + $settings.customCpuSupportsFMA3) Cyan @@ -1435,28 +1469,13 @@ if ($settings.mode -eq 'CUSTOM') { Write-ColorText('TortureTime = ' + $settings.customTortureTime) Cyan } else { - Write-ColorText('Selected FFT size: ' + $settings.FFTSize + ' (' + $minFFTSize + 'K - ' + $maxFFTSize + 'K)') Cyan -} - -# Verbosity -if ($settings.verbosityMode -eq 1) { - Write-ColorText('Verbose mode is ENABLED: Writing to log file') Cyan -} -elseif ($settings.verbosityMode -eq 2) { - Write-ColorText('Verbose mode is ENABLED: Displaying in terminal') Cyan + if ($settings.stressTestProgram -eq 'prime95') { + Write-ColorText('Selected FFT size: ........ ' + $settings.FFTSize + ' (' + $minFFTSize + 'K - ' + $maxFFTSize + 'K)') Cyan + } } Write-ColorText('---------------------------------------------------------------------------') Cyan - -# Print a message if we're ignoring certain cores -if ($settings.coresToIgnore.Length -gt 0) { - $settings.coresToIgnoreString = (($settings.coresToIgnore | sort) -join ', ') - Write-ColorText('Ignored cores: ' + $settings.coresToIgnoreString) Cyan - Write-ColorText('---------------------------------------------------------------------------') Cyan -} - - # Display the results.txt file name for Prime95 for this run Write-ColorText('Prime95''s results are being stored in:') Cyan Write-ColorText($primeResultsPath) Cyan @@ -1465,13 +1484,12 @@ Write-ColorText($primeResultsPath) Cyan Write-ColorText('') Cyan Write-ColorText('The path of the CoreCycler log file is:') Cyan Write-ColorText($logfilePath) Cyan - +Write-ColorText('---------------------------------------------------------------------------') Cyan # Try to get the affinity of the Prime95 process. If not found, abort try { $null = $process.ProcessorAffinity - Write-Verbose('') Write-Verbose('The current affinity of the process: ' + $process.ProcessorAffinity) } catch { @@ -1492,7 +1510,8 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { $timestamp = Get-Date -format HH:mm:ss # Check if all of the cores have thrown an error, and if so, abort - if ($coresWithError.Length -eq ($numPhysCores - $settings.coresToIgnore.Length)) { + # Only if the skipOnError setting is set + if ($settings.skipOnError -and $coresWithError.Length -eq ($numPhysCores - $settings.coresToIgnore.Length)) { # Also close the Prime95 process to not let it run unnecessarily Close-Prime95 @@ -1547,8 +1566,8 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { continue } - # If this core is stored in the error core array - if ($coresWithError -contains $coreNumber) { + # If this core is stored in the error core array, skip it + if ($settings.skipOnError -and $coresWithError -contains $coreNumber) { Write-Text($timestamp + ' - Core ' + $coreNumber + ' (CPU ' + $cpuNumberString + ') has previously thrown an error, skipping') continue } @@ -1596,6 +1615,15 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { } Write-Verbose('Successfully set the affinity to ' + $affinity) + + # If this core is stored in the error core array and the skipOnError setting is not set, display the amount of errors + if (!$settings.skipOnError -and $coresWithError -contains $coreNumber) { + $text = ' Note: This core has previously thrown ' + $coresWithErrorsCounter[$coreNumber] + ' error' + $text += $(if ($coresWithErrorsCounter[$coreNumber] -gt 1) {'s'}) + + Write-Text($text) + } + Write-Text(' Running for ' + (Get-FormattedRuntimePerCoreString $settings.runtimePerCore) + '...') @@ -1647,7 +1675,31 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { # Print out the cores that have thrown an error so far if ($coresWithError.Length -gt 0) { - Write-ColorText('The following cores have thrown an error: ' + (($coresWithError | sort) -join ', ')) Blue + if ($settings.skipOnError) { + Write-ColorText('The following cores have thrown an error: ' + (($coresWithError | sort) -join ', ')) Blue + } + else { + Write-ColorText('The following cores have thrown an error:') Blue + + foreach ($entry in ($coresWithErrorsCounter.GetEnumerator() | Sort Name)) { + # No error, skip + if ($entry.Value -lt 1) { + continue + } + + $coreText = $(if ($entry.Name -lt 10) {' '}) + $coreText += $entry.Name.ToString() + + $textErrors = 'error' + $textIterations = 'iteration' + + $textErrors += $(if ($entry.Value -gt 1) {'s'}) + $textIterations += $(if ($iteration -gt 1) {'s'}) + + Write-ColorText(' - Core ' + $coreText + ': ' + $entry.Value.ToString() + ' ' + $textErrors + ' in ' + $iteration + ' ' + $textIterations) Blue + } + } + } } From 3274d7550f54bec4a72bf67c993c82213945d23c Mon Sep 17 00:00:00 2001 From: sp00n Date: Sat, 13 Mar 2021 00:34:54 +0100 Subject: [PATCH 04/12] Updated the skipOnError output. --- script-corecycler.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index e07a296..01479cd 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -1680,6 +1680,15 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { } else { Write-ColorText('The following cores have thrown an error:') Blue + + $coreWithTwoDigitsHasError = $false + + foreach ($entry in $coresWithErrorsCounter.GetEnumerator()) { + if ( $entry.Name -gt 9 -and $entry.Value -gt 0) { + $coreWithTwoDigitsHasError = $true + break + } + } foreach ($entry in ($coresWithErrorsCounter.GetEnumerator() | Sort Name)) { # No error, skip @@ -1687,7 +1696,8 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { continue } - $coreText = $(if ($entry.Name -lt 10) {' '}) + $corePadding = $(if ($coreWithTwoDigitsHasError) {' '} else {''}) + $coreText = $(if ($entry.Name -lt 10) {$corePadding}) $coreText += $entry.Name.ToString() $textErrors = 'error' From 2cb894847c154db6108c80664ffd61f14f6fa1b5 Mon Sep 17 00:00:00 2001 From: sp00n Date: Sat, 13 Mar 2021 00:41:34 +0100 Subject: [PATCH 05/12] The skipOnError default setting was incorrectly set. --- config.default.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.default.ini b/config.default.ini index 60c3fba..35b3f1f 100644 --- a/config.default.ini +++ b/config.default.ini @@ -30,7 +30,7 @@ runtimePerCore = 360 # Skip a core that has thrown an error on the following iterations # If set to 0, this will test a core on the next iterations even if has thrown an error before # Default: 1 -skipOnError = 0 +skipOnError = 1 # Stop the whole testing process if an error occurred From c496186be41346d8d048d768f18edde1b79883db Mon Sep 17 00:00:00 2001 From: sp00n Date: Sat, 13 Mar 2021 00:48:30 +0100 Subject: [PATCH 06/12] Added a new FAQ entry regarding script freezes when you click into the terminal window. --- readme.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.txt b/readme.txt index 51eb8c7..046d1e7 100644 --- a/readme.txt +++ b/readme.txt @@ -149,6 +149,11 @@ A: The errors may actually come from your overclocked RAM and not your CPU direc After you're sure that both overclocks are stable on their own, you can combine them and check for instabilities again. +Q: My script freezes! It appears to be running but I see no new output! +A: PowerShell scripts seem to freeze when you select some text or click with the mouse into the terminal window (which + selects the current position of your cursor). Try to hit Return and see if the execution continues. + See e.g. here: https://stackoverflow.com/questions/3204423/long-running-powershell-script-freezes + From ba16174d086a023f4ec1df6e3f571d0aabc25193 Mon Sep 17 00:00:00 2001 From: sp00n Date: Tue, 16 Mar 2021 23:32:15 +0100 Subject: [PATCH 07/12] Fixed a bug with the localized process counters. --- script-corecycler.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index 01479cd..baf4a1e 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.7.9.0 + 0.7.9.1 .DESCRIPTION Sets the affinity of the Prime95 process to only one core and cycles through all the cores to test the stability of a Curve Optimizer setting @@ -17,7 +17,7 @@ #> # Global variables -$version = '0.7.9.0' +$version = '0.7.9.1' $curDateTime = Get-Date -format yyyy-MM-dd_HH-mm-ss $settings = $null $logFilePath = $null @@ -235,7 +235,7 @@ function Get-PerformanceCounterIDs { $counterId = [Int]$allCounters[$i] $counterName = [String]$allCounters[$i+1] - if ($englishCounterNames.Contains($counterName)) { + if ($englishCounterNames.Contains($counterName) -and !$countersHash.ContainsKey($counterName)) { $countersHash[$counterName] = $counterId } From 4792f3c194a8e4418399077bd321b08817258324 Mon Sep 17 00:00:00 2001 From: sp00n Date: Wed, 17 Mar 2021 00:52:44 +0100 Subject: [PATCH 08/12] Backported a couple of fixes from the v8 branch. --- script-corecycler.ps1 | 247 ++++++++++++++++++++++++++++++++---------- 1 file changed, 188 insertions(+), 59 deletions(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index baf4a1e..2db8f9e 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.7.9.1 + 0.7.9.2 .DESCRIPTION Sets the affinity of the Prime95 process to only one core and cycles through all the cores to test the stability of a Curve Optimizer setting @@ -17,7 +17,7 @@ #> # Global variables -$version = '0.7.9.1' +$version = '0.7.9.2' $curDateTime = Get-Date -format yyyy-MM-dd_HH-mm-ss $settings = $null $logFilePath = $null @@ -149,6 +149,30 @@ function Write-Text { } +<## + # Write an error message to the screen and to the log file + # .PARAM array $errorArray An array with the text entries to output + # .RETURN void + #> +function Write-ErrorText { + param( + $errorArray + ) + + foreach ($entry in $errorArray) { + $lines = @() + $lines += $entry.Exception.Message + $lines += $entry.InvocationInfo.PositionMessage + $lines += (' + CategoryInfo : ' + $entry.CategoryInfo.Category + ': (' + $entry.CategoryInfo.TargetName + ':' + $entry.CategoryInfo.TargetType + ') [' + $entry.CategoryInfo.Activity + '], ' + $entry.CategoryInfo.Reason) + $lines += (' + FullyQualifiedErrorId : ' + $entry.FullyQualifiedErrorId) + $string = $lines | Out-String + + Write-Host $string -ForegroundColor Red + Add-Content $logFilePath ($string) + } +} + + <## # Write a message to the screen with a specific color and to the log file # .PARAM string $text The text to output @@ -598,16 +622,64 @@ function Get-Prime95WindowHandler { # 'Prime95 - Not running': worker not running anymore # 'Prime95 - Waiting for work': worker not running, tried to start, no worker started # 'Prime95': worker not yet started + $windowNames = @( + '^Prime95 \- Self\-Test$' + '^Prime95 \- Not running$' + '^Prime95 \- Waiting for work$' + '^Prime95$' + ) + + Write-Verbose('Trying to get the Prime95 window handler'); + Write-Verbose('Looking for these window names:') + Write-Verbose(($windowNames -Join ', ')) + $windowObj = [Api.Apidef]::GetWindows() | Where-Object { - $_.WinTitle -eq 'Prime95 - Self-Test' ` - -or $_.WinTitle -eq 'Prime95 - Not running' ` - -or $_.WinTitle -eq 'Prime95 - Waiting for work' ` - -or $_.WinTitle -eq 'Prime95' + $_.WinTitle -match ($windowNames -Join '|') + } + + Write-Verbose('Found the following window(s) with these names:') + + $windowObj | ForEach-Object { + $path = (Get-Process -Id $_.ProcessId).Path + Write-Verbose(' - WinTitle: ' + $_.WinTitle) + Write-Verbose(' ProcessId: ' + $_.ProcessId) + Write-Verbose(' Process Path: ' + $path) } + # There might be another window open with the name "Prime95" # Select the correct one - $filteredWindowObj = $windowObj | Where-Object {(Get-Process -Id $_.ProcessId).Path -like '*prime95.exe'} + Write-Verbose('Filtering the windows for ".*prime95\.exe$":') + + $filteredWindowObj = $windowObj | Where-Object { + (Get-Process -Id $_.ProcessId).Path -match ('.*prime95\.exe$') + } + + $filteredWindowObj | ForEach-Object { + $path = (Get-Process -Id $_.ProcessId).Path + Write-Verbose(' - WinTitle: ' + $_.WinTitle) + Write-Verbose(' ProcessId: ' + $_.ProcessId) + Write-Verbose(' Process Path: ' + $path) + } + + + # Multiple processes found with the same name AND process name + # Abort and let the user close these programs + if ($filteredWindowObj -is [Array]) { + Write-ColorText('FATAL ERROR: Could not find the correct Prime95 window!') Red + Write-ColorText('There exist multiple windows with the same name as the Prime95:') Red + + $filteredWindowObj | ForEach-Object { + $path = (Get-Process -Id $_.ProcessId).Path + Write-ColorText(' - Windows Title: ' + $_.WinTitle) Yellow + Write-ColorText(' Process Path: ' + $path) Yellow + Write-ColorText(' Process Id: ' + $_.ProcessId) Yellow + } + + Write-ColorText('Please close these windows and try again.') Red + Exit-WithFatalError + } + # Override the global script variables $Script:processWindowHandler = $filteredWindowObj.MainWindowHandle @@ -762,6 +834,7 @@ function Close-Prime95 { # If we now have a processWindowHandler, try to close the window if ($processWindowHandler) { $process = Get-Process -Id $processId -ErrorAction SilentlyContinue + $Error.Clear() Write-Verbose('Trying to gracefully close Prime95') @@ -780,6 +853,7 @@ function Close-Prime95 { # If the window is still here at this point, just kill the process $process = Get-Process $processName -ErrorAction SilentlyContinue + $Error.Clear() if ($process) { Write-Verbose('Could not gracefully close Prime95, killing the process') @@ -824,9 +898,11 @@ function Test-ProcessUsage { # Get the content of the results.txt file $resultFileHandle = Get-Item -Path $primeResultsPath -ErrorAction SilentlyContinue + $Error.Clear() # Does the process still exist? $process = Get-Process $processName -ErrorAction SilentlyContinue + $Error.Clear() # 1. The process doesn't exist anymore, immediate error @@ -878,6 +954,7 @@ function Test-ProcessUsage { if (!$primeError) { # Get the CPU percentage $processCPUPercentage = [Math]::Round(((Get-Counter $processCounterPathTime -ErrorAction SilentlyContinue).CounterSamples.CookedValue) / $numLogicalCores, 2) + $Error.Clear() Write-Verbose($timestamp + ' - ...checking CPU usage: ' + $processCPUPercentage + '%') @@ -914,6 +991,7 @@ function Test-ProcessUsage { $thisProcessCounterPathTime = $thisProcessCounterPathId -replace $counterNames['SearchString'], $counterNames['ReplaceString'] $thisProcessCPUPercentage = [Math]::Round(((Get-Counter $thisProcessCounterPathTime -ErrorAction SilentlyContinue).CounterSamples.CookedValue) / $numLogicalCores, 2) + $Error.Clear() Write-Verbose($timestamp + ' - ...checking CPU usage again: ' + $thisProcessCPUPercentage + '%') @@ -948,10 +1026,6 @@ function Test-ProcessUsage { } - # Try to close the Prime95 process if it is still running - Close-Prime95 - - # Put out an error message $timestamp = Get-Date -format HH:mm:ss Write-ColorText('ERROR: ' + $timestamp) Magenta @@ -961,33 +1035,53 @@ function Test-ProcessUsage { # DEBUG # Also add the 5 last rows of the results.txt file - #Write-Verbose('LAST 5 ROWS OF RESULTS.TXT:') - #Write-Verbose(Get-Item -Path $primeResultsPath | Get-Content -Tail 5) + #Write-Text('LAST 5 ROWS OF RESULTS.TXT:') + #Write-Text(Get-Item -Path $stressTestLogFilePath | Get-Content -Tail 5) # Try to determine the last run FFT size # If the results.txt doesn't exist, assume that it was on the very first iteration - # Note: Unfortunately Prime95 randomizes the FFT sizes for anything above Small FFT sizes + # Note: Unfortunately Prime95 randomizes the FFT sizes for anything above Large FFT sizes # So we cannot make an educated guess for these settings - if ($maxFFTSize -le $FFTMinMaxValues[$settings.mode]['Small'].Max) { + #if ($maxFFTSize -le $FFTMinMaxValues[$settings.mode]['Large'].Max) { + + # This check is taken from the Prime95 source code: + # if (fftlen > max_small_fftlen * 2) num_large_lengths++; + # The max smallest FFT size is 240, so starting with 480 the order should get randomized + # Large FFTs are not randomized, Huge FFTs and All FFTs are + # TODO: this doesn't seem right + #if ($minFFTSize -le ($FFTMinMaxValues[$settings.mode]['Small']['Min'] * 2)) { + + #if ($settings.FFTSize -eq 'Smallest' -or $settings.FFTSize -eq 'Small' -or $settings.FFTSize -eq 'Large') { + + # Temporary(?) solution + if ($maxFFTSize -le $FFTMinMaxValues['SSE']['Large']['Max']) { + Write-Verbose('The maximum FFT size is within the range where we can still make an educated guess about the failed FFT size') + + # No results file exists yet if (!$resultFileHandle) { + Write-Verbose('No results.txt exists yet, assuming the error happened on the first FFT size') $lastRunFFT = $minFFTSize } # Get the last couple of rows and find the last passed FFT size else { + Write-Verbose('Trying to find the last passed FFT sizes') + $lastFiveRows = $resultFileHandle | Get-Content -Tail 5 $lastPassedFFTArr = @($lastFiveRows | Where-Object {$_ -like '*passed*'}) - $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self-test (\d+)K passed' + $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self\-test (\d+)K passed' $lastPassedFFT = if ($matches -is [Hashtable] -or $matches -is [Array]) { [Int]$matches[1] } # $matches is a fixed(?) variable name for -match # No passed FFT was found, assume it's the first FFT size if (!$lastPassedFFT) { $lastRunFFT = $minFFTSize + Write-Verbose('No passed FFT was found, assume it was the first FFT size: ' + $lastRunFFT) } # If the last passed FFT size is the max selected FFT size, start at the beginning elseif ($lastPassedFFT -eq $maxFFTSize) { $lastRunFFT = $minFFTSize + Write-Verbose('The last passed FFT size is the max selected FFT size, use the min FFT size: ' + $lastRunFFT) } # If the last passed FFT size is not the max size, check if the value doesn't show up at all in the FFT array @@ -995,14 +1089,16 @@ function Test-ProcessUsage { # Example: Smallest FFT max = 21, but the actual last size tested is 20K elseif (!$FFTSizes[$cpuTestMode].Contains($lastPassedFFT)) { $lastRunFFT = $minFFTSize + Write-Verbose('The last passed FFT size does not show up in the FFTSizes array, assume it''s the first FFT size: ' + $lastRunFFT) } # If it's not the max value and it does show up in the FFT array, select the next value else { $lastRunFFT = $FFTSizes[$cpuTestMode][$FFTSizes[$cpuTestMode].indexOf($lastPassedFFT)+1] + Write-Verbose('Last passed FFT size found: ' + $lastRunFFT) } } - + # Educated guess if ($lastRunFFT) { Write-ColorText('ERROR: The error likely happened at FFT size ' + $lastRunFFT + 'K') Magenta @@ -1016,26 +1112,37 @@ function Test-ProcessUsage { Write-Text('') } + + # Only Smallest, Small and Large FFT presets follow the order, so no real FFT size fail detection is possible due to randomization of the order by Prime95 else { $lastFiveRows = $resultFileHandle | Get-Content -Tail 5 $lastPassedFFTArr = @($lastFiveRows | Where-Object {$_ -like '*passed*'}) - $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self-test (\d+)K passed' + $hasMatched = $lastPassedFFTArr[$lastPassedFFTArr.Length-1] -match 'Self\-test (\d+)K passed' $lastPassedFFT = if ($matches -is [Hashtable] -or $matches -is [Array]) { [Int]$matches[1] } # $matches is a fixed(?) variable name for -match if ($lastPassedFFT) { Write-ColorText('ERROR: The last *passed* FFT size before the error was: ' + $lastPassedFFT + 'K') Magenta - Write-ColorText('ERROR: Unfortunately FFT size fail detection only works for Smallest or Small FFT sizes.') Magenta + Write-ColorText('ERROR: Unfortunately FFT size fail detection only works for Smallest, Small or Large FFT sizes.') Magenta } else { Write-ColorText('ERROR: No additional FFT size information found in the results.txt') Magenta } + Write-Verbose('The max FFT size was outside of the range where it still follows a numerical order') + Write-Verbose('The selected max FFT size: ' + $maxFFTSize) + Write-Verbose('The limit for the numerical order: ' + $FFTMinMaxValues['SSE']['Large']['Max']) + + Write-Verbose('The last 5 entries in the results.txt:') Write-Verbose($lastFiveRows -Join ', ') Write-Text('') } + # Try to close the stress test program process if it is still running + Write-Verbose('Trying to close Prime95 to re-start it') + Close-Prime95 + # If the stopOnError flag is set, stop at this point if ($settings.stopOnError) { @@ -1070,7 +1177,11 @@ function Test-ProcessUsage { # Throw an error to let the caller know there was an error - throw 'Prime95 seems to have stopped with an error at Core ' + $coreNumber + ' (CPU ' + $cpuNumberString + ')' + #throw ('Prime95 seems to have stopped with an error at Core ' + $coreNumber + ' (CPU ' + $cpuNumberString + ')') + # Use a fixed value to be able to differentiate between a "real" error and this info + # System.ApplicationException + # System.Activities.WorkflowApplicationAbortedException + throw '999' } } @@ -1081,35 +1192,8 @@ function Test-ProcessUsage { #> -# Get the localized counter names -try { - $counterNameIds = Get-PerformanceCounterIDs $englishCounterNames - - $counterNames['Process'] = Get-PerformanceCounterLocalName $counterNameIds['Process'] - $counterNames['ID Process'] = Get-PerformanceCounterLocalName $counterNameIds['ID Process'] - $counterNames['% Processor Time'] = Get-PerformanceCounterLocalName $counterNameIds['% Processor Time'] - $counterNames['FullName'] = "\" + $counterNames['Process'] + "(*)\" + $counterNames['ID Process'] - $counterNames['SearchString'] = '\\' + $counterNames['ID Process'] + '$' - $counterNames['ReplaceString'] = '\' + $counterNames['% Processor Time'] - - # Examples - # English: ID Process - # German: Prozesskennung - # English: % Processor Time - # German: Prozessorzeit (%) -} -catch { - Write-Host 'FATAL ERROR: Could not get the localized Performance Process Counter name!' -ForegroundColor Red - Write-Host - Write-Host 'You may need to re-enable the Performance Process Counter (PerfProc).' -ForegroundColor Red - Write-Host 'Please see the "Troubleshooting / FAQ" section in the readme.txt.' -ForegroundColor Red - Write-Host - - $Error - - Read-Host -Prompt 'Press Enter to exit' - exit -} +# Get the default and the user settings +Get-Settings # Error Checks @@ -1140,6 +1224,37 @@ if (!$hasDotNet3_5 -and !$hasDotNet4_0 -and !$hasDotNet4_x) { $Error.clear() +# Trry to get the localized counter names +try { + $counterNameIds = Get-PerformanceCounterIDs $englishCounterNames + + $counterNames['Process'] = Get-PerformanceCounterLocalName $counterNameIds['Process'] + $counterNames['ID Process'] = Get-PerformanceCounterLocalName $counterNameIds['ID Process'] + $counterNames['% Processor Time'] = Get-PerformanceCounterLocalName $counterNameIds['% Processor Time'] + $counterNames['FullName'] = "\" + $counterNames['Process'] + "(*)\" + $counterNames['ID Process'] + $counterNames['SearchString'] = '\\' + $counterNames['ID Process'] + '$' + $counterNames['ReplaceString'] = '\' + $counterNames['% Processor Time'] + + # Examples + # English: ID Process + # German: Prozesskennung + # English: % Processor Time + # German: Prozessorzeit (%) +} +catch { + Write-Host 'FATAL ERROR: Could not get the localized Performance Process Counter name!' -ForegroundColor Red + Write-Host + Write-Host 'You may need to re-enable the Performance Process Counter (PerfProc).' -ForegroundColor Red + Write-Host 'Please see the "Troubleshooting / FAQ" section in the readme.txt.' -ForegroundColor Red + Write-Host + + $Error + + Read-Host -Prompt 'Press Enter to exit' + exit +} + + # Try to access the Performance Process Counter # It may be disabled @@ -1173,13 +1288,9 @@ Add-Type -TypeDefinition $GetWindowDefinition Add-Type -TypeDefinition $CloseWindowDefinition -# Get the default and the user settings -Get-Settings - - - # The Prime95 process $process = Get-Process $processName -ErrorAction SilentlyContinue +$Error.Clear() # The expected CPU usage for the running Prime95 process @@ -1469,9 +1580,7 @@ if ($settings.mode -eq 'CUSTOM') { Write-ColorText('TortureTime = ' + $settings.customTortureTime) Cyan } else { - if ($settings.stressTestProgram -eq 'prime95') { - Write-ColorText('Selected FFT size: ........ ' + $settings.FFTSize + ' (' + $minFFTSize + 'K - ' + $maxFFTSize + 'K)') Cyan - } + Write-ColorText('Selected FFT size: ........ ' + $settings.FFTSize + ' (' + $minFFTSize + 'K - ' + $maxFFTSize + 'K)') Cyan } Write-ColorText('---------------------------------------------------------------------------') Cyan @@ -1651,7 +1760,17 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { # On error, the Prime95 process is not running anymore, so skip this core catch { - continue coreLoop + Write-Verbose('There has been some error in Test-ProcessUsage, checking') + + if ($Error -and $Error[0].ToString() -eq '999') { + Write-Verbose('Prime95 seems to have stopped with an error at Core ' + $coreNumber + ' (CPU ' + $cpuNumberString + ')') + continue coreLoop + } + else { + Write-ColorText('FATAL ERROR:') Red + Write-ErrorText $Error + Exit-WithFatalError + } } } @@ -1665,7 +1784,17 @@ for ($iteration = 1; $iteration -le $settings.maxIterations; $iteration++) { # On error, the Prime95 process is not running anymore, so skip this core catch { - continue + Write-Verbose('There has been some error in Test-ProcessUsage, checking') + + if ($Error -and $Error[0] -eq '999') { + Write-Verbose('Prime95 seems to have stopped with an error at Core ' + $coreNumber + ' (CPU ' + $cpuNumberString + ')') + continue + } + else { + Write-ColorText('FATAL ERROR:') Red + Write-ErrorText $Error + Exit-WithFatalError + } } $timestamp = (Get-Date).ToString("HH:mm:ss") From 59334973695d6aef5b571ecd5bb0ac9863f0b0e2 Mon Sep 17 00:00:00 2001 From: sp00n Date: Thu, 1 Apr 2021 21:58:02 +0200 Subject: [PATCH 09/12] Fixed a bug with the affinity for 16 cores CPUs (again). --- script-corecycler.ps1 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index 273034e..8fc4e2a 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -2,7 +2,7 @@ .AUTHOR sp00n .VERSION - 0.8.0.0 RC5 + 0.8.0.0 .DESCRIPTION Sets the affinity of the selected stress test program process to only one core and cycles through all the cores to test the stability of a Curve Optimizer setting @@ -17,7 +17,7 @@ #> # Global variables -$version = '0.8.0.0 RC5' +$version = '0.8.0.0' $startDateTime = Get-Date -format yyyy-MM-dd_HH-mm-ss $logFilePath = 'logs' $logFilePathAbsolute = $PSScriptRoot + '\' + $logFilePath + '\' @@ -3658,7 +3658,7 @@ try { $startDateThisCore = (Get-Date) $endDateThisCore = $startDateThisCore + (New-TimeSpan -Seconds $settings.General.runtimePerCore) $timestamp = $startDateThisCore.ToString("HH:mm:ss") - $affinity = [System.IntPtr][Int64] 0 + $affinity = [Int64] 0 $actualCoreNumber = [Int] $coreTestOrderArray[0] $cpuNumbersArray = @() @@ -3671,7 +3671,7 @@ try { # We don't care about Hyperthreading / SMT here, it needs to be enabled for 2 threads $thisCPUNumber = ($actualCoreNumber * 2) + $currentThread $cpuNumbersArray += $thisCPUNumber - $affinity += [System.IntPtr][Int64] [Math]::Pow(2, $thisCPUNumber) + $affinity += [Int64] [Math]::Pow(2, $thisCPUNumber) } } @@ -3681,7 +3681,7 @@ try { # Otherwise, it's the same value $cpuNumber = $actualCoreNumber * (1 + [Int] $isHyperthreadingEnabled) $cpuNumbersArray += $cpuNumber - $affinity = [System.IntPtr][Int64] [Math]::Pow(2, $cpuNumber) + $affinity = [Int64] [Math]::Pow(2, $cpuNumber) } Write-Verbose('The selected core to test: ' + $actualCoreNumber) @@ -3721,7 +3721,7 @@ try { Write-ColorText(' Apparently Aida64 doesn''t like running the stress test on the first thread of Core 0.') Black Yellow Write-ColorText(' Setting it to thread 2 of Core 0 instead (Core 0 CPU 1).') Black Yellow - $affinity = [System.IntPtr][Int64] 2 + $affinity = [Int64] 2 $cpuNumber = 1 $cpuNumberString = 1 } @@ -3781,9 +3781,6 @@ try { $timestamp = (Get-Date).ToString("HH:mm:ss") Write-Text($timestamp + ' - Set to Core ' + $actualCoreNumber + ' (CPU ' + $cpuNumberString + ')') - # We need System.IntPtr for the affinity - $affinity = [System.IntPtr][Int64] $affinity - # Set the affinity to a specific core try { Write-Verbose('Setting the affinity to ' + $affinity) From 298c38c17f80dccaf7f42669a83cbbfb7ba094ff Mon Sep 17 00:00:00 2001 From: sp00n Date: Thu, 1 Apr 2021 22:03:55 +0200 Subject: [PATCH 10/12] Forgot to remove one System.IntPtr for the Affinity (even though it shouldn't harm at this point). --- script-corecycler.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script-corecycler.ps1 b/script-corecycler.ps1 index 8fc4e2a..854ef5f 100644 --- a/script-corecycler.ps1 +++ b/script-corecycler.ps1 @@ -3793,7 +3793,7 @@ try { Start-Sleep -Milliseconds 300 try { - $stressTestProcess.ProcessorAffinity = [System.IntPtr][Int64] $affinity + $stressTestProcess.ProcessorAffinity = $affinity } catch { Close-StressTestProgram From 2fbe1f7c280e8e110c06832707c5c5c8a744cab2 Mon Sep 17 00:00:00 2001 From: sp00n Date: Sat, 3 Apr 2021 19:05:48 +0200 Subject: [PATCH 11/12] Comment change --- config.default.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.default.ini b/config.default.ini index d49305b..696ba7f 100644 --- a/config.default.ini +++ b/config.default.ini @@ -27,7 +27,7 @@ stressTestProgram = PRIME95 # - Prime95 "Huge": 8960K to MAX - [SSE] ~13-19 Minutes <|> [AVX] ~27-40 Minutes <|> [AVX2] ~33-51 Minutes # - Prime95 "All": 4K to MAX - [SSE] ~40-65 Minutes <|> [AVX] ~92-131 Minutes <|> [AVX2] ~102-159 Minutes # - Prime95 "Moderate": 1344K to 4096K - [SSE] TBD Minutes <|> [AVX] TBD Minutes <|> [AVX2] TBD Minutes -# - Prime95 "Heavy": 4K to 1344K - [SSE] ~15-28 Minutes <|> [AVX] ~75-90 TBD Minutes <|> [AVX2] ~88-99 Minutes +# - Prime95 "Heavy": 4K to 1344K - [SSE] ~15-28 Minutes <|> [AVX] ~75-90 Minutes <|> [AVX2] ~88-99 Minutes # - Prime95 "HeavyShort": 4K to 160K - [SSE] ~6-8 Minutes <|> [AVX] ~22-24 Minutes <|> [AVX2] ~23-25 Minutes # - Y-Cruncher: ~10 Minutes # Default: 360 From 64d7c5f61a1e34f7e1f49f6e135e91bbb2a6ed38 Mon Sep 17 00:00:00 2001 From: sp00n Date: Sat, 3 Apr 2021 19:18:31 +0200 Subject: [PATCH 12/12] Updated readme to Prime95 30.5b2 --- readme.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index 4bbbb5d..8edecac 100644 --- a/readme.txt +++ b/readme.txt @@ -29,10 +29,10 @@ Also, PBO technically voids the warranty of your CPU, so use it at your own risk INCLUDED SOFTWARE ----------------- -The script itself is a PowerShell script, but it uses the included Prime95 version 30.4b9 to actually do the stress -testing. You can also move your own copy of Prime95 into the /p95 directory if you want to be on the safe side (good -choice!). -To download Prime95, go to the official site at https://www.mersenne.org/download/ (however, the 30.4 version used +The script itself is a PowerShell script, but it uses the included Prime95 version 30.5b2 to actually do the stress +testing. You can also move your own copy of Prime95 into the /test_programs/p95 directory if you want to be on the +safe side (good choice!). +To download Prime95, go to the official site at https://www.mersenne.org/download/ (however, the 30.5 version used here is at the time of writing only available through their forum). Beginning with version 0.8 it also supports Aida64 and Y-Cruncher, however it does NOT include Aida64 by default.