Skip to content

Commit 0087d6a

Browse files
Jammy2211claude
authored andcommitted
feat: bootstrap autolens_profiling scaffolding
Phase 0 of the autolens_profiling z_feature roadmap tracked at PyAutoPrompt/z_features/autolens_profiling.md. - README.md with vision/scope, JAX-gradient out-of-scope note, related repos, how-to-read guide, and roadmap. - LICENSE (MIT, matching sister PyAutoLabs repos). - .gitignore mirrored from autolens_workspace_developer + profiler/cache additions. - Folder skeleton: likelihood/, simulators/, searches/, results/ each with a placeholder README pointing at the phase that will populate it. Tracks PyAutoLens issue #513. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit 0087d6a

7 files changed

Lines changed: 178 additions & 0 deletions

File tree

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
__pycache__/
2+
*.pyc
3+
output/
4+
root.log
5+
*.log
6+
.codex/
7+
8+
# Generated artifacts — never check in
9+
image.fits
10+
path/
11+
output_path/
12+
13+
# Profiler artifacts
14+
*.prof
15+
*.pstats
16+
17+
# JAX / numba / matplotlib caches (when not redirected via env vars)
18+
.jax_cache/
19+
__jax_cache__/
20+
.numba_cache/
21+
.mplconfig/
22+
23+
# Local virtualenvs
24+
.venv/
25+
venv/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Jammy2211
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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).

likelihood/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# likelihood
2+
3+
Likelihood JIT profiling scripts and per-section READMEs.
4+
5+
Populated by **Phase 1** of the `autolens_profiling` roadmap. Will mirror `autolens_workspace_developer/jax_profiling/jit/{imaging,interferometer,point_source,datacube}/`, preserving the step-by-step profile narrative each script already prints.
6+
7+
See the top-level [README](../README.md) for the full phase plan.

results/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# results
2+
3+
Versioned profiling artifacts written by scripts under [`likelihood/`](../likelihood/README.md), [`simulators/`](../simulators/README.md), and [`searches/`](../searches/README.md). Layout mirrors the source folders.
4+
5+
## Filename convention
6+
7+
```
8+
<profile_name>_summary_v<YYYY>.<M>.<D>.<PATCH>.json
9+
<profile_name>_summary_v<YYYY>.<M>.<D>.<PATCH>.png
10+
```
11+
12+
The version string is the PyAutoLens release that produced the numbers (e.g. `v2026.5.1.4`). Older versions are kept alongside newer ones so cross-release trends stay inspectable.
13+
14+
Example:
15+
16+
```
17+
results/likelihood/imaging/imaging_summary_v2026.5.1.4.json
18+
results/likelihood/imaging/imaging_summary_v2026.5.1.4.png
19+
results/likelihood/imaging/mge/delaunay_sparse_cpu_likelihood_summary_hst_v2026.5.1.4.json
20+
```
21+
22+
Populated as Phases 1–3 land. See the top-level [README](../README.md) for the full phase plan.

searches/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# searches
2+
3+
Sampler / search profiling — Nautilus first, with the folder layout designed so that other samplers (Dynesty, Emcee, BlackJAX, NumPyro, NSS, LBFGS, PocoMC) can slot in under their own prompts.
4+
5+
Populated by **Phase 3** of the `autolens_profiling` roadmap. Will mirror `autolens_workspace_developer/searches_minimal/`.
6+
7+
See the top-level [README](../README.md) for the full phase plan.

simulators/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# simulators
2+
3+
Run-time tracking for the PyAutoLens simulators (imaging, interferometer, point-source, cluster, group, multi).
4+
5+
Populated by **Phase 2** of the `autolens_profiling` roadmap. Will mirror `autolens_workspace_developer/jax_profiling/simulators/`. JIT support is partial across the simulator suite — placeholder scripts will land for cases where upstream JIT is not yet implemented, linking to the relevant tracking issues.
6+
7+
See the top-level [README](../README.md) for the full phase plan.

0 commit comments

Comments
 (0)