diff --git a/README.md b/README.md index 9319fff24..b68a3ee78 100644 --- a/README.md +++ b/README.md @@ -92,13 +92,18 @@ Results are framed by **astronomy instrument** (HST, Euclid, JWST, …) rather t | `interferometer/delaunay_numba_symmetric` | sma | local_cpu_fp64 | sparse (numba) | 443.1 ms | v2026.8.17.1 | | `interferometer/delaunay_numba_two_stage` | sma | local_cpu_fp64 | sparse (numba) | 388.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma | local_cpu_fp64 | dense (mapping) | 41.19 s | v2026.8.17.1 | +| `interferometer/mge` | alma | local_cpu_fp64 | sparse (w-tilde) | 32.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma | hpc_a100_fp64 | dense (mapping) | 943.2 ms | v2026.8.17.1 | +| `interferometer/mge` | alma | hpc_a100_fp64 | sparse (w-tilde) | 2.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma_high | local_cpu_fp64 | dense (mapping) | 212.19 s | v2026.8.17.1 | | `interferometer/mge` | alma_high | hpc_a100_fp64 | dense (mapping) | 3.88 s | v2026.8.17.1 | +| `interferometer/mge` | alma_high | hpc_a100_fp64 | sparse (w-tilde) | 19.6 ms | v2026.8.17.1 | | `interferometer/mge` | alma_high | hpc_a100_mp | dense (mapping) | 3.93 s | v2026.8.17.1 | | `interferometer/mge` | jvla | hpc_a100_fp64 | dense (mapping) | 23.81 s | v2026.8.17.1 | +| `interferometer/mge` | jvla | hpc_a100_fp64 | sparse (w-tilde) | 16.7 ms | v2026.8.17.1 | | `interferometer/mge` | jvla | hpc_a100_mp | dense (mapping) | 23.72 s | v2026.8.17.1 | | `interferometer/mge` | sma | local_cpu_fp64 | dense (mapping) | 84.0 ms | v2026.8.17.1 | +| `interferometer/mge` | sma | local_cpu_fp64 | sparse (w-tilde) | 11.8 ms | v2026.8.17.1 | | `interferometer/mge` | sma | hpc_a100_fp64 | dense (mapping) | 856.2 ms | v2026.8.17.1 | | `interferometer/mge_dft` | sma | local_cpu_fp64 | dense (mapping) | 32.9 ms | v2026.8.17.1 | | `interferometer/pixelization_numba_direct_conv` | alma | local_cpu_fp64 | sparse (numba) | 1.76 s | v2026.8.17.1 | diff --git a/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_fp64_sparse b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_fp64_sparse new file mode 100644 index 000000000..4e67f5aca --- /dev/null +++ b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_fp64_sparse @@ -0,0 +1,87 @@ +#!/bin/bash -l +# +# A100 likelihood-breakdown profile: interferometer/mge x alma x fp64, LIBRARY W~ ROUTE. +# PyAutoArray#575 routes an MGE-only interferometer fit through +# InversionInterferometerSparse once dataset.apply_sparse_operator() is applied +# (--sparse). The dense arms of the #308 submit (library dense path, recorded as +# an OOM; --transform-chunk 4 chunked arm; --w-tilde measurement-only arm) run in +# the same job, so before/after land in one JSON. --sparse-vmap-batch 64,16,4 is +# a small VRAM probe of the sparse full pipeline for scripts/misc/vram/config.py. +# +# BRANCH LIBRARIES: until #575 merges and HPCPullPyAuto brings it to the shared +# mirror, the three branch libraries are a PRIVATE copy under +# $PYAUTO_BRANCH_LIBS (default below), prepended to PYTHONPATH after +# activate.sh. The shared mirror /mnt/ral/jnightin/PyAuto is not touched. The job +# fails unless autoarray/autogalaxy/autolens import from that copy. +# +# Output: results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.json +# A RESOURCE_EXHAUSTED / OOM here is a result, not a failure: record it. + +#SBATCH -J breakdown_interferometer_mge_alma_fp64_sparse +#SBATCH --partition=gpu +#SBATCH --gres=gpu:1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=4 +#SBATCH --mem=64gb +#SBATCH --time=2:00:00 +#SBATCH -o output/output.%A.out +#SBATCH -e error/error.%A.err +#SBATCH --mail-type=END,FAIL +#SBATCH --mail-user=james.w.nightingale@durham.ac.uk + +# Derive the repo root from where this was submitted (hpc/batch_gpu/../..): it runs from +# a RAL worktree of the feature branch, not only the canonical RAL checkout. +export AP_ROOT="$(cd "${SLURM_SUBMIT_DIR:-$(dirname "$0")}/../.." && pwd)" +export PROJECT_PATH="$AP_ROOT" +export PYAUTO_HPC_BASE="${PYAUTO_HPC_BASE:-/mnt/ral/jnightin/PyAuto}" +export PYAUTO_BRANCH_LIBS="${PYAUTO_BRANCH_LIBS:-/mnt/ral/jnightin/PyAuto_branch/interferometer-mge-w-tilde-route}" +echo "AP_ROOT=$AP_ROOT" +source $AP_ROOT/activate.sh +export PYTHONPATH="$PYAUTO_BRANCH_LIBS/PyAutoArray:$PYAUTO_BRANCH_LIBS/PyAutoGalaxy:$PYAUTO_BRANCH_LIBS/PyAutoLens:$PYTHONPATH" + +export JAX_PLATFORM_NAME=cuda +export JAX_PLATFORMS=cuda,cpu +export XLA_PYTHON_CLIENT_PREALLOCATE=false +export JAX_ENABLE_X64=True +export XLA_FLAGS="--xla_disable_hlo_passes=constant_folding" + +nvidia-smi + +echo "==========================================" +date +echo "Cell: likelihood_breakdown/interferometer/mge" +echo "Instrument: alma" +echo "Precision: fp64" +echo "Inversion path: library W~ route (--sparse) + dense arms + W~ arm" + +cd $AP_ROOT + +echo "=== source revisions ===" +for r in PyAutoArray PyAutoGalaxy PyAutoLens; do + printf '%-14s %s (branch copy)\n' "$r" "$(git -C $PYAUTO_BRANCH_LIBS/$r rev-parse HEAD 2>&1)" +done +for r in PyAutoNerves PyAutoFit; do + printf '%-14s %s (shared mirror)\n' "$r" "$(git -C $PYAUTO_HPC_BASE/$r rev-parse HEAD 2>&1)" +done +echo "AP_ROOT rev: $(git -C $AP_ROOT rev-parse HEAD 2>&1)" + +echo "=== import provenance (must be the branch copy) ===" +python3 -c " +import os, autoarray, autogalaxy, autolens +base = os.environ['PYAUTO_BRANCH_LIBS'] +for m in (autoarray, autogalaxy, autolens): + print(m.__name__ + '.__file__ =', m.__file__) + assert m.__file__.startswith(base), f'{m.__name__} not imported from {base}' +" + +python3 -u scripts/interferometer/likelihood_breakdown/mge.py \ + --config-name hpc_a100_fp64 \ + --instrument alma \ + --sparse \ + --sparse-vmap-batch 64,16,4 \ + --w-tilde \ + --transform-chunk 4 \ + --vmap-batch 4 + +echo "Finished." +date diff --git a/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_high_fp64_sparse b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_high_fp64_sparse new file mode 100644 index 000000000..d5482f486 --- /dev/null +++ b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_alma_high_fp64_sparse @@ -0,0 +1,86 @@ +#!/bin/bash -l +# +# A100 likelihood-breakdown profile: interferometer/mge x alma_high x fp64, LIBRARY W~ ROUTE. +# PyAutoArray#575 routes an MGE-only interferometer fit through +# InversionInterferometerSparse once dataset.apply_sparse_operator() is applied +# (--sparse). The dense arms of the #308 submit (library dense path, recorded as +# an OOM; --transform-chunk 4 chunked arm; --w-tilde measurement-only arm) run in +# the same job, so before/after land in one JSON. --sparse-vmap-batch 64,16,4 is +# a small VRAM probe of the sparse full pipeline for scripts/misc/vram/config.py. +# +# BRANCH LIBRARIES: until #575 merges and HPCPullPyAuto brings it to the shared +# mirror, the three branch libraries are a PRIVATE copy under +# $PYAUTO_BRANCH_LIBS (default below), prepended to PYTHONPATH after +# activate.sh. The shared mirror /mnt/ral/jnightin/PyAuto is not touched. The job +# fails unless autoarray/autogalaxy/autolens import from that copy. +# +# Output: results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.json +# A RESOURCE_EXHAUSTED / OOM here is a result, not a failure: record it. + +#SBATCH -J breakdown_interferometer_mge_alma_high_fp64_sparse +#SBATCH --partition=gpu +#SBATCH --gres=gpu:1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=4 +#SBATCH --mem=64gb +#SBATCH --time=4:00:00 +#SBATCH -o output/output.%A.out +#SBATCH -e error/error.%A.err +#SBATCH --mail-type=END,FAIL +#SBATCH --mail-user=james.w.nightingale@durham.ac.uk + +# Derive the repo root from where this was submitted (hpc/batch_gpu/../..): it runs from +# a RAL worktree of the feature branch, not only the canonical RAL checkout. +export AP_ROOT="$(cd "${SLURM_SUBMIT_DIR:-$(dirname "$0")}/../.." && pwd)" +export PROJECT_PATH="$AP_ROOT" +export PYAUTO_HPC_BASE="${PYAUTO_HPC_BASE:-/mnt/ral/jnightin/PyAuto}" +export PYAUTO_BRANCH_LIBS="${PYAUTO_BRANCH_LIBS:-/mnt/ral/jnightin/PyAuto_branch/interferometer-mge-w-tilde-route}" +echo "AP_ROOT=$AP_ROOT" +source $AP_ROOT/activate.sh +export PYTHONPATH="$PYAUTO_BRANCH_LIBS/PyAutoArray:$PYAUTO_BRANCH_LIBS/PyAutoGalaxy:$PYAUTO_BRANCH_LIBS/PyAutoLens:$PYTHONPATH" + +export JAX_PLATFORM_NAME=cuda +export JAX_PLATFORMS=cuda,cpu +export XLA_PYTHON_CLIENT_PREALLOCATE=false +export JAX_ENABLE_X64=True +export XLA_FLAGS="--xla_disable_hlo_passes=constant_folding" + +nvidia-smi + +echo "==========================================" +date +echo "Cell: likelihood_breakdown/interferometer/mge" +echo "Instrument: alma_high" +echo "Precision: fp64" +echo "Inversion path: library W~ route (--sparse) + dense arms + W~ arm" + +cd $AP_ROOT + +echo "=== source revisions ===" +for r in PyAutoArray PyAutoGalaxy PyAutoLens; do + printf '%-14s %s (branch copy)\n' "$r" "$(git -C $PYAUTO_BRANCH_LIBS/$r rev-parse HEAD 2>&1)" +done +for r in PyAutoNerves PyAutoFit; do + printf '%-14s %s (shared mirror)\n' "$r" "$(git -C $PYAUTO_HPC_BASE/$r rev-parse HEAD 2>&1)" +done +echo "AP_ROOT rev: $(git -C $AP_ROOT rev-parse HEAD 2>&1)" + +echo "=== import provenance (must be the branch copy) ===" +python3 -c " +import os, autoarray, autogalaxy, autolens +base = os.environ['PYAUTO_BRANCH_LIBS'] +for m in (autoarray, autogalaxy, autolens): + print(m.__name__ + '.__file__ =', m.__file__) + assert m.__file__.startswith(base), f'{m.__name__} not imported from {base}' +" + +python3 -u scripts/interferometer/likelihood_breakdown/mge.py \ + --config-name hpc_a100_fp64 \ + --instrument alma_high \ + --sparse \ + --sparse-vmap-batch 64,16,4 \ + --w-tilde \ + --transform-chunk 4 + +echo "Finished." +date diff --git a/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_jvla_fp64_sparse b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_jvla_fp64_sparse new file mode 100644 index 000000000..b30145afc --- /dev/null +++ b/hpc/batch_gpu/submit_breakdown_interferometer_mge_a100_jvla_fp64_sparse @@ -0,0 +1,86 @@ +#!/bin/bash -l +# +# A100 likelihood-breakdown profile: interferometer/mge x jvla x fp64, LIBRARY W~ ROUTE. +# PyAutoArray#575 routes an MGE-only interferometer fit through +# InversionInterferometerSparse once dataset.apply_sparse_operator() is applied +# (--sparse). The dense arms of the #308 submit (library dense path, recorded as +# an OOM; --transform-chunk 4 chunked arm; --w-tilde measurement-only arm) run in +# the same job, so before/after land in one JSON. --sparse-vmap-batch 64,16,4 is +# a small VRAM probe of the sparse full pipeline for scripts/misc/vram/config.py. +# +# BRANCH LIBRARIES: until #575 merges and HPCPullPyAuto brings it to the shared +# mirror, the three branch libraries are a PRIVATE copy under +# $PYAUTO_BRANCH_LIBS (default below), prepended to PYTHONPATH after +# activate.sh. The shared mirror /mnt/ral/jnightin/PyAuto is not touched. The job +# fails unless autoarray/autogalaxy/autolens import from that copy. +# +# Output: results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.json +# A RESOURCE_EXHAUSTED / OOM here is a result, not a failure: record it. + +#SBATCH -J breakdown_interferometer_mge_jvla_fp64_sparse +#SBATCH --partition=gpu +#SBATCH --gres=gpu:1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=4 +#SBATCH --mem=128gb +#SBATCH --time=6:00:00 +#SBATCH -o output/output.%A.out +#SBATCH -e error/error.%A.err +#SBATCH --mail-type=END,FAIL +#SBATCH --mail-user=james.w.nightingale@durham.ac.uk + +# Derive the repo root from where this was submitted (hpc/batch_gpu/../..): it runs from +# a RAL worktree of the feature branch, not only the canonical RAL checkout. +export AP_ROOT="$(cd "${SLURM_SUBMIT_DIR:-$(dirname "$0")}/../.." && pwd)" +export PROJECT_PATH="$AP_ROOT" +export PYAUTO_HPC_BASE="${PYAUTO_HPC_BASE:-/mnt/ral/jnightin/PyAuto}" +export PYAUTO_BRANCH_LIBS="${PYAUTO_BRANCH_LIBS:-/mnt/ral/jnightin/PyAuto_branch/interferometer-mge-w-tilde-route}" +echo "AP_ROOT=$AP_ROOT" +source $AP_ROOT/activate.sh +export PYTHONPATH="$PYAUTO_BRANCH_LIBS/PyAutoArray:$PYAUTO_BRANCH_LIBS/PyAutoGalaxy:$PYAUTO_BRANCH_LIBS/PyAutoLens:$PYTHONPATH" + +export JAX_PLATFORM_NAME=cuda +export JAX_PLATFORMS=cuda,cpu +export XLA_PYTHON_CLIENT_PREALLOCATE=false +export JAX_ENABLE_X64=True +export XLA_FLAGS="--xla_disable_hlo_passes=constant_folding" + +nvidia-smi + +echo "==========================================" +date +echo "Cell: likelihood_breakdown/interferometer/mge" +echo "Instrument: jvla" +echo "Precision: fp64" +echo "Inversion path: library W~ route (--sparse) + dense arms + W~ arm" + +cd $AP_ROOT + +echo "=== source revisions ===" +for r in PyAutoArray PyAutoGalaxy PyAutoLens; do + printf '%-14s %s (branch copy)\n' "$r" "$(git -C $PYAUTO_BRANCH_LIBS/$r rev-parse HEAD 2>&1)" +done +for r in PyAutoNerves PyAutoFit; do + printf '%-14s %s (shared mirror)\n' "$r" "$(git -C $PYAUTO_HPC_BASE/$r rev-parse HEAD 2>&1)" +done +echo "AP_ROOT rev: $(git -C $AP_ROOT rev-parse HEAD 2>&1)" + +echo "=== import provenance (must be the branch copy) ===" +python3 -c " +import os, autoarray, autogalaxy, autolens +base = os.environ['PYAUTO_BRANCH_LIBS'] +for m in (autoarray, autogalaxy, autolens): + print(m.__name__ + '.__file__ =', m.__file__) + assert m.__file__.startswith(base), f'{m.__name__} not imported from {base}' +" + +python3 -u scripts/interferometer/likelihood_breakdown/mge.py \ + --config-name hpc_a100_fp64 \ + --instrument jvla \ + --sparse \ + --sparse-vmap-batch 64,16,4 \ + --w-tilde \ + --transform-chunk 4 + +echo "Finished." +date diff --git a/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.json b/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.json new file mode 100644 index 000000000..a02e10d04 --- /dev/null +++ b/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.json @@ -0,0 +1,393 @@ +{ + "stage": "complete", + "autolens_version": "2026.8.17.1", + "device": { + "backend": "gpu", + "device": "cuda:0", + "hostname": "euclid-ral-gpu-1", + "xla_flags": "--xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0 --xla_gpu_enable_triton_gemm=false", + "omp_num_threads": null, + "cpu_count": 124, + "jax_compilation_cache_dir": "/mnt/ral/jnightin/.cache/pyauto_jax", + "autotune_cache_entries_at_start": 204, + "cache_fresh": false, + "nvidia_smi": "NVIDIA A100 80GB PCIe, 36883 MiB, 81920 MiB" + }, + "instrument": "alma_high", + "model": "mge", + "transformer": "TransformerNUFFT", + "use_mixed_precision": false, + "configuration": { + "pixel_scale_arcsec": 0.025, + "mask_radius_arcsec": 3.5, + "real_space_shape": [ + 800, + 800 + ], + "image_pixels_masked": 61572, + "visibilities": 5000000, + "linear_gaussians": 20, + "lens_light": null, + "inversion_path": "sparse", + "inversion_class": "InversionInterferometerSparse", + "dense_inversion_class": "InversionInterferometerMapping", + "transformer": "TransformerNUFFT", + "chunk_size": 1000000, + "chunk_size_note": "TransformerNUFFT.transform_mapping_matrix ignores chunk_size: step 3 is one nufft2d2 over every column and every visibility.", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "nufftax_version": "0.6.1", + "transform": "script_chunked", + "transform_column_batch": 4, + "transform_vis_chunk": 1000000, + "w_tilde_arm": true, + "library_sparse_arm": true, + "n_repeats": 10, + "thread_env": { + "n_threads": null, + "vars": [ + "OPENBLAS_NUM_THREADS", + "MKL_NUM_THREADS", + "OMP_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "NUMEXPR_NUM_THREADS" + ], + "set_to": null, + "preexisting": {}, + "overridden": {}, + "note": "Not pinned (legacy variant): recorded as found." + }, + "host_load_avg_start": [ + 1.41, + 0.34, + 0.11 + ], + "host_load_avg_end": [ + 2.07, + 1.66, + 0.78 + ] + }, + "reference_mode": "cpu_pinned", + "library_path": { + "status": "oom", + "requested_bytes": 322433932328, + "where": "jax.jit(FitInterferometer) reference", + "error": "RESOURCE_EXHAUSTED: Out of memory while trying to allocate 300.29GiB. [executable_name='jit__reference_fn'] [tf-allocator-allocation-error='']" + }, + "full_pipeline_status": { + "status": "skipped", + "reason": "library path OOMed (same transform)" + }, + "transformed_mapping_matrix_chunked_vs_library_max_rel_diff": null, + "log_likelihood_reference": -60242552.89874968, + "figure_of_merit_reference": -60242552.89876968, + "figure_of_merit_step_by_step": -60242552.898769744, + "log_likelihood_step_by_step": -60242552.89875044, + "figure_of_merit_full_pipeline": null, + "figure_of_merit_abs_diff_nats": 6.705522537231445e-08, + "log_likelihood_abs_diff_nats": 7.599592208862305e-07, + "full_pipeline_abs_diff_nats": null, + "log_likelihood_atol_nats": 0.001, + "diagonal_floor_bias_nats": 1.9997358322143555e-05, + "diagonal_floor_note": "log_likelihood - figure_of_merit: fast_chi_squared uses F with the no-regularization diagonal floor (0.001), so the figure of merit the sampler sees sits 0.5 * floor * |s|^2 below the residual-form log L.", + "setup_cross_check": { + "mapping_matrix_max_rel_diff_vs_eager": null, + "transformed_mapping_matrix_max_rel_diff_vs_eager": null + }, + "log_det_terms": { + "value": 0.0, + "timed": false, + "note": "Structurally zero: an MGE-only inversion has no regularization." + }, + "nnls": { + "iterations": 11, + "converged": true, + "max_iter": 50, + "solver": "pdip", + "preconditioning": "raw" + }, + "steps": { + "Ray-trace grids": 0.0005378146001021378, + "Mapping matrix (20 Gaussians)": 0.0005201775988098234, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.0021206896024523305, + "Reconstruction (PDIP NNLS)": 0.001143730299372692, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.015290673998242712 + }, + "total_step_by_step": 0.019613086098979694, + "source_revisions": { + "autolens_profiling": "bb6ec21f28a83177edadb725f12eb07af8c5dad5", + "PyAutoNerves": "1fa613aa8d89a79613009fb66f5b4e2d21deb57a", + "PyAutoFit": "dd9fbe0aab60c4a57702b1444ca031b317c91331", + "PyAutoArray": "b5ef2e89eaeb7ab4b240adb0e3f035f8104323ec", + "PyAutoGalaxy": "068daa9db0933c32b4e48f919046771f69c44e00", + "PyAutoLens": "acb136cdd918c12d7f89b7fac4313de54fee0a7e" + }, + "full_pipeline_single_jit": null, + "steps_sub_rows": { + "Ray-trace (standalone, eager tracer)": 0.00022214729979168623, + "transform_mapping_matrix (standalone)": 3.7487630318995797, + "Mapped visibilities + residual chi-squared (log_likelihood)": 0.002460274500481319, + "Dense chain from mapping matrix (steps 3-8 fused)": 3.8074253650003813 + }, + "setup_split": { + "Ray-trace grids": 0.0005378146001021378, + "Mapping matrix (20 Gaussians)": 0.0005201775988098234, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.0021206896024523305, + "Reconstruction (PDIP NNLS)": 0.001143730299372692, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.015290673998242712 + }, + "setup_prefix_per_call_s": { + "1": 0.00048254729917971415, + "2": 0.0010588713004835882, + "3": 3.8081593440991126 + }, + "jit_phases": { + "setup_prefix_1": { + "lower_s": 0.0790004810114624, + "compile_s": 0.4623568849929143, + "first_call_s": 0.002888055008952506, + "steady_per_call_s": 0.00048254729917971415 + }, + "setup_prefix_2": { + "lower_s": 0.37423417301033624, + "compile_s": 0.11514079700282309, + "first_call_s": 0.006749488995410502, + "steady_per_call_s": 0.0010588713004835882 + }, + "setup_prefix_3": { + "lower_s": 0.3699650149937952, + "compile_s": 1.819281520001823, + "first_call_s": 3.7584718680009246, + "steady_per_call_s": 3.8081593440991126 + }, + "ray_trace_standalone": { + "lower_s": 0.06963093200465664, + "compile_s": 0.333372913999483, + "first_call_s": 0.0013700029958272353, + "steady_per_call_s": 0.00022214729979168623 + }, + "transform_mapping_matrix_standalone": { + "lower_s": 0.0909198169974843, + "compile_s": 1.5799625059880782, + "first_call_s": 3.660229128989158, + "steady_per_call_s": 3.7487630318995797 + }, + "data_vector": { + "lower_s": 0.007975724001880735, + "compile_s": 0.16973351000342518, + "first_call_s": 0.0030540540028596297, + "steady_per_call_s": 0.0025265467003919182 + }, + "curvature_matrix": { + "lower_s": 0.010856239998247474, + "compile_s": 0.06764992699027061, + "first_call_s": 0.1554839809978148, + "steady_per_call_s": 0.12476032790000317 + }, + "reconstruction": { + "lower_s": 0.027711586997611448, + "compile_s": 0.3693468709971057, + "first_call_s": 0.01280690600106027, + "steady_per_call_s": 0.0017324490996543317 + }, + "figure_of_merit": { + "lower_s": 0.011053787005948834, + "compile_s": 0.23859177398844622, + "first_call_s": 0.001212884992128238, + "steady_per_call_s": 0.0003633376996731386 + }, + "log_likelihood_residual_visibilities": { + "lower_s": 0.008734536007978022, + "compile_s": 0.27383868901233654, + "first_call_s": 0.003207600995665416, + "steady_per_call_s": 0.002460274500481319 + }, + "dense_chain_from_mapping_matrix": { + "lower_s": 0.18478414000128396, + "compile_s": 2.2978464390034787, + "first_call_s": 3.7922541119914968, + "steady_per_call_s": 3.8074253650003813 + }, + "w_tilde_curvature": { + "lower_s": 0.09071409999160096, + "compile_s": 0.1721733110025525, + "first_call_s": 0.03305450300103985, + "steady_per_call_s": 0.0018658674991456792 + }, + "w_tilde_data_vector": { + "lower_s": 0.006591680008568801, + "compile_s": 0.07108047600195277, + "first_call_s": 0.0008247790101449937, + "steady_per_call_s": 0.00012220159987919033 + }, + "w_tilde_reconstruction": { + "lower_s": 0.00032514600025024265, + "compile_s": 1.0390009265393019e-05, + "first_call_s": 0.0020734849967993796, + "steady_per_call_s": 0.0017324622996966355 + }, + "w_tilde_figure_of_merit": { + "lower_s": 0.006018726999172941, + "compile_s": 0.04682723700534552, + "first_call_s": 0.0007120920054148883, + "steady_per_call_s": 0.0001474101998610422 + }, + "w_tilde_chain_from_mapping_matrix": { + "lower_s": 0.04163699998753145, + "compile_s": 0.5598862819897477, + "first_call_s": 0.009968629005015828, + "steady_per_call_s": 0.0033625594995100984 + }, + "library_sparse_prefix_1": { + "lower_s": 0.07478007199824788, + "compile_s": 0.4501501710037701, + "first_call_s": 0.0029266839992487803, + "steady_per_call_s": 0.0005378146001021378 + }, + "library_sparse_prefix_2": { + "lower_s": 0.2709289640042698, + "compile_s": 0.1196173830103362, + "first_call_s": 0.007169813005020842, + "steady_per_call_s": 0.0010579921989119611 + }, + "library_sparse_prefix_3": { + "lower_s": 0.8960250520030968, + "compile_s": 2.201188520004507, + "first_call_s": 0.027722316997824237, + "steady_per_call_s": 0.0031786818013642914 + }, + "library_sparse_prefix_4": { + "lower_s": 0.7141071789956186, + "compile_s": 2.376519833007478, + "first_call_s": 0.017343751998851076, + "steady_per_call_s": 0.004322412100736983 + }, + "library_sparse_prefix_5": { + "lower_s": 1.3328599450032925, + "compile_s": 15.122731202995055, + "first_call_s": 0.05152100000123028, + "steady_per_call_s": 0.019613086098979694 + }, + "library_sparse_fit_log_likelihood": { + "lower_s": 1.1933673040039139, + "compile_s": 22.24661202399875, + "first_call_s": 0.07933095599582884, + "steady_per_call_s": 0.03519665649946546 + }, + "library_sparse_full_pipeline": { + "lower_s": 1.360826320000342, + "compile_s": 15.015887674991973, + "first_call_s": 0.05323802000202704, + "steady_per_call_s": 0.0196069981000619 + }, + "library_sparse_full_pipeline_vmap64": { + "first_call_s": 18.08955711100134, + "batch_per_call_s": 0.09867688700032887, + "steady_per_call_s": 0.0015418263593801385 + } + }, + "peak_rss_mb": 8308.91796875, + "w_tilde": { + "operator_build_s": 3.8125258889922407, + "operator_build_nufft_chunk_size": 1000000, + "operator_shape": [ + 280, + 280 + ], + "curvature_max_rel_diff_vs_dense": 2.777021821784969e-12, + "data_vector_max_rel_diff_vs_dense": 2.0421856935492616e-16, + "figure_of_merit": -60242552.898770384, + "figure_of_merit_chain": -60242552.898770384, + "figure_of_merit_abs_diff_vs_fit_nats": 7.078051567077637e-07, + "figure_of_merit_abs_diff_vs_step_by_step_nats": 6.407499313354492e-07, + "log_likelihood_unfloored": -60242552.89875039, + "log_likelihood_abs_diff_vs_fit_nats": 7.078051567077637e-07, + "operator_build_peak_rss_mb": 5389.5703125, + "total_step_by_step": 0.0038679415985825474, + "chain_from_mapping_matrix_s": 0.0033625594995100984, + "dense_chain_from_mapping_matrix_s": 3.8074253650003813, + "dense_transform_plus_curvature_s": 3.873523359799583, + "w_tilde_curvature_s": 0.0018658674991456792, + "speedup_curvature_vs_dense_transform_plus_curvature": 2075.990584311665, + "speedup_chain_vs_dense_chain": 1132.2997750835625, + "note": "Measurement-only: an MGE-only fit never takes this path in the library (inversion/factory.py switches the sparse operator off when every linear object is an AbstractLinearObjFuncList). The chain row replaces steps 3-8 from the same mapping matrix; its per-call cost has no N_vis term." + }, + "w_tilde_steps": { + "Curvature matrix F~ = B\u1d40 W~ B": 0.0018658674991456792, + "Data vector D~ = B\u1d40 d~": 0.00012220159987919033, + "Reconstruction (PDIP NNLS)": 0.0017324622996966355, + "Fast chi-squared + figure of merit (constants hoisted)": 0.0001474101998610422 + }, + "dense_steps": { + "Ray-trace grids": 0.00048254729917971415, + "Mapping matrix (20 Gaussians)": 0.000576324001303874, + "Transformed mapping matrix (NUFFT)": 3.807100472798629, + "Data vector (D)": 0.0025265467003919182, + "Curvature matrix (F)": 0.12476032790000317, + "Reconstruction (PDIP NNLS)": 0.0017324490996543317, + "Fast chi-squared + figure of merit": 0.0003633376996731386 + }, + "dense_total_step_by_step": 3.937542005498835, + "dense_setup_split": { + "Ray-trace grids": 0.00048254729917971415, + "Mapping matrix (20 Gaussians)": 0.000576324001303874, + "Transformed mapping matrix (NUFFT)": 3.807100472798629 + }, + "library_sparse": { + "status": "ok", + "operator_build_s": 3.8125258889922407, + "operator_build_peak_rss_mb": 5389.5703125, + "operator_build_nufft_chunk_size": 1000000, + "fit_transformer_chunk_size": 1000000, + "inversion_class": "InversionInterferometerSparse", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "data_vector_max_rel_diff_vs_dense": 2.0421856935492616e-16, + "curvature_reg_matrix_max_rel_diff_vs_dense": 2.777021821780885e-12, + "setup_split": { + "Ray-trace grids": 0.0005378146001021378, + "Mapping matrix (20 Gaussians)": 0.0005201775988098234, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.0021206896024523305, + "Reconstruction (PDIP NNLS)": 0.001143730299372692, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.015290673998242712 + }, + "setup_prefix_per_call_s": { + "1": 0.0005378146001021378, + "2": 0.0010579921989119611, + "3": 0.0031786818013642914, + "4": 0.004322412100736983, + "5": 0.019613086098979694 + }, + "total_step_by_step": 0.019613086098979694, + "fit_log_likelihood_s": 0.03519665649946546, + "full_pipeline_single_jit": 0.0196069981000619, + "log_likelihood": -60242552.89874968, + "figure_of_merit": -60242552.898769625, + "figure_of_merit_full_pipeline": -60242552.898769625, + "reference_mode": "cpu_pinned", + "log_likelihood_abs_diff_vs_reference_nats": 0.0, + "figure_of_merit_abs_diff_vs_reference_nats": 5.21540641784668e-08, + "full_pipeline_abs_diff_vs_reference_nats": 5.21540641784668e-08, + "witness_threshold_nats": 1e-06, + "witness_pass": null, + "witness_note": "no dense reference on this device (cpu_pinned); diffs are against the laptop fp64 CPU pins where they exist", + "dense_full_pipeline_single_jit": null, + "dense_total_step_by_step": 3.937542005498835, + "figure_of_merit_abs_diff_vs_w_tilde_arm_nats": 7.599592208862305e-07, + "log_likelihood_abs_diff_vs_w_tilde_arm_nats": 7.078051567077637e-07, + "lens_sersic_variant": { + "status": "skipped", + "reason": "no dense library reference on this device (cpu_pinned)" + }, + "vmap": [ + { + "batch": 64, + "status": "ok", + "per_call_s": 0.0015418263593801385 + } + ] + }, + "pinned_expected": -60242552.89876968, + "pinned_drift": [] +} \ No newline at end of file diff --git a/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.png b/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.png new file mode 100644 index 000000000..630e9c2c1 Binary files /dev/null and b/results/breakdown/interferometer/alma_high/mge_hpc_a100_fp64_sparse.png differ diff --git a/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.json b/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.json new file mode 100644 index 000000000..07e1f95d6 --- /dev/null +++ b/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.json @@ -0,0 +1,400 @@ +{ + "stage": "complete", + "autolens_version": "2026.8.17.1", + "device": { + "backend": "gpu", + "device": "cuda:0", + "hostname": "euclid-ral-gpu-1", + "xla_flags": "--xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0 --xla_gpu_enable_triton_gemm=false", + "omp_num_threads": null, + "cpu_count": 124, + "jax_compilation_cache_dir": "/mnt/ral/jnightin/.cache/pyauto_jax", + "autotune_cache_entries_at_start": 204, + "cache_fresh": false, + "nvidia_smi": "NVIDIA A100 80GB PCIe, 47903 MiB, 81920 MiB" + }, + "instrument": "jvla", + "model": "mge", + "transformer": "TransformerNUFFT", + "use_mixed_precision": false, + "configuration": { + "pixel_scale_arcsec": 0.01, + "mask_radius_arcsec": 3.5, + "real_space_shape": [ + 800, + 800 + ], + "image_pixels_masked": 384852, + "visibilities": 25000000, + "linear_gaussians": 20, + "lens_light": null, + "inversion_path": "sparse", + "inversion_class": "InversionInterferometerSparse", + "dense_inversion_class": "InversionInterferometerMapping", + "transformer": "TransformerNUFFT", + "chunk_size": 1000000, + "chunk_size_note": "TransformerNUFFT.transform_mapping_matrix ignores chunk_size: step 3 is one nufft2d2 over every column and every visibility.", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "nufftax_version": "0.6.1", + "transform": "script_chunked", + "transform_column_batch": 4, + "transform_vis_chunk": 1000000, + "w_tilde_arm": true, + "library_sparse_arm": true, + "n_repeats": 10, + "thread_env": { + "n_threads": null, + "vars": [ + "OPENBLAS_NUM_THREADS", + "MKL_NUM_THREADS", + "OMP_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "NUMEXPR_NUM_THREADS" + ], + "set_to": null, + "preexisting": {}, + "overridden": {}, + "note": "Not pinned (legacy variant): recorded as found." + }, + "host_load_avg_start": [ + 0.38, + 0.08, + 0.03 + ], + "host_load_avg_end": [ + 0.91, + 0.99, + 0.86 + ] + }, + "reference_mode": "none", + "library_path": { + "status": "oom", + "requested_bytes": 1605286976552, + "where": "jax.jit(FitInterferometer) reference", + "error": "RESOURCE_EXHAUSTED: Out of memory while trying to allocate 1.46TiB. [executable_name='jit__reference_fn'] [tf-allocator-allocation-error='']" + }, + "full_pipeline_status": { + "status": "skipped", + "reason": "library path OOMed (same transform)" + }, + "transformed_mapping_matrix_chunked_vs_library_max_rel_diff": null, + "log_likelihood_reference": null, + "figure_of_merit_reference": null, + "figure_of_merit_step_by_step": -301880677.72605056, + "log_likelihood_step_by_step": -301880677.7267545, + "figure_of_merit_full_pipeline": null, + "figure_of_merit_abs_diff_nats": null, + "log_likelihood_abs_diff_nats": null, + "full_pipeline_abs_diff_nats": null, + "log_likelihood_atol_nats": 0.001, + "diagonal_floor_bias_nats": -0.0007039308547973633, + "diagonal_floor_note": "log_likelihood - figure_of_merit: fast_chi_squared uses F with the no-regularization diagonal floor (0.001), so the figure of merit the sampler sees sits 0.5 * floor * |s|^2 below the residual-form log L.", + "setup_cross_check": { + "mapping_matrix_max_rel_diff_vs_eager": null, + "transformed_mapping_matrix_max_rel_diff_vs_eager": null + }, + "log_det_terms": { + "value": 0.0, + "timed": false, + "note": "Structurally zero: an MGE-only inversion has no regularization." + }, + "nnls": { + "iterations": 17, + "converged": true, + "max_iter": 50, + "solver": "pdip", + "preconditioning": "raw" + }, + "steps": { + "Ray-trace grids": 0.0005919308998272755, + "Mapping matrix (20 Gaussians)": 0.0026181016000919044, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.011255499901017173, + "Reconstruction (PDIP NNLS)": 0.0019322836000355906, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00032169619953492656 + }, + "total_step_by_step": 0.01671951220050687, + "source_revisions": { + "autolens_profiling": "bb6ec21f28a83177edadb725f12eb07af8c5dad5", + "PyAutoNerves": "1fa613aa8d89a79613009fb66f5b4e2d21deb57a", + "PyAutoFit": "dd9fbe0aab60c4a57702b1444ca031b317c91331", + "PyAutoArray": "b5ef2e89eaeb7ab4b240adb0e3f035f8104323ec", + "PyAutoGalaxy": "36d1b43605444ea2a213204d71360e53936cf76b", + "PyAutoLens": "ac333b175c660bd64e1d5920ddf2b489e532229d" + }, + "full_pipeline_single_jit": null, + "steps_sub_rows": { + "Ray-trace (standalone, eager tracer)": 0.00028469459939515216, + "transform_mapping_matrix (standalone)": 23.516417920000094, + "Mapped visibilities + residual chi-squared (log_likelihood)": 0.011065398198843468, + "Dense chain from mapping matrix (steps 3-8 fused)": 24.06797760019981 + }, + "setup_split": { + "Ray-trace grids": 0.0005919308998272755, + "Mapping matrix (20 Gaussians)": 0.0026181016000919044, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.011255499901017173, + "Reconstruction (PDIP NNLS)": 0.0019322836000355906, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00032169619953492656 + }, + "setup_prefix_per_call_s": { + "1": 0.0005950047008809634, + "2": 0.003138550600851886, + "3": 23.55903510650096 + }, + "jit_phases": { + "setup_prefix_1": { + "lower_s": 0.07666105199314188, + "compile_s": 0.680078795994632, + "first_call_s": 0.004737220995593816, + "steady_per_call_s": 0.0005950047008809634 + }, + "setup_prefix_2": { + "lower_s": 0.2671676800091518, + "compile_s": 0.14513231300225016, + "first_call_s": 0.010190324988798238, + "steady_per_call_s": 0.003138550600851886 + }, + "setup_prefix_3": { + "lower_s": 0.5960747549979715, + "compile_s": 8.801544950998505, + "first_call_s": 23.097305574003258, + "steady_per_call_s": 23.55903510650096 + }, + "ray_trace_standalone": { + "lower_s": 0.07108584599336609, + "compile_s": 0.392052285009413, + "first_call_s": 0.0015563019987894222, + "steady_per_call_s": 0.00028469459939515216 + }, + "transform_mapping_matrix_standalone": { + "lower_s": 0.2108222209935775, + "compile_s": 7.56156497199845, + "first_call_s": 23.650242440999136, + "steady_per_call_s": 23.516417920000094 + }, + "data_vector": { + "lower_s": 0.00873370400222484, + "compile_s": 0.15218997199553996, + "first_call_s": 0.016334234998794273, + "steady_per_call_s": 0.01569888440135401 + }, + "curvature_matrix": { + "lower_s": 0.011254123994149268, + "compile_s": 0.06787159500527196, + "first_call_s": 0.6422817059938097, + "steady_per_call_s": 0.6211710942996433 + }, + "reconstruction": { + "lower_s": 0.02692010600003414, + "compile_s": 0.35769834301027004, + "first_call_s": 0.24643961001129355, + "steady_per_call_s": 0.0026788069008034654 + }, + "figure_of_merit": { + "lower_s": 0.010615313003654592, + "compile_s": 0.23807483099517412, + "first_call_s": 0.001636000000871718, + "steady_per_call_s": 0.0008513687993399799 + }, + "log_likelihood_residual_visibilities": { + "lower_s": 0.007948544996907003, + "compile_s": 0.23537980399851222, + "first_call_s": 0.011772628000471741, + "steady_per_call_s": 0.011065398198843468 + }, + "dense_chain_from_mapping_matrix": { + "lower_s": 0.5335578810045263, + "compile_s": 12.182932203999371, + "first_call_s": 24.12508748000255, + "steady_per_call_s": 24.06797760019981 + }, + "w_tilde_curvature": { + "lower_s": 0.1393884459976107, + "compile_s": 0.34213374099635985, + "first_call_s": 0.06605864599987399, + "steady_per_call_s": 0.011166564999439289 + }, + "w_tilde_data_vector": { + "lower_s": 0.007142193004256114, + "compile_s": 0.10082191899709869, + "first_call_s": 0.0013032639981247485, + "steady_per_call_s": 0.000254006999603007 + }, + "w_tilde_reconstruction": { + "lower_s": 0.0003591249987948686, + "compile_s": 1.3319993740879e-05, + "first_call_s": 0.0029399350023595616, + "steady_per_call_s": 0.002550121299282182 + }, + "w_tilde_figure_of_merit": { + "lower_s": 0.005909549989155494, + "compile_s": 0.04848963700351305, + "first_call_s": 0.0007751009979983792, + "steady_per_call_s": 0.00014158929989207535 + }, + "w_tilde_chain_from_mapping_matrix": { + "lower_s": 0.04414006999286357, + "compile_s": 0.7173584340052912, + "first_call_s": 0.03069199199671857, + "steady_per_call_s": 0.013550146200577729 + }, + "library_sparse_prefix_1": { + "lower_s": 0.07689901599951554, + "compile_s": 0.6875088230008259, + "first_call_s": 0.004462796001462266, + "steady_per_call_s": 0.0005919308998272755 + }, + "library_sparse_prefix_2": { + "lower_s": 0.39147681900067255, + "compile_s": 0.15179741599422414, + "first_call_s": 0.010256198002025485, + "steady_per_call_s": 0.0032100324999191797 + }, + "library_sparse_prefix_3": { + "lower_s": 1.9959377769991988, + "compile_s": 3.519532648002496, + "first_call_s": 0.03543324299971573, + "steady_per_call_s": 0.014465532400936353 + }, + "library_sparse_prefix_4": { + "lower_s": 0.84149273399089, + "compile_s": 3.5989321539964294, + "first_call_s": 0.03997067001182586, + "steady_per_call_s": 0.016397816000971944 + }, + "library_sparse_prefix_5": { + "lower_s": 1.87506643900997, + "compile_s": 21.652438559001894, + "first_call_s": 0.1053698049945524, + "steady_per_call_s": 0.01671951220050687 + }, + "library_sparse_fit_log_likelihood": { + "lower_s": 2.306960212998092, + "compile_s": 65.58099107501039, + "first_call_s": 0.2220654130069306, + "steady_per_call_s": 0.09312331569963135 + }, + "library_sparse_full_pipeline": { + "lower_s": 1.7356350640038727, + "compile_s": 21.12670554300712, + "first_call_s": 0.10977632200228982, + "steady_per_call_s": 0.016708837200712878 + }, + "library_sparse_full_pipeline_vmap16": { + "first_call_s": 24.982725670997752, + "batch_per_call_s": 0.17221115560096223, + "steady_per_call_s": 0.01076319722506014 + } + }, + "peak_rss_mb": 28881.8203125, + "w_tilde": { + "operator_build_s": 8.201472885004478, + "operator_build_nufft_chunk_size": 1000000, + "operator_shape": [ + 700, + 700 + ], + "curvature_max_rel_diff_vs_dense": 1.586323749931879e-11, + "data_vector_max_rel_diff_vs_dense": 1.8785886488189193e-15, + "figure_of_merit": -301880677.7267994, + "figure_of_merit_chain": -301880677.7267994, + "figure_of_merit_abs_diff_vs_fit_nats": null, + "figure_of_merit_abs_diff_vs_step_by_step_nats": 0.0007488727569580078, + "log_likelihood_unfloored": -301880677.7267325, + "log_likelihood_abs_diff_vs_fit_nats": null, + "operator_build_peak_rss_mb": 22865.36328125, + "total_step_by_step": 0.014112282598216553, + "chain_from_mapping_matrix_s": 0.013550146200577729, + "dense_chain_from_mapping_matrix_s": 24.06797760019981, + "dense_transform_plus_curvature_s": 24.13758901429974, + "w_tilde_curvature_s": 0.011166564999439289, + "speedup_curvature_vs_dense_transform_plus_curvature": 2161.5948159090794, + "speedup_chain_vs_dense_chain": 1776.2153443904274, + "note": "Measurement-only: an MGE-only fit never takes this path in the library (inversion/factory.py switches the sparse operator off when every linear object is an AbstractLinearObjFuncList). The chain row replaces steps 3-8 from the same mapping matrix; its per-call cost has no N_vis term." + }, + "w_tilde_steps": { + "Curvature matrix F~ = B\u1d40 W~ B": 0.011166564999439289, + "Data vector D~ = B\u1d40 d~": 0.000254006999603007, + "Reconstruction (PDIP NNLS)": 0.002550121299282182, + "Fast chi-squared + figure of merit (constants hoisted)": 0.00014158929989207535 + }, + "dense_steps": { + "Ray-trace grids": 0.0005950047008809634, + "Mapping matrix (20 Gaussians)": 0.002543545899970923, + "Transformed mapping matrix (NUFFT)": 23.55589655590011, + "Data vector (D)": 0.01569888440135401, + "Curvature matrix (F)": 0.6211710942996433, + "Reconstruction (PDIP NNLS)": 0.0026788069008034654, + "Fast chi-squared + figure of merit": 0.0008513687993399799 + }, + "dense_total_step_by_step": 24.199435260902103, + "dense_setup_split": { + "Ray-trace grids": 0.0005950047008809634, + "Mapping matrix (20 Gaussians)": 0.002543545899970923, + "Transformed mapping matrix (NUFFT)": 23.55589655590011 + }, + "library_sparse": { + "status": "ok", + "operator_build_s": 8.201472885004478, + "operator_build_peak_rss_mb": 22865.36328125, + "operator_build_nufft_chunk_size": 1000000, + "fit_transformer_chunk_size": 1000000, + "inversion_class": "InversionInterferometerSparse", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "data_vector_max_rel_diff_vs_dense": 1.8785886488189193e-15, + "curvature_reg_matrix_max_rel_diff_vs_dense": 1.586323749931867e-11, + "setup_split": { + "Ray-trace grids": 0.0005919308998272755, + "Mapping matrix (20 Gaussians)": 0.0026181016000919044, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.011255499901017173, + "Reconstruction (PDIP NNLS)": 0.0019322836000355906, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00032169619953492656 + }, + "setup_prefix_per_call_s": { + "1": 0.0005919308998272755, + "2": 0.0032100324999191797, + "3": 0.014465532400936353, + "4": 0.016397816000971944, + "5": 0.01671951220050687 + }, + "total_step_by_step": 0.01671951220050687, + "fit_log_likelihood_s": 0.09312331569963135, + "full_pipeline_single_jit": 0.016708837200712878, + "log_likelihood": -301880677.7267686, + "figure_of_merit": -301880677.7268135, + "figure_of_merit_full_pipeline": -301880677.7268135, + "reference_mode": "none", + "log_likelihood_abs_diff_vs_reference_nats": null, + "figure_of_merit_abs_diff_vs_reference_nats": null, + "full_pipeline_abs_diff_vs_reference_nats": null, + "witness_threshold_nats": 1e-06, + "witness_pass": null, + "witness_note": "no dense reference on this device (none); diffs are against the laptop fp64 CPU pins where they exist", + "dense_full_pipeline_single_jit": null, + "dense_total_step_by_step": 24.199435260902103, + "figure_of_merit_abs_diff_vs_w_tilde_arm_nats": 1.4066696166992188e-05, + "log_likelihood_abs_diff_vs_w_tilde_arm_nats": 3.612041473388672e-05, + "lens_sersic_variant": { + "status": "skipped", + "reason": "no dense library reference on this device (none)" + }, + "vmap": [ + { + "batch": 64, + "status": "oom", + "requested_bytes": 44141526384, + "where": "library W~ vmap batch 64", + "error": "RESOURCE_EXHAUSTED: Out of memory while trying to allocate 41.11GiB. [executable_name='jit_full_pipeline_sparse'] [tf-allocator-allocation-error='']" + }, + { + "batch": 16, + "status": "ok", + "per_call_s": 0.01076319722506014 + } + ] + }, + "pinned_expected": null, + "pinned_drift": [] +} \ No newline at end of file diff --git a/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.png b/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.png new file mode 100644 index 000000000..282182ef9 Binary files /dev/null and b/results/breakdown/interferometer/jvla/mge_hpc_a100_fp64_sparse.png differ diff --git a/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.json b/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.json new file mode 100644 index 000000000..bc6e5d4ff --- /dev/null +++ b/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.json @@ -0,0 +1,397 @@ +{ + "stage": "complete", + "autolens_version": "2026.8.17.1", + "device": { + "backend": "cpu", + "device": "cpu:0", + "hostname": "DESKTOP-H143S82", + "xla_flags": "--xla_cpu_multi_thread_eigen=false --xla_force_host_platform_device_count=1 --xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0 --xla_gpu_enable_triton_gemm=false", + "omp_num_threads": "1", + "cpu_count": 8, + "jax_compilation_cache_dir": "/home/jammy/.cache/pyauto_jax", + "autotune_cache_entries_at_start": 0, + "cache_fresh": true + }, + "instrument": "alma", + "model": "mge", + "transformer": "TransformerNUFFT", + "use_mixed_precision": false, + "configuration": { + "pixel_scale_arcsec": 0.05, + "mask_radius_arcsec": 3.5, + "real_space_shape": [ + 800, + 800 + ], + "image_pixels_masked": 15380, + "visibilities": 1000000, + "linear_gaussians": 20, + "lens_light": null, + "inversion_path": "sparse", + "inversion_class": "InversionInterferometerSparse", + "dense_inversion_class": "InversionInterferometerMapping", + "transformer": "TransformerNUFFT", + "chunk_size": null, + "chunk_size_note": "TransformerNUFFT.transform_mapping_matrix ignores chunk_size: step 3 is one nufft2d2 over every column and every visibility.", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "nufftax_version": "0.6.1", + "transform": "library", + "transform_column_batch": null, + "transform_vis_chunk": null, + "w_tilde_arm": true, + "library_sparse_arm": true, + "n_repeats": 2, + "thread_env": { + "n_threads": null, + "vars": [ + "OPENBLAS_NUM_THREADS", + "MKL_NUM_THREADS", + "OMP_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "NUMEXPR_NUM_THREADS" + ], + "set_to": null, + "preexisting": { + "OPENBLAS_NUM_THREADS": "1", + "MKL_NUM_THREADS": "1", + "OMP_NUM_THREADS": "1", + "VECLIB_MAXIMUM_THREADS": "1", + "NUMEXPR_NUM_THREADS": "1" + }, + "overridden": {}, + "note": "Not pinned (legacy variant): recorded as found." + }, + "host_load_avg_start": [ + 3.7744140625, + 3.9072265625, + 3.18994140625 + ], + "host_load_avg_end": [ + 6.478515625, + 6.06591796875, + 4.3447265625 + ] + }, + "reference_mode": "jit_jax", + "library_path": { + "status": "ok", + "where": "jax.jit(FitInterferometer) reference" + }, + "full_pipeline_status": { + "status": "ok" + }, + "transformed_mapping_matrix_chunked_vs_library_max_rel_diff": null, + "log_likelihood_reference": -12047193.687220689, + "figure_of_merit_reference": -12047193.68761333, + "figure_of_merit_step_by_step": -12047193.687613312, + "log_likelihood_step_by_step": -12047193.68722067, + "figure_of_merit_full_pipeline": -12047193.68761333, + "figure_of_merit_abs_diff_nats": 1.862645149230957e-08, + "log_likelihood_abs_diff_nats": 1.862645149230957e-08, + "full_pipeline_abs_diff_nats": 0.0, + "log_likelihood_atol_nats": 0.001, + "diagonal_floor_bias_nats": 0.0003926418721675873, + "diagonal_floor_note": "log_likelihood - figure_of_merit: fast_chi_squared uses F with the no-regularization diagonal floor (0.001), so the figure of merit the sampler sees sits 0.5 * floor * |s|^2 below the residual-form log L.", + "setup_cross_check": { + "mapping_matrix_max_rel_diff_vs_eager": null, + "transformed_mapping_matrix_max_rel_diff_vs_eager": null + }, + "log_det_terms": { + "value": 0.0, + "timed": false, + "note": "Structurally zero: an MGE-only inversion has no regularization." + }, + "nnls": { + "iterations": 9, + "converged": true, + "max_iter": 50, + "solver": "pdip", + "preconditioning": "raw" + }, + "steps": { + "Ray-trace grids": 0.0016214999996009283, + "Mapping matrix (20 Gaussians)": 0.0021684999992430676, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.04759050000211573, + "Reconstruction (PDIP NNLS)": -0.0070953500016912585, + "Fast chi-squared + figure of merit (FitInterferometer)": -0.011607049998929142 + }, + "total_step_by_step": 0.03267810000033933, + "source_revisions": { + "autolens_profiling": "ee671dcf345cc56b0439fec167468d78cd921ddf", + "PyAutoNerves": "8021c41dd110e7f3a70e3c650234e138a05cfb8a", + "PyAutoFit": "326f611b1b40afd89bb73956441faa7379328407", + "PyAutoArray": "b5ef2e89eaeb7ab4b240adb0e3f035f8104323ec", + "PyAutoGalaxy": "36d1b43605444ea2a213204d71360e53936cf76b", + "PyAutoLens": "ac333b175c660bd64e1d5920ddf2b489e532229d" + }, + "full_pipeline_single_jit": 13.10301575000085, + "steps_sub_rows": { + "Ray-trace (standalone, eager tracer)": 0.0009015499999804888, + "transform_mapping_matrix (standalone)": 11.950081900000441, + "Mapped visibilities + residual chi-squared (log_likelihood)": 0.025181499999234802, + "Dense chain from mapping matrix (steps 3-8 fused)": 11.869372299999668 + }, + "setup_split": { + "Ray-trace grids": 0.0016214999996009283, + "Mapping matrix (20 Gaussians)": 0.0021684999992430676, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.04759050000211573, + "Reconstruction (PDIP NNLS)": -0.0070953500016912585, + "Fast chi-squared + figure of merit (FitInterferometer)": -0.011607049998929142 + }, + "setup_prefix_per_call_s": { + "1": 0.0011793000012403354, + "2": 0.0032964000001811655, + "3": 10.848211299999093 + }, + "jit_phases": { + "setup_prefix_1": { + "lower_s": 0.09278619999895454, + "compile_s": 0.021703500002331566, + "first_call_s": 0.0023723000012978446, + "steady_per_call_s": 0.0011793000012403354 + }, + "setup_prefix_2": { + "lower_s": 0.41619489999720827, + "compile_s": 0.0686688999994658, + "first_call_s": 0.005364500000723638, + "steady_per_call_s": 0.0032964000001811655 + }, + "setup_prefix_3": { + "lower_s": 0.485694599999988, + "compile_s": 0.4181484000000637, + "first_call_s": 11.82999109999946, + "steady_per_call_s": 10.848211299999093 + }, + "ray_trace_standalone": { + "lower_s": 0.09671589999925345, + "compile_s": 0.20179339999958756, + "first_call_s": 0.0015269999967131298, + "steady_per_call_s": 0.0009015499999804888 + }, + "transform_mapping_matrix_standalone": { + "lower_s": 0.07632839999860153, + "compile_s": 0.858147300001292, + "first_call_s": 11.510467500000232, + "steady_per_call_s": 11.950081900000441 + }, + "data_vector": { + "lower_s": 0.0116740999983449, + "compile_s": 0.08387759999823174, + "first_call_s": 0.06958460000168998, + "steady_per_call_s": 0.06816414999957487 + }, + "curvature_matrix": { + "lower_s": 0.01684180000302149, + "compile_s": 0.11654300000009243, + "first_call_s": 0.1378813999981503, + "steady_per_call_s": 0.12631909999981872 + }, + "reconstruction": { + "lower_s": 0.06941110000116169, + "compile_s": 0.043527800000447314, + "first_call_s": 0.0035170000010111835, + "steady_per_call_s": 0.00031024999952933285 + }, + "figure_of_merit": { + "lower_s": 0.01690489999964484, + "compile_s": 0.08763700000054087, + "first_call_s": 0.012466600001062034, + "steady_per_call_s": 0.00796115000048303 + }, + "log_likelihood_residual_visibilities": { + "lower_s": 0.014427699999941979, + "compile_s": 0.0910223999999289, + "first_call_s": 0.032608100002107676, + "steady_per_call_s": 0.025181499999234802 + }, + "dense_chain_from_mapping_matrix": { + "lower_s": 0.125999399999273, + "compile_s": 0.6531188000008115, + "first_call_s": 13.282875500000955, + "steady_per_call_s": 11.869372299999668 + }, + "full_pipeline": { + "lower_s": 0.7641280999996525, + "compile_s": 6.669821499999671, + "first_call_s": 12.217262300000584, + "steady_per_call_s": 13.10301575000085 + }, + "w_tilde_curvature": { + "lower_s": 0.1042323999972723, + "compile_s": 0.12649749999764026, + "first_call_s": 0.0297379000003275, + "steady_per_call_s": 0.030999149999843212 + }, + "w_tilde_data_vector": { + "lower_s": 0.007709800000156974, + "compile_s": 0.09280779999971855, + "first_call_s": 0.0010947999980999157, + "steady_per_call_s": 0.0005810000002384186 + }, + "w_tilde_reconstruction": { + "lower_s": 0.0004760999981954228, + "compile_s": 1.720000000204891e-05, + "first_call_s": 0.000667500000417931, + "steady_per_call_s": 0.0003945500011468539 + }, + "w_tilde_figure_of_merit": { + "lower_s": 0.009449100001802435, + "compile_s": 0.053215200001432095, + "first_call_s": 0.00041989999954239465, + "steady_per_call_s": 6.749999920430128e-05 + }, + "w_tilde_chain_from_mapping_matrix": { + "lower_s": 0.07971760000145878, + "compile_s": 0.03440509999927599, + "first_call_s": 0.03512500000215368, + "steady_per_call_s": 0.03472499999952561 + }, + "library_sparse_prefix_1": { + "lower_s": 0.12813630000164267, + "compile_s": 0.021930799997790018, + "first_call_s": 0.002727700000832556, + "steady_per_call_s": 0.0016214999996009283 + }, + "library_sparse_prefix_2": { + "lower_s": 0.48702830000183894, + "compile_s": 0.09292270000150893, + "first_call_s": 0.006607399998756591, + "steady_per_call_s": 0.003789999998843996 + }, + "library_sparse_prefix_3": { + "lower_s": 1.3485734000023513, + "compile_s": 1.5400558000001183, + "first_call_s": 0.04983210000136751, + "steady_per_call_s": 0.05138050000095973 + }, + "library_sparse_prefix_4": { + "lower_s": 1.31041660000119, + "compile_s": 0.16725159999987227, + "first_call_s": 0.0443249999989348, + "steady_per_call_s": 0.04428514999926847 + }, + "library_sparse_prefix_5": { + "lower_s": 2.4104630000001634, + "compile_s": 3.3019069000001764, + "first_call_s": 0.03973039999982575, + "steady_per_call_s": 0.03267810000033933 + }, + "library_sparse_fit_log_likelihood": { + "lower_s": 1.4906588000012562, + "compile_s": 5.248003900000185, + "first_call_s": 2.869493899997906, + "steady_per_call_s": 2.86328605000017 + }, + "library_sparse_full_pipeline": { + "lower_s": 1.8468243000024813, + "compile_s": 2.879134200000408, + "first_call_s": 0.03738629999861587, + "steady_per_call_s": 0.0346518999995169 + } + }, + "peak_rss_mb": 5226.08984375, + "w_tilde": { + "operator_build_s": 10.90492549999908, + "operator_build_nufft_chunk_size": 100000, + "operator_shape": [ + 140, + 140 + ], + "curvature_max_rel_diff_vs_dense": 7.958074106421049e-14, + "data_vector_max_rel_diff_vs_dense": 1.803350834882151e-15, + "figure_of_merit": -12047193.68761331, + "figure_of_merit_chain": -12047193.68761331, + "figure_of_merit_abs_diff_vs_fit_nats": 2.0489096641540527e-08, + "figure_of_merit_abs_diff_vs_step_by_step_nats": 1.862645149230957e-09, + "log_likelihood_unfloored": -12047193.68722067, + "log_likelihood_abs_diff_vs_fit_nats": 1.862645149230957e-08, + "operator_build_peak_rss_mb": 4113.734375, + "total_step_by_step": 0.032042200000432786, + "chain_from_mapping_matrix_s": 0.03472499999952561, + "dense_chain_from_mapping_matrix_s": 11.869372299999668, + "dense_transform_plus_curvature_s": 12.07640100000026, + "w_tilde_curvature_s": 0.030999149999843212, + "speedup_curvature_vs_dense_transform_plus_curvature": 389.57200439564764, + "speedup_chain_vs_dense_chain": 341.8105773984685, + "note": "Measurement-only: an MGE-only fit never takes this path in the library (inversion/factory.py switches the sparse operator off when every linear object is an AbstractLinearObjFuncList). The chain row replaces steps 3-8 from the same mapping matrix; its per-call cost has no N_vis term." + }, + "w_tilde_steps": { + "Curvature matrix F~ = B\u1d40 W~ B": 0.030999149999843212, + "Data vector D~ = B\u1d40 d~": 0.0005810000002384186, + "Reconstruction (PDIP NNLS)": 0.0003945500011468539, + "Fast chi-squared + figure of merit (constants hoisted)": 6.749999920430128e-05 + }, + "dense_steps": { + "Ray-trace grids": 0.0011793000012403354, + "Mapping matrix (20 Gaussians)": 0.00211709999894083, + "Transformed mapping matrix (NUFFT)": 10.844914899998912, + "Data vector (D)": 0.06816414999957487, + "Curvature matrix (F)": 0.12631909999981872, + "Reconstruction (PDIP NNLS)": 0.00031024999952933285, + "Fast chi-squared + figure of merit": 0.00796115000048303 + }, + "dense_total_step_by_step": 11.0509659499985, + "dense_setup_split": { + "Ray-trace grids": 0.0011793000012403354, + "Mapping matrix (20 Gaussians)": 0.00211709999894083, + "Transformed mapping matrix (NUFFT)": 10.844914899998912 + }, + "library_sparse": { + "status": "ok", + "operator_build_s": 10.90492549999908, + "operator_build_peak_rss_mb": 4113.734375, + "operator_build_nufft_chunk_size": 100000, + "fit_transformer_chunk_size": 100000, + "inversion_class": "InversionInterferometerSparse", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "data_vector_max_rel_diff_vs_dense": 1.803350834882151e-15, + "curvature_reg_matrix_max_rel_diff_vs_dense": 7.958074105473959e-14, + "setup_split": { + "Ray-trace grids": 0.0016214999996009283, + "Mapping matrix (20 Gaussians)": 0.0021684999992430676, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.04759050000211573, + "Reconstruction (PDIP NNLS)": -0.0070953500016912585, + "Fast chi-squared + figure of merit (FitInterferometer)": -0.011607049998929142 + }, + "setup_prefix_per_call_s": { + "1": 0.0016214999996009283, + "2": 0.003789999998843996, + "3": 0.05138050000095973, + "4": 0.04428514999926847, + "5": 0.03267810000033933 + }, + "total_step_by_step": 0.03267810000033933, + "fit_log_likelihood_s": 2.86328605000017, + "full_pipeline_single_jit": 0.0346518999995169, + "log_likelihood": -12047193.687220689, + "figure_of_merit": -12047193.687613329, + "figure_of_merit_full_pipeline": -12047193.687613329, + "reference_mode": "jit_jax", + "log_likelihood_abs_diff_vs_reference_nats": 0.0, + "figure_of_merit_abs_diff_vs_reference_nats": 1.862645149230957e-09, + "full_pipeline_abs_diff_vs_reference_nats": 1.862645149230957e-09, + "witness_threshold_nats": 1e-06, + "witness_pass": true, + "witness_note": "dense library reference ran on this device", + "dense_full_pipeline_single_jit": 13.10301575000085, + "dense_total_step_by_step": 11.0509659499985, + "figure_of_merit_abs_diff_vs_w_tilde_arm_nats": 1.862645149230957e-08, + "log_likelihood_abs_diff_vs_w_tilde_arm_nats": 1.862645149230957e-08, + "lens_sersic_variant": { + "sparse_log_likelihood": -12069647.617608804, + "dense_log_likelihood": -12069647.617608804, + "sparse_figure_of_merit": -12069647.618007902, + "dense_figure_of_merit": -12069647.618007902, + "log_likelihood_abs_diff_nats": 0.0, + "figure_of_merit_abs_diff_nats": 0.0, + "control_sparse_uncorrected_log_likelihood": -12070426.84911821, + "control_uncorrected_abs_diff_nats": 779.2315094061196, + "note": "Lens Sersic(ell_comps=(0.05,0), I=0.1, R_eff=0.6, n=2.5) added to the cell's MGE-only model; single jitted calls (first call, compile included)." + }, + "vmap": [] + }, + "pinned_expected": -12047193.68761333, + "pinned_drift": [] +} \ No newline at end of file diff --git a/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.png b/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.png new file mode 100644 index 000000000..b59f97f94 Binary files /dev/null and b/results/breakdown/interferometer/mge_breakdown_alma_v2026.8.17.1_sparse.png differ diff --git a/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.json b/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.json new file mode 100644 index 000000000..ab4d773f6 --- /dev/null +++ b/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.json @@ -0,0 +1,437 @@ +{ + "stage": "complete", + "autolens_version": "2026.8.17.1", + "device": { + "backend": "cpu", + "device": "cpu:0", + "hostname": "DESKTOP-H143S82", + "xla_flags": "--xla_cpu_multi_thread_eigen=false --xla_force_host_platform_device_count=1 --xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0 --xla_gpu_enable_triton_gemm=false", + "omp_num_threads": "1", + "cpu_count": 8, + "jax_compilation_cache_dir": "/home/jammy/.cache/pyauto_jax", + "autotune_cache_entries_at_start": 0, + "cache_fresh": true + }, + "instrument": "sma", + "model": "mge", + "transformer": "TransformerNUFFT", + "use_mixed_precision": false, + "configuration": { + "pixel_scale_arcsec": 0.1, + "mask_radius_arcsec": 3.5, + "real_space_shape": [ + 256, + 256 + ], + "image_pixels_masked": 3852, + "visibilities": 190, + "linear_gaussians": 20, + "lens_light": null, + "inversion_path": "sparse", + "inversion_class": "InversionInterferometerSparse", + "dense_inversion_class": "InversionInterferometerMapping", + "transformer": "TransformerNUFFT", + "chunk_size": null, + "chunk_size_note": "TransformerNUFFT.transform_mapping_matrix ignores chunk_size: step 3 is one nufft2d2 over every column and every visibility.", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "nufftax_version": "0.6.1", + "transform": "library", + "transform_column_batch": null, + "transform_vis_chunk": null, + "w_tilde_arm": true, + "library_sparse_arm": true, + "n_repeats": 10, + "thread_env": { + "n_threads": null, + "vars": [ + "OPENBLAS_NUM_THREADS", + "MKL_NUM_THREADS", + "OMP_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "NUMEXPR_NUM_THREADS" + ], + "set_to": null, + "preexisting": { + "OPENBLAS_NUM_THREADS": "1", + "MKL_NUM_THREADS": "1", + "OMP_NUM_THREADS": "1", + "VECLIB_MAXIMUM_THREADS": "1", + "NUMEXPR_NUM_THREADS": "1" + }, + "overridden": {}, + "note": "Not pinned (legacy variant): recorded as found." + }, + "host_load_avg_start": [ + 2.54541015625, + 3.7431640625, + 3.0869140625 + ], + "host_load_avg_end": [ + 3.7744140625, + 3.9072265625, + 3.18994140625 + ] + }, + "reference_mode": "eager_numpy", + "library_path": { + "status": "ok", + "where": "eager FitInterferometer reference" + }, + "full_pipeline_status": { + "status": "ok" + }, + "transformed_mapping_matrix_chunked_vs_library_max_rel_diff": null, + "log_likelihood_reference": -3153.942384509246, + "figure_of_merit_reference": -3153.948230379729, + "figure_of_merit_step_by_step": -3153.9482303797304, + "log_likelihood_step_by_step": -3153.942384509247, + "figure_of_merit_full_pipeline": -3153.9482303797295, + "figure_of_merit_abs_diff_nats": 1.3642420526593924e-12, + "log_likelihood_abs_diff_nats": 9.094947017729282e-13, + "full_pipeline_abs_diff_nats": 4.547473508864641e-13, + "log_likelihood_atol_nats": 0.001, + "diagonal_floor_bias_nats": 0.0058458704829718044, + "diagonal_floor_note": "log_likelihood - figure_of_merit: fast_chi_squared uses F with the no-regularization diagonal floor (0.001), so the figure of merit the sampler sees sits 0.5 * floor * |s|^2 below the residual-form log L.", + "setup_cross_check": { + "mapping_matrix_max_rel_diff_vs_eager": 1.0846967559301895e-13, + "transformed_mapping_matrix_max_rel_diff_vs_eager": 6.330132139109455e-16 + }, + "log_det_terms": { + "value": 0.0, + "timed": false, + "note": "Structurally zero: an MGE-only inversion has no regularization." + }, + "nnls": { + "iterations": 15, + "converged": true, + "max_iter": 50, + "solver": "pdip", + "preconditioning": "raw" + }, + "steps": { + "Ray-trace grids": 0.0008524599998054327, + "Mapping matrix (20 Gaussians)": 0.0007177700001193444, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.008591810000143595, + "Reconstruction (PDIP NNLS)": -0.0012198600001283918, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.0028701000002911304 + }, + "total_step_by_step": 0.011812280000231112, + "source_revisions": { + "autolens_profiling": "ee671dcf345cc56b0439fec167468d78cd921ddf", + "PyAutoNerves": "8021c41dd110e7f3a70e3c650234e138a05cfb8a", + "PyAutoFit": "326f611b1b40afd89bb73956441faa7379328407", + "PyAutoArray": "b5ef2e89eaeb7ab4b240adb0e3f035f8104323ec", + "PyAutoGalaxy": "36d1b43605444ea2a213204d71360e53936cf76b", + "PyAutoLens": "ac333b175c660bd64e1d5920ddf2b489e532229d" + }, + "full_pipeline_single_jit": 0.08205540000017209, + "steps_sub_rows": { + "Ray-trace (standalone, eager tracer)": 0.00047602999984519556, + "transform_mapping_matrix (standalone)": 0.10646723000027122, + "Mapped visibilities + residual chi-squared (log_likelihood)": 0.00012932999998156448, + "Dense chain from mapping matrix (steps 3-8 fused)": 0.11447109000000637 + }, + "setup_split": { + "Ray-trace grids": 0.0008524599998054327, + "Mapping matrix (20 Gaussians)": 0.0007177700001193444, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.008591810000143595, + "Reconstruction (PDIP NNLS)": -0.0012198600001283918, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.0028701000002911304 + }, + "setup_prefix_per_call_s": { + "1": 0.000720530000035069, + "2": 0.001481480000074953, + "3": 0.08842538999997487 + }, + "jit_phases": { + "setup_prefix_1": { + "lower_s": 0.13247889999911422, + "compile_s": 0.017934800001967233, + "first_call_s": 0.0018341000031796284, + "steady_per_call_s": 0.000720530000035069 + }, + "setup_prefix_2": { + "lower_s": 0.5199237000015273, + "compile_s": 0.09569209999972372, + "first_call_s": 0.0032868000016605947, + "steady_per_call_s": 0.001481480000074953 + }, + "setup_prefix_3": { + "lower_s": 0.4784171999999671, + "compile_s": 0.09319909999976517, + "first_call_s": 0.12326179999945452, + "steady_per_call_s": 0.08842538999997487 + }, + "ray_trace_standalone": { + "lower_s": 0.09413610000046901, + "compile_s": 0.014831799999228679, + "first_call_s": 0.0014084000031289179, + "steady_per_call_s": 0.00047602999984519556 + }, + "transform_mapping_matrix_standalone": { + "lower_s": 0.06968440000127885, + "compile_s": 0.026388700000097742, + "first_call_s": 0.09341560000029858, + "steady_per_call_s": 0.10646723000027122 + }, + "data_vector": { + "lower_s": 0.019483699998090742, + "compile_s": 0.1156113999968511, + "first_call_s": 0.0005338000009942334, + "steady_per_call_s": 0.0002036699999734992 + }, + "curvature_matrix": { + "lower_s": 0.03031140000166488, + "compile_s": 0.11998840000160271, + "first_call_s": 0.000665400002617389, + "steady_per_call_s": 0.00020077000008313916 + }, + "reconstruction": { + "lower_s": 0.14207309999983408, + "compile_s": 0.028191099998366553, + "first_call_s": 0.0012693999997281935, + "steady_per_call_s": 0.000455589999910444 + }, + "figure_of_merit": { + "lower_s": 0.027232599997660145, + "compile_s": 0.09786589999930584, + "first_call_s": 0.0006302000001596753, + "steady_per_call_s": 7.659000002604443e-05 + }, + "log_likelihood_residual_visibilities": { + "lower_s": 0.025066100002732128, + "compile_s": 0.1106169000013324, + "first_call_s": 0.001905199998873286, + "steady_per_call_s": 0.00012932999998156448 + }, + "dense_chain_from_mapping_matrix": { + "lower_s": 0.1496106000013242, + "compile_s": 0.06263960000069346, + "first_call_s": 0.11505340000076103, + "steady_per_call_s": 0.11447109000000637 + }, + "full_pipeline": { + "lower_s": 1.618392500000482, + "compile_s": 1.6134662000004028, + "first_call_s": 0.11493590000100085, + "steady_per_call_s": 0.08205540000017209 + }, + "w_tilde_curvature": { + "lower_s": 0.0888967999999295, + "compile_s": 0.08768689999851631, + "first_call_s": 0.007262699997227173, + "steady_per_call_s": 0.007305880000058096 + }, + "w_tilde_data_vector": { + "lower_s": 0.010938800001895288, + "compile_s": 0.10166810000009718, + "first_call_s": 0.0006945999994059093, + "steady_per_call_s": 0.00031122999971557876 + }, + "w_tilde_reconstruction": { + "lower_s": 0.0005166000009921845, + "compile_s": 1.7300000763498247e-05, + "first_call_s": 0.0005703000024368521, + "steady_per_call_s": 0.00035825999984808734 + }, + "w_tilde_figure_of_merit": { + "lower_s": 0.009606200001144316, + "compile_s": 0.05319959999906132, + "first_call_s": 0.0004248000004736241, + "steady_per_call_s": 4.6599999768659474e-05 + }, + "w_tilde_chain_from_mapping_matrix": { + "lower_s": 0.07455119999940507, + "compile_s": 0.04063510000196402, + "first_call_s": 0.012539499999547843, + "steady_per_call_s": 0.007057580000036978 + }, + "library_sparse_prefix_1": { + "lower_s": 0.12306229999740026, + "compile_s": 0.020005300000775605, + "first_call_s": 0.0021277000014379155, + "steady_per_call_s": 0.0008524599998054327 + }, + "library_sparse_prefix_2": { + "lower_s": 0.4187979999987874, + "compile_s": 0.07599859999754699, + "first_call_s": 0.0035616000022855587, + "steady_per_call_s": 0.0015702299999247771 + }, + "library_sparse_prefix_3": { + "lower_s": 0.9389023999974597, + "compile_s": 1.1206657000002451, + "first_call_s": 0.014373599999089492, + "steady_per_call_s": 0.010162040000068373 + }, + "library_sparse_prefix_4": { + "lower_s": 0.9776969000013196, + "compile_s": 0.14503899999908754, + "first_call_s": 0.010339300002669916, + "steady_per_call_s": 0.008942179999939981 + }, + "library_sparse_prefix_5": { + "lower_s": 1.8662051999999676, + "compile_s": 2.2662382000016805, + "first_call_s": 0.015308500001992797, + "steady_per_call_s": 0.011812280000231112 + }, + "library_sparse_fit_log_likelihood": { + "lower_s": 2.4006977999997616, + "compile_s": 3.0162659999987227, + "first_call_s": 0.020275700000638608, + "steady_per_call_s": 0.016139970000222093 + }, + "library_sparse_full_pipeline": { + "lower_s": 1.731988999999885, + "compile_s": 1.87647300000026, + "first_call_s": 0.009933299999829615, + "steady_per_call_s": 0.007771820000198204 + }, + "library_sparse_full_pipeline_vmap4": { + "first_call_s": 5.482914099997288, + "batch_per_call_s": 0.04232379999994009, + "steady_per_call_s": 0.010580949999985023 + }, + "setup_prefix_1_vmap4": { + "first_call_s": 0.26490259999991395, + "batch_per_call_s": 0.002521790000173496, + "steady_per_call_s": 0.000630447500043374 + }, + "setup_prefix_2_vmap4": { + "first_call_s": 1.3463680999993812, + "batch_per_call_s": 0.005149470000105794, + "steady_per_call_s": 0.0012873675000264484 + }, + "setup_prefix_3_vmap4": { + "first_call_s": 1.770815500000026, + "batch_per_call_s": 0.3727251000000251, + "steady_per_call_s": 0.09318127500000628 + }, + "full_pipeline_vmap4": { + "first_call_s": 2.972847900000488, + "batch_per_call_s": 0.3263298800000484, + "steady_per_call_s": 0.0815824700000121 + } + }, + "peak_rss_mb": 1738.52734375, + "w_tilde": { + "operator_build_s": 1.1858160000010685, + "operator_build_nufft_chunk_size": null, + "operator_shape": [ + 70, + 70 + ], + "curvature_max_rel_diff_vs_dense": 2.5579315384225843e-14, + "data_vector_max_rel_diff_vs_dense": 1.299751715624984e-15, + "figure_of_merit": -3153.9482303797304, + "figure_of_merit_chain": -3153.9482303797304, + "figure_of_merit_abs_diff_vs_fit_nats": 1.3642420526593924e-12, + "figure_of_merit_abs_diff_vs_step_by_step_nats": 0.0, + "log_likelihood_unfloored": -3153.942384509247, + "log_likelihood_abs_diff_vs_fit_nats": 9.094947017729282e-13, + "operator_build_peak_rss_mb": 942.54296875, + "total_step_by_step": 0.008021969999390421, + "chain_from_mapping_matrix_s": 0.007057580000036978, + "dense_chain_from_mapping_matrix_s": 0.11447109000000637, + "dense_transform_plus_curvature_s": 0.10666800000035437, + "w_tilde_curvature_s": 0.007305880000058096, + "speedup_curvature_vs_dense_transform_plus_curvature": 14.60029455719313, + "speedup_chain_vs_dense_chain": 16.219595101919722, + "note": "Measurement-only: an MGE-only fit never takes this path in the library (inversion/factory.py switches the sparse operator off when every linear object is an AbstractLinearObjFuncList). The chain row replaces steps 3-8 from the same mapping matrix; its per-call cost has no N_vis term." + }, + "w_tilde_steps": { + "Curvature matrix F~ = B\u1d40 W~ B": 0.007305880000058096, + "Data vector D~ = B\u1d40 d~": 0.00031122999971557876, + "Reconstruction (PDIP NNLS)": 0.00035825999984808734, + "Fast chi-squared + figure of merit (constants hoisted)": 4.6599999768659474e-05 + }, + "dense_steps": { + "Ray-trace grids": 0.000720530000035069, + "Mapping matrix (20 Gaussians)": 0.0007609500000398839, + "Transformed mapping matrix (NUFFT)": 0.08694390999989993, + "Data vector (D)": 0.0002036699999734992, + "Curvature matrix (F)": 0.00020077000008313916, + "Reconstruction (PDIP NNLS)": 0.000455589999910444, + "Fast chi-squared + figure of merit": 7.659000002604443e-05 + }, + "dense_total_step_by_step": 0.089362009999968, + "dense_setup_split": { + "Ray-trace grids": 0.000720530000035069, + "Mapping matrix (20 Gaussians)": 0.0007609500000398839, + "Transformed mapping matrix (NUFFT)": 0.08694390999989993 + }, + "library_sparse": { + "status": "ok", + "operator_build_s": 1.1858160000010685, + "operator_build_peak_rss_mb": 942.54296875, + "operator_build_nufft_chunk_size": null, + "fit_transformer_chunk_size": null, + "inversion_class": "InversionInterferometerSparse", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "data_vector_max_rel_diff_vs_dense": 1.299751715624984e-15, + "curvature_reg_matrix_max_rel_diff_vs_dense": 2.5579002174686132e-14, + "setup_split": { + "Ray-trace grids": 0.0008524599998054327, + "Mapping matrix (20 Gaussians)": 0.0007177700001193444, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.008591810000143595, + "Reconstruction (PDIP NNLS)": -0.0012198600001283918, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.0028701000002911304 + }, + "setup_prefix_per_call_s": { + "1": 0.0008524599998054327, + "2": 0.0015702299999247771, + "3": 0.010162040000068373, + "4": 0.008942179999939981, + "5": 0.011812280000231112 + }, + "total_step_by_step": 0.011812280000231112, + "fit_log_likelihood_s": 0.016139970000222093, + "full_pipeline_single_jit": 0.007771820000198204, + "log_likelihood": -3153.942384509246, + "figure_of_merit": -3153.9482303797295, + "figure_of_merit_full_pipeline": -3153.9482303797295, + "reference_mode": "eager_numpy", + "log_likelihood_abs_diff_vs_reference_nats": 0.0, + "figure_of_merit_abs_diff_vs_reference_nats": 4.547473508864641e-13, + "full_pipeline_abs_diff_vs_reference_nats": 4.547473508864641e-13, + "witness_threshold_nats": 1e-06, + "witness_pass": true, + "witness_note": "dense library reference ran on this device", + "dense_full_pipeline_single_jit": 0.08205540000017209, + "dense_total_step_by_step": 0.089362009999968, + "figure_of_merit_abs_diff_vs_w_tilde_arm_nats": 9.094947017729282e-13, + "log_likelihood_abs_diff_vs_w_tilde_arm_nats": 9.094947017729282e-13, + "lens_sersic_variant": { + "sparse_log_likelihood": -3153.3467852620693, + "dense_log_likelihood": -3153.3467852620693, + "sparse_figure_of_merit": -3153.3521005812086, + "dense_figure_of_merit": -3153.3521005812086, + "log_likelihood_abs_diff_nats": 0.0, + "figure_of_merit_abs_diff_nats": 0.0, + "control_sparse_uncorrected_log_likelihood": -3153.3505451528786, + "control_uncorrected_abs_diff_nats": 0.0037598908093059435, + "note": "Lens Sersic(ell_comps=(0.05,0), I=0.1, R_eff=0.6, n=2.5) added to the cell's MGE-only model; single jitted calls (first call, compile included)." + }, + "vmap": [ + { + "batch": 4, + "status": "ok", + "per_call_s": 0.010580949999985023 + } + ] + }, + "vmap_batch": 4, + "steps_vmap_per_call": { + "Full pipeline": 0.0815824700000121 + }, + "setup_split_vmap": { + "Ray-trace grids": 0.000630447500043374, + "Mapping matrix (20 Gaussians)": 0.0006569199999830744, + "Transformed mapping matrix (NUFFT)": 0.09189390749997983 + }, + "pinned_expected": -3153.948230379729, + "pinned_drift": [] +} \ No newline at end of file diff --git a/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.png b/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.png new file mode 100644 index 000000000..c20f177fe Binary files /dev/null and b/results/breakdown/interferometer/mge_breakdown_sma_v2026.8.17.1_sparse.png differ diff --git a/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.json b/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.json new file mode 100644 index 000000000..4d31b28a9 --- /dev/null +++ b/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.json @@ -0,0 +1,415 @@ +{ + "stage": "complete", + "autolens_version": "2026.8.17.1", + "device": { + "backend": "gpu", + "device": "cuda:0", + "hostname": "euclid-ral-gpu-1", + "xla_flags": "--xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0 --xla_gpu_enable_triton_gemm=false", + "omp_num_threads": null, + "cpu_count": 124, + "jax_compilation_cache_dir": "/mnt/ral/jnightin/.cache/pyauto_jax", + "autotune_cache_entries_at_start": 204, + "cache_fresh": false, + "nvidia_smi": "NVIDIA A100 80GB PCIe, 9505 MiB, 81920 MiB" + }, + "instrument": "alma", + "model": "mge", + "transformer": "TransformerNUFFT", + "use_mixed_precision": false, + "configuration": { + "pixel_scale_arcsec": 0.05, + "mask_radius_arcsec": 3.5, + "real_space_shape": [ + 800, + 800 + ], + "image_pixels_masked": 15380, + "visibilities": 1000000, + "linear_gaussians": 20, + "lens_light": null, + "inversion_path": "sparse", + "inversion_class": "InversionInterferometerSparse", + "dense_inversion_class": "InversionInterferometerMapping", + "transformer": "TransformerNUFFT", + "chunk_size": null, + "chunk_size_note": "TransformerNUFFT.transform_mapping_matrix ignores chunk_size: step 3 is one nufft2d2 over every column and every visibility.", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "nufftax_version": "0.6.1", + "transform": "script_chunked", + "transform_column_batch": 4, + "transform_vis_chunk": null, + "w_tilde_arm": true, + "library_sparse_arm": true, + "n_repeats": 10, + "thread_env": { + "n_threads": null, + "vars": [ + "OPENBLAS_NUM_THREADS", + "MKL_NUM_THREADS", + "OMP_NUM_THREADS", + "VECLIB_MAXIMUM_THREADS", + "NUMEXPR_NUM_THREADS" + ], + "set_to": null, + "preexisting": {}, + "overridden": {}, + "note": "Not pinned (legacy variant): recorded as found." + }, + "host_load_avg_start": [ + 0.38, + 0.08, + 0.03 + ], + "host_load_avg_end": [ + 2.01, + 0.82, + 0.31 + ] + }, + "reference_mode": "cpu_pinned", + "library_path": { + "status": "oom", + "requested_bytes": 65143916462, + "where": "jax.jit(FitInterferometer) reference", + "error": "RESOURCE_EXHAUSTED: Out of memory while trying to allocate 60.67GiB. [tf-allocator-allocation-error=''] [executable_name='jit__reference_fn']" + }, + "full_pipeline_status": { + "status": "skipped", + "reason": "library path OOMed (same transform)" + }, + "transformed_mapping_matrix_chunked_vs_library_max_rel_diff": null, + "log_likelihood_reference": -12047193.687220689, + "figure_of_merit_reference": -12047193.68761333, + "figure_of_merit_step_by_step": -12047193.687613314, + "log_likelihood_step_by_step": -12047193.687220674, + "figure_of_merit_full_pipeline": null, + "figure_of_merit_abs_diff_nats": 1.6763806343078613e-08, + "log_likelihood_abs_diff_nats": 1.4901161193847656e-08, + "full_pipeline_abs_diff_nats": null, + "log_likelihood_atol_nats": 0.001, + "diagonal_floor_bias_nats": 0.0003926418721675873, + "diagonal_floor_note": "log_likelihood - figure_of_merit: fast_chi_squared uses F with the no-regularization diagonal floor (0.001), so the figure of merit the sampler sees sits 0.5 * floor * |s|^2 below the residual-form log L.", + "setup_cross_check": { + "mapping_matrix_max_rel_diff_vs_eager": null, + "transformed_mapping_matrix_max_rel_diff_vs_eager": null + }, + "log_det_terms": { + "value": 0.0, + "timed": false, + "note": "Structurally zero: an MGE-only inversion has no regularization." + }, + "nnls": { + "iterations": 9, + "converged": true, + "max_iter": 50, + "solver": "pdip", + "preconditioning": "raw" + }, + "steps": { + "Ray-trace grids": 0.0004687973007094115, + "Mapping matrix (20 Gaussians)": 0.0004157387986197136, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.00040813610103214166, + "Reconstruction (PDIP NNLS)": 0.0012532716995337977, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00012591450067702672 + }, + "total_step_by_step": 0.002671858400572091, + "source_revisions": { + "autolens_profiling": "bb6ec21f28a83177edadb725f12eb07af8c5dad5", + "PyAutoNerves": "1fa613aa8d89a79613009fb66f5b4e2d21deb57a", + "PyAutoFit": "dd9fbe0aab60c4a57702b1444ca031b317c91331", + "PyAutoArray": "b5ef2e89eaeb7ab4b240adb0e3f035f8104323ec", + "PyAutoGalaxy": "36d1b43605444ea2a213204d71360e53936cf76b", + "PyAutoLens": "ac333b175c660bd64e1d5920ddf2b489e532229d" + }, + "full_pipeline_single_jit": null, + "steps_sub_rows": { + "Ray-trace (standalone, eager tracer)": 0.00017610880022402852, + "transform_mapping_matrix (standalone)": 0.9083563209002022, + "Mapped visibilities + residual chi-squared (log_likelihood)": 0.00064938709983835, + "Dense chain from mapping matrix (steps 3-8 fused)": 0.9215241255995352 + }, + "setup_split": { + "Ray-trace grids": 0.0004687973007094115, + "Mapping matrix (20 Gaussians)": 0.0004157387986197136, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.00040813610103214166, + "Reconstruction (PDIP NNLS)": 0.0012532716995337977, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00012591450067702672 + }, + "setup_prefix_per_call_s": { + "1": 0.0005040899006417022, + "2": 0.0008635503996629268, + "3": 0.9117456714011496 + }, + "jit_phases": { + "setup_prefix_1": { + "lower_s": 0.0748065239895368, + "compile_s": 0.40815497499716, + "first_call_s": 0.002455309993820265, + "steady_per_call_s": 0.0005040899006417022 + }, + "setup_prefix_2": { + "lower_s": 0.27061235799919814, + "compile_s": 0.10042153099493589, + "first_call_s": 0.0050213989889016375, + "steady_per_call_s": 0.0008635503996629268 + }, + "setup_prefix_3": { + "lower_s": 0.3308478699909756, + "compile_s": 0.4965935520012863, + "first_call_s": 1.0309659719932824, + "steady_per_call_s": 0.9117456714011496 + }, + "ray_trace_standalone": { + "lower_s": 0.17374698200728744, + "compile_s": 0.32819599300273694, + "first_call_s": 0.001186945999506861, + "steady_per_call_s": 0.00017610880022402852 + }, + "transform_mapping_matrix_standalone": { + "lower_s": 0.05371139199996833, + "compile_s": 0.8183042039891006, + "first_call_s": 0.9111198580067139, + "steady_per_call_s": 0.9083563209002022 + }, + "data_vector": { + "lower_s": 0.008475235998048447, + "compile_s": 0.10908640499110334, + "first_call_s": 0.0010934959864243865, + "steady_per_call_s": 0.00046307640004670245 + }, + "curvature_matrix": { + "lower_s": 0.011044213999412023, + "compile_s": 0.06510456200339831, + "first_call_s": 0.27383528799691703, + "steady_per_call_s": 0.025575169899093454 + }, + "reconstruction": { + "lower_s": 0.027512581989867613, + "compile_s": 0.35270426400529686, + "first_call_s": 0.283175263000885, + "steady_per_call_s": 0.001525596399733331 + }, + "figure_of_merit": { + "lower_s": 0.010603811009787023, + "compile_s": 0.2410729090042878, + "first_call_s": 0.0010883369977818802, + "steady_per_call_s": 0.0002702306999708526 + }, + "log_likelihood_residual_visibilities": { + "lower_s": 0.008021482004551217, + "compile_s": 0.2746564890112495, + "first_call_s": 0.0014099120016908273, + "steady_per_call_s": 0.00064938709983835 + }, + "dense_chain_from_mapping_matrix": { + "lower_s": 0.09519516500586178, + "compile_s": 0.6113974160107318, + "first_call_s": 0.9368072040088009, + "steady_per_call_s": 0.9215241255995352 + }, + "w_tilde_curvature": { + "lower_s": 0.13233115000184625, + "compile_s": 0.15173742300248705, + "first_call_s": 0.017833432008046657, + "steady_per_call_s": 0.0006136474999948405 + }, + "w_tilde_data_vector": { + "lower_s": 0.006039446001523174, + "compile_s": 0.06258922400593292, + "first_call_s": 0.0007638210081495345, + "steady_per_call_s": 0.00012888839992228896 + }, + "w_tilde_reconstruction": { + "lower_s": 0.0003047179925488308, + "compile_s": 9.90999978967011e-06, + "first_call_s": 0.0018399079999653623, + "steady_per_call_s": 0.0014961906999815255 + }, + "w_tilde_figure_of_merit": { + "lower_s": 0.006120545993326232, + "compile_s": 0.047478917986154556, + "first_call_s": 0.0007551910093752667, + "steady_per_call_s": 0.00013355629926081747 + }, + "w_tilde_chain_from_mapping_matrix": { + "lower_s": 0.03888455299602356, + "compile_s": 0.5200097850029124, + "first_call_s": 0.0083772170037264, + "steady_per_call_s": 0.0019300264000776223 + }, + "library_sparse_prefix_1": { + "lower_s": 0.07518680900102481, + "compile_s": 0.4277667940041283, + "first_call_s": 0.002279691005242057, + "steady_per_call_s": 0.0004687973007094115 + }, + "library_sparse_prefix_2": { + "lower_s": 0.39626615900488105, + "compile_s": 0.09236305000376888, + "first_call_s": 0.005404944007750601, + "steady_per_call_s": 0.0008845360993291251 + }, + "library_sparse_prefix_3": { + "lower_s": 0.6640219410037389, + "compile_s": 2.179306695004925, + "first_call_s": 0.009988317004172131, + "steady_per_call_s": 0.0012926722003612668 + }, + "library_sparse_prefix_4": { + "lower_s": 0.6837134820088977, + "compile_s": 2.419437486998504, + "first_call_s": 0.012608035001903772, + "steady_per_call_s": 0.0025459438998950644 + }, + "library_sparse_prefix_5": { + "lower_s": 1.1098985839926172, + "compile_s": 3.6366418289981084, + "first_call_s": 0.015200854002614506, + "steady_per_call_s": 0.002671858400572091 + }, + "library_sparse_fit_log_likelihood": { + "lower_s": 1.0051186569908168, + "compile_s": 5.5763635670009535, + "first_call_s": 0.02651396500004921, + "steady_per_call_s": 0.009043498300889042 + }, + "library_sparse_full_pipeline": { + "lower_s": 1.126240894998773, + "compile_s": 3.5675013639993267, + "first_call_s": 0.015316502001951449, + "steady_per_call_s": 0.002690865099430084 + }, + "library_sparse_full_pipeline_vmap64": { + "first_call_s": 6.315279421993182, + "batch_per_call_s": 0.02433758819970535, + "steady_per_call_s": 0.0003802748156203961 + }, + "setup_prefix_1_vmap4": { + "first_call_s": 0.5421997039957205, + "batch_per_call_s": 0.00045386740093817935, + "steady_per_call_s": 0.00011346685023454484 + }, + "setup_prefix_2_vmap4": { + "first_call_s": 0.6780637000047136, + "batch_per_call_s": 0.0010749798006145284, + "steady_per_call_s": 0.0002687449501536321 + }, + "setup_prefix_3_vmap4": { + "first_call_s": 2.340066058008233, + "batch_per_call_s": 1.3793891044988413, + "steady_per_call_s": 0.34484727612471033 + } + }, + "peak_rss_mb": 2352.69140625, + "w_tilde": { + "operator_build_s": 3.0892108190018917, + "operator_build_nufft_chunk_size": 100000, + "operator_shape": [ + 140, + 140 + ], + "curvature_max_rel_diff_vs_dense": 3.261092414988328e-13, + "data_vector_max_rel_diff_vs_dense": 1.2881077392015367e-16, + "figure_of_merit": -12047193.687613314, + "figure_of_merit_chain": -12047193.687613314, + "figure_of_merit_abs_diff_vs_fit_nats": 1.6763806343078613e-08, + "figure_of_merit_abs_diff_vs_step_by_step_nats": 0.0, + "log_likelihood_unfloored": -12047193.687220674, + "log_likelihood_abs_diff_vs_fit_nats": 1.4901161193847656e-08, + "operator_build_peak_rss_mb": 1808.04296875, + "total_step_by_step": 0.0023722828991594724, + "chain_from_mapping_matrix_s": 0.0019300264000776223, + "dense_chain_from_mapping_matrix_s": 0.9215241255995352, + "dense_transform_plus_curvature_s": 0.9339314907992957, + "w_tilde_curvature_s": 0.0006136474999948405, + "speedup_curvature_vs_dense_transform_plus_curvature": 1521.934809165112, + "speedup_chain_vs_dense_chain": 477.46710903149983, + "note": "Measurement-only: an MGE-only fit never takes this path in the library (inversion/factory.py switches the sparse operator off when every linear object is an AbstractLinearObjFuncList). The chain row replaces steps 3-8 from the same mapping matrix; its per-call cost has no N_vis term." + }, + "w_tilde_steps": { + "Curvature matrix F~ = B\u1d40 W~ B": 0.0006136474999948405, + "Data vector D~ = B\u1d40 d~": 0.00012888839992228896, + "Reconstruction (PDIP NNLS)": 0.0014961906999815255, + "Fast chi-squared + figure of merit (constants hoisted)": 0.00013355629926081747 + }, + "dense_steps": { + "Ray-trace grids": 0.0005040899006417022, + "Mapping matrix (20 Gaussians)": 0.00035946049902122466, + "Transformed mapping matrix (NUFFT)": 0.9108821210014867, + "Data vector (D)": 0.00046307640004670245, + "Curvature matrix (F)": 0.025575169899093454, + "Reconstruction (PDIP NNLS)": 0.001525596399733331, + "Fast chi-squared + figure of merit": 0.0002702306999708526 + }, + "dense_total_step_by_step": 0.939579744799994, + "dense_setup_split": { + "Ray-trace grids": 0.0005040899006417022, + "Mapping matrix (20 Gaussians)": 0.00035946049902122466, + "Transformed mapping matrix (NUFFT)": 0.9108821210014867 + }, + "library_sparse": { + "status": "ok", + "operator_build_s": 3.0892108190018917, + "operator_build_peak_rss_mb": 1808.04296875, + "operator_build_nufft_chunk_size": 100000, + "fit_transformer_chunk_size": 100000, + "inversion_class": "InversionInterferometerSparse", + "nnls_solver": "pdip", + "nnls_preconditioning": "raw", + "data_vector_max_rel_diff_vs_dense": 1.2881077392015367e-16, + "curvature_reg_matrix_max_rel_diff_vs_dense": 3.2610924146002255e-13, + "setup_split": { + "Ray-trace grids": 0.0004687973007094115, + "Mapping matrix (20 Gaussians)": 0.0004157387986197136, + "Data vector + curvature matrix (library W~: B\u1d40 d~, B\u1d40 W~ B)": 0.00040813610103214166, + "Reconstruction (PDIP NNLS)": 0.0012532716995337977, + "Fast chi-squared + figure of merit (FitInterferometer)": 0.00012591450067702672 + }, + "setup_prefix_per_call_s": { + "1": 0.0004687973007094115, + "2": 0.0008845360993291251, + "3": 0.0012926722003612668, + "4": 0.0025459438998950644, + "5": 0.002671858400572091 + }, + "total_step_by_step": 0.002671858400572091, + "fit_log_likelihood_s": 0.009043498300889042, + "full_pipeline_single_jit": 0.002690865099430084, + "log_likelihood": -12047193.687220689, + "figure_of_merit": -12047193.687613329, + "figure_of_merit_full_pipeline": -12047193.687613329, + "reference_mode": "cpu_pinned", + "log_likelihood_abs_diff_vs_reference_nats": 0.0, + "figure_of_merit_abs_diff_vs_reference_nats": 1.862645149230957e-09, + "full_pipeline_abs_diff_vs_reference_nats": 1.862645149230957e-09, + "witness_threshold_nats": 1e-06, + "witness_pass": null, + "witness_note": "no dense reference on this device (cpu_pinned); diffs are against the laptop fp64 CPU pins where they exist", + "dense_full_pipeline_single_jit": null, + "dense_total_step_by_step": 0.939579744799994, + "figure_of_merit_abs_diff_vs_w_tilde_arm_nats": 1.4901161193847656e-08, + "log_likelihood_abs_diff_vs_w_tilde_arm_nats": 1.4901161193847656e-08, + "lens_sersic_variant": { + "status": "skipped", + "reason": "no dense library reference on this device (cpu_pinned)" + }, + "vmap": [ + { + "batch": 64, + "status": "ok", + "per_call_s": 0.0003802748156203961 + } + ] + }, + "vmap_batch": 4, + "steps_vmap_per_call": {}, + "setup_split_vmap": { + "Ray-trace grids": 0.00011346685023454484, + "Mapping matrix (20 Gaussians)": 0.00015527809991908729, + "Transformed mapping matrix (NUFFT)": 0.3445785311745567 + }, + "pinned_expected": -12047193.68761333, + "pinned_drift": [] +} \ No newline at end of file diff --git a/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.png b/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.png new file mode 100644 index 000000000..5fa675082 Binary files /dev/null and b/results/breakdown/interferometer/mge_hpc_a100_fp64_sparse.png differ diff --git a/results/notes/interferometer_mge_breakdown_2026_09.md b/results/notes/interferometer_mge_breakdown_2026_09.md index 33b754dfd..e130d2f7a 100644 --- a/results/notes/interferometer_mge_breakdown_2026_09.md +++ b/results/notes/interferometer_mge_breakdown_2026_09.md @@ -217,3 +217,141 @@ Not filed: levers 5 (mp) and 6 (eps / batched NUFFT, shared eccentric radius, PD n=20 — revisit PDIP after lever 1). The `scripts/misc/test/` failures seen on this branch before merging `origin/main` (6 tests, PyAutoArray#572 `preconditioning`) are already fixed on main (912 passed after the merge). + +## Library W~ route (2026-09-26) + +Lever 1, landed as PyAutoArray#575 (PyAutoArray#576, PyAutoGalaxy#629, PyAutoLens#750 — branch +`feature/interferometer-mge-w-tilde-route`, measured before merge). The inversion factory no longer +turns the sparse operator off for an all-func-list inversion. An MGE-only `FitInterferometer` on a +dataset with `apply_sparse_operator()` applied now takes `InversionInterferometerSparse`. Fits that +also have ordinary light profiles use the dirty image of the profile-subtracted visibilities +(`d~ - W~ i_p`). + +**Cell:** the same `mge.py` with `--sparse` (PART C2). It runs the library path in the dense schema: +nested `params -> stage` prefixes, `jit_phases`, the jitted `FitInterferometer.log_likelihood`, and +the `AnalysisInterferometer` full pipeline on the sparse dataset. The dense and `--w-tilde` arms +still run in the same job, so each JSON holds before and after: +- the library rows are in `steps` / `library_sparse`; +- the dense rows are in `dense_steps`. + +Libraries were imported from the branch. On RAL that means a private copy at +`/mnt/ral/jnightin/PyAuto_branch/interferometer-mge-w-tilde-route/`, whose `__file__` the submit +asserts; the shared mirror was not touched. SHAs are in each JSON's `source_revisions`. RAL used the +mirror's PyAutoFit `dd9fbe0a` and PyAutoNerves `1fa613aa`, with nufftax 0.6.1. + +Two rounds were measured: +- **Round 1:** PyAutoArray `b5ef2e89`, PyAutoGalaxy `068daa9d`, PyAutoLens `acb136cd` (RAL jobs + 356359-356361). +- **Round 2:** the zero-image NUFFT fix below, PyAutoGalaxy `36d1b436`, PyAutoLens `ac333b17` + (PyAutoArray unchanged). It re-ran CPU sma/alma and A100 alma/jvla (RAL jobs 356362, 356363); the + committed JSONs for those legs are from round 2. The A100 alma_high JSON is still round 1. + +| Leg | JSON | +|---|---| +| CPU sma / alma | `results/breakdown/interferometer/mge_breakdown_{sma,alma}_v2026.8.17.1_sparse.json` | +| A100 alma / alma_high / jvla | `interferometer/mge_hpc_a100_fp64_sparse.json` (356362), `interferometer/alma_high/mge_hpc_a100_fp64_sparse.json` (356360, round 1), `interferometer/jvla/mge_hpc_a100_fp64_sparse.json` (356363) | + +### Before / after — per-call seconds, fp64 + +`library full` is `library_sparse.full_pipeline_single_jit`, i.e. `AnalysisInterferometer` on the +sparse dataset, which is what a sampler calls. `library log L` is the jitted +`FitInterferometer.log_likelihood`, which also forms the mapped visibilities. `dense` is the same +run's dense path: the library path where it runs, otherwise the chunked-transform arm (¹). `W~ arm` is +the #308 measurement-only chain from the mapping matrix. + +| Instrument | Device | Inversion (library) | library full, round 1 | library full, round 2 | library log L, round 2 | dense | dense library path | W~ arm 3-8 | +|---|---|---|---:|---:|---:|---:|---|---:| +| sma | CPU | InversionInterferometerSparse | 11.1 ms | 7.77 ms | 16.1 ms | 82.1 ms (full pipeline) | runs | 7.06 ms | +| alma | CPU | InversionInterferometerSparse | 1.29 s | 34.7 ms | 2.86 s | 13.10 s (full pipeline) | runs | 34.7 ms | +| alma | A100 | InversionInterferometerSparse | 8.92 ms | 2.69 ms | 9.04 ms | 939.6 ms¹ | OOM (asks 61.4 GiB) | 1.93 ms | +| alma_high | A100 | InversionInterferometerSparse | 19.6 ms | — (not re-run) | 35.2 ms (round 1) | 3.94 s¹ | OOM (asks 300.3 GiB) | 3.36 ms | +| jvla | A100 | InversionInterferometerSparse | 92.2 ms | 16.7 ms | 93.1 ms | 24.20 s¹ | OOM (asks 1.46 TiB) | 13.6 ms | + +¹ Dense step total on the chunked-transform arm, because the dense library path OOMs. + +The `dense`, `library log L` and `W~ arm` columns are from the round-2 JSONs, except alma_high. + +After round 2, on the A100 the library full pipeline is 349x (alma) and 1449x (jvla) faster than +the chunked dense arm, and within 1.2-1.4x of the measurement-only W~ chain. It runs where the dense +library path cannot run at all. On CPU it is 378x (alma) and 10.6x (sma) faster than the dense full +pipeline. The jitted `FitInterferometer.log_likelihood` stays O(N_vis), because it forms the mapped +visibilities by design; the sampler path (`figure_of_merit`) does not. + +CPU caveat: the laptop was shared with other sessions (load average 1.3-6, recorded in +`host_load_avg_*`). The dense alma rows in this run (13.0 s full pipeline, 11.2 s transform) are +about 3.6x faster than #308's (41.1 s, 40.7 s) on the same host; round 2 reproduced 13.1 s. +Compare rows within one JSON, not across runs. + +### Witness + +- **Inversion class:** `InversionInterferometerSparse` on every leg. The cell raises otherwise. +Witness numbers are identical in rounds 1 and 2. + +- **|Δ log L| ≤ 1e-6 nats** against the dense library reference, where it runs (CPU, fp64): + - sma: log L 0.0, figure of merit 4.5e-13; + - alma: log L 0.0, figure of merit 1.9e-9; + - `library_sparse.witness_pass = true` on both. +- **A100**, where the dense reference OOMs, against the laptop fp64 pins: + - alma: log L 0.0, figure of merit 1.9e-9; + - alma_high: log L 0.0, figure of merit 5.2e-8. +- **jvla:** no dense reference or pin. The library route agrees with the #308 W~ arm to 3.6e-5 nats + in log L (1.4e-5 in figure of merit), relative 1.2e-13 at log L = -3.0e8. +- **Curvature and data vector:** library F~ vs dense F max rel diff 8.0e-14 (CPU alma); D~ 1.8e-15. +- **No OOM:** the jitted library fit ran at alma, alma_high and jvla on the A100. +- **MGE + lens Sersic** (`lens_sersic_variant`, the dirty-image correction): sparse matches dense to + 0.0 nats in log L at sma and alma. The control with the correction switched off is 3.8e-3 nats off + (sma) and 779 nats off (alma), so the check discriminates. Not run on the A100, where the dense + reference OOMs. + +### The zero-image NUFFT — found in round 1, fixed in round 2 + +In round 1 the library full pipeline was 4-7x slower than the #308 W~ arm chain (alma A100: 8.9 ms +against 1.9 ms; jvla: 92 ms against 13.5 ms). The step that grew was +`Fast chi-squared + figure of merit (FitInterferometer)`: 6.2 ms at alma, 15.3 ms at alma_high and +75.8 ms at jvla on the A100, and 2.37 s at alma on CPU. + +That step was O(N_vis). `FitInterferometer.profile_visibilities` NUFFTed the standard-light image +whenever `tracer.has(LightProfile)`, and a linear MGE counts as a `LightProfile`. So every call did a +forward NUFFT of an all-zero image, and `fast_chi_squared`'s `dᵀN⁻¹d` term then ran over the +profile-subtracted visibilities. A laptop probe at alma (jit, 3 repeats) measured +`profile_visibilities` at 3.2 s, `inversion.fast_chi_squared` at 4.8 s and `reconstruction` at 43 ms. + +**Fix** (folded into the library PRs: PyAutoGalaxy `36d1b436`, PyAutoLens `ac333b17`): when no +ordinary light profile is present, `profile_visibilities` returns zeros without a transform. This is +the same structural check `sparse_dirty_image_from` makes. + +Before / after, figure-of-merit row (`setup_split`) and full pipeline: + +| Instrument | Device | FoM row, round 1 | FoM row, round 2 | full pipeline, round 1 | full pipeline, round 2 | +|---|---|---:|---:|---:|---:| +| sma | CPU | 4.07 ms | 2.87 ms | 11.1 ms | 7.77 ms | +| alma | CPU | 2.37 s | ≈0 (−11.6 ms, differencing noise) | 1.29 s | 34.7 ms (37x) | +| alma | A100 | 6.23 ms | 0.13 ms | 8.92 ms | 2.69 ms (3.3x) | +| jvla | A100 | 75.8 ms | 0.32 ms | 92.2 ms | 16.7 ms (5.5x) | + +`dᵀN⁻¹d` is still a per-call reduction over the visibilities, but it is cheap next to the NUFFT it +replaced. Hoisting it as a dataset constant is a possible further step, not needed now. + +### vmap (A100, sparse full pipeline) and VRAM rows + +| Instrument | batch 64 | batch 16 | `VMAP_BATCH_SPARSE` row | +|---|---|---|---| +| alma | 0.38 ms/call (round 2; 0.48 round 1) | — | 64 | +| alma_high | 1.54 ms/call (round 1) | — | 64 | +| jvla | OOM, asks 41.1 GiB in both rounds | 10.8 ms/call (round 2; 15.5 round 1) | 16 | + +The jvla batch-64 request did not change with the fix, so the zero-image NUFFT was not what capped +it. The request is consistent with the W~ curvature's FFT convolution of the 20 mapping-matrix +columns on the padded operator grid: operator 700² at jvla, padded 1400² complex128, times 20 +columns times 64 replicas is about 37 GiB. That attribution is inferred from sizes, not profiled. + +These rows are now in `scripts/misc/vram/config.py` under `VMAP_BATCH_SPARSE`. The dense +`VMAP_BATCH` rows stay `None`, because the dense library path still OOMs. + +### Not run + +- **CPU alma_high.** The laptop kernel OOM-killed it at 10.8 GB anon RSS inside `apply_sparse_operator()` + (the eager operator build, with a 1M-visibility NUFFT chunk from the instrument preset), after the dense + arms had finished. The partial JSON is not committed. The A100 alma_high leg covers the witness. +- **CPU jvla** was not attempted. +- **A100 alma_high** was not re-run in round 2; its JSON is round 1. diff --git a/scripts/interferometer/likelihood_breakdown/mge.py b/scripts/interferometer/likelihood_breakdown/mge.py index 23b320769..044f56e12 100644 --- a/scripts/interferometer/likelihood_breakdown/mge.py +++ b/scripts/interferometer/likelihood_breakdown/mge.py @@ -61,9 +61,9 @@ The W~ arm (``--w-tilde``) -------------------------- -An MGE-only fit always takes the dense path: ``inversion/factory.py`` switches -the sparse operator off when every linear object is an -``AbstractLinearObjFuncList``. The W~ curvature helpers that the mixed +Before PyAutoArray#575 an MGE-only fit always took the dense path: +``inversion/factory.py`` switched the sparse operator off when every linear +object is an ``AbstractLinearObjFuncList``. The W~ curvature helpers that the mixed mapper + MGE inversion already uses (``InterferometerSparseOperator. curvature_matrix_func_list_from`` / ``operated_matrix_slim_from``, ``interferometer/sparse.py``) can nevertheless be driven directly on this @@ -84,6 +84,39 @@ + dirty image, two eager type-1 NUFFTs) is chunked over visibilities above the eager threshold, and its wall time is recorded as ``w_tilde.operator_build_s``. +The library W~ route (``--sparse``) +----------------------------------- + +Since PyAutoArray#575 the factory keeps the sparse operator for an all-func-list +interferometer inversion, so ``FitInterferometer`` on a dataset with +``apply_sparse_operator()`` applied takes ``InversionInterferometerSparse``. +The shared ``--sparse`` flag adds that arm (PART C2) after the dense arms, which +still run, so one JSON holds before and after: + +- the inversion class the library picks (asserted to be the sparse class); +- steps as nested ``params -> stage`` prefixes on the library path (ray-trace, + mapping matrix, ``D~`` + ``F~``, NNLS, ``FitInterferometer.figure_of_merit``), + attributed by successive differences, in ``steps`` / ``setup_split`` / + ``jit_phases`` — the dense rows move to ``dense_steps`` / + ``dense_total_step_by_step`` / ``dense_setup_split``, and + ``configuration.inversion_path`` becomes ``"sparse"``; +- the jitted ``FitInterferometer.log_likelihood`` and the + ``AnalysisInterferometer`` full pipeline on the sparse dataset, checked + against the dense reference (``library_sparse.witness_pass``: ``|Δ| <= 1e-6`` + nats where the dense reference runs on the device; against the laptop CPU pins + otherwise, recorded only); +- where the dense reference runs, an MGE + lens Sersic variant, sparse vs dense, + with an uncorrected-dirty-image control (``library_sparse.lens_sersic_variant``) + that exercises the #575 ``d~ - W~ i_p`` correction; +- ``--sparse-vmap-batch 64,16,4``: the sparse full pipeline under ``jax.vmap``, + largest batch first, stopping at the first that fits (the VRAM rows). + +The sparse dataset is the one the W~ arm builds (chunked transformer above the +eager threshold), so ``library_sparse.fit_transformer_chunk_size`` records the +visibility chunk the fit's own NUFFTs (mapped visibilities, profile +visibilities) ran with. A library error, or a gap beyond ``LOG_L_ATOL_NATS``, +exits non-zero after the JSON is written. + Memory and repeats at alma scale -------------------------------- @@ -111,6 +144,9 @@ ``mge_hpc_a100_fp64.json``), every other instrument to ``interferometer//``. The dashboard reads the instrument from the payload either way. +- ``--sparse`` appends ``_sparse`` (``_profile_cli.resolve_output_paths``): + ``mge_breakdown_{instrument}_v{al_version}_sparse`` / + ``mge__sparse.json``, so the #308 dense files are kept. """ import sys as _sys @@ -156,6 +192,7 @@ def _profiling_root() -> _Path: # Shared breakdown harness. Imported *before* the smoke short-circuit so the CI # import smoke covers the package too. from likelihood_breakdown import timing # noqa: E402 +from likelihood_breakdown.provenance import source_revisions # noqa: E402 if _smoke_os.environ.get("AUTOLENS_PROFILING_SMOKE") == "1": print(f"[smoke] {__file__}: imports + module setup OK; exiting.") @@ -226,13 +263,39 @@ def _profiling_root() -> _Path: "Default: the instrument's transformer_chunk_size preset (None = one shot)." ), ) +_cell_parser.add_argument( + "--sparse-vmap-batch", + type=str, + default=None, + help=( + "Library W~ route arm (--sparse) only: comma-separated vmap batches to try for the " + "sparse full pipeline, largest first; the first that runs without a device OOM is " + "kept (a small VRAM probe). Default: --vmap-batch." + ), +) _cell_args = _cli.parse_cell_args(_cell_parser) USE_DFT = bool(_cell_args.use_dft) USE_W_TILDE = bool(_cell_args.w_tilde) +# The library W~ route (PyAutoArray#575): the shared ``--sparse`` flag applies +# ``dataset.apply_sparse_operator()`` and fits through the library, which since +# #575 routes an MGE-only inversion to ``InversionInterferometerSparse``. +USE_LIBRARY_SPARSE = bool(_cli.use_sparse_operator) TRANSFORM_COLUMN_BATCH = _cell_args.transform_chunk _vmap_batch = _cell_args.vmap_batch +# Import provenance: which library checkouts actually ran (a branch run on RAL +# prepends a private copy to PYTHONPATH; the log and the JSON must show it). +_source_revisions = source_revisions(_profiling_root()) +print("--- Import provenance ---") +for _module in (aa, al, af): + print(f" {_module.__name__}.__file__ = {_module.__file__}") +import autogalaxy as _ag # noqa: E402 + +print(f" autogalaxy.__file__ = {_ag.__file__}") +for _repo, _rev in _source_revisions.items(): + print(f" {_repo:<18} {_rev}") + instrument = _cli.instrument or "sma" # --instrument overrides (default sma) total_gaussians = 20 # matches the imaging MGE-20 cell and likelihood_runtime/mge.py @@ -968,6 +1031,10 @@ def _abs_diff(a, b): vmap_split: dict[str, float] | None = None vmap_error: str | None = None +# Library W~ route arm (--sparse), filled in PART C2. +library_sparse: dict | None = None +library_sparse_steps: dict[str, float] | None = None + # =================================================================== # Summary + JSON + PNG (written after the dense steps, then again at the end) @@ -1016,6 +1083,10 @@ def write_results(stage: str): print(" W~ arm rows:") for label, per_call in w_tilde_steps.items(): print(f" {label:<{_w}} {per_call * 1e3:12.3f} ms") + if library_sparse_steps: + print(f" Library W~ route rows ({(library_sparse or {}).get('inversion_class')}):") + for label, per_call in library_sparse_steps.items(): + print(f" {label:<{_w}} {per_call * 1e3:12.3f} ms") print(f" Peak RSS: {peak_rss_mb:.0f} MB") print("=" * 70) @@ -1035,8 +1106,15 @@ def write_results(stage: str): "visibilities": n_visibilities, "linear_gaussians": n_linear, "lens_light": None, - "inversion_path": "dense", - "inversion_class": type(inversion).__name__, + # With --sparse the top-level rows are the library W~ route; the dense + # rows of the same run move to ``dense_steps`` (before/after in one JSON). + "inversion_path": "sparse" if USE_LIBRARY_SPARSE else "dense", + "inversion_class": ( + (library_sparse or {}).get("inversion_class") + if USE_LIBRARY_SPARSE + else type(inversion).__name__ + ), + "dense_inversion_class": type(inversion).__name__, "transformer": transformer_name, "chunk_size": transformer_chunk_size, "chunk_size_note": ( @@ -1048,6 +1126,7 @@ def write_results(stage: str): "nufftax_version": _nufftax_version(), **transform_config, "w_tilde_arm": USE_W_TILDE, + "library_sparse_arm": USE_LIBRARY_SPARSE, "n_repeats": N_REPEATS, "thread_env": _observe_thread_env(), "host_load_avg_start": _load_avg_start, @@ -1094,6 +1173,7 @@ def write_results(stage: str): }, "steps": {label: float(per_call) for label, per_call in likelihood_steps}, "total_step_by_step": step_total, + "source_revisions": _source_revisions, "full_pipeline_single_jit": ( float(full_pipeline_per_call) if full_pipeline_per_call is not None else None ), @@ -1109,6 +1189,20 @@ def write_results(stage: str): if w_tilde_steps is not None: breakdown_summary["w_tilde_steps"] = {k: float(v) for k, v in w_tilde_steps.items()} + if USE_LIBRARY_SPARSE: + # The dashboard reads ``steps`` / ``total_step_by_step`` and labels the + # row by ``configuration.inversion_path``: they are the library W~ route + # here, and the dense rows of this same run are kept alongside. + breakdown_summary["dense_steps"] = breakdown_summary["steps"] + breakdown_summary["dense_total_step_by_step"] = step_total + breakdown_summary["dense_setup_split"] = breakdown_summary["setup_split"] + breakdown_summary["steps"] = {k: float(v) for k, v in (library_sparse_steps or {}).items()} + breakdown_summary["total_step_by_step"] = ( + float(sum(library_sparse_steps.values())) if library_sparse_steps else None + ) + breakdown_summary["setup_split"] = (library_sparse or {}).get("setup_split") + breakdown_summary["library_sparse"] = library_sparse + if vmap_skipped_reason is not None: breakdown_summary["vmap_skipped_reason"] = vmap_skipped_reason @@ -1144,6 +1238,10 @@ def write_results(stage: str): colors = ["#4C72B0"] * len(likelihood_steps) + ["#55A868"] * ( len(labels) - len(likelihood_steps) ) + if library_sparse_steps: + labels += [f"Library W~: {label}" for label in library_sparse_steps] + times += list(library_sparse_steps.values()) + colors += ["#C44E52"] * len(library_sparse_steps) fig, ax = plt.subplots(figsize=(10, 0.45 * len(labels) + 2)) y_pos = range(len(labels)) @@ -1260,22 +1358,26 @@ def full_pipeline(params): else (100_000 if n_visibilities > EAGER_REFERENCE_MAX_VIS else None) ) -if USE_W_TILDE: - print("\n" + "=" * 70) - print("W~ ARM (func-list W~ curvature, measurement only)") - print("=" * 70) - try: +_sparse_dataset_cache: dict = {} + + +def sparse_dataset(): + """``apply_sparse_operator()`` once, shared by the W~ arm and the library arm. + + ``apply_sparse_operator`` runs two eager (op-by-op) type-1 NUFFTs: the + precision-operator build and the dirty image (``transformer.image_from``). + Both honour a visibility chunk size — the builder through + ``nufft_chunk_size``, the dirty image through the transformer's own + ``chunk_size`` — so above the eager threshold the operator is built from a + copy of the dataset whose transformer is chunked. Unchunked, the build was + killed at 9.2-9.6 GB RSS at alma on the laptop. The operator and dirty image + are the same quantities either way (chunking only bounds the spread buffer), + and the F~ / D~ checks and the library-vs-dense witness verify it. + + Returns ``(dataset_w, build_s, build_peak_rss_mb)``. + """ + if "dataset_w" not in _sparse_dataset_cache: with timer.section("w_tilde_apply_sparse_operator"): - # ``apply_sparse_operator`` runs two eager (op-by-op) type-1 NUFFTs: - # the precision-operator build and the dirty image - # (``transformer.image_from``). Both honour a visibility chunk size — - # the builder through ``nufft_chunk_size``, the dirty image through - # the transformer's own ``chunk_size`` — so above the eager threshold - # the operator is built from a copy of the dataset whose transformer - # is chunked. Unchunked, the build was killed at 9.2-9.6 GB RSS at - # alma on the laptop. The operator and dirty image are the same - # quantities either way (chunking only bounds the spread buffer), and - # the F~ / D~ checks below verify it against the dense path. if w_tilde_nufft_chunk_size is not None and not USE_DFT: _chunk = w_tilde_nufft_chunk_size dataset_for_operator = al.Interferometer( @@ -1291,11 +1393,24 @@ def full_pipeline(params): ) else: dataset_for_operator = dataset - dataset_w = dataset_for_operator.apply_sparse_operator( + _sparse_dataset_cache["dataset_w"] = dataset_for_operator.apply_sparse_operator( use_jax=True, nufft_chunk_size=w_tilde_nufft_chunk_size ) - w_tilde_build_s = timer.records[-1][1] - w_tilde_build_peak_rss_mb = _peak_rss_mb() + _sparse_dataset_cache["build_s"] = timer.records[-1][1] + _sparse_dataset_cache["build_peak_rss_mb"] = _peak_rss_mb() + return ( + _sparse_dataset_cache["dataset_w"], + _sparse_dataset_cache["build_s"], + _sparse_dataset_cache["build_peak_rss_mb"], + ) + + +if USE_W_TILDE: + print("\n" + "=" * 70) + print("W~ ARM (func-list W~ curvature, measurement only)") + print("=" * 70) + try: + dataset_w, w_tilde_build_s, w_tilde_build_peak_rss_mb = sparse_dataset() sparse_operator = dataset_w.sparse_operator extent_index = jnp.asarray( np.asarray(dataset.real_space_mask.extent_index_for_masked_pixel), dtype=jnp.int32 @@ -1434,6 +1549,319 @@ def w_tilde_chain_from_mapping_matrix(mapping_matrix): print(" W~ ARM FAILED — dense results are unaffected. Traceback:") print(w_tilde["error"]) +# =================================================================== +# PART C2 — Library W~ route (--sparse): the MGE-only fit on the library path +# =================================================================== +# +# Since PyAutoArray#575 the inversion factory no longer switches the sparse +# operator off for an all-func-list inversion, so ``FitInterferometer`` on a +# dataset with ``apply_sparse_operator()`` applied takes +# ``InversionInterferometerSparse`` for this MGE-only model. This arm times that +# library path in the dense arm's schema (nested ``params -> stage`` prefixes, +# successive differences, ``jit_phases``) and checks its jitted +# ``log_likelihood`` / ``figure_of_merit`` against the dense reference. +# +# Witness: ``|Δ log L| <= 1e-6`` nats against the dense library reference where +# the dense reference runs on this device, and no device OOM. + +# Structural dense-vs-sparse witness threshold (fp64); mixed precision is recorded only. +LIBRARY_SPARSE_WITNESS_NATS = 1e-6 +library_sparse_failed = False + + +def _sparse_vmap_batches() -> list[int]: + if _cell_args.sparse_vmap_batch is not None: + return sorted({int(b) for b in _cell_args.sparse_vmap_batch.split(",")}, reverse=True) + return [int(_vmap_batch)] if _vmap_batch is not None else [] + + +def _tracer_with_lens_sersic(params): + """The cell's tracer plus an ordinary (non-linear) Sersic on the lens galaxy. + + Exercises the sparse dirty-image correction (``d~ - W~ i_p``, + ``autogalaxy.interferometer.fit_interferometer.sparse_dirty_image_from``): + with a regular light profile the inversion fits the profile-subtracted + visibilities, and the cached dirty image alone would be the wrong D. + """ + galaxies = list(params.galaxies) + lens_with_light = al.Galaxy( + redshift=0.5, + mass=galaxies[0].mass, + light=al.lp.Sersic( + centre=(0.0, 0.0), + ell_comps=(0.05, 0.0), + intensity=0.1, + effective_radius=0.6, + sersic_index=2.5, + ), + ) + return al.Tracer(galaxies=[lens_with_light, *galaxies[1:]], fields=[params.fields]) + + +if USE_LIBRARY_SPARSE: + print("\n" + "=" * 70) + print("LIBRARY W~ ROUTE (--sparse: apply_sparse_operator + FitInterferometer)") + print("=" * 70) + library_sparse = {"status": "running"} + try: + dataset_sparse, _build_s, _build_rss = sparse_dataset() + library_sparse["operator_build_s"] = float(_build_s) + library_sparse["operator_build_peak_rss_mb"] = float(_build_rss) + library_sparse["operator_build_nufft_chunk_size"] = w_tilde_nufft_chunk_size + library_sparse["fit_transformer_chunk_size"] = getattr( + dataset_sparse.transformer, "chunk_size", None + ) + + # Structural: which inversion class the library picks (no mapping matrix evaluated). + _inversion_sparse = al.TracerToInversion( + dataset=aa.DatasetInterface( + data=dataset.data, + noise_map=dataset.noise_map, + grids=dataset.grids, + transformer=dataset_sparse.transformer, + sparse_operator=dataset_sparse.sparse_operator, + ), + tracer=tracer, + settings=settings, + xp=np, + ).inversion + library_sparse["inversion_class"] = type(_inversion_sparse).__name__ + library_sparse["nnls_solver"] = _inversion_sparse.positive_only_solver_used + library_sparse["nnls_preconditioning"] = ( + _inversion_sparse.positive_only_preconditioning_used + ) + print(f" inversion class = {library_sparse['inversion_class']}") + if library_sparse["inversion_class"] != "InversionInterferometerSparse": + raise RuntimeError( + "MGE-only fit on a sparse dataset did not take InversionInterferometerSparse " + f"(got {library_sparse['inversion_class']}): are the #575 libraries imported?" + ) + + def _fit_sparse(params): + return al.FitInterferometer( + dataset=dataset_sparse, tracer=_tracer_from(params), settings=settings, xp=jnp + ) + + def sparse_prefix_fn(upto: int): + """Nested ``params -> stage`` prefix on the library W~ route.""" + + def fn(params): + if upto <= 2: + return setup_prefix_fn(upto)(params) + fit_w = _fit_sparse(params) + if upto == 3: + return fit_w.inversion.data_vector, fit_w.inversion.curvature_reg_matrix + if upto == 4: + return fit_w.inversion.reconstruction + return fit_w.figure_of_merit + + return fn + + sparse_prefix_labels = { + 1: "Ray-trace grids", + 2: f"Mapping matrix ({total_gaussians} Gaussians)", + 3: "Data vector + curvature matrix (library W~: Bᵀ d~, Bᵀ W~ B)", + 4: "Reconstruction (PDIP NNLS)", + 5: "Fast chi-squared + figure of merit (FitInterferometer)", + } + sparse_prefix_per_call: dict[int, float] = {} + _sparse_prefix_outputs: dict[int, object] = {} + for _upto in sorted(sparse_prefix_labels): + print(f"\n--- Library W~ prefix 1..{_upto}: {sparse_prefix_labels[_upto]} ---") + _, _sparse_prefix_outputs[_upto] = jit_profile( + sparse_prefix_fn(_upto), f"library_sparse_prefix_{_upto}", params_tree + ) + sparse_prefix_per_call[_upto] = _per_call(f"library_sparse_prefix_{_upto}") + print(f" peak RSS so far: {_peak_rss_mb():.0f} MB") + library_sparse_setup_split = timing.split_by_successive_differences( + sparse_prefix_per_call, sparse_prefix_labels + ) + library_sparse_steps = dict(library_sparse_setup_split) + figure_of_merit_sparse = float(_sparse_prefix_outputs[5]) + + _dv_w, _f_w = _sparse_prefix_outputs[3] + library_sparse["data_vector_max_rel_diff_vs_dense"] = float( + jnp.max(jnp.abs(_dv_w - data_vector)) / jnp.max(jnp.abs(data_vector)) + ) + library_sparse["curvature_reg_matrix_max_rel_diff_vs_dense"] = float( + jnp.max(jnp.abs(_f_w - curvature_matrix)) / jnp.max(jnp.abs(curvature_matrix)) + ) + + print("\n--- Library W~: jax.jit(FitInterferometer.log_likelihood) ---") + _, _ll_sparse = jit_profile( + lambda params: _fit_sparse(params).log_likelihood, + "library_sparse_fit_log_likelihood", + params_tree, + ) + log_likelihood_sparse = float(_ll_sparse) + + print("\n--- Library W~: full pipeline (AnalysisInterferometer on the sparse dataset) ---") + analysis_sparse = al.AnalysisInterferometer( + dataset=dataset_sparse, settings=settings, use_jax=True + ) + + def full_pipeline_sparse(params): + return analysis_sparse.log_likelihood_function(instance=params) + + _, _fp_sparse = jit_profile( + full_pipeline_sparse, "library_sparse_full_pipeline", params_tree + ) + full_pipeline_sparse_logl = float(_fp_sparse) + + _ll_diff = _abs_diff(log_likelihood_sparse, log_likelihood_ref) + _fom_diff = _abs_diff(figure_of_merit_sparse, figure_of_merit_ref) + _reference_is_dense_here = reference_mode in ("eager_numpy", "jit_jax") + library_sparse.update( + { + "status": "ok", + "setup_split": {k: float(v) for k, v in library_sparse_setup_split.items()}, + "setup_prefix_per_call_s": { + str(k): float(v) for k, v in sparse_prefix_per_call.items() + }, + "total_step_by_step": float(sum(library_sparse_steps.values())), + "fit_log_likelihood_s": _per_call("library_sparse_fit_log_likelihood"), + "full_pipeline_single_jit": _per_call("library_sparse_full_pipeline"), + "log_likelihood": log_likelihood_sparse, + "figure_of_merit": figure_of_merit_sparse, + "figure_of_merit_full_pipeline": full_pipeline_sparse_logl, + "reference_mode": reference_mode, + "log_likelihood_abs_diff_vs_reference_nats": _ll_diff, + "figure_of_merit_abs_diff_vs_reference_nats": _fom_diff, + "full_pipeline_abs_diff_vs_reference_nats": _abs_diff( + full_pipeline_sparse_logl, figure_of_merit_ref + ), + "witness_threshold_nats": LIBRARY_SPARSE_WITNESS_NATS, + "witness_pass": ( + bool( + _ll_diff <= LIBRARY_SPARSE_WITNESS_NATS + and _fom_diff <= LIBRARY_SPARSE_WITNESS_NATS + ) + if _reference_is_dense_here and not _cli.use_mixed_precision + else None + ), + "witness_note": ( + "dense library reference ran on this device" + if _reference_is_dense_here + else f"no dense reference on this device ({reference_mode}); diffs are " + "against the laptop fp64 CPU pins where they exist" + ), + "dense_full_pipeline_single_jit": full_pipeline_per_call, + "dense_total_step_by_step": float(sum(t for _, t in likelihood_steps)), + } + ) + if w_tilde is not None and "figure_of_merit" in w_tilde: + library_sparse["figure_of_merit_abs_diff_vs_w_tilde_arm_nats"] = _abs_diff( + figure_of_merit_sparse, w_tilde["figure_of_merit"] + ) + library_sparse["log_likelihood_abs_diff_vs_w_tilde_arm_nats"] = _abs_diff( + log_likelihood_sparse, w_tilde["log_likelihood_unfloored"] + ) + print( + f" library W~ log_likelihood = {log_likelihood_sparse} " + f"(|Δ vs {reference_mode}| = {_ll_diff} nats)" + ) + print( + f" library W~ figure_of_merit = {figure_of_merit_sparse} " + f"(|Δ vs {reference_mode}| = {_fom_diff} nats); witness_pass = " + f"{library_sparse['witness_pass']}" + ) + write_results("library_sparse") + + # MGE + lens Sersic: sparse vs dense, where the dense library fit runs here. + if _reference_is_dense_here: + print("\n--- Library W~: MGE + lens Sersic variant (dirty-image correction) ---") + + def _sersic_values(ds): + def fn(params): + fit_s = al.FitInterferometer( + dataset=ds, + tracer=_tracer_with_lens_sersic(params), + settings=settings, + xp=jnp, + ) + return fit_s.log_likelihood, fit_s.figure_of_merit + + return fn + + with timer.section("lens_sersic_sparse"): + _ll_s, _fom_s = jax.jit(_sersic_values(dataset_sparse))(params_tree) + _ll_s, _fom_s = float(_ll_s), float(_fom_s) + with timer.section("lens_sersic_dense"): + _ll_d, _fom_d = jax.jit(_sersic_values(dataset))(params_tree) + _ll_d, _fom_d = float(_ll_d), float(_fom_d) + # Control: the same sparse fit with the dirty-image correction switched + # off (the pre-#575 behaviour), so the check is shown to discriminate. + import autolens.interferometer.fit_interferometer as _lens_fit_module + + _correction = _lens_fit_module.sparse_dirty_image_from + _lens_fit_module.sparse_dirty_image_from = lambda **_kwargs: None + try: + with timer.section("lens_sersic_sparse_uncorrected"): + _ll_u, _ = jax.jit(_sersic_values(dataset_sparse))(params_tree) + _ll_u = float(_ll_u) + finally: + _lens_fit_module.sparse_dirty_image_from = _correction + library_sparse["lens_sersic_variant"] = { + "sparse_log_likelihood": _ll_s, + "dense_log_likelihood": _ll_d, + "sparse_figure_of_merit": _fom_s, + "dense_figure_of_merit": _fom_d, + "log_likelihood_abs_diff_nats": _abs_diff(_ll_s, _ll_d), + "figure_of_merit_abs_diff_nats": _abs_diff(_fom_s, _fom_d), + "control_sparse_uncorrected_log_likelihood": _ll_u, + "control_uncorrected_abs_diff_nats": _abs_diff(_ll_u, _ll_d), + "note": ( + "Lens Sersic(ell_comps=(0.05,0), I=0.1, R_eff=0.6, n=2.5) added to the " + "cell's MGE-only model; single jitted calls (first call, compile included)." + ), + } + print( + f" sparse vs dense: |Δ log L| = " + f"{library_sparse['lens_sersic_variant']['log_likelihood_abs_diff_nats']} nats, " + f"|Δ FoM| = {library_sparse['lens_sersic_variant']['figure_of_merit_abs_diff_nats']}" + ) + else: + library_sparse["lens_sersic_variant"] = { + "status": "skipped", + "reason": f"no dense library reference on this device ({reference_mode})", + } + + # vmap probe of the sparse full pipeline (VRAM rows): largest batch first. + library_sparse["vmap"] = [] + for _batch in _sparse_vmap_batches(): + print(f"\n--- Library W~ full pipeline under vmap, batch {_batch} ---") + _params_b = jax.tree_util.tree_map( + lambda leaf, n=_batch: jnp.broadcast_to(leaf, (n, *leaf.shape)), params_tree + ) + try: + _per = timing.vmap_profile( + full_pipeline_sparse, + "library_sparse_full_pipeline", + _params_b, + _batch, + n_repeats=N_REPEATS, + timer=timer, + jit_records=jit_records, + ) + library_sparse["vmap"].append( + {"batch": _batch, "status": "ok", "per_call_s": float(_per)} + ) + break + except Exception as exc: # noqa: BLE001 — only a device OOM is recorded + if not _is_oom(exc): + raise + library_sparse["vmap"].append( + {"batch": _batch, **_oom_record(exc, f"library W~ vmap batch {_batch}")} + ) + except Exception as exc: # noqa: BLE001 — recorded, then the run exits non-zero + if _is_oom(exc): + library_sparse.update(_oom_record(exc, "library W~ route")) + else: + library_sparse_failed = True + library_sparse.update({"status": "error", "error": traceback.format_exc()}) + print(" LIBRARY W~ ROUTE FAILED. Traceback:") + print(library_sparse["error"]) + # =================================================================== # PART D — Optional batched re-timing (--vmap-batch N) # =================================================================== @@ -1511,3 +1939,29 @@ def w_tilde_chain_from_mapping_matrix(mapping_matrix): record_pinned_check(dict_path, _pinned_expected, _pinned_drift) if _pinned_expected is not None and not _pinned_drift: print(" Pinned-value check PASSED (recorded in result JSON).") + +# =================================================================== +# Library W~ route — fail loudly (after every result is on disk) +# =================================================================== +# +# A library error, or a library-vs-reference gap beyond the cell's own +# ``LOG_L_ATOL_NATS``, exits non-zero so a SLURM "COMPLETED" cannot hide it. A +# device OOM is a recorded result (``library_sparse.status = "oom"``), as in the +# dense arms. + +if USE_LIBRARY_SPARSE: + if library_sparse_failed: + raise SystemExit("interferometer/mge: library W~ route raised (see library_sparse.error)") + for _key in ( + "log_likelihood_abs_diff_vs_reference_nats", + "figure_of_merit_abs_diff_vs_reference_nats", + ): + _gap = (library_sparse or {}).get(_key) + if _gap is not None and _gap > LOG_L_ATOL_NATS: + raise SystemExit( + f"interferometer/mge: library W~ route {_key} = {_gap} > {LOG_L_ATOL_NATS} nats" + ) + print( + f" Library W~ route: status={library_sparse.get('status')}, " + f"witness_pass={library_sparse.get('witness_pass')}" + ) diff --git a/scripts/misc/likelihood_breakdown/README.md b/scripts/misc/likelihood_breakdown/README.md index 709260cca..0661c98f5 100644 --- a/scripts/misc/likelihood_breakdown/README.md +++ b/scripts/misc/likelihood_breakdown/README.md @@ -51,13 +51,18 @@ For *how long the likelihood actually takes* on production hardware — i.e. a s | `interferometer/delaunay_numba_symmetric` | sma | local_cpu_fp64 | sparse (numba) | 443.1 ms | v2026.8.17.1 | | `interferometer/delaunay_numba_two_stage` | sma | local_cpu_fp64 | sparse (numba) | 388.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma | local_cpu_fp64 | dense (mapping) | 41.19 s | v2026.8.17.1 | +| `interferometer/mge` | alma | local_cpu_fp64 | sparse (w-tilde) | 32.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma | hpc_a100_fp64 | dense (mapping) | 943.2 ms | v2026.8.17.1 | +| `interferometer/mge` | alma | hpc_a100_fp64 | sparse (w-tilde) | 2.7 ms | v2026.8.17.1 | | `interferometer/mge` | alma_high | local_cpu_fp64 | dense (mapping) | 212.19 s | v2026.8.17.1 | | `interferometer/mge` | alma_high | hpc_a100_fp64 | dense (mapping) | 3.88 s | v2026.8.17.1 | +| `interferometer/mge` | alma_high | hpc_a100_fp64 | sparse (w-tilde) | 19.6 ms | v2026.8.17.1 | | `interferometer/mge` | alma_high | hpc_a100_mp | dense (mapping) | 3.93 s | v2026.8.17.1 | | `interferometer/mge` | jvla | hpc_a100_fp64 | dense (mapping) | 23.81 s | v2026.8.17.1 | +| `interferometer/mge` | jvla | hpc_a100_fp64 | sparse (w-tilde) | 16.7 ms | v2026.8.17.1 | | `interferometer/mge` | jvla | hpc_a100_mp | dense (mapping) | 23.72 s | v2026.8.17.1 | | `interferometer/mge` | sma | local_cpu_fp64 | dense (mapping) | 84.0 ms | v2026.8.17.1 | +| `interferometer/mge` | sma | local_cpu_fp64 | sparse (w-tilde) | 11.8 ms | v2026.8.17.1 | | `interferometer/mge` | sma | hpc_a100_fp64 | dense (mapping) | 856.2 ms | v2026.8.17.1 | | `interferometer/mge_dft` | sma | local_cpu_fp64 | dense (mapping) | 32.9 ms | v2026.8.17.1 | | `interferometer/pixelization_numba_direct_conv` | alma | local_cpu_fp64 | sparse (numba) | 1.76 s | v2026.8.17.1 | diff --git a/scripts/misc/vram/config.py b/scripts/misc/vram/config.py index c83c06673..6cf658fb9 100644 --- a/scripts/misc/vram/config.py +++ b/scripts/misc/vram/config.py @@ -24,8 +24,11 @@ at every instrument (0.94 s alma → 23.6 s jvla per call), and the func-list W~ route — N_vis-independent — runs every instrument in 1.9-13.5 ms per call on the A100. Re-tested 2026-09 (autolens_profiling#308); - see ``results/notes/interferometer_mge_breakdown_2026_09.md``. The - ``None`` rows stay until one of those routes lands in the library. + see ``results/notes/interferometer_mge_breakdown_2026_09.md``. The dense + ``None`` rows stay (the dense library path still OOMs there); since + PyAutoArray#575 an MGE-only fit with ``apply_sparse_operator()`` takes the + library W~ route instead, whose rows live in ``VMAP_BATCH_SPARSE`` below + (A100-measured 2026-09-26, same note, "Library W~ route (2026-09-26)"). - Interferometer pixelization at ALMA+ scale: blocked on ``transform_mapping_matrix`` not being chunked. Pixelization's mapping IS sparse (localized mesh) and could eventually use the @@ -102,9 +105,10 @@ ): 16, # 1,243 MB / replica — probe said 46, OOM at runtime ("interferometer", "delaunay", "jvla"): 3, # 7,689 MB / replica — probe said 7, OOM at runtime # - # mge — sma only; alma+ blocked by the unchunked dense library transform on - # GPU (not inherent: chunked transform and the W~ route both run at every - # instrument — results/notes/interferometer_mge_breakdown_2026_09.md). + # mge — sma only on the DENSE path; alma+ blocked by the unchunked dense + # library transform on GPU. With apply_sparse_operator() (PyAutoArray#575) + # the library W~ route runs at every instrument — see VMAP_BATCH_SPARSE and + # results/notes/interferometer_mge_breakdown_2026_09.md. ("interferometer", "mge", "sma"): 64, # 160 MB / replica ( "interferometer", @@ -148,7 +152,18 @@ # conservative, since the sparse path's per-replica footprint is smaller for # every cell measured so far. Populated by the probe-only SLURM submits # (``hpc/batch_gpu/submit_probe_*``) as campaign probes come in. -VMAP_BATCH_SPARSE: dict[tuple[str, str, str], int | None] = {} +VMAP_BATCH_SPARSE: dict[tuple[str, str, str], int | None] = { + # interferometer mge, library W~ route (PyAutoArray#575): the sparse full + # pipeline under jax.vmap on the A100 (fp64, nufftax 0.6.1), largest batch + # first from 64/16/4 (--sparse-vmap-batch). RAL jobs 356359-356363, + # results/notes/interferometer_mge_breakdown_2026_09.md "Library W~ route + # (2026-09-26)". jvla batch 64 asks 41.1 GiB both before and after the + # zero-image NUFFT fix, so the cap is not that NUFFT; by size it matches the + # W~ curvature FFT of 20 columns on the padded 1400² grid (inferred). + ("interferometer", "mge", "alma"): 64, # 0.38 ms / call amortised at 64 + ("interferometer", "mge", "alma_high"): 64, # 1.54 ms / call amortised at 64 (round 1) + ("interferometer", "mge", "jvla"): 16, # 64 asks 41.1 GiB (OOM); 10.8 ms / call at 16 +} # Where each table's numbers came from — checked before a campaign trusts @@ -158,7 +173,11 @@ "probed 2026-05-24 on RAL A100 80GB PCIe (PyAutoLens ~2026.5.x); " "manual halvings for cuFFT scratch failures noted per row" ), - "VMAP_BATCH_SPARSE": "unprobed — falls back to dense rows", + "VMAP_BATCH_SPARSE": ( + "interferometer mge alma/alma_high/jvla: RAL A100 80GB, 2026-09-26, " + "PyAutoArray#575 branch (library W~ route), jobs 356359-356363; " + "every other cell unprobed — falls back to dense rows" + ), }