From 617554ddcf2fc8900b4a2d5c111e9164cbb0239d Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Fri, 25 Sep 2026 16:37:33 +0100 Subject: [PATCH] maintenance: keep Python/JAX caches off $HOME on HPC (autolens_inference#13) On RAL every node's /home (and /tmp) sits on a small root disk; the RAL admin found nodes broken by ~/.cache filling it (2026-09-25). A hot-fix lives in the RAL venv's bin/activate but is lost on a venv rebuild; this makes it permanent in tracked activate.sh. The HPC branch now exports XDG_CACHE_HOME, PIP_CACHE_DIR, MPLCONFIGDIR, NUMBA_CACHE_DIR, CUDA_CACHE_PATH, TRITON_CACHE_DIR, JAX_COMPILATION_CACHE_DIR and ASTROPY_CACHE_DIR under ${PYAUTO_HPC_CACHE:-$(dirname "$PYAUTO_HPC_BASE")/.cache}, filling only unset variables (JAX via ${VAR-...} so an explicit empty value still disables the cache). Block is inside the PYAUTO_HPC_BASE branch only; laptop .venv users are unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) --- activate.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/activate.sh b/activate.sh index e3aeb34..c03d4f1 100644 --- a/activate.sh +++ b/activate.sh @@ -20,6 +20,25 @@ elif [ -n "${PYAUTO_HPC_BASE:-}" ] && [ -f "$PYAUTO_HPC_BASE/PyAuto/bin/activate export PYTHONPATH=$BASE:\ $BASE/PyAutoNerves:\ $BASE/PyAutoFit + # --- Keep caches OFF $HOME on HPC --------------------------------------- + # On many clusters (RAL: every node) /home sits on a small root disk, so tools that + # default to ~/.cache — the PyAutoNerves JAX compile cache (~/.cache/pyauto_jax), pip, + # matplotlib, numba, CUDA/Triton kernels — fill it and break the node (RAL admin, + # 2026-09-25). Send them to the shared project filesystem instead: by default a + # `.cache/` next to PYAUTO_HPC_BASE (override with PYAUTO_HPC_CACHE). Only unset + # variables are filled, so a submit script's own JAX_COMPILATION_CACHE_DIR still wins + # (and an explicitly EMPTY one still disables the JAX cache). Laptop `.venv` users + # never reach this branch. + export PYAUTO_HPC_CACHE="${PYAUTO_HPC_CACHE:-$(dirname "$PYAUTO_HPC_BASE")/.cache}" + mkdir -p "$PYAUTO_HPC_CACHE" 2>/dev/null || true + export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$PYAUTO_HPC_CACHE}" + export PIP_CACHE_DIR="${PIP_CACHE_DIR:-$PYAUTO_HPC_CACHE/pip}" + export MPLCONFIGDIR="${MPLCONFIGDIR:-$PYAUTO_HPC_CACHE/matplotlib}" + export NUMBA_CACHE_DIR="${NUMBA_CACHE_DIR:-$PYAUTO_HPC_CACHE/numba}" + export CUDA_CACHE_PATH="${CUDA_CACHE_PATH:-$PYAUTO_HPC_CACHE/nv}" + export TRITON_CACHE_DIR="${TRITON_CACHE_DIR:-$PYAUTO_HPC_CACHE/triton}" + export JAX_COMPILATION_CACHE_DIR="${JAX_COMPILATION_CACHE_DIR-$PYAUTO_HPC_CACHE/pyauto_jax}" + export ASTROPY_CACHE_DIR="${ASTROPY_CACHE_DIR:-$PYAUTO_HPC_CACHE/astropy}" else echo "No local .venv found (set PYAUTO_HPC_BASE for a shared/HPC PyAuto checkout)." >&2 fi