@@ -55,11 +55,11 @@ jobs:
55
55
matrix :
56
56
python-version : ["3.10", "3.12"]
57
57
steps :
58
- - uses : actions/checkout@v4
59
- - uses : actions/setup-python@v5
60
- with :
61
- python-version : ${{ matrix.python-version }}
62
- -
uses :
pre-commit/[email protected]
58
+ - uses : actions/checkout@v4
59
+ - uses : actions/setup-python@v5
60
+ with :
61
+ python-version : ${{ matrix.python-version }}
62
+ -
uses :
pre-commit/[email protected]
63
63
64
64
test_ubuntu :
65
65
name : " Test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
72
72
fail-fast : false
73
73
matrix :
74
74
python-version : ["3.10", "3.12"]
75
- fast-compile : [0,1]
76
- float32 : [0,1]
75
+ fast-compile : [0, 1]
76
+ float32 : [0, 1]
77
77
install-numba : [0]
78
78
install-jax : [0]
79
79
part :
84
84
- " tests/tensor/conv"
85
85
- " tests/tensor/rewriting"
86
86
- " tests/tensor/test_math.py"
87
- - " tests/tensor/test_basic.py tests/tensor/test_inplace.py"
87
+ - " tests/tensor/test_basic.py tests/tensor/test_inplace.py"
88
88
- " tests/tensor/test_blas.py tests/tensor/test_elemwise.py tests/tensor/test_math_scipy.py"
89
89
exclude :
90
90
- python-version : " 3.10"
@@ -121,11 +121,13 @@ jobs:
121
121
with :
122
122
fetch-depth : 0
123
123
- name : Set up Python ${{ matrix.python-version }}
124
- uses : conda-incubator /setup-miniconda@v3
124
+ uses : mamba-org /setup-micromamba@v1
125
125
with :
126
- miniforge-variant : Mambaforge
127
- miniforge-version : latest
128
- python-version : ${{ matrix.python-version }}
126
+ environment-name : pytensor-test
127
+ micromamba-version : " latest"
128
+ init-shell : bash
129
+ post-cleanup : " all"
130
+ create-args : python=${{ matrix.python-version }}
129
131
130
132
- name : Create matrix id
131
133
id : matrix-id
@@ -138,13 +140,13 @@ jobs:
138
140
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
139
141
140
142
- name : Install dependencies
141
- shell : bash -l {0}
143
+ shell : micromamba-shell {0}
142
144
run : |
143
- mamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock sympy
144
- if [[ $INSTALL_NUMBA == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi
145
- if [[ $INSTALL_JAX == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi
145
+ micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock sympy
146
+ if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi
147
+ if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi
146
148
pip install -e ./
147
- mamba list && pip freeze
149
+ micromamba list && pip freeze
148
150
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
149
151
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"'
150
152
env :
@@ -153,7 +155,7 @@ jobs:
153
155
INSTALL_JAX : ${{ matrix.install-jax }}
154
156
155
157
- name : Run tests
156
- shell : bash -l {0}
158
+ shell : micromamba-shell {0}
157
159
run : |
158
160
if [[ $FAST_COMPILE == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi
159
161
if [[ $FLOAT32 == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,floatX=float32; fi
@@ -175,55 +177,57 @@ jobs:
175
177
path : coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml
176
178
177
179
benchmarks :
178
- name : " Benchmarks"
179
- needs :
180
- - changes
181
- - style
182
- runs-on : ubuntu-latest
183
- if : ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
184
- strategy :
185
- fail-fast : false
186
- steps :
187
- - uses : actions/checkout@v4
188
- with :
189
- fetch-depth : 0
190
- - name : Set up Python 3.10
191
- uses : conda-incubator/setup-miniconda@v3
192
- with :
193
- miniforge-variant : Mambaforge
194
- miniforge-version : latest
195
- - name : Install dependencies
196
- shell : bash -l {0}
197
- run : |
198
- mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.57" jax jaxlib pytest-benchmark
199
- pip install -e ./
200
- mamba list && pip freeze
201
- python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
202
- python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"'
203
- env :
204
- PYTHON_VERSION : 3.10
205
- - name : Download previous benchmark data
206
- uses : actions/cache@v4
207
- with :
208
- path : ./cache
209
- key : ${{ runner.os }}-benchmark
210
- - name : Run benchmarks
211
- shell : bash -l {0}
212
- run : |
213
- export PYTENSOR_FLAGS=mode=FAST_COMPILE,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
214
- python -m pytest --runslow --benchmark-only --benchmark-json output.json
215
- - name : Store benchmark result
216
- uses : benchmark-action/github-action-benchmark@v1
217
- with :
218
- name : Python Benchmark with pytest-benchmark
219
- tool : ' pytest'
220
- output-file-path : output.json
221
- external-data-json-path : ./cache/benchmark-data.json
222
- alert-threshold : ' 200%'
223
- github-token : ${{ secrets.GITHUB_TOKEN }}
224
- comment-on-alert : false
225
- fail-on-alert : false
226
- auto-push : false
180
+ name : " Benchmarks"
181
+ needs :
182
+ - changes
183
+ - style
184
+ runs-on : ubuntu-latest
185
+ if : ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
186
+ strategy :
187
+ fail-fast : false
188
+ steps :
189
+ - uses : actions/checkout@v4
190
+ with :
191
+ fetch-depth : 0
192
+ - name : Set up Python 3.10
193
+ uses : mamba-org/setup-micromamba@v1
194
+ with :
195
+ environment-name : pytensor-test
196
+ micromamba-version : " latest"
197
+ init-shell : bash
198
+ post-cleanup : " all"
199
+ - name : Install dependencies
200
+ shell : micromamba-shell {0}
201
+ run : |
202
+ micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.57" jax jaxlib pytest-benchmark
203
+ pip install -e ./
204
+ micromamba list && pip freeze
205
+ python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
206
+ python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"'
207
+ env :
208
+ PYTHON_VERSION : 3.10
209
+ - name : Download previous benchmark data
210
+ uses : actions/cache@v4
211
+ with :
212
+ path : ./cache
213
+ key : ${{ runner.os }}-benchmark
214
+ - name : Run benchmarks
215
+ shell : micromamba-shell {0}
216
+ run : |
217
+ export PYTENSOR_FLAGS=mode=FAST_COMPILE,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
218
+ python -m pytest --runslow --benchmark-only --benchmark-json output.json
219
+ - name : Store benchmark result
220
+ uses : benchmark-action/github-action-benchmark@v1
221
+ with :
222
+ name : Python Benchmark with pytest-benchmark
223
+ tool : " pytest"
224
+ output-file-path : output.json
225
+ external-data-json-path : ./cache/benchmark-data.json
226
+ alert-threshold : " 200%"
227
+ github-token : ${{ secrets.GITHUB_TOKEN }}
228
+ comment-on-alert : false
229
+ fail-on-alert : false
230
+ auto-push : false
227
231
228
232
all-checks :
229
233
if : ${{ always() }}
0 commit comments