|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - main
|
7 |
| - - checks |
8 | 7 | pull_request:
|
9 | 8 | branches:
|
10 | 9 | - main
|
@@ -148,6 +147,60 @@ jobs:
|
148 | 147 | name: coverage
|
149 | 148 | path: coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml
|
150 | 149 |
|
| 150 | + benchmarks: |
| 151 | + name: "Benchmarks" |
| 152 | + needs: |
| 153 | + - changes |
| 154 | + - style |
| 155 | + runs-on: ubuntu-latest |
| 156 | + if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }} |
| 157 | + strategy: |
| 158 | + fail-fast: true |
| 159 | + steps: |
| 160 | + - uses: actions/checkout@v3 |
| 161 | + with: |
| 162 | + fetch-depth: 0 |
| 163 | + - name: Set up Python 3.9 |
| 164 | + uses: conda-incubator/setup-miniconda@v2 |
| 165 | + with: |
| 166 | + mamba-version: "*" |
| 167 | + channels: conda-forge,defaults |
| 168 | + channel-priority: true |
| 169 | + python-version: 3.9 |
| 170 | + auto-update-conda: true |
| 171 | + - name: Install dependencies |
| 172 | + shell: bash -l {0} |
| 173 | + run: | |
| 174 | + mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.55" numba-scipy jax jaxlib pytest-benchmark |
| 175 | + pip install -e ./ |
| 176 | + mamba list && pip freeze |
| 177 | + python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))' |
| 178 | + python -c 'import pytensor; assert(pytensor.config.blas__ldflags != "")' |
| 179 | + env: |
| 180 | + PYTHON_VERSION: 3.9 |
| 181 | + - name: Download previous benchmark data |
| 182 | + uses: actions/cache@v1 |
| 183 | + with: |
| 184 | + path: ./cache |
| 185 | + key: ${{ runner.os }}-benchmark |
| 186 | + - name: Run benchmarks |
| 187 | + shell: bash -l {0} |
| 188 | + run: | |
| 189 | + export PYTENSOR_FLAGS=mode=FAST_COMPILE,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe |
| 190 | + python -m pytest --runslow --benchmark-only --benchmark-json output.json |
| 191 | + - name: Store benchmark result |
| 192 | + uses: benchmark-action/github-action-benchmark@v1 |
| 193 | + with: |
| 194 | + name: Python Benchmark with pytest-benchmark |
| 195 | + tool: 'pytest' |
| 196 | + output-file-path: output.json |
| 197 | + external-data-json-path: ./cache/benchmark-data.json |
| 198 | + alert-threshold: '200%' |
| 199 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 200 | + comment-on-alert: ${{ github.event_name == 'push' }} |
| 201 | + fail-on-alert: true |
| 202 | + auto-push: false |
| 203 | + |
151 | 204 | all-checks:
|
152 | 205 | if: ${{ always() }}
|
153 | 206 | runs-on: ubuntu-latest
|
|
0 commit comments