Skip to content

docs: SLaM scripts pass one setup="auto" to every stage (5F PR2) - #690

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

Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5f2-slam

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Likelihood-lifecycle phase 5F, PR2 of 3 (#688). Every SLaM script now passes one setup input, setup = "auto", to every stage, and runs its searches with number_of_cores="auto". Each stage picks its own fastest setup. On a CPU the light-profile stage uses JAX on 1 worker and the pixelized stages use numba with a sparse operator on every core; on a GPU it's JAX throughout.

Merge order and timing: merge after PR1 (#689), because the regenerated workspace_index.json / llms-full.txt cross-reference guides/advanced/auto_setup.py. Like PR1, merge with or after the library release carrying the automatic setup.

Changes

  • Template scripts/guides/modeling/slam_start_here.py: a __Compute Setup__ block after settings_search (setup = "auto"; how each stage picks; overrides via setup_id or PYAUTO_SETUP; link to the guide). Every stage function takes setup, every al.Analysis* gets setup=setup, the per-stage use_jax=True lines are gone, and settings_search has number_of_cores="auto". No model or science changes.
  • The same change in 36 more SLaM / SLaM-like scripts across imaging, group and multi_galaxy (features + advanced), the subhalo/detect start_here scripts, multi_dataset independent.py / simultaneous.py, and interferometer:
    • simultaneous.py: af.FactorGraphModel(..., use_jax=True) → af.FactorGraphModel(...), and the backend follows the factors' shared setup. The setup-agreement check passes.
    • Interferometer: one TransformerNUFFT dataset. The w-tilde sparse operator is built once up front, from the nufft_precision_operator.npy preload when present, and each pixelized stage's setup reuses it (Interferometer.apply_setup keeps a matching attached operator). It is built once per run, not per stage; the light-profile stage chooses a dense NUFFT setup and doesn't use it.
  • Untouched: subhalo/sensitivity/slam_source_pixelized.py (owned by another task) and scripts/cluster/plot.py (PR Teach the family fit panels one by one using Pandora #687). slam_source_parametric.py gets the setup but keeps number_of_cores as is, because its sensitivity classes read settings_search.number_of_cores and all its stages are JAX anyway.
  • Notebooks, llms-full.txt and workspace_index.json regenerated.

Test Plan

  • All 37 edited scripts in test mode (headless): 34 pass. 3 fail identically on unedited HEAD, so this change didn't cause them; filed as Mind drafts draft/bug/autolens/dspl_slam_visualize_positions_inhomogeneous_shape.md (group/imaging double_source_plane_lens) and draft/bug/autolens_workspace/slam_source_parametric_model_has_no_centre.md.
  • After the follow-up fixes, reran slam_start_here, all 5 interferometer scripts, imaging/group/multi_galaxy pixelization, and both multi_dataset scripts: 11/11 rc=0. Interferometer "Computing NUFFT Precision Operator" dropped from 3 builds per run to 1 (8 → 1 for subhalo/detect).
  • pyauto-heart smoke autolens against this branch: 42/42 PASS (SLaM scripts aren't in the smoke list).
  • scripts/check_sizes.sh: OK.

Per-stage lines from slam_start_here.py (8-core laptop, test mode):

Setup:    JAX · CPU · dense · fp64   (rule imaging/mge · extrapolated: 8 cores, rules measured on ≥16-core nodes)
source_lp[1] - INFO - Parallel: 1 worker (JAX on CPU)
Setup:    numba · CPU · sparse operator · fp64   (rule imaging/rectangular · extrapolated: 8 cores, …)
source_pix[1] - INFO - Parallel: 8 workers (auto: detected cores)
… (source_pix[2], light[1], mass_total[1] the same)

Switching from a JAX stage to a forked numba stage in one process was tested separately with real sampling (see the issue): there was no deadlock.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…res="auto" (5F PR2)

Every SLaM script gets a __Compute Setup__ block (setup = "auto") passed to
every stage's analysis, with settings_search number_of_cores="auto"; per-stage
use_jax lines go. Interferometer SLaMs build the w-tilde sparse operator once
up front (preload when present) and each pixelized stage's setup reuses it.
multi_dataset simultaneous lets the factor graph follow the shared setup.
Notebooks and catalogues regenerated.

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

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