Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions campaigns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,19 @@ tasks:
updated: '2026-10-13'
next: Unchanged and unissued (PyAutoArray#496 closed 2026-08-27). Select one bounded step when prioritised.
evidence: https://github.com/PyAutoLabs/PyAutoArray/issues/496
- id: numba_num_threads_pin_and_delaunay_nn_remeasure
campaign: measurement-tools
title: Pin NUMBA_NUM_THREADS=1 in profiling cells; re-measure the DelaunayNN numba Optimal cell after PyAutoArray#677 releases
status: ready
priority: medium
path: tasks/numba_num_threads_pin_and_delaunay_nn_remeasure.md
updated: '2026-11-05'
next: 'Filed 2026-11-05 (human). pin_thread_env omits NUMBA_NUM_THREADS (numba ignores OMP_NUM_THREADS), so the
day-zero optimal cell imaging/delaunay_nn/hst numba_cpu_sparse_fp64@hpc_ral_cpu ran its parallel Sibson on up to 8
cores (laptop Sibson 14 ms at 8 threads vs 56 ms at 1, about 3-10% of the 1.3 s call). Step 1 (pin, no compute) is
ready now; step 2 (re-measure, RAL go) waits for the release carrying PyAutoArray#677; step 3 (day-zero
designation) is a human decision.'
evidence: https://github.com/PyAutoLabs/PyAutoArray/pull/677
- id: search_settings_estimation_infrastructure
campaign: measurement-tools
title: Search settings-estimation + profiling infrastructure (n_starts / batch_size / n_batch)
Expand Down
2 changes: 1 addition & 1 deletion dashboard.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dashboard.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyAutoPulse — profiling dashboard

<!-- pulse-campaigns:1d875169f93a57e6620c6e3593398f7e518ab029907c025c3c4666ee477ef154 -->
<!-- pulse-campaigns:0df98084819c074752f8e1899e1f75b939fab981778ea01ac8f75d9f4fdbca13 -->
## Profiling Check In

