Skip to content

Benchmarking

Benchmarking #8

Workflow file for this run

name: Benchmark Availability Checks
on:
# This workflow checks whether the benchmark code can be installed and
# started on the supported GitHub-hosted runners. It is a smoke check, not a
# performance benchmark suite.
pull_request:
branches:
- "main"
paths:
- ".github/workflows/asv-benchmarks.yml"
- "asv*.json"
- "benchmarks/**"
- "pyproject.toml"
push:
branches:
- "main"
paths:
- ".github/workflows/asv-benchmarks.yml"
- "asv*.json"
- "benchmarks/**"
- "pyproject.toml"
workflow_dispatch:
permissions:
contents: read
jobs:
benchmark_asv_existing_env:
# Use the same dependency combinations as main.yml, but run only one
# lightweight benchmark method in the already-created Python environment.
# That avoids ASV's conda environment management in CI while still proving
# that users can start the benchmark suite on each runner family.
name: ASV smoke on ${{ matrix.os }} py${{ matrix.ver.py }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- case-id: ubuntu-py311
os: ubuntu-latest
ver: { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
- case-id: ubuntu-py312
os: ubuntu-latest
ver: { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
- case-id: ubuntu-py313
os: ubuntu-latest
ver: { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
- case-id: ubuntu-py314
os: ubuntu-latest
ver: { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
asv_backends: "cython_fallback"
- case-id: windows-py311
os: windows-latest
ver: { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
- case-id: windows-py312
os: windows-latest
ver: { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
- case-id: windows-py313
os: windows-latest
ver: { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
- case-id: windows-py314
os: windows-latest
ver: { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
asv_backends: "cython_fallback"
- case-id: macos-latest-py311
os: macos-latest
ver: { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
- case-id: macos-latest-py312
os: macos-latest
ver: { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
- case-id: macos-latest-py313
os: macos-latest
ver: { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
- case-id: macos-latest-py314
os: macos-latest
ver: { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
asv_backends: "cython_fallback"
- case-id: macos15-intel-py311
os: macos-15-intel
ver: { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
- case-id: macos15-intel-py312
os: macos-15-intel
ver: { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
- case-id: macos15-intel-py313
os: macos-15-intel
ver: { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
- case-id: macos15-intel-py314
os: macos-15-intel
ver: { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
asv_backends: "cython_fallback"
defaults:
run:
# Use one shell syntax for Linux, Windows, and macOS smoke commands.
shell: bash
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.ver.py }}
- name: Install benchmark smoke dependencies
run: |
python -m pip install --upgrade pip
python -m pip install \
asv \
emcee \
"gstools-cython>=1,<2" \
"gstools_core>=1.0.0" \
hankel \
meshio \
"numpy${{ matrix.ver.np }}" \
pyevtk \
"scipy${{ matrix.ver.sp }}"
python -m pip install --no-deps --editable .
- name: Configure ASV machine
run: |
# existing environments still need a machine profile for ASV result
# metadata. --yes keeps the command non-interactive in CI.
asv machine --yes
- name: Run ASV smoke check in existing environment
env:
GSTOOLS_BENCHMARK_THREADS: "1"
GSTOOLS_BENCHMARK_BACKENDS: ${{ matrix.asv_backends || '' }}
run: |
# -E existing uses the Python environment prepared above. Python 3.14
# is currently Cython-only because gstools_core 1.2.0 can fail during
# the Rust variogram smoke case.
asv run \
-E existing \
--quick \
--bench benchmark_backends.VariogramWorkflowBenchmarks.time_variogram_estimate \
--show-stderr \
'HEAD^!'
benchmark_parallel_readiness:
# Keep this separate from the ASV smoke job. It checks the smallest useful
# runtime proof for parallel backends without running a full ASV benchmark
# and without building gstools-cython from the PyPI source distribution.
name: Parallel readiness on ${{ matrix.os }} py3.13
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
- macos-15-intel
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3
with:
activate-environment: gstools-benchmark-readiness
python-version: "3.13"
channels: conda-forge
conda-remove-defaults: true
- name: Install parallel readiness dependencies
run: |
conda install -n gstools-benchmark-readiness -y -c conda-forge \
emcee \
gstools-cython \
hankel \
meshio \
"numpy=2.1.0" \
pip \
pyevtk \
"scipy=1.14.1"
conda run -n gstools-benchmark-readiness python -m pip install \
"gstools_core>=1.0.0"
conda run -n gstools-benchmark-readiness python -m pip install \
--no-deps --editable .
- name: Check Cython OpenMP and Rust backend readiness
run: |
conda run -n gstools-benchmark-readiness python \
benchmarks/tools/check_backend_parallel_ready.py --verbose