8000 perf: warm-start the pH grid of the ratio uncertainty check by rafatahmed · Pull Request #340 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

perf: warm-start the pH grid of the ratio uncertainty check - #340

Merged
rafatahmed merged 2 commits into
mainfrom
perf/ph-grid-warm-start
Nov 27, 2026
Merged

rafatahmed merged 2 commits into
mainfrom
perf/ph-grid-warm-start

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Closes #339

Stacked on #338 (base branch perf/aqueous-solver; after #338 merges, retarget to main).

refine_ph solved every pH point from a cold start. Each point of a scenario now starts from the nearest pH already solved for the same totals, through the existing start= argument (a failed warm start already falls back to the cold start). The two uncertainty checks use it (ratio_analysis_uncertainty, ratio_uncertainty). The nominal check in ratio_verification stays cold, so the reported nominal values do not change.

Results are not bit-identical. The warm state agrees with the cold one within the solver tolerance:

Over 1,500 recorded solves Max difference
saturation index 2.7e-10
ionic strength 3.6e-14
charge balance 1.6e-14
species molality (relative) 2.1e-10

Evidence

  • Solves 2.17x faster; test_feasible_1_0 alone about 250 s on main, 122 s with perf: faster aqueous equilibrium solve, results bit-identical #338, 50 s with this change.
  • 214 non-heavy test modules and all 181 heavy tests pass locally, none timed out (records in outputs/test-runs/2026-11-27-perf-warm-start/, local).
  • New tests/test_ph_warm_start.py: nearest-pH seeding and agreement with cold solves.
  • No chemistry values change beyond the last digits above; no hash-pinned or golden value moved in any test, so nothing was re-captured.

@rafatahmed rafatahmed added the enhancement New feature or request label Nov 26, 2026
@rafatahmed rafatahmed self-assigned this Nov 26, 2026
@codecov
codecov Bot commented Nov 26, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (062beb3) to head (c0d0546).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #340   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          148       148           
  Lines        17507     17515    +8     
  Branches      3550      3550           
=========================================
+ Hits         17507     17515    +8     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from perf/aqueous-solver to main November 26, 2026 23:55
@rafatahmed
rafatahmed marked this pull request as ready for review November 26, 2026 23:56
@rafatahmed
rafatahmed merged commit e741d1e into main Nov 27, 2026
27 checks passed
@rafatahmed
rafatahmed deleted the perf/ph-grid-warm-start branch November 27, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: pH refinement solves every grid point from a cold start

1 participant

0