Skip to content

Commit

Permalink
stricter update rules
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Mar 19, 2024
1 parent c6465d6 commit c31ca4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
push:
branches: [ main, create-pull-request/patch, benchmark ]

pull_request:
branches:
- main

jobs:
benchmark:
runs-on: ubuntu-latest
Expand All @@ -34,7 +30,7 @@ jobs:
poetry-version: 1.2.2

# Run benchmakrs
- name: Run benchmakrs on python 3.8
- name: Run benchmarks on python 3.8
run: |
poetry run pytest --full-trace --show-capture=no -sv benchmarks/benchmark_*.py
Expand Down
25 changes: 15 additions & 10 deletions benchmarks/benchmark_sed.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ def test_binning_1d() -> None:
print(result)
assert min(result) < targets["binning_1d"]
# update targets if substantial improvement occurs
if np.mean(result) < 0.9 * targets["binning_1d"]:
targets["binning_1d"] = float(np.mean(result) * 1.1)
if np.mean(result) < 0.8 * targets["binning_1d"]:
print(f"Updating targets for 'binning_1d' to {float(np.mean(result) * 1.2)}")
targets["binning_1d"] = float(np.mean(result) * 1.2)
save_config(targets, package_dir + "/../benchmarks/benchmark_targets.yaml")


Expand All @@ -73,8 +74,9 @@ def test_binning_4d() -> None:
print(result)
assert min(result) < targets["binning_4d"]
# update targets if substantial improvement occurs
if np.mean(result) < 0.9 * targets["binning_4d"]:
targets["binning_4d"] = float(np.mean(result) * 1.1)
if np.mean(result) < 0.8 * targets["binning_4d"]:
print(f"Updating targets for 'binning_4d' to {float(np.mean(result) * 1.2)}")
targets["binning_4d"] = float(np.mean(result) * 1.2)
save_config(targets, package_dir + "/../benchmarks/benchmark_targets.yaml")


Expand All @@ -97,8 +99,9 @@ def test_splinewarp() -> None:
print(result)
assert min(result) < targets["inv_dfield"]
# update targets if substantial improvement occurs
if np.mean(result) < 0.9 * targets["inv_dfield"]:
targets["inv_dfield"] = float(np.mean(result) * 1.1)
if np.mean(result) < 0.8 * targets["inv_dfield"]:
print(f"Updating targets for 'inv_dfield' to {float(np.mean(result) * 1.2)}")
targets["inv_dfield"] = float(np.mean(result) * 1.2)
save_config(targets, package_dir + "/../benchmarks/benchmark_targets.yaml")


Expand Down Expand Up @@ -130,8 +133,9 @@ def test_workflow_1d() -> None:
print(result)
assert min(result) < targets["workflow_1d"]
# update targets if substantial improvement occurs
if np.mean(result) < 0.9 * targets["workflow_1d"]:
targets["workflow_1d"] = float(np.mean(result) * 1.1)
if np.mean(result) < 0.8 * targets["workflow_1d"]:
print(f"Updating targets for 'workflow_1d' to {float(np.mean(result) * 1.2)}")
targets["workflow_1d"] = float(np.mean(result) * 1.2)
save_config(targets, package_dir + "/../benchmarks/benchmark_targets.yaml")


Expand Down Expand Up @@ -163,6 +167,7 @@ def test_workflow_4d() -> None:
print(result)
assert min(result) < targets["workflow_4d"]
# update targets if substantial improvement occurs
if np.mean(result) < 0.9 * targets["workflow_4d"]:
targets["workflow_4d"] = float(np.mean(result) * 1.1)
if np.mean(result) < 0.8 * targets["workflow_4d"]:
print(f"Updating targets for 'workflow_4d' to {float(np.mean(result) * 1.2)}")
targets["workflow_4d"] = float(np.mean(result) * 1.2)
save_config(targets, package_dir + "/../benchmarks/benchmark_targets.yaml")

0 comments on commit c31ca4f

Please sign in to comment.