Skip to content

perf: Skip VRAM, I/O, model.info in test mode 2+ and add PYAUTO_DISABLE_JAX#1184

Merged
Jammy2211 merged 1 commit intomain_buildfrom
feature/smoke-test-fast-pyautofit
Apr 7, 2026
Merged

perf: Skip VRAM, I/O, model.info in test mode 2+ and add PYAUTO_DISABLE_JAX#1184
Jammy2211 merged 1 commit intomain_buildfrom
feature/smoke-test-fast-pyautofit

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

When PYAUTOFIT_TEST_MODE >= 2, skip expensive operations that aren't needed for smoke testing: VRAM estimation (16s), pre/post-fit file I/O (10s), model.info formatting (7s), and result.info formatting (5s). Also adds PYAUTO_DISABLE_JAX=1 env var to force use_jax=False in the Analysis base class.

Combined with the earlier PYAUTO_WORKSPACE_SMALL_DATASETS and PYAUTO_DISABLE_CRITICAL_CAUSTICS env vars, this reduces smoke test runtime from ~100s to ~22s per modeling script.

API Changes

Added one environment variable: PYAUTO_DISABLE_JAX=1. When set, Analysis.__init__ forces use_jax=False regardless of what the caller passes.

In test mode 2+, model.info returns a stub string and result.info returns a stub string. print_vram_use() is a no-op. search.fit() skips pre-fit output, post-fit output, and all file I/O in the bypass path. These are internal behavioural changes that only apply when the test mode env var is explicitly set.

See full details below.

Test Plan

  • PyAutoFit unit tests pass (1198 passed)
  • imaging/modeling.py completes in ~22s with all env vars
  • interferometer/modeling.py completes in ~22s with all env vars
  • Without env vars, original behaviour preserved
Full API Changes (for automation & release notes)

Added

  • Environment variable PYAUTO_DISABLE_JAX=1 — forces use_jax=False in Analysis.__init__

Changed Behaviour (test mode 2+ only)

  • Analysis.print_vram_use() — returns immediately (no-op)
  • AbstractSearch.fit() — skips pre_fit_output(), post_fit_output(), modify_after_fit()
  • AbstractSearch._fit_bypass_test_mode() — skips save_samples(), save_results(), save_results_combined(), paths.completed()
  • AbstractPriorModel.info — returns stub string
  • text_util.result_info_from() — returns stub string

Migration

None — all changes are gated behind PYAUTOFIT_TEST_MODE >= 2 or PYAUTO_DISABLE_JAX=1.

🤖 Generated with Claude Code

…mode 2+

When PYAUTOFIT_TEST_MODE >= 2:
- print_vram_use() returns immediately (saves ~16s)
- pre_fit_output() and post_fit_output() are skipped (saves ~4s)
- _fit_bypass_test_mode() skips all file I/O (saves ~6s)
- model.info returns a stub (saves ~7s for MGE models)
- result_info_from() returns a stub (saves ~5s)

Also adds PYAUTO_DISABLE_JAX=1 env var to force use_jax=False
in Analysis base class, avoiding JAX JIT overhead in smoke tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit 730a133 into main_build Apr 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant