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
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ jobs:
python scripts/imaging/hazards/pixelization.py
python scripts/misc/simulators/imaging.py
python scripts/imaging/searches/nautilus/mge.py
python scripts/misc/searches/multi_start_nan_accounting_overhead.py
67 changes: 67 additions & 0 deletions results/searches/multi_start_nan_accounting/local_cpu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"hardware": "local_cpu",
"jax_version": "0.10.2",
"platform": "Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35",
"dataset_class": "imaging",
"model_type": "mge",
"instrument": "hst",
"n_starts": 16,
"ndim": 15,
"n_steps": 5,
"reps": 3,
"mixed_precision": false,
"tag": "",
"rows": [
{
"variant": "baseline",
"us_per_step": 1026922.8400000429,
"us_per_step_median": 1139497.4599999841,
"overhead_us": 0.0,
"overhead_percent": 0.0
},
{
"variant": "control",
"us_per_step": 1063466.4999997767,
"us_per_step_median": 1085053.7999998778,
"overhead_us": 36543.65999973379,
"overhead_percent": 3.5585594726603085
},
{
"variant": "host",
"us_per_step": 1085971.2199999194,
"us_per_step_median": 1094969.6600000607,
"overhead_us": 59048.37999987649,
"overhead_percent": 5.7500308396952216
},
{
"variant": "eager",
"us_per_step": 1109694.3399999873,
"us_per_step_median": 1232193.7799999432,
"overhead_us": 82771.49999994435,
"overhead_percent": 8.060147926979683
},
{
"variant": "fused",
"us_per_step": 1098545.8800001652,
"us_per_step_median": 1249355.760000617,
"overhead_us": 71623.04000012227,
"overhead_percent": 6.974529848817004
}
],
"noise_floor_percent": 3.5585594726603085,
"step_us": 1026922.8400000429,
"accounting_us": {
"host": 7.035099999484373,
"eager": 29.41264999935811,
"fused": 4.05384999976377
},
"accounting_percent_of_step": {
"host": 0.0006850660756054543,
"eager": 0.0028641538442515193,
"fused": 0.00039475701989095897
},
"python_call_overhead_us": 0.0409500007663155,
"verdict": "fused accounting costs 4.1us on a 1.027s step = 0.00039% of run time"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions scripts/misc/searches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,37 @@ To change the channel count, edit `_DATACUBE_N_CHANNELS` in `_setup.py`
(34 matches the existing ALMA cube fiducial; 4 keeps profiling
turnaround sane).

## Standalone instruments

- **`multi_start_nan_accounting_overhead.py`** — does `MultiStartGradient`'s
per-step value-NaN / gradient-NaN accounting (PyAutoFit#1472) cost any run
time? Times four ways of obtaining per-lane gradient finiteness against a
real likelihood, with a duplicate-baseline **control** so the measurement
noise floor is reported alongside the overhead — the shipped `fused` variant
is meant to sit below it. Counter-intuitively the `eager` variant (reduce on
device but outside the jit) is the *worst*, not the best: an un-jitted
reduction buys a kernel dispatch plus a host round-trip to save a few KB that
were never the cost. Run it on **both** CPU and GPU — on CPU a device→host
copy is a same-address-space memcpy, so the `host` variant's true cost is
invisible there.

Local CPU row (`mge`, 16 starts, ndim 15, 1.03 s/step): **fused 4.1 us
(0.0004% of a step)**, host 7.0 us, eager 29.4 us. Absolute values move ~50%
between CPU runs; the *ordering* (fused < host < eager) has been stable across
three independent measurements, so read the ranking as the result and the
magnitudes as order-of-magnitude.

The `fused` figure comes from a proxy objective at the real array shapes, not
from the real likelihood — differencing two ~1 s jitted calls cannot resolve a
~4 us effect (it returns negative "costs"). That makes it an upper bound on
the reduction in isolation; XLA's fusion into the real backward pass is not
captured. The end-to-end loop is ~1200x too coarse to see any of this and
reports itself as bounding, not measuring.

Related but distinct: `misc/hazards/checks/nonfinite_gradient.py` *detects*
non-finite gradients on a likelihood surface; this one measures what it costs
to *count* them during a fit.

## What this *doesn't* profile (yet)

- **Pool scaling.** `number_of_cores > 1` sweeps are future work.
Expand Down
Loading
Loading