1
Fork 0

refactor(hpc): migrate to PBS/vsc-venv, reorganise scripts under scripts/hpc/

- Replace Slurm headers with PBS (#PBS) directives
- Replace manual module+venv logic with vsc-venv --activate
- Cluster selection via 'module swap cluster/<name>' before qsub
- MUJOCO_GL=egl retained: required for headless physics sim and video rendering
- Delete deprecated scripts/hpc_install.sh and scripts/hpc_train.slurm
This commit is contained in:
Tibo De Peuter 2026-04-04 18:11:38 +02:00
parent 14fd832283
commit 9dce017525
4 changed files with 71 additions and 91 deletions

33
scripts/hpc/install.sh Normal file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# scripts/hpc/install.sh — Run once on a login node (donphan) to set up the
# project's Python virtual environment using the official vsc-venv wrapper.
#
# Usage (from project root):
# bash scripts/hpc/install.sh
#
# Prerequisites:
# - Connected to VSC via the web portal (HPC Login → Shell tmux)
# - Project cloned to $VSC_DATA or $VSC_HOME
# - Run from the project root directory
set -euo pipefail
echo "==> Loading vsc-venv module..."
module load vsc-venv
echo "==> Activating virtual environment (created per-cluster in \$VSC_DATA)..."
# vsc-venv transparently creates and manages a per-cluster venv in $VSC_DATA,
# loading the modules listed in env/hpc/modules.txt and pip-installing anything
# in env/hpc/requirements.txt that is not already satisfied.
source vsc-venv --activate \
--modules env/hpc/modules.txt \
--requirements env/hpc/requirements.txt
echo "==> Registering Jupyter kernel..."
python -m ipykernel install --user --name="sel3_${VSC_INSTITUTE_CLUSTER}" \
--display-name "SEL3 (${VSC_INSTITUTE_CLUSTER})"
echo ""
echo "✅ Environment ready. Kernel: sel3_${VSC_INSTITUTE_CLUSTER}"
echo " Activate in future sessions with:"
echo " module load vsc-venv && source vsc-venv --activate --modules env/hpc/modules.txt"

38
scripts/hpc/train.pbs Normal file
View file

@ -0,0 +1,38 @@
#!/bin/bash
# scripts/hpc/train.pbs — Submit PPO training as a batch job with qsub.
#
# Usage (from project root):
# qsub scripts/hpc/train.pbs
#
# To target a specific GPU cluster (default: joltik):
# module swap cluster/accelgor && qsub scripts/hpc/train.pbs
#
# Available GPU clusters: joltik, accelgor, litleo
# Debug / interactive: doduo (CPU) or donphan (interactive GPU)
# ---------------------------------------------------------------------------
# PBS job directives
# ---------------------------------------------------------------------------
#PBS -N brittlestar-ppo
#PBS -l nodes=1:ppn=8:gpus=1
#PBS -l walltime=24:00:00
#PBS -l mem=32gb
#PBS -o runs/pbs_${PBS_JOBID}.out
#PBS -e runs/pbs_${PBS_JOBID}.err
# ---------------------------------------------------------------------------
set -euo pipefail
cd "$PBS_O_WORKDIR"
# Activate the project virtual environment via the official vsc-venv wrapper.
# This loads the modules listed in env/hpc/modules.txt and the per-cluster venv.
module load vsc-venv
source vsc-venv --activate --modules env/hpc/modules.txt
# EGL is required for headless MuJoCo operation — both for the physics
# simulation loop and for rendering videos to disk. Without this, MuJoCo
# attempts to open an X11 display and fails on compute nodes.
export MUJOCO_GL=egl
python src/train.py --config configs/production_training.yaml