Files
ML-Porosity/scripts/run_p3.ps1
holale 9976abc96b Complete P3 F3 evaluation and Windows execution
Implement the frozen F3 protocol, nested LOWO, posterior label banks,
ablations, diagnostics, checkpoint validation and full-volume inference.
Record the negative G-C result: improvement at 1/4 wells, coverage80 52.38%
and coverage90 60.91%, with unchanged thresholds and historical P2 results.

Add native Windows logging, the RTX 3060 environment lock, detached runs,
and an audited dashboard-lock recovery that preserves frozen scientific code.
Update report.html, the plan and agent guidance with completed P3 status.
Archive thesis sources under code_thesis with identical Git blobs and record
the original-output audit without committing large data or model artifacts.

Validation: 129 tests passed, 13 skipped; CUDA end-to-end smoke passed;
completion audit verified 1,320 checkpoint/prediction pairs, 28 registration
bundles and all 649 interior volume inlines. Scripts 04 and 09 were not rerun.

Co-authored-by: Codex <codex@openai.com>
2026-10-28 07:01:08 +07:00

41 lines
1.9 KiB
PowerShell

param(
[ValidateSet('status','prepare','benchmark','benchmark-registration','lock','register','train','diagnostics','summarize','all')]
[string]$Stage = 'all',
[ValidatePattern('^(cuda:[0-9]+|cpu)$')][string]$Device = 'cuda:0',
[ValidateRange(1,8)][int]$Workers = 4,
[switch]$Detach,
[switch]$Smoke,
[switch]$Sections,
[switch]$SkipVolume
)
$ErrorActionPreference = 'Stop'
$p3Workspace = Split-Path -Parent $PSScriptRoot
$p3Python = Join-Path $p3Workspace '.venv/Scripts/python.exe'
$env:OMP_NUM_THREADS = '2'
$env:MKL_NUM_THREADS = '2'
$env:OPENBLAS_NUM_THREADS = '2'
$env:NUMBA_NUM_THREADS = '2'
$env:PYTHONUTF8 = '1'
$env:PYTHONHASHSEED = '0'
$env:CUBLAS_WORKSPACE_CONFIG = ':4096:8'
$p3Arguments = @('-X','utf8','-m','ml_porosity.runlog','-n',"p3_$Stage",'--',
$p3Python,'-X','utf8',(Join-Path $PSScriptRoot '19_run_f3.py'),$Stage,
'--device',$Device,'--workers',"$Workers")
if ($Smoke) { $p3Arguments += '--smoke' }
if ($Sections) { $p3Arguments += '--sections' }
if ($SkipVolume) { $p3Arguments += '--skip-volume' }
if ($Detach) {
$p3LogDirectory = Join-Path $p3Workspace 'logs/runs'
New-Item -ItemType Directory -Path $p3LogDirectory -Force | Out-Null
$p3Stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
$p3QuotedArguments = $p3Arguments | ForEach-Object { '"' + $_.Replace('"','\"') + '"' }
$p3Process = Start-Process -FilePath $p3Python -ArgumentList $p3QuotedArguments -WorkingDirectory $p3Workspace `
-WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $p3LogDirectory "${p3Stamp}_p3_stdout.log") `
-RedirectStandardError (Join-Path $p3LogDirectory "${p3Stamp}_p3_stderr.log")
Write-Output "P3 detached: PID $($p3Process.Id). Track report.html and outputs/p3/progress.json."
} else {
Push-Location $p3Workspace
try { & $p3Python @p3Arguments; if ($LASTEXITCODE -ne 0) { throw "P3 exited with code $LASTEXITCODE" } }
finally { Pop-Location }
}