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>
This commit is contained in:
2026-10-28 07:01:08 +07:00
parent a22f9d951f
commit 9976abc96b
50 changed files with 2738 additions and 219 deletions

View File

@@ -12,6 +12,47 @@ python -m venv .venv
Dữ liệu F3 Demo 2023 đặt ở `data/F3_Demo_2023/F3_Demo_2023/`, dữ liệu Volve ở `data/Volve/`, LAS và TD của NLOG ở `data/NLOG/` (hoặc trỏ `ML_POROSITY_F3_ROOT` tới thư mục chứa `.survey`). Kết quả ghi vào `outputs/` (đổi bằng `ML_POROSITY_OUTPUTS`).
Code luận văn được lưu ở [`code_thesis/`](code_thesis/), các output gốc ở [`outputs_thesis/`](outputs_thesis/). SHA-256 của 7 artifact nằm trong [`data_manifest/thesis_outputs.json`](data_manifest/thesis_outputs.json); kết quả kiểm tra ngày 27/10/2026 ở [thesis-output-audit.md](docs/research/thesis-output-audit.md). Pipeline nghiên cứu ghi kết quả mới vào `outputs/`.
## P3 trên Windows / RTX 3060
Môi trường trên máy này: Python 3.12.16, PyTorch 2.11.0+cu128, driver NVIDIA
577.00, RTX 3060 12 GB và RAM 24 GB. Các phiên bản được lưu riêng trong
`requirements-windows-rtx3060.txt`; không thay bản khóa môi trường Linux.
Cài vào venv bằng `uv pip install --python .venv/Scripts/python.exe -r
requirements-windows-rtx3060.txt`, rồi cài project bằng `uv pip install --python
.venv/Scripts/python.exe --no-deps -e .`.
P3 dùng `configs/protocol_f3.yaml`. Bản khóa kèm theo lưu SHA-256 của protocol,
code, dữ liệu đầu vào và phiên bản thư viện. Checkpoint được chọn bằng ba vòng
validation bên trong, giếng ngoài chỉ dùng để chấm điểm. Đọc chi tiết rà soát
và giới hạn khoa học ở [p3-code-review.md](docs/research/p3-code-review.md).
```powershell
# Chỉ dùng khi chưa khóa/chưa chạy P3; không khóa lại sau khi có kết quả.
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run_p3.ps1 -Stage lock
# Chạy toàn bộ: registration, 1.320 trajectory, diagnostics, LOWO, 20 mô hình volume.
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run_p3.ps1 -Stage all -Device cuda:0 -Workers 4 -Detach
```
Lệnh `all` có thể chạy lại để resume đúng fingerprint; job hoàn tất được kiểm
tra checksum trước khi tái sử dụng. Không chạy đồng thời hai scheduler trên cùng
thư mục output. Tiến độ cập nhật mỗi 10 giây khi mở [report.html](report.html),
kể cả qua `file://`; dữ liệu gốc ở `outputs/p3/progress.json`, log ở `logs/runs/`.
Process giữ máy thức trong thời gian chạy, không đổi chính sách nguồn toàn hệ
thống. Driver giới hạn mỗi worker ở hai luồng CPU và chạy cửa sổ nền ẩn.
Benchmark thực tế so sánh 1/2/3/4/6 worker: 4 nhanh nhất (khoảng 319 bước/s).
Riêng huấn luyện dự kiến 1,6–3,3 giờ; tổng thời gian có thêm registration,
diagnostics và volume được lưu ở `outputs/p3/progress.json` sau pilot. Đây là
khoảng dự toán thời gian, không phải khoảng tin cậy thống kê.
**Theo yêu cầu phiên làm việc: không chạy script 04 hoặc 09.** P3 chỉ fit
wavelet/prior cục bộ theo đúng giếng train, ghi trong `outputs/p3/`; hai artifact
cũ `outputs/wavelets.npz` và `outputs/p2/warp_prior_f3.json` được bảo vệ bằng hash.
G-C giữ nguyên: cải thiện ít nhất 3/4 giếng và coverage 80/90% trong ±5 điểm %.
Kết quả G-C nằm ở `outputs/p3/summary/gate_gc.json`; fail vẫn được báo cáo.
## Chạy
```bash
@@ -37,7 +78,7 @@ Biến môi trường máy đặt sẵn `OMP_NUM_THREADS=40` (cả MKL, OpenBLAS
| Script | Việc |
| --- | --- |
| `scripts/00_data_manifest.py [--check] [--dataset f3\|volve\|nlog]` | Ghi/kiểm SHA-256 theo `data_manifest/*.json` (F3: 279 file) |
| `scripts/00_data_manifest.py [--check] [--dataset f3\|volve\|nlog\|thesis]` | Ghi/kiểm SHA-256 theo `data_manifest/*.json` (F3: 279 file; thesis: 7 artifact trong `outputs_thesis/`) |
| `scripts/01_build_wells.py` | Vị trí giếng từ `.survey`, 4 TDR (legacy, calibrated, anchors, wlt), log sang thời gian có chống alias, trích patch seismic → `outputs/f3_wells.npz` |
| `scripts/02_td_qc.py` | Lệch của các nguồn TD so với marker → `outputs/figures/td_drift.png`, `outputs/td_qc.csv` |
| `scripts/03_train.py --config configs/b2_smoke.yaml` | CNN–GRU v2 + loss gốc (B2), split tách rời train/val/test (chạy thử P0) |
@@ -56,4 +97,4 @@ Biến môi trường máy đặt sẵn `OMP_NUM_THREADS=40` (cả MKL, OpenBLAS
| `scripts/16_f3_posterior.py [--device cuda:1]` | Đặt F3 lên trục σ_post (chỉ mô tả): posterior SMC trên 4 giếng F3 → `outputs/p2/diag/f3_posterior/` |
| `scripts/17_summarize_p2r_dev.py [--only …]` | Tổng hợp dev cho P2r: screen, train/dose-response H2b, B(σ), stability, σ_a, F3 → `outputs/p2/diag/p2rdev/summary.md` |
`test 2/` là bản lưu trữ code luận văn, không sửa.
`code_thesis/` là bản lưu trữ code luận văn. Giữ nguyên nội dung để đối chiếu: các script này còn đường dẫn máy cũ và ghi vào `outputs/`, nên cần một bản sao đã điều chỉnh đường dẫn nếu muốn chạy lại. Kiểm tra bộ artifact hiện có bằng `python scripts/00_data_manifest.py --dataset thesis --check`.