Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 47 additions & 0 deletions .github/workflows/benchmarks-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Benchmark cron

on:
schedule:
- cron: '23 */6 * * * '
pull_request:
types: [opened, reopened, synchronize]

jobs:

benchmark_linux:
name: HEAD vs HEAD^
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2

- name: Setup some dependencies
shell: bash -l {0}
run:
pip install asv

- name: Run benchmarks
shell: bash -l {0}
run: |
set -x

# ID this runner
asv machine --yes

echo "Baseline: HEAD^"
echo "Contender: HEAD"

# Run benchmarks for last commit against previous one
asv continuous --interleave-processes --split --show-stderr 'HEAD^' 'HEAD'

- uses: actions/upload-artifact@v2
if: always()
with:
name: asv-benchmark-results
path: .asv/results
51 changes: 51 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Benchmark PR

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:

benchmark_linux:
name: Linux
runs-on: ubuntu-20.04

steps:
# We need the full repo to avoid this issue
# https://github.com/actions/checkout/issues/23
- name: Checkout full repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2

- name: Setup some dependencies
shell: bash -l {0}
run:
pip install asv

- name: Run benchmarks
shell: bash -l {0}
run: |
set -x

# ID this runner
asv machine --yes

echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"

# Run benchmarks for current commit against base
# See https://github.com/airspeed-velocity/asv/issues/595 for discussion on interleaved processes
asv continuous --split --show-stderr --verbose --interleave-processes ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} | sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" | tee benchmarks.log
if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then
exit 1
fi

- uses: actions/upload-artifact@v2
if: always()
with:
name: asv-benchmark-results
path: .asv/results
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ jobs:
fi
source tools/github/script.sh


- name: Check benchmarks
run: |
asv check -E existing

test_skimage_macos:
name: macos-cp${{ matrix.python-version }}
Expand Down Expand Up @@ -190,4 +192,6 @@ jobs:
fi
source tools/github/script.sh


- name: Check benchmarks
run: |
asv check -E existing
5 changes: 3 additions & 2 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"pythons": ["3.7"],
"matrix": {
"cython": [],
"numpy": ["1.15", "1.16"],
"scipy": []
"numpy": ["1.17"],
"scipy": [],
"pooch": []
},

"env_dir": ".asv/env",
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/benchmark_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def time_ilk(self):

class PhaseCrossCorrelationRegistration:
"""Benchmarks for registration.phase_cross_correlation in scikit-image"""
param_names = ["ndims", "image_size", "upscale_factor"]
param_names = ["ndims", "image_size", "upsample_factor"]
params = [(2, 3), (32, 100), (1, 5, 10)]

def setup(self, ndims, image_size, upscale_factor, *args):
def setup(self, ndims, image_size, upsample_factor, *args):
if phase_cross_correlation is None:
raise NotImplementedError("phase_cross_correlation unavailable")
shifts = (-2.3, 1.7, 5.4, -3.2)[:ndims]
Expand All @@ -53,10 +53,10 @@ def setup(self, ndims, image_size, upscale_factor, *args):
self.reference_image = np.fft.fftn(phantom)
self.shifted_image = ndi.fourier_shift(self.reference_image, shifts)

def time_phase_cross_correlation(self, ndims, image_size, upscale_factor):
def time_phase_cross_correlation(self, ndims, image_size, upsample_factor):
result = phase_cross_correlation(self.reference_image,
self.shifted_image,
upscale_factor,
upsample_factor=upsample_factor,
space="fourier")

def peakmem_reference(self, *args):
Expand All @@ -74,8 +74,8 @@ def peakmem_reference(self, *args):
pass

def peakmem_phase_cross_correlation(self, ndims, image_size,
upscale_factor):
upsample_factor):
result = phase_cross_correlation(self.reference_image,
self.shifted_image,
upscale_factor,
upsample_factor=upsample_factor,
space="fourier")
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest-faulthandler
flake8
codecov
pooch>=1.3.0
asv