Repository navigation
Description
Overview
Likelihood-lifecycle epic, phase 5E: the runtime estimator. At fit start, a lens fit prints an honest "Estimate:" line under the Parallel: banner, with ms per evaluation, expected evaluations (the Nautilus heuristic), the parallel efficiency and the wall time on this hardware. 5D's memory cap goes live from the same data. This ships as three PRs under this issue: 5E-1 autolens_profiling (exporter v2), 5E-2 PyAutoFit (estimate hook), 5E-3 PyAutoLens (estimator, data file, analyses).
Plan
- 5E-1, autolens_profiling: the exporter adds per-instrument size fields (n_pixels_masked, n_vis, source pixels) from the simulator summaries, replaces the stale
parallel_efficiencyblock with the measured curve, bumps to schema v2, regeneratescatalogue/runtime_estimates.yaml, and adds--copy-to <PyAutoLens>. - 5E-2, PyAutoFit:
resolve_fit_paralleltakes the model and calls a duck-typedanalysis.runtime_estimate(search, model, number_of_cores)after theParallel:line, logging its line and never raising. - 5E-3, PyAutoLens:
- ships
autolens/config/runtime_estimates.yamland a cached, schema-checked loader; - adds a
RuntimeEstimatedataclass and the ported wall model; - adds
al.estimate_runtime(...)and exportsal.Setup; - the lens analyses implement
runtime_estimate()andresources_per_eval().
- ships
Design calls (human-approved 2026-11-24):
- The estimator lives in PyAutoLens; Galaxy is untouched.
- Row matching:
decision_id+setup_id+ the nearest instrument size; otherwise a min–max band, with the largestpeak_rss_gbfor the memory cap. - Honest labelling: "Nautilus heuristic"; interferometer/weak "uncalibrated (held-out 0.2–0.5×)"; other samplers "no estimate".
al.estimate_runtime(...)rather thanal.Setup.estimate.
- Tier + merge mode: effective level: supervised; merge mode: human /prm (per PR)
Detailed implementation plan
Affected Repositories
- PyAutoLens (primary, issue home)
- autolens_profiling (5E-1)
- PyAutoFit (5E-2)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./autolens_profiling | main | clean |
| ./PyAutoFit | main | clean |
| ./PyAutoLens | main | clean |
Suggested branches: feature/likelihood-lifecycle-p5e1-profiling, feature/likelihood-lifecycle-p5e2-fit, feature/likelihood-lifecycle-p5e3-lens, in worktree ~/Code/PyAutoLabs-wt/likelihood-lifecycle-p5e.
Implementation Steps
- 5E-1
scripts/misc/tooling/export_runtime_estimates.py:- for each row, add
n_pixels_masked(imaging-type),n_vis(interferometer) andsource_pixelswhen known, from the profiling simulator summaries / instrument definitions (find the canonical instrument-size source in the repo and cite it in the header); - replace the header
parallel_efficiencywith{curve: {1: 1.0, 2: 0.68, 4: 0.62, 8: 0.55, 16: 0.36, 32: 0.28}, likelihood: imaging/rectangular, setup_id: numba_cpu_sparse_fp64, source: autolens_inference phase 4 (wall/model.py)}; version: 2;- add
--copy-to <path>, which writes the same file to<path>/autolens/config/runtime_estimates.yaml; - regenerate; keep the
--checkdrift test and CI lint green.
- for each row, add
- 5E-2 autofit
runtime.pyresolve_fit_parallel(search, analysis, model)(update its caller inabstract_search._fit_and_output): after the banner,hook = getattr(analysis, "runtime_estimate", None); if callable,line = hook(search=search, model=model, number_of_cores=resolution.number_of_cores); log it if it is a non-empty string; swallow any exception (debug log). Addruntime_estimatetofiles/parallel.json(estimate_line). Tests with a dummy analysis. - 5E-3 PyAutoLens:
autolens/config/runtime_estimates.yaml(copied from 5E-1).autolens/analysis/runtime_estimate.py(orautolens/setup/):- a loader (direct path, cached, schema version check);
RuntimeEstimate(ms_per_eval, record_id, instrument, matched_by, expected_evals, evals_model "nautilus-heuristic", parallel_efficiency, number_of_cores, wall_seconds, wall_band, calibrated: bool, note);- the ported wall-model constants and functions (cite autolens_inference wall/model.py);
estimate_runtime(dataset, model, search, setup, number_of_cores);line()formatting, e.g.Estimate: ~1.9 ms/eval · Nautilus n_live=150 ≈ 2.1e5 evals (heuristic) · η=0.55 on 8 cores · ~7 min on this hardware.
- Analyses (imaging, interferometer, point, weak, via the Lens setup mixin or analysis base):
runtime_estimate(search, model, number_of_cores)→ line, or a "no estimate …" line, or None when there is no setup;resources_per_eval()→ {cpus_per_eval, peak_rss_gb} from the matched row, using the largest across instruments when unmatched.
- Export
estimate_runtimeandSetupfromautolens/__init__.py. - Tests: loader, schema mismatch, row matching (nearest size / band), labelling (uncalibrated / non-Nautilus), numba η, resources_per_eval feeding a fake ParallelResolution memory cap, the hook end-to-end with a MockSearch.
- Each repo's full suite;
pyauto-heart smoke --affected-by <repo>for PyAutoFit and PyAutoLens.
Key Files
autolens_profiling/scripts/misc/tooling/export_runtime_estimates.py,autolens_profiling/catalogue/runtime_estimates.yamlautofit/non_linear/search/runtime.py,autofit/non_linear/search/abstract_search.pyautolens/config/runtime_estimates.yaml(new),autolens/analysis/runtime_estimate.py(new),autolens/analysis/analysis/setup.py,autolens/__init__.py- Source:
autolens_inference/scripts/misc/wall/model.py
Original Prompt
Click to expand starting prompt
Likelihood lifecycle phase 5E: runtime estimator: profiling exporter v2 with dataset sizes, a PyAutoFit estimate hook, and the PyAutoLens estimator, data file and memory cap
Type: feature
Target: PyAutoLens
Repos:
- autolens_profiling
- PyAutoFit
- PyAutoLens
Themes: - hpc-gpu
- profiling
Difficulty: large
Autonomy: supervised
Priority: high
Status: draft
Consequence: judge
Witness: autolens_profilingruntime_estimates.yamlv2 carries per-instrument size fields and the measured parallel-efficiency curve, and the exporter can copy it into PyAutoLens (--copy-to). PyAutoFit'sresolve_fit_parallelcalls a duck-typedanalysis.runtime_estimate(search, model, number_of_cores)after theParallel:line and logs its line without ever raising. PyAutoLens shipsautolens/config/runtime_estimates.yamlwith a cached, schema-checked loader, aRuntimeEstimatedataclass, the ported autolens_inference wall model, and publical.estimate_runtime(dataset, model, search, setup, number_of_cores)plusal.Setup. The lens analyses implementruntime_estimate()(the "Estimate:" line) andresources_per_eval()(5D's memory cap goes live). Rows are matched bydecision_id+setup_idand the nearest instrument size, with a min–max band when unmatched. Lines are labelled "Nautilus heuristic", interferometer/weak are flagged "uncalibrated", and other samplers get "no estimate". Each repo's suite is green, and smoke passes at each ship.
Review-minutes: 30
Unattended: no
Lane: any
Gate: 5D MERGED (PyAutoFit#1795:resolve_fit_parallel,resources_per_eval()hook). Plan and design calls approved by the human 2026-11-24.
Epic: likelihood-lifecycle
Phase: 5
Parent: draft/research/autolens_profiling/likelihood_lifecycle_epic.md
Filed: 2026-11-24
Context
- Report §3.5, Estimator row: a RuntimeEstimate (ms_per_eval, source record id, expected_evals labelled as the Nautilus heuristic until phase 7, parallel efficiency, wall); a data file
autolens/config/runtime_estimates.yamlregenerated by an autolens_profiling exporter; the banner's "Estimate:" line. - Survey 2026-11-24:
lens/autolens_profiling/catalogue/runtime_estimates.yaml(schema v1, tag 2026.10.25.1, 116 rows; fields likelihood, hardware_class, host_class, instrument, setup_id, role, decision_id, ms_per_eval, per_eval_source, cpus_per_eval, devices_per_eval, peak_rss_gb, workers_per_node, bound_by, calls_per_s_per_node, record_id).- There are no size fields, and the
parallel_efficiencyblock is stale (1.0, "unmeasured"). - The exporter is
scripts/misc/tooling/export_runtime_estimates.py --pulse ../PyAutoPulse [--check](stdlib; CI drift check in.github/workflows/lint.yml:127-132). Instrument sizes live in the profiling simulator summaries. - The wall model is
lens/autolens_inference/scripts/misc/wall/model.py(stdlib): evals = 4.30 · n_live · d^1.637 · EVALS_FACTOR; a 0.014 s floor; 30 s startup; numba η {1:1.0, 2:.68, 4:.62, 8:.55, 16:.36, 32:.28}; per-call/per-eval overrides. It is Nautilus only; in-sample 0.56–1.59×; held-out interferometer 0.19–0.45× and weak 0.50–0.52× (uncalibrated). - Insight has no expected-evals table.
- 5D
resolve_fit_parallel(autofitruntime.py) has the search, the setup-resolved analysis and theParallelResolution; it does not take the model yet. resources_per_eval()expectscpus_per_evalandpeak_rss_gb.- PyAutoLens ships
autolens/config/*(pyproject package-data, MANIFEST.in). Follow PyAutoArray's direct-path loader precedent (RULES_PATH).
- Design calls (human-approved 2026-11-24):
- The estimator lives in PyAutoLens; Galaxy is untouched (no estimate line for Galaxy fits).
- Row matching:
decision_id+setup_id, nearest instrument by size (masked pixels for imaging, n_vis for interferometer). Otherwise a min–max band, and the memory cap uses the largestpeak_rss_gb. - Honest labelling: "Nautilus heuristic"; interferometer/weak "uncalibrated (held-out 0.2–0.5×)"; other samplers "no estimate for ".
- The API is
al.estimate_runtime(...), notal.Setup.estimate, becauseSetuplives in PyAutoArray.
- PRs, in order: 5E-1 autolens_profiling (project repo; ship_workspace; no pending-release) → 5E-2 PyAutoFit (tiny) → 5E-3 PyAutoLens (medium).
Out of scope
- Phase 7 sampler campaign and expected-evals tables.
- Workspace prose (5F) and assistant (5G).
- The default flip (R6).
ModelAnalysisforwarding ofmodify_before_fit(separate follow-up).
Activity
Jammy2211 commentedon Nov 24, 2026
5E-1 shipped as PyAutoLabs/autolens_profiling#535: runtime_estimates.yaml v2 (per-row dataset sizes from the evidence files, the measured parallel-efficiency curve,
--copy-to <PyAutoLens>). Gate: 1915 passed, ruff clean,--checkcurrent. 5E-2 (PyAutoFit hook) and 5E-3 (PyAutoLens estimator) follow.Jammy2211 commentedon Nov 24, 2026
5E-2 shipped as PyAutoLabs/PyAutoFit#1796 (pending-release): duck-typed
analysis.runtime_estimate(search, model, number_of_cores)hook after theParallel:banner, logged and recorded asestimate_linein parallel.json; never affects a fit. Gate: 4383 passed, Heart GREEN, smoke 8/8. 5E-3 (PyAutoLens estimator) in progress.Jammy2211 commentedon Nov 24, 2026
5E-3 shipped as #888 (pending-release): runtime_estimates.yaml v2, ported wall model,
al.estimate_runtime/al.RuntimeEstimate/al.Setup, andruntime_estimate()+resources_per_eval()on the lens analyses. Gate: 1154 passed + 1 xfailed, Heart GREEN, smoke 4/4. Merge order: PyAutoFit#1796 first (this PR's CI clones PyAutoFit main), then #888, which closes this issue.Jammy2211 commentedon Nov 24, 2026
Shipped
Phase 5E merged in three PRs:
--copy-to).runtime_estimatehook after theParallel:banner.autolens/config/runtime_estimates.yaml,al.estimate_runtime/al.RuntimeEstimate/al.Setup, andruntime_estimate()+resources_per_eval()on the lens analyses (5D memory cap live).#1796 and #888 are pending release. #888's first CI run failed only on the end-to-end hook test (
resolve_fit_parallel(... model=)) until #1796 merged; the re-run was GREEN. Next in the epic: 5F (workspace prose).