Skip to content

Commit

Permalink
Merge branch 'main' into dtype_fix
Browse files Browse the repository at this point in the history
* main:
  Move benchmark code from nox to bm_runner (SciTools#361)
  Bump scitools/workflows from 2024.01.0 to 2024.04.3 (SciTools#356)
  Bump peter-evans/create-pull-request from 5.0.2 to 6.0.5 (SciTools#355)
  [pre-commit.ci] pre-commit autoupdate (SciTools#336)
  Updated environment lockfiles (SciTools#344)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
stephenworsley committed May 28, 2024
2 parents e341ecf + a50b2b8 commit 504d7ad
Show file tree
Hide file tree
Showing 16 changed files with 482 additions and 336 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ exclude =
build
esmf_regrid/__init__.py
esmf_regrid/tests/results
benchmarks/*
4 changes: 1 addition & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ jobs:
- name: Benchmark script
run: |
if ${{ github.event_name != 'pull_request' }}; then export COMPARE="HEAD~"; else export COMPARE="origin/${{ github.base_ref }}"; fi;
nox --session=tests --install-only
export DATA_GEN_PYTHON=$(realpath $(find .nox -path "*tests/bin/python"))
nox --session="benchmarks(branch)" -- "${COMPARE}"
python benchmarks/bm_runner.py branch ${COMPARE}
- name: Archive ASV results
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ concurrency:
jobs:
manifest:
name: "check-manifest"
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.01.0
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.04.3
2 changes: 1 addition & 1 deletion .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: generate lockfiles
run: $CONDA/bin/nox --session update_lockfiles
- name: create pull request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e
with:
commit-message: Updated environment lockfiles
delete-branch: true
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.5.0'
rev: 'v4.6.0'
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
Expand All @@ -17,7 +17,7 @@ repos:
# Don't commit to master branch.
- id: no-commit-to-branch
- repo: https://github.com/psf/black
rev: '23.12.1'
rev: '24.4.2'
hooks:
- id: black
# Force black to run on whole repo, using settings from pyproject.toml
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- [PR#361](https://github.com/SciTools-incubator/iris-esmf-regrid/pull/361)
Moved the code for running benchmarks to `bm_runner.py` in line with iris
benchmarks.
[@stephenworsley](https://github.com/stephenworsley)

### Fixed
- [PR#239](https://github.com/SciTools-incubator/iris-esmf-regrid/pull/239)
Ensured dtype is preserved by regridding.
Expand Down
23 changes: 17 additions & 6 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,27 @@ raising a ❌ failure.
installed, as well as Nox (see
[Benchmark environments](#benchmark-environments)).

[iris-esmf-regrid's noxfile](../noxfile.py) includes a `benchmarks` session
that provides conveniences for setting up before benchmarking, and can also
replicate the CI run locally. See the session docstring for detail.
The benchmark runner ([bm_runner.py](./bm_runner.py)) provides conveniences for
common benchmark setup and run tasks, including replicating the automated
overnight run locally. See `python bm_runner.py --help` for detail.

A significant portion of benchmark run time is environment management. Run-time
can be reduced by placing the benchmark environment on the same file system as
your
[Conda package cache](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-pkg-directories),
if it is not already. You can achieve this by either:

- Temporarily reconfiguring `delegated_env_commands` and `delegated_env_parent`
in [asv.conf.json](asv.conf.json) to reference a location on the same file
system as the Conda package cache.
- Moving your Iris repo to the same file system as the Conda package cache.

### Environment variables

* `DATA_GEN_PYTHON` - required - path to a Python executable that can be
used to generate benchmark test objects/files; see
[Data generation](#data-generation). The Nox session sets this automatically,
but will defer to any value already set in the shell.
[Data generation](#data-generation). The benchmark runner sets this
automatically, but will defer to any value already set in the shell.
* `BENCHMARK_DATA` - optional - path to a directory for benchmark synthetic
test data, which the benchmark scripts will create if it doesn't already
exist. Defaults to `<root>/benchmarks/.data/` if not set. Note that some of
Expand All @@ -34,7 +45,7 @@ plan accordingly.
* `ON_DEMAND_BENCHMARKS` - optional - when set (to any value): benchmarks
decorated with `@on_demand_benchmark` are included in the ASV run. Usually
coupled with the ASV `--bench` argument to only run the benchmark(s) of
interest. Is set during the Nox `sperf` session.
interest. Is set during the benchmark runner `sperf` sub-commands.

### Reducing run time

Expand Down
5 changes: 5 additions & 0 deletions benchmarks/asv_delegated_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def copy_asv_files(src_parent: Path, dst_parent: Path) -> None:
# Record new environment information in properties.
self._update_info()

def _run_conda(self, args, env=None):
# TODO: remove after airspeed-velocity/asv#1397 is merged and released.
args = ["--yes" if arg == "--force" else arg for arg in args]
return super()._run_conda(args, env)

def checkout_project(self, repo: Repo, commit_hash: str) -> None:
"""Check out the working tree of the project at given commit hash."""
super().checkout_project(repo, commit_hash)
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Benchmark tests for iris-esmf-regrid."""


from os import environ


Expand Down
1 change: 1 addition & 0 deletions benchmarks/benchmarks/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
benchmark sequence runs over two different Python versions.
"""

from inspect import getsource
from os import environ
from pathlib import Path
Expand Down
Loading

0 comments on commit 504d7ad

Please sign in to comment.