Overview
With PYAUTO_WORKSPACE_SMALL_DATASETS=1 and PYAUTO_DISABLE_CRITICAL_CAUSTICS=1 (shipped in PyAutoLabs/autolens_workspace#34), smoke test scripts still take ~40-50s each under PYAUTOFIT_TEST_MODE=2. Profiling shows the remaining time is dominated by PyAutoFit-level operations: VRAM estimation (16s), pre-fit file I/O (10s), model.info formatting (7s), and result deserialization (5s). Addressing these should bring total runtime under 10s per script.
Plan
- Skip
print_vram_use() when PYAUTOFIT_TEST_MODE >= 2 — avoids expensive JAX JIT compilation + memory analysis
- Reduce file I/O in
_fit_bypass_test_mode() — skip saving samples, results, and visualization in test mode
- Speed up or skip
model.info formatting for large models in test mode
- Speed up
result_info_from() — skip expensive sigma quantile calculations in test mode
Detailed implementation plan
Affected Repositories
Work Classification
Library
Branch Survey
| Repository |
Current Branch |
Dirty? |
| PyAutoFit |
main_build |
clean |
Suggested branch: feature/smoke-test-fast-pyautofit
Implementation Steps
-
Skip VRAM estimation in test mode — In autofit/non_linear/analysis/analysis.py:319, add early return in print_vram_use() when test_mode_level() >= 2. Saves ~16s per script.
-
Reduce file I/O in test mode bypass — In autofit/non_linear/search/abstract_search.py:790, the _fit_bypass_test_mode() method calls save_samples_summary(), save_samples(), save_results(), save_results_combined(), and paths.completed(). Skip save_samples(), save_results(), and save_results_combined() in test mode 2+ (keep save_samples_summary for result access). Saves ~8-10s.
-
Speed up model.info — In autofit/mapper/prior_model/abstract.py:1775, the info property iterates all path/prior tuples, calls find_groups(), and formats via TextFormatter. For MGE models with ~40 gaussians this takes 7s. Options: cache the property, or return a minimal stub when test_mode_level() >= 2.
-
Speed up result_info_from — In autofit/text/text_util.py:53, result_info_from() calls samples_text.summary() twice (sigma=3.0, sigma=1.0). The values_at_sigma() computation is expensive. Skip in test mode 2+.
Key Files
autofit/non_linear/analysis/analysis.py:319 — print_vram_use()
autofit/non_linear/search/abstract_search.py:790 — _fit_bypass_test_mode()
autofit/mapper/prior_model/abstract.py:1775 — info property
autofit/non_linear/result.py:85 — result.info
autofit/text/text_util.py:53 — result_info_from()
autofit/text/samples_text.py:15 — summary()
autofit/non_linear/test_mode.py — test_mode_level()
Original Prompt
Click to expand starting prompt
Continuation of the smoke test speed-up work. The first phase shipped env vars
for small datasets and disabled critical curves (autolens_workspace#34). This
phase targets the remaining PyAutoFit-level bottlenecks identified by profiling.
With PYAUTO_WORKSPACE_SMALL_DATASETS=1 and PYAUTO_DISABLE_CRITICAL_CAUSTICS=1,
the imaging and interferometer modeling scripts still take ~40-50s each under
PYAUTOFIT_TEST_MODE=2. The remaining time is dominated by:
-
VRAM estimation: ~16s — analysis.print_vram_use() does full JAX JIT
compilation + memory analysis. Should be skipped when PYAUTOFIT_TEST_MODE >= 2.
-
search.fit pre-fit I/O: ~10s — _fit_bypass_test_mode() writes model.info,
visualization, saves samples, saves results. Much of this can be skipped in
test mode 2+.
-
model.info formatting: ~7s — The info property on MGE models with ~40
gaussians takes 7s to format. Can be cached or stubbed in test mode.
-
Result access: ~5s — max_log_likelihood_instance takes ~5s to
deserialize. The result_info_from() function calls expensive
samples_text.summary() twice.
Target: get both scripts under 10s total with all env vars set.
Overview
With
PYAUTO_WORKSPACE_SMALL_DATASETS=1andPYAUTO_DISABLE_CRITICAL_CAUSTICS=1(shipped in PyAutoLabs/autolens_workspace#34), smoke test scripts still take ~40-50s each underPYAUTOFIT_TEST_MODE=2. Profiling shows the remaining time is dominated by PyAutoFit-level operations: VRAM estimation (16s), pre-fit file I/O (10s), model.info formatting (7s), and result deserialization (5s). Addressing these should bring total runtime under 10s per script.Plan
print_vram_use()whenPYAUTOFIT_TEST_MODE >= 2— avoids expensive JAX JIT compilation + memory analysis_fit_bypass_test_mode()— skip saving samples, results, and visualization in test modemodel.infoformatting for large models in test moderesult_info_from()— skip expensive sigma quantile calculations in test modeDetailed implementation plan
Affected Repositories
Work Classification
Library
Branch Survey
Suggested branch:
feature/smoke-test-fast-pyautofitImplementation Steps
Skip VRAM estimation in test mode — In
autofit/non_linear/analysis/analysis.py:319, add early return inprint_vram_use()whentest_mode_level() >= 2. Saves ~16s per script.Reduce file I/O in test mode bypass — In
autofit/non_linear/search/abstract_search.py:790, the_fit_bypass_test_mode()method callssave_samples_summary(),save_samples(),save_results(),save_results_combined(), andpaths.completed(). Skipsave_samples(),save_results(), andsave_results_combined()in test mode 2+ (keepsave_samples_summaryfor result access). Saves ~8-10s.Speed up model.info — In
autofit/mapper/prior_model/abstract.py:1775, theinfoproperty iterates all path/prior tuples, callsfind_groups(), and formats viaTextFormatter. For MGE models with ~40 gaussians this takes 7s. Options: cache the property, or return a minimal stub whentest_mode_level() >= 2.Speed up result_info_from — In
autofit/text/text_util.py:53,result_info_from()callssamples_text.summary()twice (sigma=3.0, sigma=1.0). Thevalues_at_sigma()computation is expensive. Skip in test mode 2+.Key Files
autofit/non_linear/analysis/analysis.py:319—print_vram_use()autofit/non_linear/search/abstract_search.py:790—_fit_bypass_test_mode()autofit/mapper/prior_model/abstract.py:1775—infopropertyautofit/non_linear/result.py:85—result.infoautofit/text/text_util.py:53—result_info_from()autofit/text/samples_text.py:15—summary()autofit/non_linear/test_mode.py—test_mode_level()Original Prompt
Click to expand starting prompt
Continuation of the smoke test speed-up work. The first phase shipped env vars
for small datasets and disabled critical curves (autolens_workspace#34). This
phase targets the remaining PyAutoFit-level bottlenecks identified by profiling.
With PYAUTO_WORKSPACE_SMALL_DATASETS=1 and PYAUTO_DISABLE_CRITICAL_CAUSTICS=1,
the imaging and interferometer modeling scripts still take ~40-50s each under
PYAUTOFIT_TEST_MODE=2. The remaining time is dominated by:
VRAM estimation: ~16s — analysis.print_vram_use() does full JAX JIT
compilation + memory analysis. Should be skipped when PYAUTOFIT_TEST_MODE >= 2.
search.fit pre-fit I/O: ~10s — _fit_bypass_test_mode() writes model.info,
visualization, saves samples, saves results. Much of this can be skipped in
test mode 2+.
model.info formatting: ~7s — The info property on MGE models with ~40
gaussians takes 7s to format. Can be cached or stubbed in test mode.
Result access: ~5s — max_log_likelihood_instance takes ~5s to
deserialize. The result_info_from() function calls expensive
samples_text.summary() twice.
Target: get both scripts under 10s total with all env vars set.