You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ec06f69
Browse filesBrowse the repository at this point in the historyBrowse files
feat: route interferometer numba vs FFT curvature by a cost model (#628)
The numba direct_conv route gate was a fixed 60 non-zeros per source column,
calibrated at the autolens_profiling#226 extents (70^2-280^2). On the Aris
512x512 mask (extent 341^2) it sent 2,577 vertices (106 nnz/col) to the FFT
route at 44.1 s/call against 34.2 s for direct_conv.
The default routing is now a two-constant cost model over quantities known at
routing time: t_fft = c_fft * S * [rfft2+irfft2 work of the (2ny,2nx) padded
extent, pocketfft cost_guess incl. factorisation/Bluestein], t_dc = c_dc * nnz
* ny * nx. Constants fitted by least squares on log seconds to the 9 paired
timings (6 bake-off cells of autolens_profiling#226 + 3 Aris 512 points);
predicted faster route matches the measured one at all nine, ratio residuals
0.68-1.47.
Settings: interferometer_numba_nnz_per_source_max packaged default -> null
(cost model); positive value = hard gate (unchanged); 0 = kill switch
(unchanged). New interferometer_route ("numba" | "fft" | None) forces a route
for benchmarking. _use_interferometer_numba takes extent_shape, passed from
dataset.sparse_operator (y_shape, x_shape).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: autoarray/config/general.yaml
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,8 @@ inversion:
18
18
reconstruction_vmax_factor: 0.5# Plots of an Inversion's reconstruction use the reconstructed data's bright value multiplied by this factor.
19
19
log_det_method: cholesky # How the Bayesian-evidence log-determinant terms are computed. "cholesky" (default) is the historical 2*sum(log(diag(cholesky(M)))); "slogdet" uses logabsdet of slogdet(M), which is identical where M is positive-definite but finite (not NaN) where the Cholesky fails, for gradient-based searches (opt-in, non-default; does not change the default evidence). Under "slogdet" the kernel regularization schemes (Matern/Gaussian/Exponential) also compute the regularization log-det analytically from a Cholesky of their covariance instead of factorizing the formed inverse. See PyAutoArray#391.
20
20
regularization_term_method: matmul # How the Bayesian-evidence regularization term s^T H s is computed. "matmul" (default) is the historical s @ (H @ s) against the explicitly formed regularization matrix; "cho_solve" evaluates coefficient * s^T C^-1 s for the kernel schemes (Matern/Gaussian/Exponential/MaternAdapt) via one Cholesky solve of their covariance C, avoiding the explicit inverse whose round-off is amplified by cond(C) (~1e9 on clustered traced mesh vertices). Opt-in, non-default; does not change the default evidence. Schemes with no such factorization fall back to the formed matrix.
21
-
interferometer_numba_nnz_per_source_max: 60.0# Geometry gate for the numba `direct_conv` interferometer curvature path, in mean non-zeros per source column (mapper.pix_sizes_for_sub_slim_index.sum() / mapper.params). At or below this the factory routes a NumPy (xp=np) single-mapper interferometer inversion to InversionInterferometerSparseNumba, which is 2-7x faster than the JAX/FFT route while the mapping operator stays sparse; above it the FFT route wins and is used. Measured crossovers are ~60 (Delaunay) and ~77 (rectangular) on the reference CPU (autolens_profiling#226 verdict section 2) -- this is a machine-dependent constant, so re-measure before tuning. Set 0 to disable the numba path entirely.
21
+
interferometer_numba_nnz_per_source_max: null # How a NumPy (xp=np) single-mapper interferometer inversion chooses between the numba `direct_conv` curvature path (InversionInterferometerSparseNumba) and the FFT one (InversionInterferometerSparse). null (default) = cost model: predicts both routes' single-thread time from source pixels S, total mapping non-zeros and the extent rectangle (FFT ~ S x rfft2+irfft2 cost of the padded (2ny,2nx) extent, direct_conv ~ nnz x ny x nx) and picks the faster; calibrated on autolens_profiling#226 and the Aris 512x512 mask (PyAutoArray#628). A positive value is a hard gate in mean non-zeros per source column (mapper.pix_sizes_for_sub_slim_index.sum() / mapper.params): numba at or below it, FFT above (the pre-#628 behaviour, default was 60.0). Set 0 to disable the numba path entirely.
22
+
interferometer_route: null # Force the interferometer curvature route for benchmarking: null (default) routes by interferometer_numba_nnz_per_source_max; "fft" always uses the FFT route; "numba" uses the numba direct_conv route whenever it can represent the inversion (NumPy, one mapper, no linear functions, no over-sampling), overriding the gate and the 0 kill switch.
0 commit comments