Skip to content

docs: explain the automatic compute setup and its printed lines (5F PR3) - #139

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5f3-howtolens
Nov 25, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5f3-howtolens

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Likelihood-lifecycle phase 5F, PR3 of 3 (PyAutoLabs/autolens_workspace#688). This adds a concise explanation of the automatic compute setup where HowToLens first discusses run times, and updates the speed tutorial.

Merge timing: like the workspace PRs, merge with or after the library release that carries the automatic setup (setup="auto", al.estimate_runtime, al.Settings(lazy_sparse_operator=...) are merged but not yet on PyPI).

Changes

  • chapter_2_lens_modeling/tutorial_2_practicalities.py: a new "Automatic Compute Setup" section after "Run Times". It shows the one-line "not set (auto would choose …)" message, how to opt in (setup="auto", number_of_cores="auto"), the real header with its Setup: / Parallel: / Estimate: lines and what each means, overrides (setup_id or PYAUTO_SETUP), and a pointer to autolens_workspace scripts/guides/advanced/auto_setup.py. The tutorial's own code is unchanged.
  • chapter_optional/tutorial_need_for_speed.py: the setup is chosen from measured profiling. JAX isn't always fastest; on a CPU, pixelized fits use numba with a sparse operator. The section also adds an al.estimate_runtime(...).line() example.
  • chapter_3_pixelizations/tutorial_6_adaptive_reconstruction.py: two sentences on al.Settings(lazy_sparse_operator="auto") as the lazy alternative to calling apply_sparse_operator() yourself.
  • Notebooks and workspace_index.json regenerated.

Real lines quoted in tutorial 2 (8-core laptop, test mode):

Compute setup: not set (auto would choose JAX · CPU · dense · fp64; pass setup="auto")
Automatic compute setup (CPU/GPU choice from setup="auto"; override with PYAUTO_SETUP or setup=...):
Setup:    JAX · CPU · dense · fp64   (rule imaging/mge · extrapolated: 8 cores, rules measured on ≥16-core nodes)
Parallel: 1 worker (JAX on CPU)
Estimate: ~47 min on this hardware   (7.1 ms/eval, euclid cell · Nautilus n_live=200 ≈ 1.3e5 evals, heuristic · 1 worker (JAX))

Test Plan

  • The three edited scripts run headless in test mode: rc=0.
  • pyauto-heart smoke howtolens against this branch: 41/41 PASS.
  • Heart dev gate (pyauto-heart readiness --dev --repos HowToLens): GREEN.

Notes:

  • Tutorial 2 stays without a setup. It calls analysis.print_vram_use(...) before the fit, and with setup="auto" that currently raises a misleading SetupException. This is filed as draft/bug/autogalaxy/setup_auto_unresolved_before_fit_print_vram_use.md.
  • The estimate_runtime example passes a concrete setup_id. setup="auto" isn't accepted there yet; this is filed as draft/feature/autolens/estimate_runtime_accept_auto.md.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

tutorial_2_practicalities gains an Automatic Compute Setup section (opting
in, the header + Setup/Parallel/Estimate lines, overrides, link to the
workspace guide); tutorial_need_for_speed explains how the setup is chosen
and shows al.estimate_runtime; tutorial_6 mentions the lazy sparse operator.
Notebooks regenerated.

Part of PyAutoLabs/autolens_workspace#688 (likelihood-lifecycle phase 5F).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit b711792 into main Nov 25, 2026
9 checks passed
@Jammy2211
Jammy2211 deleted the feature/likelihood-lifecycle-p5f3-howtolens branch November 25, 2026 20:15
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