From d915dd90904d08173645170d8e601b6295702d64 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sun, 23 Aug 2026 17:43:30 -0400 Subject: [PATCH 1/2] fix: drop deleted TransformerNUFFTPyNUFFT from jax_profiling dataset setup The transformer lookup dict in simulate() is built eagerly, so the reference to al.TransformerNUFFTPyNUFFT (deleted by PyAutoArray#475) raised AttributeError for EVERY instrument, not just the alma_high_res config that selected it -- reproduced via simulate('sma'), a DFT dataset. Drops the 'nufft_pynufft' arm and repoints alma_high_res at the nufftax-backed TransformerNUFFT rather than DFT: its ~20GB dense-matrix OOM constraint is real (5000 vis x 512x512 = 1.31e9, far above the ~1e7 crossover). The stale 'nufftax needs >=3.12, venv is 3.10' caveat is moot -- the stack now floors requires-python >=3.12. Verified by running simulate() for all four instruments (sma, alma, alma_high_res, hannah); all pass, and alma_high_res completes without OOM. Closes #128 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JEXzQpvG3QNUdTh6tZcaAE --- jax_profiling/dataset_setup/interferometer.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jax_profiling/dataset_setup/interferometer.py b/jax_profiling/dataset_setup/interferometer.py index d7e8555..4446543 100644 --- a/jax_profiling/dataset_setup/interferometer.py +++ b/jax_profiling/dataset_setup/interferometer.py @@ -62,9 +62,14 @@ }, "alma_high_res": { # ALMA-style 5000-vis coverage at 0.025"/px on a 512x512 real-space - # grid. Simulator uses pynufft because (a) DFT would need a dense - # (n_vis x n_real_space) matrix = ~20GB and OOM on a 15GB laptop, - # and (b) nufftax requires Python >= 3.12 (PyAutoGPU venv is 3.10). + # grid. Simulator uses the nufftax-backed NUFFT because a DFT would + # need a dense (n_vis x n_real_space) matrix = ~20GB and OOM on a 15GB + # laptop: 5000 vis x 512x512 = 1.31e9, far above the ~1e7 n_vis*n_pix + # crossover past which the NUFFT is the only feasible path. + # This was pynufft until 2026-08-23; TransformerNUFFTPyNUFFT was + # deleted by PyAutoArray#475. The old "nufftax needs Python >= 3.12 + # but the PyAutoGPU venv is 3.10" caveat is moot — the whole stack now + # declares requires-python >= 3.12, so a 3.10 venv cannot run it at all. # Likelihood scripts can still use TransformerDFT downstream — they # only read uv_wavelengths from this file. "n_visibilities": 5000, @@ -73,7 +78,7 @@ "shape_native": (512, 512), "noise_sigma": 100.0, "seed": 1, - "transformer_class": "nufft_pynufft", + "transformer_class": "nufft", }, "hannah": { "n_visibilities": 16984, @@ -137,7 +142,6 @@ def simulate(instrument: str): transformer_class = { "dft": al.TransformerDFT, "nufft": al.TransformerNUFFT, - "nufft_pynufft": al.TransformerNUFFTPyNUFFT, }[transformer_choice] simulator = al.SimulatorInterferometer( From 5efd3e8a952e017cb3cb1d704d9558ae9e9272a2 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sun, 23 Aug 2026 17:47:06 -0400 Subject: [PATCH 2/2] docs: correct stale pynufft/JIT claims in jax_profiling delaunay scripts Four sites claimed TransformerNUFFT is 'pynufft-based' and 'not JIT-friendly'. Both are wrong: the pynufft backend was deleted by PyAutoArray#475, and the nufftax-backed TransformerNUFFT jits fine. The real subtlety, verified 2026-08-23: transform_mapping_matrix takes a PER-CALL xp argument defaulting to np. With xp=jnp it jits and matches the numpy path to 5e-16 relative; with the default xp=np it raises TracerArrayConversionError under jax.jit. That is what the caveat should say. No behaviour change -- these scripts still use TransformerDFT, now with an accurate reason (baseline comparability, not a JIT limitation). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01JEXzQpvG3QNUdTh6tZcaAE --- jax_profiling/jit/datacube/delaunay.py | 8 ++++++-- jax_profiling/jit/interferometer/delaunay.py | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/jax_profiling/jit/datacube/delaunay.py b/jax_profiling/jit/datacube/delaunay.py index 41b6e6f..eb25673 100644 --- a/jax_profiling/jit/datacube/delaunay.py +++ b/jax_profiling/jit/datacube/delaunay.py @@ -231,8 +231,12 @@ def jit_profile(func, label, *args, n_repeats=10): real_space_mask=real_space_mask, transformer_class=al.TransformerDFT, # DFT is intentional even at ALMA-scale visibility counts — profiling - # the JAX-traceable path is the goal, NUFFT (pynufft) is not yet - # JIT-friendly. + # the JAX-traceable path is the goal. NOTE (2026-08-23): the old + # reason given here, "NUFFT (pynufft) is not yet JIT-friendly", is + # no longer true — the pynufft backend is deleted and the + # nufftax-backed TransformerNUFFT jits fine via xp=jnp. DFT is left + # in place so existing profiling baselines stay comparable; revisit + # if NUFFT-path timings are wanted. raise_error_dft_visibilities_limit=False, ).apply_sparse_operator(use_jax=True, show_progress=False) for _ in range(n_channels) diff --git a/jax_profiling/jit/interferometer/delaunay.py b/jax_profiling/jit/interferometer/delaunay.py index b8cef6d..1595aac 100644 --- a/jax_profiling/jit/interferometer/delaunay.py +++ b/jax_profiling/jit/interferometer/delaunay.py @@ -64,8 +64,11 @@ - ``dataset.transformer.transform_mapping_matrix`` is JIT-friendly for ``TransformerDFT`` (a single matrix multiply) and the default SMA preset - uses it. ``TransformerNUFFT`` (pynufft-based) is not JIT-friendly; if you - swap the transformer the step-8 timing will fall back to eager-only. + uses it. ``TransformerNUFFT`` (nufftax-backed) is JIT-friendly *too*, but + only when called with ``xp=jnp``: ``xp`` is a per-call argument that + defaults to ``np``, and the numpy path raises + ``TracerArrayConversionError`` under ``jax.jit``. Verified 2026-08-23 — + the two paths agree to 5e-16 relative. - The visibility-space χ² in step 13 separates the complex visibilities and noise into real/imag components inside the JIT body (matching the ``pixelization/likelihood_function.py`` reference). Complex-valued JIT @@ -214,8 +217,12 @@ def jit_profile(func, label, *args, n_repeats=10): real_space_mask=real_space_mask, transformer_class=al.TransformerDFT, # DFT is intentional even at ALMA-scale visibility counts — profiling - # the JAX-traceable path is the goal, NUFFT (pynufft) is not yet - # JIT-friendly. + # the JAX-traceable path is the goal. NOTE (2026-08-23): the old + # reason given here, "NUFFT (pynufft) is not yet JIT-friendly", is no + # longer true — the pynufft backend is deleted and the nufftax-backed + # TransformerNUFFT jits fine via xp=jnp. DFT is left in place here so + # existing profiling baselines stay comparable, not because NUFFT + # cannot be traced; revisit if NUFFT-path timings are wanted. raise_error_dft_visibilities_limit=False, ) @@ -553,8 +560,9 @@ def ray_trace_mesh_raw(mesh_raw): # For ``TransformerDFT`` this is a single complex matrix multiply # ``D @ M`` where D is the discrete Fourier matrix (n_vis × n_image) and # M is the real mapping matrix (n_image × source_pixels). JIT-friendly. -# For ``TransformerNUFFT`` (pynufft-based, ALMA-scale) this step would fall -# back to eager — flag if you swap the transformer. +# For ``TransformerNUFFT`` (nufftax-backed, ALMA-scale) this step also jits, +# provided ``transform_mapping_matrix`` is called with ``xp=jnp``; with the +# default ``xp=np`` it raises ``TracerArrayConversionError`` under jit. print("\n--- Step 8: Transformed mapping matrix (NUFFT) ---")