Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ef3166a
Add docs and submission script for archer2
connoraird May 7, 2026
43e07fc
Update archer2 submissions script to not use nox
connoraird May 11, 2026
0d6f1c3
Activate python venv in archer2 submission script
connoraird May 11, 2026
99d0dc5
Remove batch array config and increase timeout
connoraird May 11, 2026
889aa44
Add sub script for archer2 gpu
connoraird May 11, 2026
3cd763f
Allow running benchmarks against jax
connoraird May 12, 2026
301871c
Setup array backends when running benchmark tests
connoraird May 12, 2026
9f3dcf3
Make test_cls2cov more forgiving
connoraird May 12, 2026
3d98788
Update archer2 workflow to setup environments and submit jobs from a …
connoraird May 18, 2026
2fa32e5
Fix typos and paths and use --active in uv sync command
connoraird May 18, 2026
f0a844c
Improve the interface to the regression test script
connoraird May 18, 2026
f01bf05
Rename script to run_regression_test.sh
connoraird May 18, 2026
813df5b
Ensure GLASS_DIR is provided
connoraird May 18, 2026
8bb77b9
Fix setting benchmark dir path in script and rename scripts
connoraird May 18, 2026
3f8b74d
Move account setting to run_regression_test.sh
connoraird May 18, 2026
53899a8
Fix typo
connoraird May 18, 2026
a133cb0
Remove uv from archer2 scripts
connoraird May 18, 2026
f2cb693
Swap back to uv
connoraird May 18, 2026
939f1f2
Simplify archer2 execution instructions
connoraird May 18, 2026
6e2b9bb
PWD -> HOME
connoraird May 18, 2026
7080ca7
Update work profile file to be correct
connoraird May 18, 2026
f32ecab
Make setting up env optional and improve docs
connoraird May 19, 2026
c98da36
Remove outptu from run script
connoraird May 19, 2026
3de8a83
Ensure active venv is used in submitted jobs
connoraird May 19, 2026
03771a6
Put --active in the right place
connoraird May 19, 2026
1ee3e6b
Fix typo
connoraird May 19, 2026
1f7e204
Use correc partitiion for gpu
connoraird May 19, 2026
d4cd78a
Remove reference to gpu from archer2 benchmarking
connoraird May 19, 2026
380f07d
Merge branch 'main' into connor/run-on-archer2
paddyroddy May 19, 2026
35eaa0b
Undo changes to do with benchmakring with jax and gpu
connoraird May 19, 2026
7d65649
Move shelcheck ignores inside files
connoraird May 19, 2026
45ff7c3
Do not install glass through uv sync
connoraird May 19, 2026
29e31bd
Deactivate between setting up envs to ensure glass versions are diffe…
connoraird May 20, 2026
afb1e60
Test if the correct glass versions are being used in CI
connoraird May 20, 2026
f99d46b
Temporarily only run the intentionally failing test
connoraird May 20, 2026
6269ece
Fix bug in allowing pytest arsg to be passed to nox regression test
connoraird May 20, 2026
44f10bc
Be explicit about python path in submission script
connoraird May 21, 2026
d274e44
Ensure we use the correct versions of glass from git rather than the …
connoraird May 21, 2026
7366e6d
Remove temp failure line and ensure benchmark output is within the ar…
connoraird May 21, 2026
ec50a28
Merge branch 'main' into connor/run-on-archer2
connoraird May 21, 2026
46a541d
Remove correct benchmarks path
connoraird May 21, 2026
a0a8ff8
Fix linting
connoraird May 21, 2026
bd3766e
Rmove temporary change to regression test workflow
connoraird May 21, 2026
8159a3b
Restructure docs
connoraird May 21, 2026
b0e91e8
Merge branch 'main' into connor/run-on-archer2
connoraird May 26, 2026
82fb087
Use the correct output name so it is ignored by git
connoraird May 27, 2026
a315790
Add correct env path
connoraird Jun 2, 2026
c2a4e90
Add output file to command rather than sentence and lint submission s…
connoraird Jun 2, 2026
29700bf
linting
connoraird Jun 2, 2026
9f36557
Remove the need for the user to pass the path to the GLASS dir
connoraird Jun 2, 2026
bbcaa1a
Correct path
connoraird Jun 2, 2026
f7a3f53
typo
connoraird Jun 2, 2026
dbced93
Revert "Remove the need for the user to pass the path to the GLASS dir"
connoraird Jun 2, 2026
5bc9d07
Add example command
connoraird Jun 2, 2026
b3b63c8
Use pushd and popd to allow running script from any path
connoraird Jun 2, 2026
a26a9a0
Fix typos and remove excess
connoraird Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def benchmarks(session: nox.Session) -> None:
_check_revision_count(session.posargs, expected_count=1)
revision = session.posargs[0]