<details><summary>Full check-in prompt</summary>
Expand Down Expand Up @@ -130,6 +130,7 @@ Reviewed 2026-10-17. Timing audit #410–#412 and raw HST/MGE pilot producer #41
- [MGE likelihood_breakdown steps are cumulative and `linear_gaussians` is reported as 0](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/mge_likelihood_breakdown_steps_are_cumulative_an.md) — ready: Unchanged and unissued (no GitHub refs, 2026-10-04). Select one bounded step when measurement-tools is prioritised.
- [A gradient-cost probe: forward vs `value_and_grad` ms/eval and a strict FD check, on any registry cell](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/gradient_cost_probe.md) — ready: Unissued. New context 2026-10-07: Heart unit-test timing flagged PyAutoLens forward-gradient tests +150%/+96% after PyAutoLens#768 rewrote that test file; not a controlled comparison, and this probe is the right instrument. Select one bounded step when prioritised.
- [Numba breakdown harness: perturb the instance so the operated-matrix memo cannot hide a step](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/numba_breakdown_harness_memo_blind.md) — ready: Unchanged and unissued (PyAutoArray#496 closed 2026-08-27). Select one bounded step when prioritised.
- [Pin NUMBA_NUM_THREADS=1 in profiling cells; re-measure the DelaunayNN numba Optimal cell after PyAutoArray#677 releases](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/numba_num_threads_pin_and_delaunay_nn_remeasure.md) — ready: Filed 2026-11-05 (human). pin_thread_env omits NUMBA_NUM_THREADS (numba ignores OMP_NUM_THREADS), so the day-zero optimal cell imaging/delaunay_nn/hst numba_cpu_sparse_fp64@hpc_ral_cpu ran its parallel Sibson on up to 8 cores (laptop Sibson 14 ms at 8 threads vs 56 ms at 1, about 3-10% of the 1.3 s call). Step 1 (pin, no compute) is ready now; step 2 (re-measure, RAL go) waits for the release carrying PyAutoArray#677; step 3 (day-zero designation) is a human decision.
- [Search settings-estimation + profiling infrastructure (n_starts / batch_size / n_batch)](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/search_settings_estimation_infrastructure.md) — ready: Unchanged and unissued (autolens_profiling#82 closed 2026-08-18). Select one bounded step when prioritised.
- [jax_compile/probe.py lost its cell builder with the searches tier — give profiling its own](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/jax_compile_probe_needs_own_cell_builder.md) — active: Manual HST/MGE fp64 jit builder #414 and separate raw pilot runner #416 merged. Bounded Mind implementations complete; wider builder coverage/global compile dispatch still unavailable. Agree a next capability or separately authorize a qualified pilot; no production compute authorized. Check-in 2026-10-17: autolens_profiling#418 (pilot qualification design) open since 2026-10-13 with CI green and no review; #417 open; no new measurements.
- [profile_lens_aggregator.py cannot run from the autolens_workspace_developer root: no config/ directory](https://github.com/PyAutoLabs/PyAutoPulse/blob/main/tasks/profile_lens_aggregator_needs_config_dir.md) — ready: Unchanged: workspace_developer main still has no root config/ (bug presumed live, not re-run). Select one bounded step when prioritised.
Expand Down
64 changes: 64 additions & 0 deletions tasks/numba_num_threads_pin_and_delaunay_nn_remeasure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Filed: 2026-11-05 (human request in chat: "yes file the profiling follow-up in Pulse")

# Pin `NUMBA_NUM_THREADS=1` in profiling cells and re-measure the DelaunayNN numba Optimal cell after PyAutoArray#677 is released

Type: feature
Target: autolens_profiling
Repos:
- @autolens_profiling
- @PyAutoPulse
Themes:
- numba-cpu
- profiling
Difficulty: small
Priority: medium

## Finding

`autolens_profiling/_production_config.pin_thread_env` pins `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`,
`OMP_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS` to 1, but **not `NUMBA_NUM_THREADS`**.
numba ignores `OMP_NUM_THREADS`. On the laptop (numba 0.68.1, omp layer), `OMP_NUM_THREADS=1` still gave
`numba.get_num_threads() == 8` and about 5× CPU per wall-second. numba's default is the node's
`cpu_count` (252 on RAL); the SLURM cgroup bounds it to the job's CPUs.

Until PyAutoArray#677 (merged 2026-11-05, pending release) the Sibson interpolator was always a numba
`parallel=True` kernel. So the day-zero cell
`imaging/delaunay_nn/hst numba_cpu_sparse_fp64@hpc_ral_cpu` (class `optimal`, in
`snapshots/day_zero/lens.json`; runtime `warm_iid_median_s` 1.295 s, breakdown per call 1.385 s; RAL job
412955, an 8-CPU array task) ran its Sibson step on up to 8 cores. In production every Nautilus worker is
one process on one core, and since #677 a worker always runs the serial Sibson build, so the profiled
number is optimistic.

Size (laptop, Sibson kernel only, 1,280 vertices × 61,600 over-sampled queries, the profiled HST size):
8 threads 14.1 ms, 4 threads 17.1 ms, 1 thread 56.3 ms. That is about +42 ms per likelihood call for one
interpolation, roughly 3% of the profiled call. RAL cores are slower and a call may interpolate more than
once, so the estimate is 3–10%. That is not enough to reorder setups, but the Optimal row should be the
single-core number.

Not affected:
- every other numba cell: all other numba kernels are serial by default (`general.yaml numba: parallel: false`);
- the interferometer `direct_conv` cells: `parallel: false`;
- the `misc/streaming_scaling` study, which varies threads deliberately;
- the fixed-light breakdown submits, which already export `NUMBA_NUM_THREADS=1`;
- the `delaunay-nn-cpu` campaign measurements (PyAutoArray#637), which were 1-thread.

## Steps

1. **Pin (now, no compute):** add `NUMBA_NUM_THREADS` to `_production_config.THREAD_ENV_VARS`, so
`configuration.thread_env` records it. It must be set before numba is imported. Cells call
`pin_thread_env` above `import numpy`, so check that numba isn't imported earlier.
2. **Re-measure after the release carrying PyAutoArray#677:** the DelaunayNN numba runtime + breakdown cell
on `hpc_ral_cpu` (human go for the RAL job). Mark the 2026.10.25.1 rows `superseded` and keep them.
3. **Pulse:** decide with the human whether the new row replaces the day-zero designation for that cell (a
day-zero re-freeze of one cell) or stands as a post-day-zero current record. Record the decision.
4. Phase-4 cross-check: the autolens_inference validation leg (RAL 414189, pin + #677) measures wall
time with serial Sibson in workers. Its implied per-call can be compared with the step-2 row.

## Evidence

- Failure and fix: PyAutoArray#676 / #677 (numba `prange` kernels serial in multiprocessing workers);
Mind record `complete/2026/11/numba-fork-safe-threading.md`.
- Row provenance: `results/imaging/delaunay_nn/hst/numba_cpu_sparse_fp64/hpc_ral_cpu/breakdown.json`
(`configuration.thread_env.vars` lacks `NUMBA_NUM_THREADS`; `device.cpu_count` 252).
- Human doctrine: numba CPU cost is per process and per core ("one process per core under Nautilus"),
and numba parallel threads never run inside multiprocessing workers (2026-11-05).
Loading