Skip to content

fix: skip the CPU memory probe that doubles MultiStart compile - #1647

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/multistart-cpu-memory-probe
Sep 26, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/multistart-cpu-memory-probe

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

MultiStartGradient._warn_if_unbatched_exceeds_memory (PyAutoFit#1453) probed Analysis.batched_memory_bytes at batch 1 and 2 whenever batch_size=None. Each probe is a full throwaway XLA compile of jit(vmap(value_and_grad(fitness.call))). It counted on memory_analysis returning 0 on CPU to stop after the first probe. From jax 0.10.2 CPU returns a non-zero value, so every CPU MultiStart fit paid two extra full-model compiles. In release-integrate run 36226772178 (2026-09-26) one of them hit the slow CPU compile mode (~54 min) and pushed autolens_workspace/scripts/imaging/start_here.py to a 3605 s TIMEOUT. The previous three nights took 704-770 s.

The guard now returns before any probe on the CPU backend. It exists to catch GPU OOM (#1452). It also reads the memory budget before probing, so an unknown budget never pays for a compile. The docstring's "Known limitation" paragraph is rewritten to explain the deliberate CPU skip and cite the run.

Closes #1646

API Changes

None — internal changes only.

Test Plan

  • New test__unbatched_memory_guard__* tests (stub probe records calls; jax.default_backend monkeypatched):
    • CPU never probes: failed on unfixed main, passes now
    • unknown budget skips the probe: failed on unfixed main, passes now
    • GPU still probes at [1, 2] and logs the batch_size= warning: passes before and after
  • pytest test_autofit/non_linear/search/mle/: 139 passed
  • Next nightly Stage 3: imaging/start_here.py back near ~700 s

🤖 Generated with Claude Code

MultiStartGradient._warn_if_unbatched_exceeds_memory probed
Analysis.batched_memory_bytes at batch 1 and 2 whenever batch_size=None,
and each probe is a full throwaway XLA compile of the batched
value_and_grad. It relied on memory_analysis returning 0 on CPU to bail
after the first probe; from jax 0.10.2 CPU reports a non-zero value, so
every CPU MultiStart fit paid two extra full-model compiles. One drew the
slow compile mode (~54 min) and pushed autolens imaging/start_here.py to
a 3605 s TIMEOUT in release-integrate run 36226772178.

Return before any probe on the CPU backend (the guard exists for GPU
OOM, #1452), and read the memory budget before probing so an unknown
budget never pays a compile. Tests pin both gates with stub probes.

Closes #1646

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 26, 2026
@Jammy2211
Jammy2211 merged commit 326f611 into main Sep 26, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/multistart-cpu-memory-probe branch September 26, 2026 10:56
Jammy2211 pushed a commit to PyAutoLabs/PyAutoMind that referenced this pull request Sep 26, 2026
PyAutoFit#1647 merged (326f611b); issue #1646 closed. Record carries
pending-release: PyAutoFit@PyAutoLabs/PyAutoFit#1647.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 26, 2026
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.

fix: skip the CPU memory probe that doubles MultiStartProdigy compile

1 participant