Skip to content

feat: concise automatic compute-setup banner and outside-modeling notices #754

Done

Description

@Jammy2211

Overview

A follow-up to likelihood-lifecycle phase 5 (5A–5E merged). It makes the automatic compute-setup choice visible and concise. A fit prints one header line saying this is the automatic CPU/GPU setup choice, then the aligned Setup / Parallel / Estimate lines together, with no contradicting line before them. When the setup acts outside modeling (a lazy sparse-operator build, or an aggregator reload reapplying setup.json), a one-line notice says so. Format approved by the human on 2026-11-25.

Plan

  • PyAutoFit: log_fit_start drops the pre-setup "with JAX (…)" claim. The Parallel: line reports the device for JAX ("1 worker (JAX on GPU: A100…)") and uses the concise wording.

  • PyAutoGalaxy: the setup resolution logs the header (auto / explicit / PYAUTO_SETUP wording) and the concise Setup: line, with the extrapolated reason. No setup gives the single "not set (auto would choose …)" line. The aggregator reapply logs a one-line notice.

  • PyAutoLens: RuntimeEstimate.line() puts the wall time first in the concise Estimate: format.

  • PyAutoArray: the lazy sparse-operator build logs Automatic compute setup: built the … operator for this dataset (…; cached; lazy_sparse_operator: auto).

  • Lines are logged consecutively with aligned labels. All four repos use the same branch name (feature/auto-setup-banner) so each repo's CI tests them together.

  • Tier + merge mode: effective level: supervised; merge mode: human /prm (per PR; merge order Array → Fit → Galaxy → Lens)

Detailed implementation plan

Affected Repositories

  • PyAutoGalaxy (primary, issue home)
  • PyAutoArray, PyAutoFit, PyAutoLens

Branch Survey

All four are on main and clean.

Branch (same name in all four): feature/auto-setup-banner, worktree ~/Code/PyAutoLabs-wt/auto-setup-banner.

Implementation Steps

  1. PyAutoFit:
    • autofit/non_linear/search/runtime.py log_fit_start: remove the JAX device claim and keep the quick-update line.
    • autofit/non_linear/parallel/pool.py ParallelResolution.banner: Parallel: N workers (auto: detected cores) / (requested N) / 1 worker (JAX on CPU|GPU: <name>) / (auto: capped by memory: …). The device comes from the analysis / JAX only if JAX is already imported.
    • Update the tests that assert banner text.
  2. PyAutoGalaxy:
    • autogalaxy/analysis/setup_util.py setup_banner_from → returns the header plus the Setup: line, logged as two consecutive records or one multi-line record (choose the one that renders cleanly with the workspace logging format, and say which).
    • Readable tokens: backend name, CPU/GPU, "sparse operator" / "dense" / "no operator", the precision, and the transformer when present.
    • The rule shown as <dataset_type>/<variant>.
    • The extrapolated reason from the hardware class and MANY_CORE_MIN_CORES (non-A100 GPU / fewer cores than a many-core node).
    • _log_setup_auto_would_choose → the single "not set" line.
    • agg_util.dataset_with_setup_from → an INFO notice on a successful reapply.
    • Tests.
  3. PyAutoLens: autolens/analysis/runtime_estimate.py RuntimeEstimate.line() puts ~<wall> on this hardware first, with the details in parentheses. Keep the band, uncalibrated and non-Nautilus variants concise. Update the tests.
  4. PyAutoArray: Imaging.sparse_operator_for / Interferometer.sparse_operator_for build log → the "Automatic compute setup: built …" notice. Tests.
  5. Demo check: the orchestrator reruns the test-mode workspace fit and pastes the terminal output into the PR bodies.
  6. Each repo's full suite; pyauto-heart smoke --affected-by for each repo.

Key Files

  • autofit/non_linear/search/runtime.py, autofit/non_linear/parallel/pool.py
  • autogalaxy/analysis/setup_util.py, autogalaxy/analysis/analysis/setup.py, autogalaxy/aggregator/agg_util.py
  • autolens/analysis/runtime_estimate.py
  • autoarray/dataset/imaging/dataset.py, autoarray/dataset/interferometer/dataset.py, autoarray/dataset/lazy_operator.py

Original Prompt

Click to expand starting prompt

Likelihood lifecycle phase 5 follow-up: a concise automatic compute-setup banner at fit start, and notices when the setup acts outside modeling

