-
Notifications
You must be signed in to change notification settings - Fork 14
gh-984: Add config to run on Archer2 #1064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
connoraird
wants to merge
56
commits into
main
Choose a base branch
from
connor/run-on-archer2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 43e07fc
Update archer2 submissions script to not use nox
connoraird 0d6f1c3
Activate python venv in archer2 submission script
connoraird 99d0dc5
Remove batch array config and increase timeout
connoraird 889aa44
Add sub script for archer2 gpu
connoraird 3cd763f
Allow running benchmarks against jax
connoraird 301871c
Setup array backends when running benchmark tests
connoraird 9f3dcf3
Make test_cls2cov more forgiving
connoraird 3d98788
Update archer2 workflow to setup environments and submit jobs from a …
connoraird 2fa32e5
Fix typos and paths and use --active in uv sync command
connoraird f0a844c
Improve the interface to the regression test script
connoraird f01bf05
Rename script to run_regression_test.sh
connoraird 813df5b
Ensure GLASS_DIR is provided
connoraird 8bb77b9
Fix setting benchmark dir path in script and rename scripts
connoraird 3f8b74d
Move account setting to run_regression_test.sh
connoraird 53899a8
Fix typo
connoraird a133cb0
Remove uv from archer2 scripts
connoraird f2cb693
Swap back to uv
connoraird 939f1f2
Simplify archer2 execution instructions
connoraird 6e2b9bb
PWD -> HOME
connoraird 7080ca7
Update work profile file to be correct
connoraird f32ecab
Make setting up env optional and improve docs
connoraird c98da36
Remove outptu from run script
connoraird 3de8a83
Ensure active venv is used in submitted jobs
connoraird 03771a6
Put --active in the right place
connoraird 1ee3e6b
Fix typo
connoraird 1f7e204
Use correc partitiion for gpu
connoraird d4cd78a
Remove reference to gpu from archer2 benchmarking
connoraird 380f07d
Merge branch 'main' into connor/run-on-archer2
paddyroddy 35eaa0b
Undo changes to do with benchmakring with jax and gpu
connoraird 7d65649
Move shelcheck ignores inside files
connoraird 45ff7c3
Do not install glass through uv sync
connoraird 29e31bd
Deactivate between setting up envs to ensure glass versions are diffe…
connoraird afb1e60
Test if the correct glass versions are being used in CI
connoraird f99d46b
Temporarily only run the intentionally failing test
connoraird 6269ece
Fix bug in allowing pytest arsg to be passed to nox regression test
connoraird 44f10bc
Be explicit about python path in submission script
connoraird d274e44
Ensure we use the correct versions of glass from git rather than the …
connoraird 7366e6d
Remove temp failure line and ensure benchmark output is within the ar…
connoraird ec50a28
Merge branch 'main' into connor/run-on-archer2
connoraird 46a541d
Remove correct benchmarks path
connoraird a0a8ff8
Fix linting
connoraird bd3766e
Rmove temporary change to regression test workflow
connoraird 8159a3b
Restructure docs
connoraird b0e91e8
Merge branch 'main' into connor/run-on-archer2
connoraird 82fb087
Use the correct output name so it is ignored by git
connoraird a315790
Add correct env path
connoraird c2a4e90
Add output file to command rather than sentence and lint submission s…
connoraird 29700bf
linting
connoraird 9f36557
Remove the need for the user to pass the path to the GLASS dir
connoraird bbcaa1a
Correct path
connoraird f7a3f53
typo
connoraird dbced93
Revert "Remove the need for the user to pass the path to the GLASS dir"
connoraird 5bc9d07
Add example command
connoraird b3b63c8
Use pushd and popd to allow running script from any path
connoraird a26a9a0
Fix typos and remove excess
connoraird File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
|
|
||
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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[@]}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.