Skip to content

fix: detect no GPU when JAX_PLATFORMS excludes GPU platforms - #224

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/auto-setup-banner
Nov 25, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/auto-setup-banner

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

detect_gpu reports no GPU when JAX_PLATFORMS (or the older JAX_PLATFORM_NAME) is set and names no GPU platform (cuda, rocm, gpu), without running nvidia-smi. JAX won't use an installed GPU then, so setup="auto" must not choose a GPU setup. Previously this was only right when JAX happened to be imported before detection, which PyAutoFit's old fit-start line did; the banner change removed that line and exposed the bug.

Test Plan

  • pytest test_autonerves: 384 passed (new: 4 restricted-to-CPU cases skip nvidia-smi; 5 GPU or empty cases still query it; the no_jax fixture clears JAX_PLATFORMS / JAX_PLATFORM_NAME)
  • Heart dev gate (all five repos): GREEN. Non-blocking shown reasons: manifest drift; test run status unknown; no release rehearsal for current source; release push credential check 69 h old.
  • pyauto-heart smoke --affected-by PyAutoNerves --jobs 3 over the task root (all five branches): 8/8 workspaces PASS

The terminal output now (real test-mode run from autolens_workspace)

A rectangular pixelization fit with setup="auto" and af.Nautilus(number_of_cores="auto"), on a laptop (8 cores, RTX 2060, JAX pinned to CPU by JAX_PLATFORMS=cpu), with timestamps trimmed:

autofit.non_linear.search.runtime - INFO - Starting non-linear search.
... (numba / mask-padding warnings) ...
autogalaxy.analysis.analysis.setup - INFO - Automatic compute setup (CPU/GPU choice from setup="auto"; override with PYAUTO_SETUP or setup=...):
autogalaxy.analysis.analysis.setup - INFO - Setup:    numba · CPU · sparse operator · fp64   (rule imaging/rectangular · extrapolated: 8 cores, rules measured on ≥16-core nodes)
auto - INFO - Parallel: 8 workers (auto: detected cores)
auto - INFO - Estimate: ~6.4 min on this hardware   (283 ms/eval, euclid cell · Nautilus n_live=50 ≈ 4.6e3 evals, heuristic · η=0.55)

Outside modeling, a plain al.FitImaging(dataset, tracer, settings=aa.Settings(lazy_sparse_operator="auto")) prints once, and the second fit reuses the cache silently:

autoarray.dataset.imaging.dataset - INFO - Automatic compute setup: built the numba sparse operator for this dataset (256 image pixels, 0.20 s; cached; lazy_sparse_operator: auto)

Before this change the same run printed a stale Starting non-linear search with JAX (CPU: cpu). before setup resolution, a verbose Setup line, and warnings between the lines. After the old JAX line was removed, the run also picked JAX · GPU · dense (detected via nvidia-smi) while JAX ran on the CPU. The PyAutoNerves PR fixes that.

All five PRs share the branch name feature/auto-setup-banner, so each repo's CI tests them together. Merge order: PyAutoNerves → PyAutoArray → PyAutoFit → PyAutoGalaxy → PyAutoLens.

Part of PyAutoLabs/PyAutoGalaxy#754 (format approved by the human on 2026-11-25).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

Part of the concise automatic compute-setup banner (PyAutoLabs/PyAutoGalaxy#754):
one header line stating the automatic CPU/GPU choice, aligned Setup /
Parallel / Estimate lines printed together, and notices when the setup acts
outside modeling. Shares branch feature/auto-setup-banner across PyAutoNerves,
PyAutoArray, PyAutoFit, PyAutoGalaxy and PyAutoLens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 25, 2026
@Jammy2211
Jammy2211 merged commit 3af6de8 into main Nov 25, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/auto-setup-banner branch November 25, 2026 11:00
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 25, 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.

1 participant