Type: feature
Target: PyAutoGalaxy
Repos:

  • PyAutoArray
  • PyAutoFit
  • PyAutoGalaxy
  • PyAutoLens
    Themes:
  • hpc-gpu
  • profiling
    Difficulty: medium
    Autonomy: supervised
    Priority: high
    Status: draft
    Consequence: judge
    Witness: A test-mode al.AnalysisImaging(dataset, setup="auto") + af.Nautilus(number_of_cores="auto") fit prints, with no contradicting line before it, one header line stating that this is the automatic CPU/GPU compute-setup choice, followed together by the aligned Setup:, Parallel: and Estimate: lines in the approved concise format. The stale "Starting non-linear search with JAX (CPU: cpu)." claim is gone, and the device is reported in Parallel: once known. Explicit and PYAUTO_SETUP setups get their own header wording; no setup gives one "not set (auto would choose …)" line. Outside modeling, a lazy sparse-operator build (lazy_sparse_operator: auto) and an aggregator reload that reapplies setup.json each print one concise notice in the same "compute setup" voice. All four suites are green, and smoke passes.
    Review-minutes: 20
    Unattended: no
    Lane: any
    Gate: 5A–5E MERGED. Human approved the format on 2026-11-25 ("pretty much good, but maybe also have a header … and make sure such a message appears outside of modeling too so a user knows it happened"). Ships before 5F, so the 5F guides/advanced/auto_setup.py guide shows the final output.
    Epic: likelihood-lifecycle
    Phase: 5
    Parent: draft/research/autolens_profiling/likelihood_lifecycle_epic.md
    Filed: 2026-11-25

Context

  • Observed 2026-11-25 (a test-mode run from autolens_workspace):

    • PyAutoFit log_fit_start prints "Starting non-linear search with JAX (CPU: cpu)." before modify_before_fit; the setup then picked numba.
    • The Galaxy Setup line reads numba/cpu/sparse/fp64 (8 CPU cores) · rule imaging-rectangular-standard-cpu-many-core · extrapolated (decision imaging-rectangular-standard-cpu-many-core) · override: PYAUTO_SETUP, with the id repeated and no reason for "extrapolated".
    • Setup, Parallel and Estimate are split by warnings and other log lines.
  • Approved target format (the timestamp/module prefix comes from the workspace logging.yaml and is unchanged). The label column is aligned and the lines are logged consecutively:

    Automatic compute setup (CPU/GPU choice from setup="auto"; override with PYAUTO_SETUP or setup=...):
    Setup:    numba · CPU · sparse operator · fp64   (rule imaging/rectangular · extrapolated: 8 cores, rules measured on ≥16-core nodes)
    Parallel: 8 workers (auto: detected cores)
    Estimate: ~6.4 min on this hardware   (283 ms/eval, euclid cell · Nautilus n_live=50 ≈ 4.6e3 evals, heuristic · η=0.55)
    
    • Explicit setup: header Compute setup (set explicitly by setup=...):. PYAUTO_SETUP: Compute setup (set by PYAUTO_SETUP=<id>):.
    • No setup: one line, Compute setup: not set (auto would choose numba · CPU · sparse operator · fp64; pass setup="auto").
    • JAX: Parallel: 1 worker (JAX on CPU) / (JAX on GPU: <name>).
  • Outside modeling:

    • Array lazy build: Automatic compute setup: built the numba sparse operator for this dataset (256 image pixels, 0.12 s; cached; lazy_sparse_operator: auto), or the interferometer w-tilde equivalent with visibilities and "chunked".
    • Galaxy aggregator reapply: Compute setup: reapplied numba_cpu_sparse_fp64 from the search's setup.json.
    • apply_setup itself stays silent, so modeling doesn't print twice.

Out of scope

  • The global log format (workspace logging.yaml).
  • The 5F workspace guide and prose.
  • The default flip (R6).

Activity

  1. Jammy2211 commented on Nov 25, 2026

    @Jammy2211
    CollaboratorAuthor

    Claim note: PyAutoLens is still registered in Mind to cluster-family-fit-figures, but that task's PR (PyAutoLabs/PyAutoLens#884) is merged and touched only cluster/point plotting. The human approved overriding the stale claim (2026-11-25). This task's PyAutoLens change is limited to autolens/analysis/runtime_estimate.py (the Estimate line) and its tests.

  2. Jammy2211 commented on Nov 25, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped as five PRs on feature/auto-setup-banner (merge in this order): PyAutoLabs/PyAutoNerves#224 → PyAutoLabs/PyAutoArray#713 → PyAutoLabs/PyAutoFit#1797 → #755 → PyAutoLabs/PyAutoLens#889. The Nerves PR fixes GPU detection under JAX_PLATFORMS=cpu, which the demo exposed. Gate: all suites green, Heart GREEN, smoke 8/8.

  3. Jammy2211 commented on Nov 25, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped

    Merged in order (all pending release):

    Next: 5F (workspace prose, including guides/advanced/auto_setup.py).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions