Skip to content

Commit

Permalink
feat: add CodSpeed to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
adriencaccia authored and CodSpeed Install Bot committed Jun 22, 2024
1 parent eb30590 commit c83d0fa
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 242 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Benchmark

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
benchmark_cpu:
name: CPU Pytest benchmark
runs-on: ubuntu-latest

steps:
- uses: asottile/workflows/.github/actions/fast-checkout@v1.6.0

- name: Setup environment
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install pytorch
shell: bash
run: pip install torch==2.2.0 --index-url https://download.pytorch.org/whl/cpu

- name: Install Kornia dev
shell: bash
run: pip install .[dev,x]

- name: Check torch version
shell: bash
run: pip show torch | grep 2.2.0 || false

- name: Print dependencies and kornia version
shell: bash
run: |
python -c "import torch;print('Pytorch version: ', torch.__version__)"
python -c "import kornia;print('Kornia version: ', kornia.__version__)"
- name: Install benchmark requirements
run: pip install -r requirements/requirements-benchmarks.txt

- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
# run only 4 benchmarks because they take a long time to run for the time being
run: |
pytest -vvv --codspeed -n auto \
benchmarks/augmentation/2d_geometric_test.py::test_aug_2d_thin_plate_spline \
benchmarks/augmentation/2d_geometric_test.py::test_aug_2d_elastic_transform \
benchmarks/augmentation/2d_intensity_test.py::test_aug_2d_linear_corner_illumination \
benchmarks/augmentation/2d_intensity_test.py::test_aug_2d_solarize
75 changes: 0 additions & 75 deletions .github/workflows/pr_test_cpu.yml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/pypi-release.yml

This file was deleted.

67 changes: 0 additions & 67 deletions .github/workflows/scheduled_test_cpu.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/scheduled_test_pypi_package.yml

This file was deleted.

7 changes: 5 additions & 2 deletions benchmarks/augmentation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ def shape(B, C, H, W):


def pytest_generate_tests(metafunc):
B = [1, 5]
C = [1, 3]
# B = [1, 5]
# C = [1, 3]
# use only 1x1x128x128 for now, to only have a single test case
B = [1]
C = [1]
H = W = [128] # , 237, 512]
params = list(product(B, C, H, W))
metafunc.parametrize("B, C, H, W", params)
2 changes: 2 additions & 0 deletions requirements/requirements-benchmarks.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pytest-benchmark
pytest-codspeed
pytest-xdist

0 comments on commit c83d0fa

Please sign in to comment.