|
| 1 | +# autolens_profiling |
| 2 | + |
| 3 | +Profiling and run-time tracking for [PyAutoLens](https://github.com/PyAutoLabs/PyAutoLens) likelihood functions, simulators, and samplers across CPU, laptop GPU, and HPC GPU. |
| 4 | + |
| 5 | +## Vision |
| 6 | + |
| 7 | +This repository is the single home for PyAutoLens performance measurement. It exists so that the run-times that matter for science — fitting a real lens, simulating an Euclid-resolution dataset, sampling a model with Nautilus — are visible, reproducible, and versioned across PyAutoLens releases. |
| 8 | + |
| 9 | +**What is profiled:** |
| 10 | + |
| 11 | +- **Likelihood functions** — imaging, interferometer, point-source, and datacube paths, across the MGE, pixelization, and Delaunay model compositions used in real science cases. |
| 12 | +- **Simulators** — run-time tracking for the imaging, interferometer, point-source, cluster, group, and multi-plane simulators. |
| 13 | +- **Searches / samplers** — sampler-level profiling, starting with Nautilus. Other samplers (Dynesty, Emcee, BlackJAX, NumPyro, NSS, LBFGS, PocoMC) follow in later sweeps. |
| 14 | + |
| 15 | +**Hardware tiers covered:** |
| 16 | + |
| 17 | +- CPU (single-machine, numpy backend). |
| 18 | +- Laptop GPU (consumer-class, JAX backend). |
| 19 | +- HPC GPU (A100 and similar, JAX backend). |
| 20 | + |
| 21 | +**Dataset framing:** |
| 22 | + |
| 23 | +Results are framed by **astronomy instrument** (HST, Euclid, JWST, …) rather than by raw pixel counts. Pixel counts are recorded too, but the headline numbers a reader sees first are the ones that map onto a real observing programme. |
| 24 | + |
| 25 | +## JAX gradients — currently out of scope |
| 26 | + |
| 27 | +Gradient profiling (`jax.grad` of the likelihood, autodiff-based optimisers) is **not yet** part of this repo. It is tracked in [`PyAutoLabs/autolens_workspace_developer/jax_profiling/gradient/`](https://github.com/PyAutoLabs/autolens_workspace_developer/tree/main/jax_profiling/gradient) and will fold into this repo in a future phase once the gradient story stabilises. |
| 28 | + |
| 29 | +## How to read this repo |
| 30 | + |
| 31 | +Each profiling script writes a **versioned artifact pair** under `results/`: |
| 32 | + |
| 33 | +``` |
| 34 | +results/<section>/<subfolder>/<profile_name>_summary_v<YYYY>.<M>.<D>.<PATCH>.json |
| 35 | +results/<section>/<subfolder>/<profile_name>_summary_v<YYYY>.<M>.<D>.<PATCH>.png |
| 36 | +``` |
| 37 | + |
| 38 | +The version string matches the PyAutoLens release that produced the numbers (e.g. `v2026.5.1.4`). Older versions are retained alongside newer ones, so trends across releases stay inspectable. The JSON carries structured timings; the PNG is the at-a-glance plot. |
| 39 | + |
| 40 | +Examples that already exist in the source-of-truth repo: |
| 41 | + |
| 42 | +- `imaging_summary_v2026.5.1.4.json` / `.png` |
| 43 | +- `point_source_summary_v2026.5.1.4.json` |
| 44 | +- `delaunay_sparse_cpu_likelihood_summary_hst_v2026.5.1.4.json` |
| 45 | + |
| 46 | +## Section index |
| 47 | + |
| 48 | +| Folder | Contents | |
| 49 | +|--------|----------| |
| 50 | +| [`likelihood/`](./likelihood/README.md) | Likelihood JIT profiling — imaging, interferometer, point-source, datacube. | |
| 51 | +| [`simulators/`](./simulators/README.md) | Run-time tracking for the PyAutoLens simulators. | |
| 52 | +| [`searches/`](./searches/README.md) | Sampler / search profiling, Nautilus first. | |
| 53 | +| [`results/`](./results/README.md) | Versioned JSON + PNG artifacts written by the above scripts. | |
| 54 | + |
| 55 | +## Roadmap |
| 56 | + |
| 57 | +This repo is being built in phases: |
| 58 | + |
| 59 | +| Phase | Title | Status | |
| 60 | +|-------|-------|--------| |
| 61 | +| 0 | Repo bootstrap (this commit) | ✓ shipped | |
| 62 | +| 1 | Mirror JIT likelihood profiling scripts + per-section READMEs | not yet started | |
| 63 | +| 2 | Mirror simulator profiling scripts + run-time tracking | not yet started | |
| 64 | +| 3 | Nautilus profiling, design for sampler expansion | not yet started | |
| 65 | +| 4 | Top-level + per-section README dashboard with instrument framing | not yet started | |
| 66 | +| 5 | GitHub Actions for lint + profile re-runs + README refresh | not yet started | |
| 67 | + |
| 68 | +The full multi-phase plan lives in the internal `PyAutoLabs/PyAutoPrompt/z_features/autolens_profiling.md` tracker (not publicly readable). The high-level shape is captured above. |
| 69 | + |
| 70 | +## Related repos |
| 71 | + |
| 72 | +- [`PyAutoLabs/PyAutoLens`](https://github.com/PyAutoLabs/PyAutoLens) — the library being profiled. |
| 73 | +- [`PyAutoLabs/autolens_workspace`](https://github.com/PyAutoLabs/autolens_workspace) — user-facing science scripts and tutorials. |
| 74 | +- [`PyAutoLabs/autolens_workspace_developer`](https://github.com/PyAutoLabs/autolens_workspace_developer) — the developer workspace; **source of truth during the migration**. Each phase mirrors the relevant subdirectories from here into this repo. |
| 75 | +- [`Jammy2211/autolens_colab_profiling`](https://github.com/Jammy2211/autolens_colab_profiling) — sibling repo, Colab-specific scope. Not yet migrated to PyAutoLabs. |
| 76 | + |
| 77 | +## Package vs scripts |
| 78 | + |
| 79 | +This repo is a **collection of standalone profiling scripts**, not an installable Python package. There is no `pyproject.toml`. Run scripts from the repo root. |
| 80 | + |
| 81 | +Scripts follow the JIT conventions documented in `autolens_workspace_developer/CLAUDE.md`: |
| 82 | + |
| 83 | +- Extract `.array` from autoarray types before crossing the `jax.jit` boundary (autoarray types are not JAX pytrees as inputs). |
| 84 | +- Pass `xp=jnp` through PyAutoLens / PyAutoGalaxy / PyAutoArray functions to select the JAX backend. |
| 85 | + |
| 86 | +## Community & support |
| 87 | + |
| 88 | +- **Slack** — [PyAutoLens workspace](https://join.slack.com/t/pyautolens/shared_invite/zt-2cufp4eyf-fXfgMxRGuvg~bMrI3uOAxg) for questions. |
| 89 | +- **Issues** — file profiling bugs and feature requests on this repo's [issue tracker](https://github.com/PyAutoLabs/autolens_profiling/issues). |
0 commit comments