|
| 1 | +name: Benchmark |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + benchmark_cpu: |
| 12 | + name: CPU Pytest benchmark |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: asottile/workflows/.github/actions/fast-checkout@v1.6.0 |
| 17 | + |
| 18 | + - name: Setup environment |
| 19 | + uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: 3.11 |
| 22 | + |
| 23 | + - name: Install pytorch |
| 24 | + shell: bash |
| 25 | + run: pip install torch==2.2.0 --index-url https://download.pytorch.org/whl/cpu |
| 26 | + |
| 27 | + - name: Install Kornia dev |
| 28 | + shell: bash |
| 29 | + run: pip install .[dev,x] |
| 30 | + |
| 31 | + - name: Check torch version |
| 32 | + shell: bash |
| 33 | + run: pip show torch | grep 2.2.0 || false |
| 34 | + |
| 35 | + - name: Print dependencies and kornia version |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + python -c "import torch;print('Pytorch version: ', torch.__version__)" |
| 39 | + python -c "import kornia;print('Kornia version: ', kornia.__version__)" |
| 40 | +
|
| 41 | + - name: Install benchmark requirements |
| 42 | + run: pip install -r requirements/requirements-benchmarks.txt |
| 43 | + |
| 44 | + - name: Run benchmarks |
| 45 | + uses: CodSpeedHQ/action@v2 |
| 46 | + with: |
| 47 | + token: ${{ secrets.CODSPEED_TOKEN }} |
| 48 | + # run only 4 benchmarks because they take a long time to run for the time being |
| 49 | + run: | |
| 50 | + pytest -vvv --codspeed -n auto \ |
| 51 | + benchmarks/augmentation/2d_geometric_test.py::test_aug_2d_thin_plate_spline \ |
| 52 | + benchmarks/augmentation/2d_geometric_test.py::test_aug_2d_elastic_transform \ |
| 53 | + benchmarks/augmentation/2d_intensity_test.py::test_aug_2d_linear_corner_illumination \ |
| 54 | + benchmarks/augmentation/2d_intensity_test.py::test_aug_2d_solarize |
0 commit comments