Skip to content

feat: runtime estimator, runtime_estimates.yaml and memory cap hook (5E-3) - #888

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5e3-lens
Nov 24, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5e3-lens

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Likelihood-lifecycle phase 5E-3, the third of three PRs under #887. This adds the PyAutoLens runtime estimator. A lens fit with a compute setup now prints an honest Estimate: line after PyAutoFit's Parallel: banner (via the 5E-2 hook), giving ms per evaluation, expected evaluations (the Nautilus heuristic), parallel efficiency and wall time on this hardware. The same data makes 5D's number_of_cores="auto" memory cap live, through resources_per_eval().

Depends on PyAutoLabs/PyAutoFit#1796 (5E-2). The end-to-end test calls resolve_fit_parallel(..., model=...), and this repo's CI clones PyAutoFit main, so merge #1796 first and then re-run this PR's CI.

API Changes

  • New data file autolens/config/runtime_estimates.yaml: schema v2, generated by autolens_profiling export_runtime_estimates.py --copy-to (autolens_profiling#535); do not edit by hand.
  • New al.estimate_runtime(dataset, model, search, setup, number_of_cores=1) → al.RuntimeEstimate (or None without a setup or row), with .line().
  • New al.Setup (the autoarray class, exported).
  • Lens analyses (imaging, interferometer, point, weak) implement runtime_estimate(search, model, number_of_cores) and resources_per_eval(). Both are None without a setup and never raise.
    See full details below.

Test Plan

  • pytest test_autolens: 1154 passed, 1 xfailed. New test_runtime_estimate.py (31 tests) covers:
    • loader, version check and curve fallback;
    • size matching for imaging (euclid/hst/jwst/ao) and interferometer (sma/alma), plus decision_id matching;
    • bands for point and no-size datasets;
    • the uncalibrated flag for interferometer and weak, and the non-Nautilus message;
    • numba η against the wall-model arithmetic, and JAX at 1 worker;
    • the hooks;
    • end to end through PyAutoFit's resolve_fit_parallel, logging one Estimate: line;
    • the memory cap: 64 cores and 10 GB on an hst-sized dataset gives 9 workers, reason "memory".
  • Heart dev gate (pyauto-heart readiness --dev --repos PyAutoLens): GREEN. Non-blocking shown reasons: manifest drift; test run status unknown; no release rehearsal for current source; release push credential check 55 h old.
  • pyauto-heart smoke --affected-by PyAutoLens --jobs 3: 4/4 workspaces PASS (autolens, autolens_test, euclid, howtolens), run against this branch (with the 5E-2 PyAutoFit branch) via PYAUTO_ROOT
Full API Changes (for automation & release notes)

Added

  • autolens/config/runtime_estimates.yaml (schema runtime-estimates v2).
  • autolens.analysis.wall_model: a port of autolens_inference scripts/misc/wall/model.py (Nautilus eval law, floor, startup, numba η, overrides), with provenance.
  • autolens.analysis.runtime_estimate: load_runtime_estimates, RuntimeEstimate, estimate_runtime, candidate_rows, match_rows, dataset_size_from, resources_per_eval_from, AnalysisRuntimeEstimate (mixin).
  • Exports al.Setup, al.RuntimeEstimate, al.estimate_runtime.
  • runtime_estimate() / resources_per_eval() on AnalysisDataset (imaging, interferometer), AnalysisPoint and AnalysisWeak.

Changed

  • AnalysisDataset, AnalysisPoint and AnalysisWeak gain the AnalysisRuntimeEstimate mixin, first in their bases. Its resolve_setup remembers the model, then defers to the existing setup resolution.

Migration

  • None. With no setup=, nothing changes.

Design calls (human-approved):

  1. The estimator lives in PyAutoLens; PyAutoGalaxy is untouched.
  2. Rows are matched by decision_id + setup_id, then the nearest instrument by size (masked pixels for imaging, visibilities for interferometer, log distance). A min–max band is reported when there's no size or a tie.
  3. Honest labels: "Nautilus heuristic"; interferometer, weak and datacube are "uncalibrated (held-out 0.2–0.5×)"; other samplers get "no estimate for (run-time model covers Nautilus only)".
  4. al.estimate_runtime(...) rather than a method on Setup.

Example line: Estimate: ~697 ms/eval (hst cell) · Nautilus n_live=150 ≈ 1.0e4 evals (heuristic) · η=0.55 on 8 cores · ~30 min on this hardware.

Caveats:

  • The estimate is single-stage. SLaM multi-stage pricing is not included (NUMBA_PARAMETRIC_FACTOR is ported but unused).
  • The euclid imaging/rectangular numba row has peak_rss_gb: null, so a fit matched to it gets no memory cap.
  • Interferometer and weak estimates are known to read 2–5× low on held-out data and are labelled uncalibrated.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…ok (5E-3)

Ships autolens/config/runtime_estimates.yaml (v2, from the autolens_profiling
exporter), a cached schema-checked loader, the ported autolens_inference wall
model, al.RuntimeEstimate / al.estimate_runtime and al.Setup. Lens analyses
implement runtime_estimate() (the Estimate: line PyAutoFit logs after the
Parallel: banner) and resources_per_eval() (5D's memory cap). Rows are
matched by decision_id + setup_id and nearest instrument size, otherwise a
band; labels say Nautilus heuristic / uncalibrated / no estimate.

Closes #887 (likelihood-lifecycle phase 5E-3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 24, 2026
@Jammy2211
Jammy2211 merged commit 4dbe09e into main Nov 24, 2026
6 of 9 checks passed
@Jammy2211
Jammy2211 deleted the feature/likelihood-lifecycle-p5e3-lens branch November 24, 2026 22:06
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant