Skip to content

Commit bacc9df

Browse files
committed
Add workflow job on mac to check blas
1 parent da9682f commit bacc9df

File tree

1 file changed

+82
-3
lines changed

1 file changed

+82
-3
lines changed

.github/workflows/test.yml

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,86 @@ jobs:
6161
python-version: ${{ matrix.python-version }}
6262
- uses: pre-commit/[email protected]
6363

64+
test_mac:
65+
name: "Mac test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
66+
needs:
67+
- changes
68+
- style
69+
runs-on: macos-latest
70+
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
os: ["macos-latest"]
75+
python-version: ["3.10", "3.12"]
76+
fast-compile: [0]
77+
float32: [0, 1]
78+
install-numba: [0]
79+
install-jax: [0]
80+
install-torch: [0]
81+
part:
82+
- "tests/tensor/test_blas.py tests/tensor/test_elemwise.py tests/tensor/test_math_scipy.py"
83+
exclude:
84+
- python-version: "3.10"
85+
float32: 1
86+
steps:
87+
- uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 0
90+
- name: Set up Python ${{ matrix.python-version }}
91+
uses: mamba-org/setup-micromamba@v1
92+
with:
93+
environment-name: pytensor-test
94+
micromamba-version: "1.5.10-0" # until https://github.com/mamba-org/setup-micromamba/issues/225 is resolved
95+
init-shell: bash
96+
post-cleanup: "all"
97+
create-args: python=${{ matrix.python-version }}
98+
99+
- name: Create matrix id
100+
id: matrix-id
101+
env:
102+
MATRIX_CONTEXT: ${{ toJson(matrix) }}
103+
run: |
104+
echo $MATRIX_CONTEXT
105+
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32`
106+
echo $MATRIX_ID
107+
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
108+
109+
- name: Install dependencies
110+
shell: micromamba-shell {0}
111+
run: |
112+
113+
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" numpy scipy pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock libblas=*=*accelerate
114+
pip install pytest-sphinx
115+
116+
pip install -e ./
117+
micromamba list && pip freeze
118+
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
119+
python -c 'import pytensor; assert pytensor.config.blas__ldflags.startswith("-framework Accelerate"), "Blas flags are empty"'
120+
env:
121+
PYTHON_VERSION: ${{ matrix.python-version }}
122+
123+
- name: Run tests
124+
shell: micromamba-shell {0}
125+
run: |
126+
if [[ $FAST_COMPILE == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi
127+
if [[ $FLOAT32 == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,floatX=float32; fi
128+
export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
129+
python -m pytest -r A --verbose --runslow --durations=50 --cov=pytensor/ --cov-report=xml:coverage/coverage-${MATRIX_ID}.xml --no-cov-on-fail $PART --benchmark-skip
130+
env:
131+
MATRIX_ID: ${{ steps.matrix-id.outputs.id }}
132+
PART: ${{ matrix.part }}
133+
FAST_COMPILE: ${{ matrix.fast-compile }}
134+
FLOAT32: ${{ matrix.float32 }}
135+
136+
- name: Upload coverage file
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: coverage-${{ steps.matrix-id.outputs.id }}
140+
path: coverage/coverage-${{ steps.matrix-id.outputs.id }}.xml
141+
64142
test_ubuntu:
65-
name: "Test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
143+
name: "Ubuntu test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
66144
needs:
67145
- changes
68146
- style
@@ -71,6 +149,7 @@ jobs:
71149
strategy:
72150
fail-fast: false
73151
matrix:
152+
os: ["ubuntu-latest"]
74153
python-version: ["3.10", "3.12"]
75154
fast-compile: [0, 1]
76155
float32: [0, 1]
@@ -249,10 +328,10 @@ jobs:
249328
if: ${{ always() }}
250329
runs-on: ubuntu-latest
251330
name: "All tests"
252-
needs: [changes, style, test_ubuntu]
331+
needs: [changes, style, test_mac, test_ubuntu]
253332
steps:
254333
- name: Check build matrix status
255-
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test_ubuntu.result != 'success') }}
334+
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test_mac.result != 'success' || needs.test_ubuntu.result != 'success') }}
256335
run: exit 1
257336

258337
upload-coverage:

0 commit comments

Comments
 (0)