Skip to content

Commit 3c318e3

Browse files
committed
- Fixed another bug with the Linpack path, which was introduced by the last two bug fixes
- Ryzen 9000 is unfortunately not supported yet for the Automatic Test Mode
1 parent ef8e802 commit 3c318e3

File tree

2 files changed

+150
-84
lines changed

2 files changed

+150
-84
lines changed

configs/default.config.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ memory = 2GB
522522
# Also note that enabling this setting will require the script to be run with administrator privileges
523523
# And lastly, enabling it will set "skipCoreOnError" to 0 and "stopOnError" to 0 as long as the limit has not been reached
524524
#
525-
# IMPORTANT: This is currently untested for Ryzen 9000 (Zen 5) CPUs
525+
# IMPORTANT: This currently does NOT work for Ryzen 9000 (Zen 5) CPUs :(
526526
# IMPORTANT: The automatically adjusted Curve Optimizer / voltage offset values are NOT permanent, so after a regular reboot they
527527
# will not be applied anymore
528528
# If you want to permanently set these values, you will need to set them in the BIOS, or use a startup script to

script-corecycler.ps1

+149-83
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.AUTHOR
33
sp00n
44
.VERSION
5-
0.10.0.0alpha3
5+
0.10.0.0alpha4
66
.DESCRIPTION
77
Sets the affinity of the selected stress test program process to only one
88
core and cycles through all the cores which allows to test the stability of
@@ -23,7 +23,7 @@ param(
2323

2424

2525
# Our current version
26-
$version = '0.10.0.0alpha3'
26+
$version = '0.10.0.0alpha4'
2727

2828

2929
# This defines the strict mode
@@ -723,7 +723,7 @@ memory = 2GB
723723
# Also note that enabling this setting will require the script to be run with administrator privileges
724724
# And lastly, enabling it will set "skipCoreOnError" to 0 and "stopOnError" to 0 as long as the limit has not been reached
725725
#
726-
# IMPORTANT: This is currently untested for Ryzen 9000 (Zen 5) CPUs
726+
# IMPORTANT: This currently does NOT work for Ryzen 9000 (Zen 5) CPUs :(
727727
# IMPORTANT: The automatically adjusted Curve Optimizer / voltage offset values are NOT permanent, so after a regular reboot they
728728
# will not be applied anymore
729729
# If you want to permanently set these values, you will need to set them in the BIOS, or use a startup script to
@@ -4561,9 +4561,30 @@ function Initialize-AutomaticTestMode {
45614561
return
45624562
}
45634563

4564+
Write-Debug('Initializing Automatic Test Mode')
4565+
4566+
# This currently does not work on Ryzen 9000 :(
4567+
# Maybe also Ryzen 8000?
4568+
if ( $processor.Name -match '.*AMD.*' -and $processor.Name -match '9\d{3}' ) {
4569+
Write-Text('')
4570+
Write-Text('')
4571+
Write-ColorText('┌───────────────────────────────────┤ ERROR ├──────────────────────────────────┐') Yellow DarkRed
4572+
Write-ColorText('│ ' + 'You have selected to use the Automatic Test Mode.'.PadRight(76, ' ') + ' │') Yellow DarkRed
4573+
Write-ColorText('│ ' + 'Unfortunately this does not (yet) work with Ryzen 9000 processors, so please'.PadRight(76, ' ') + ' │') Yellow DarkRed
4574+
Write-ColorText('│ ' + 'disable the Automatic Test Mode in the config.ini file.'.PadRight(76, ' ') + ' │') Yellow DarkRed
4575+
Write-ColorText('│ ' + ''.PadRight(76, ' ') + ' │') Yellow DarkRed
4576+
Write-ColorText('│ ' + 'The detected processor:'.PadRight(76, ' ') + ' │') Yellow DarkRed
4577+
Write-ColorText('│ ' + $processor.Name.PadRight(76, ' ') + ' │') Yellow DarkRed
4578+
Write-ColorText('└──────────────────────────────────────────────────────────────────────────────┘') Yellow DarkRed
4579+
Write-Text('')
4580+
Write-Text('')
4581+
Write-ColorText('Exiting...') Red
4582+
Write-Text('')
4583+
4584+
Exit-Script
4585+
}
45644586

45654587
# The Automatic Test Mode has been enabled, we require administrator privileges!
4566-
Write-Debug('Initializing Automatic Test Mode')
45674588
Write-Debug('Are we admin: ' + $areWeAdmin)
45684589

45694590

@@ -8274,107 +8295,153 @@ function Test-StressTestProgrammIsRunning {
82748295

82758296
# Note: For two threads, the processor time is actually 2x the measure time
82768297
# We're handling this by using the "factor" variables
8277-
$measureTime = 100
8278-
$expectedTime = $measureTime * $factorForExpectedUsage # 100 * 1 for 1 thread = 100ms or 100 * 2 = 200ms for 2 threads
8279-
$minTime = $measureTime * $factorForMinProcessorTime # 50% usage of the expected usage
8280-
$waitTime = 2000
8281-
$maxChecks = 3
8298+
do {
8299+
$measureTime = 100
8300+
$expectedTime = $measureTime * $factorForExpectedUsage # 100 * 1 for 1 thread = 100ms or 100 * 2 = 200ms for 2 threads
8301+
$minTime = $measureTime * $factorForMinProcessorTime # 50% usage of the expected usage
8302+
$waitTime = 2000
8303+
$maxChecks = 3
82828304

8283-
$cpuTime1 = $checkProcess.UserProcessorTime.TotalSeconds
8284-
Start-Sleep -Milliseconds $measureTime
8285-
$cpuTime2 = $checkProcess.UserProcessorTime.TotalSeconds
8286-
$measuredTime = [Math]::Round(($cpuTime2 - $cpuTime1) * 1000, 0)
8305+
try {
8306+
$cpuTime1 = $checkProcess.UserProcessorTime.TotalSeconds
8307+
Start-Sleep -Milliseconds $measureTime
8308+
$cpuTime2 = $checkProcess.UserProcessorTime.TotalSeconds
8309+
}
82878310

8288-
# For 100% core usage, this should be 0.1 seconds time increase during 100 milliseconds
8289-
Write-Verbose($timestamp + ' - Checking CPU usage: ' + $measuredTime + 'ms (expected: ' + $expectedTime + 'ms, lower limit: ' + $minTime + 'ms)')
8311+
# We assume that the process doesn't exist anymore if this fails
8312+
catch {
8313+
$timestamp = Get-Date -Format HH:mm:ss
82908314

8291-
if ($measuredTime -le $minTime) {
8292-
# For Prime95
8293-
if ($isPrime95) {
8294-
# Look for a line with an "error" string in the new log entries
8295-
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*error.*' } | Select-Object -Last 1
8315+
# Does the stress test process still exist?
8316+
$checkProcess = Get-Process -Id $stressTestProcessId -ErrorAction Ignore
82968317

8297-
# Found the "error" string
8298-
if ($errorResults) {
8299-
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8300-
$stressTestError = $errorResults.Line
8301-
$errorType = 'CALCULATIONERROR'
8318+
Write-Debug($timestamp + ' - Checking for stress test errors')
8319+
8320+
if (!$checkProcess) {
8321+
$stressTestError = 'The ' + $selectedStressTestProgram + ' process doesn''t exist anymore.'
8322+
$errorType = 'PROCESSMISSING'
8323+
break
8324+
}
8325+
else {
8326+
throw $_
83028327
}
83038328
}
83048329

8330+
$measuredTime = [Math]::Round(($cpuTime2 - $cpuTime1) * 1000, 0)
83058331

8306-
# For y-cruncher with logging enabled
8307-
elseif ($isYCruncherWithLogging) {
8308-
# Look for a line with an "error" string in the new log entries
8309-
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*error\(s\).*' } | Select-Object -Last 1
8332+
# For 100% core usage, this should be 0.1 seconds time increase during 100 milliseconds
8333+
Write-Verbose($timestamp + ' - Checking CPU usage: ' + $measuredTime + 'ms (expected: ' + $expectedTime + 'ms, lower limit: ' + $minTime + 'ms)')
83108334

8311-
# Found the "error" string
8312-
if ($errorResults) {
8313-
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8314-
$stressTestError = $errorResults.Line
8315-
$errorType = 'CALCULATIONERROR'
8335+
if ($measuredTime -le $minTime) {
8336+
# For Prime95
8337+
if ($isPrime95) {
8338+
# Look for a line with an "error" string in the new log entries
8339+
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*error.*' } | Select-Object -Last 1
8340+
8341+
# Found the "error" string
8342+
if ($errorResults) {
8343+
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8344+
$stressTestError = $errorResults.Line
8345+
$errorType = 'CALCULATIONERROR'
8346+
}
83168347
}
8317-
}
83188348

8319-
# For Linpack
8320-
elseif ($isLinpack) {
8321-
# Look for a line with a "fail" string in the new log entries
8322-
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*fail.*' } | Select-Object -Last 1
83238349

8324-
# Found the "fail" string
8325-
if ($errorResults) {
8326-
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8327-
$stressTestError = $errorResults.Line
8328-
$errorType = 'CALCULATIONERROR'
8350+
# For y-cruncher with logging enabled
8351+
elseif ($isYCruncherWithLogging) {
8352+
# Look for a line with an "error" string in the new log entries
8353+
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*error\(s\).*' } | Select-Object -Last 1
8354+
8355+
# Found the "error" string
8356+
if ($errorResults) {
8357+
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8358+
$stressTestError = $errorResults.Line
8359+
$errorType = 'CALCULATIONERROR'
8360+
}
83298361
}
8330-
}
83318362

8363+
# For Linpack
8364+
elseif ($isLinpack) {
8365+
# Look for a line with a "fail" string in the new log entries
8366+
$errorResults = $newLogEntries | Where-Object { $_.Line -Match '.*fail.*' } | Select-Object -Last 1
83328367

8368+
# Found the "fail" string
8369+
if ($errorResults) {
8370+
# We don't need to check for a false alarm anymore, as we're already checking only new log entries
8371+
$stressTestError = $errorResults.Line
8372+
$errorType = 'CALCULATIONERROR'
8373+
}
8374+
}
83338375

8334-
# Error string still not found
8335-
# This might have been a false alarm, wait a bit and try again
8336-
if (!$stressTestError) {
8337-
# Repeat the CPU usage check $maxChecks times and only throw an error if the process hasn't recovered by then
8338-
for ($curCheck = 1; $curCheck -le $maxChecks; $curCheck++) {
8339-
$timestamp = Get-Date -Format HH:mm:ss
8340-
Write-Verbose($timestamp + ' - ...the CPU usage was too low, waiting ' + $waitTime + 'ms for another check...')
83418376

8342-
# Let's use the wait time as the measure time!
8343-
$measureTime = $waitTime
8344-
$cpuTime1 = $checkProcess.UserProcessorTime.TotalSeconds
8345-
Start-Sleep -Milliseconds $measureTime
8346-
$cpuTime2 = $checkProcess.UserProcessorTime.TotalSeconds
8347-
$measuredTime = [Math]::Round(($cpuTime2 - $cpuTime1) * 1000, 0)
83488377

8349-
$expectedTime = $measureTime * $factorForExpectedUsage
8350-
$minTime = $measureTime * $factorForMinProcessorTime
8378+
# Error string still not found
8379+
# This might have been a false alarm, wait a bit and try again
8380+
if (!$stressTestError) {
8381+
# Repeat the CPU usage check $maxChecks times and only throw an error if the process hasn't recovered by then
8382+
for ($curCheck = 1; $curCheck -le $maxChecks; $curCheck++) {
8383+
$timestamp = Get-Date -Format HH:mm:ss
8384+
Write-Verbose($timestamp + ' - ...the CPU usage was too low, waiting ' + $waitTime + 'ms for another check...')
8385+
8386+
# Let's use the wait time as the measure time!
8387+
try {
8388+
$measureTime = $waitTime
8389+
$cpuTime1 = $checkProcess.UserProcessorTime.TotalSeconds
8390+
Start-Sleep -Milliseconds $measureTime
8391+
$cpuTime2 = $checkProcess.UserProcessorTime.TotalSeconds
8392+
$measuredTime = [Math]::Round(($cpuTime2 - $cpuTime1) * 1000, 0)
8393+
8394+
$expectedTime = $measureTime * $factorForExpectedUsage
8395+
$minTime = $measureTime * $factorForMinProcessorTime
8396+
}
83518397

8352-
$timestamp = Get-Date -Format HH:mm:ss
8353-
Write-Verbose($timestamp + ' - Checking CPU usage again (#' + $curCheck + '): ' + $measuredTime + 'ms (expected: ' + $expectedTime + 'ms, lower limit: ' + $minTime + 'ms)')
8398+
# We assume that the process doesn't exist anymore if this fails
8399+
catch {
8400+
$timestamp = Get-Date -Format HH:mm:ss
83548401

8355-
# If we have recovered, break and continue with stresss testing
8356-
if ($measuredTime -ge $minTime) {
8357-
Write-Verbose(' The process seems to have recovered, continuing with stress testing')
8358-
break
8359-
}
8402+
# Does the stress test process still exist?
8403+
$checkProcess = Get-Process -Id $stressTestProcessId -ErrorAction Ignore
83608404

8361-
else {
8362-
if ($curCheck -lt $maxChecks) {
8363-
Write-Verbose(' Still not enough usage (#' + $curCheck + ')')
8405+
Write-Debug($timestamp + ' - Checking for stress test errors')
8406+
8407+
if (!$checkProcess) {
8408+
$stressTestError = 'The ' + $selectedStressTestProgram + ' process doesn''t exist anymore.'
8409+
$errorType = 'PROCESSMISSING'
8410+
}
8411+
else {
8412+
throw $_
8413+
}
8414+
8415+
break
8416+
}
8417+
8418+
$timestamp = Get-Date -Format HH:mm:ss
8419+
Write-Verbose($timestamp + ' - Checking CPU usage again (#' + $curCheck + '): ' + $measuredTime + 'ms (expected: ' + $expectedTime + 'ms, lower limit: ' + $minTime + 'ms)')
8420+
8421+
# If we have recovered, break and continue with stresss testing
8422+
if ($measuredTime -ge $minTime) {
8423+
Write-Verbose(' The process seems to have recovered, continuing with stress testing')
8424+
break
83648425
}
83658426

8366-
# Reached the maximum amount of checks for the CPU usage
83678427
else {
8368-
Write-Verbose(' Still not enough usage, throw an error')
8428+
if ($curCheck -lt $maxChecks) {
8429+
Write-Verbose(' Still not enough usage (#' + $curCheck + ')')
8430+
}
83698431

8370-
# We don't care about an error string here anymore
8371-
$stressTestError = 'The ' + $selectedStressTestProgram + ' process doesn''t use enough CPU power anymore (only ' + $measuredTime + 'ms instead of the expected ' + $expectedTime + 'ms)'
8372-
$errorType = 'CPULOAD'
8432+
# Reached the maximum amount of checks for the CPU usage
8433+
else {
8434+
Write-Verbose(' Still not enough usage, throw an error')
8435+
8436+
# We don't care about an error string here anymore
8437+
$stressTestError = 'The ' + $selectedStressTestProgram + ' process doesn''t use enough CPU power anymore (only ' + $measuredTime + 'ms instead of the expected ' + $expectedTime + 'ms)'
8438+
$errorType = 'CPULOAD'
8439+
}
83738440
}
83748441
}
83758442
}
83768443
}
8377-
}
8444+
} while (0)
83788445
}
83798446

83808447

@@ -10943,6 +11010,11 @@ try {
1094311010

1094411011
# Special handling for Linpack
1094511012
if ($testProgram.Name -eq 'linpack') {
11013+
if ($isLinpack) {
11014+
$Script:stressTestLogFileName = 'Linpack_' + $scriptStartDateTime + '_Version_' + $settings.Linpack.version + '_' + $settings.mode + '.log'
11015+
$Script:stressTestLogFilePath = $logFilePathAbsolute + $stressTestLogFileName
11016+
}
11017+
1094611018
$stressTestPrograms[$testProgram.Name]['fullPathToLoadExe'] = $testProgram.Value['absolutePath'] + $testProgram.Value['processNameForLoad']
1094711019

1094811020
$data['%fileName%'] = ($testProgram.Value['processNameForLoad'] + '.' + $testProgram.Value['processNameExt'])
@@ -11018,12 +11090,6 @@ try {
1101811090
$linpackMode = $(if ($settings.Linpack.version -eq '2018' -or $settings.Linpack.version -eq '2019') { $settings.Linpack.mode.ToUpperInvariant() } else { 'FASTEST' })
1101911091

1102011092
$data.add('%MKL_DEBUG_CPU_TYPE%', '$env:MKL_DEBUG_CPU_TYPE = ' + $MKL_DEBUG_CPU_TYPES[$linpackMode][$processorType] + ';')
11021-
11022-
11023-
if ($isLinpack) {
11024-
$Script:stressTestLogFileName = 'Linpack_' + $scriptStartDateTime + '_Version_' + $settings.Linpack.version + '_' + $settings.mode + '.log'
11025-
$Script:stressTestLogFilePath = $logFilePathAbsolute + $stressTestLogFileName
11026-
}
1102711093
}
1102811094

1102911095

@@ -12933,7 +12999,7 @@ try {
1293312999
'checkType' = 'LAST_ERROR_CHECK'
1293413000
'actualCoreNumber' = $actualCoreNumber
1293513001
'coreTestOrderArray' = $coreTestOrderArray
12936-
'coreIndex' = $coreIndex
13002+
'coreIndex' = [Ref] $coreIndex
1293713003
'ExceptionObj' = $_
1293813004
'ErrorObj' = $Error
1293913005
}

0 commit comments

Comments
 (0)