_setup_array_backend(session)

# overwrite current package with specified revision
session.install(f"git+{GLASS_REPO_URL}@{revision}")
session.run(
Expand All @@ -273,8 +275,9 @@ def regression_tests(session: nox.Session) -> None:
Note it is not possible to pass extra options to pytest.

"""
_check_revision_count(session.posargs, expected_count=2)
before_revision, after_revision = session.posargs
minimum_posargs = 2
_check_revision_count(session.posargs, expected_count=minimum_posargs)
before_revision, after_revision = session.posargs[:minimum_posargs]

_setup_array_backend(session)

Expand Down
68 changes: 68 additions & 0 deletions tests/benchmarks/archer2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# GLASS benchmarks on Archer2

For a more consistent benchmarking and regression testing environment we have
been trialing using the UCL machine [Archer2](https://www.archer2.ac.uk/).

## Setting up

1. **Install uv:** Firstly, install uv via curl onto the `/work` partition

```sh
cd "${HOME/home/work}"
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Then we must make sure uv is available on the login node and the worker node.
To do this we can update our start up scripts (`.profile`) on both
partitions. Therefore, execute the following

```sh
cat <<'EOF' >> "$HOME/.profile"
WORK_DIR="${HOME/home/work}"
cd "$WORK_DIR"
source "$WORK_DIR/.profile"
EOF
```

and similarly

```sh
cat <<'EOF' >> "${HOME/home/work}/.profile"
export HOME="${HOME/home/work}"
source "$HOME/.local/bin/env"
EOF
```

Now when you next login to archer2, uv will be in your path and you will be
on the `/work` partition as your `HOME` dir.
Comment thread
connoraird marked this conversation as resolved.

2. **Clone GLASS:** Clone the glass repo into the `/work` partition of Archer2:

```sh
cd "${HOME/home/work}"
git clone https://github.com/glass-dev/glass.git
```

## Run the regression tests

Now we have cloned glass, we can run the script
[run_regression_test.sh](./run_regression_test.sh) which will setup the required
environments and submit regression test job to slurm. A help message is
provided. Just run `./tests/benchmarks/run_regression_test.sh -h` from the root
of the GLASS repo.

### Example execution

If I wished to to run a test to check for regressions from `main` to my feature
branch `feature` using the budget from account code `myaccount`, I could run the
following command from the root of the glass repo.

```sh
./tests/benchmarks/archer2/run_regression_test.sh \
-d "$(pwd)" \
-s main \
-e feature \
-a myaccount
```

> Note that this script does not have to be ran from the root of the glass repo.
126 changes: 126 additions & 0 deletions tests/benchmarks/archer2/run_regression_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/bin/bash -l
# shellcheck disable=SC1090

GLASS_DIR=""
GLASS_REPO_URL="https://github.com/glass-dev/glass"
START_REF=""
END_REF=""
START_VENV=".venv-start"
END_VENV=".venv-end"
ACCOUNT=""
SETUP_ENVS="true"

help() {
echo "Usage:"
echo " $0 "
echo ""
echo "ARGS:"
echo " -h | --help Display this help message."
echo " -d | --glass-dir <glass/dir> Path to the cloned glass directory."
echo " -s | --start-ref <start_ref> The git ref to be used as the initial state."
echo " -e | --end-ref <end_ref> The git ref to be used as the final state."
echo " -a | --account <archer2_account> The archer2 account code to run jobs against."
echo " --skip-setup Flag to state if the setup (installation of "
echo " dependencies) can be skipped. Good for simply"
echo " re-submitting"
}

# check for no input arguments and show help
if [ $# -eq 0 ];
then
help
exit 1
fi

# parse input arguments
while [ $# -gt 0 ] ; do
case $1 in
-h | --help)
help
exit 0
;;
-d | --glass-dir)
GLASS_DIR=$2
shift 2
continue
;;
-s | --start-ref)
START_REF=$2
shift 2
continue
;;
-e | --end-ref)
END_REF=$2
shift 2
continue
;;
-a | --account)
ACCOUNT=$2
shift 2
continue
;;
--skip-setup)
SETUP_ENVS="false"
shift 1
continue
;;
*)
echo "Invalid option: $1" >&2;
help
exit 1
;;
esac
shift 1
done

if [[ "$START_REF" == "" || "$END_REF" == "" ]]
then
echo "START_REF and END_REF must be provided"
help
exit 1
fi

if [[ "$GLASS_DIR" == "" ]]
then
echo "GLASS_DIR must be provided"
help
exit 1
fi

if [[ "$ACCOUNT" == "" ]]
then
echo "ACCOUNT must be provided"
help
exit 1
fi

BENCHMARKS_DIR="$GLASS_DIR/tests/benchmarks"


if [[ "$SETUP_ENVS" == "true" ]]
then
# Move to the glass directory
pushd "$GLASS_DIR" || exit

# Setup base environment
rm -rf "${GLASS_DIR:?}/$START_VENV" # Cleanup old venv
uv venv "$GLASS_DIR/$START_VENV"
source "$GLASS_DIR/$START_VENV/bin/activate"
uv sync --active --group test --no-install-project
uv pip install --no-deps "git+$GLASS_REPO_URL@$START_REF"
deactivate

# Setup head environment
rm -rf "${GLASS_DIR:?}/$END_VENV" # Cleanup old venv
uv venv "$GLASS_DIR/$END_VENV"
source "$GLASS_DIR/$END_VENV/bin/activate"
uv sync --active --group test --no-install-project
uv pip install --no-deps "git+$GLASS_REPO_URL@$END_REF"
deactivate

# Return to the starting directory
popd || exit
fi

# Submit job
sbatch --account="$ACCOUNT" "$BENCHMARKS_DIR/archer2/submission_script_cpu.sh" "$GLASS_DIR"
56 changes: 56 additions & 0 deletions tests/benchmarks/archer2/submission_script_cpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash --login
# shellcheck disable=SC1091

#SBATCH --job-name=glass_reg_test_cpu
#SBATCH --output=%x-%j.out
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=1
#SBATCH --time=0:30:0
#SBATCH --partition=standard
#SBATCH --qos=standard

# Ensure uv is available
source "${HOME/home/work}/.profile" # HOME starts as /home/... but uv needs to be on /work/...

# Recommended environment settings
# Stop unintentional multi-threading within software libraries
export OMP_NUM_THREADS=1
# Ensure the cpus-per-task option is propagated to srun commands
export SRUN_CPUS_PER_TASK=$SLURM_CPUS_PER_TASK

# Set path to class and select base or head
GLASS_DIR="$1"
BENCHMARKS_DIR="$GLASS_DIR/tests/benchmarks"
BENCHMARK_OUTPUT_PATH="$BENCHMARKS_DIR/archer2/.benchmarks"
BENCHMARKS_SHARED_FLAGS=(
"--benchmark-storage=file://$BENCHMARK_OUTPUT_PATH"
"--benchmark-calibration-precision=1000"
"--benchmark-columns=mean,stddev,rounds"
"--benchmark-max-time=5.0"
"--benchmark-sort=name"
"--benchmark-timer=time.process_time"
)
START_VENV_BIN="$GLASS_DIR/.venv-start/bin"
END_VENV_BIN="$GLASS_DIR/.venv-end/bin"

# Remove old benchmark results
rm -rf "$BENCHMARK_OUTPUT_PATH"

# Change into archer2 dir to ensure we don't pickup the glass directory as an import
cd "$BENCHMARKS_DIR/archer2" || exit

# Generate the base report for comparison later
source "$START_VENV_BIN/activate"
srun "$START_VENV_BIN/python" -m pytest "$BENCHMARKS_DIR" \
--benchmark-autosave "${BENCHMARKS_SHARED_FLAGS[@]}"
deactivate

# Run the stable and unstable benchmarks and compare to the base ref
source "$END_VENV_BIN/activate"
srun "$END_VENV_BIN/python" -m pytest "$BENCHMARKS_DIR" -m stable \
--benchmark-compare=0001 \
--benchmark-compare-fail=mean:5% "${BENCHMARKS_SHARED_FLAGS[@]}"
srun "$END_VENV_BIN/python" -m pytest "$BENCHMARKS_DIR" -m unstable \
--benchmark-compare=0001 \
--benchmark-compare-fail=mean:0.0005 "${BENCHMARKS_SHARED_FLAGS[@]}"
4 changes: 2 additions & 2 deletions tests/benchmarks/myriad/run_regression_test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash -l

# Request ten minutes of wallclock time (format hours:minutes:seconds).
# Request three hours of wallclock time (format hours:minutes:seconds).
#$ -l h_rt=3:0:0

# Request 1 gigabyte of RAM (must be an integer followed by M, G, or T)
# Request 4 gigabyte of RAM (must be an integer followed by M, G, or T)
#$ -l mem=4G

# Request exclusive access to a node
Expand Down
Loading