Skip to content

feat: environment probe, PYAUTO_SETUP at import, honour JAX_ENABLE_X64=False - #223

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5a-nerves
Nov 23, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5a-nerves

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 5A of the likelihood-lifecycle epic (part of #222). This adds the environment layer that setup="auto" will sit on. It does three things: a hardware probe, an explicit PYAUTO_SETUP override honoured at import, and a fix so that JAX_ENABLE_X64=False is respected. It only detects and honours; it chooses no setup. Choosing is 5B's Setup.auto in PyAutoArray.

API Changes

  • New autonerves.environment: Environment.detect() reports GPU (present, name, memory), usable cores, RAM, numba and nufftax availability, and a site hint. It never imports JAX itself.
  • New autonerves.environment.parse_setup_intent(value) turns PYAUTO_SETUP (auto, cpu, gpu or a setup_id) into auto, cpu or gpu. 5B will reuse it.
  • PYAUTO_SETUP=cpu, or a CPU setup_id such as numba_cpu_sparse_fp64, now sets JAX_PLATFORMS=cpu and the OMP/MKL/OPENBLAS/NUMBA thread counts at import. It fills in only the ones you haven't set. auto, unset and gpu change nothing. An invalid value raises a ValueError that names the allowed forms.
  • Behaviour change: JAX_ENABLE_X64=False or 0 is now respected. Before, it was overwritten with True. Unset still turns x64 on.
    See full details below.

Test Plan

  • python -m pytest test_autonerves -q: 375 passed (80 of these tests are in test_environment.py / test_jax_wrapper.py)
  • Subprocess import tests for PYAUTO_SETUP (cpu, setup_id, user values kept, auto/unset/gpu, invalid) and for jax_enable_x64 under False, 0, false, unset, True and 1
  • CI green

Heart dev readiness (PyAutoNerves): GREEN. Reasons shown but not blocking: manifest drift (1 workspace checkout mismatch against repos.yaml); release validation incomplete (no rehearsal for current source).

Note: the subprocess tests run python -S with the parent sys.path, because the local venv's 00_pyauto313.pth startup hook forces JAX_PLATFORMS=cpu and the thread variables to 1. Without -S, that hook would also override PYAUTO_SETUP's thread defaults on that machine.

Full API Changes (for automation & release notes)

Added

  • autonerves.environment.Environment (frozen dataclass: gpu, gpu_name, gpu_memory_gb, cores, ram_gb, numba, nufftax, site) and Environment.detect()
  • autonerves.environment.parse_setup_intent(value) -> "auto" | "cpu" | "gpu": accepts auto, cpu, gpu or (jax|numba|numpy)_(cpu|gpu)_<operator>_(fp64|fp32|mp)[_<transformer>]
  • autonerves.environment.detect_cores(), detect_ram_gb(), detect_gpu(), detect_site()
  • PYAUTO_SETUP read at import by autonerves.jax_wrapper

Changed

  • JAX_ENABLE_X64=False|0 is no longer overwritten with True

Migration

  • None needed. Anyone who set JAX_ENABLE_X64=False expecting fp64 now gets fp32; unset the variable to keep fp64.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…4=False (#222)

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 23, 2026
@Jammy2211
Jammy2211 merged commit db589c2 into main Nov 23, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/likelihood-lifecycle-p5a-nerves branch November 23, 2026 10:41
@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