From 8d22838f11ba1a73e505337eff71f8aaf8f5e1e5 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 28 May 2026 17:17:50 +0100 Subject: [PATCH] feat: add activate.sh + switch submit to PyAuto + PYTHONPATH model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PyAuto* libraries are source trees on the HPC at /mnt/ral/jnightin/PyAuto/ that HPCPullPyAuto keeps current. Editable / non-editable pip installs into a venv just duplicate that — and lock you to whatever was on main when you last reinstalled. The correct pattern, already used by z_projects/euclid and autolens_assistant, is: - venv (PyAuto) carries only third-party deps (jax, nautilus, blackjax, nss, fastprogress, jax_zero_contour, anesthetic, numpy, ...). - PYTHONPATH points at the canonical source trees; import autolens etc. resolves there, picking up whatever HPCPullPyAuto last pulled. Adds autolens_profiling/activate.sh in the same shape, and switches the A100 search submit script to ``source $AP_ROOT/activate.sh`` instead of sourcing PyAutoNSS's venv directly. PyAutoNSS is no longer a hard dependency for these submits — PyAuto's site-packages already carry nautilus, the handley-lab blackjax fork, nss, fastprogress, and jax_zero_contour (installed today as the last missing pieces), and PYTHONPATH gives us current autofit/autolens/autogalaxy/autoarray/autoconf. Future updates are a one-liner: ``HPCPullPyAuto``. No pip install of PyAuto* into the venv, ever. Co-Authored-By: Claude Opus 4.7 (1M context) --- activate.sh | 26 +++++++++++++++++++ .../submit_imaging_mge_a100_hst_fp64 | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 activate.sh diff --git a/activate.sh b/activate.sh new file mode 100755 index 0000000..d918013 --- /dev/null +++ b/activate.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Activate the shared PyAuto venv and point PYTHONPATH at the canonical +# PyAuto* source checkouts on the HPC. +# +# Mirrors the pattern used by z_projects/euclid/activate.sh and +# autolens_assistant/activate.sh: pip handles only third-party deps in +# the venv, while the five PyAuto* libraries are resolved via PYTHONPATH +# directly from /mnt/ral/jnightin/PyAuto/. ``HPCPullPyAuto`` then +# becomes the only mechanism needed to keep PyAuto* current — no pip +# install of PyAuto* into the venv ever. +# +# Usage (inside a SLURM submit or interactive shell): +# +# source /mnt/ral/jnightin/autolens_profiling/activate.sh +# python3 searches/nautilus/imaging/mge.py ... + +BASE=/mnt/ral/jnightin/PyAuto + +source "$BASE/PyAuto/bin/activate" + +export PYTHONPATH=$BASE:\ +$BASE/PyAutoConf:\ +$BASE/PyAutoFit:\ +$BASE/PyAutoArray:\ +$BASE/PyAutoGalaxy:\ +$BASE/PyAutoLens diff --git a/hpc/batch_gpu/submit_imaging_mge_a100_hst_fp64 b/hpc/batch_gpu/submit_imaging_mge_a100_hst_fp64 index 5f0f3ee..babf3f4 100755 --- a/hpc/batch_gpu/submit_imaging_mge_a100_hst_fp64 +++ b/hpc/batch_gpu/submit_imaging_mge_a100_hst_fp64 @@ -22,7 +22,7 @@ #SBATCH --mail-user=james.w.nightingale@durham.ac.uk export AP_ROOT=/mnt/ral/jnightin/autolens_profiling -source /mnt/ral/jnightin/PyAutoNSS/PyAutoNSS/bin/activate +source $AP_ROOT/activate.sh export JAX_PLATFORM_NAME=cuda export JAX_PLATFORMS=cuda,cpu