Skip to content

Commit 4d7fe8a

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

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/test.yml

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

64-
test_ubuntu:
65-
name: "Test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
64+
test:
65+
name: "${{ matrix.os }} test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
6666
needs:
6767
- changes
6868
- style
69-
runs-on: ubuntu-latest
69+
runs-on: ${{ matrix.os }}
7070
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
7171
strategy:
7272
fail-fast: false
7373
matrix:
74+
os: ["ubuntu-latest"]
7475
python-version: ["3.10", "3.12"]
7576
fast-compile: [0, 1]
7677
float32: [0, 1]
@@ -127,6 +128,15 @@ jobs:
127128
fast-compile: 0
128129
float32: 0
129130
part: "tests/link/pytorch"
131+
- os: macos-latest
132+
python-version: "3.12"
133+
fast-compile: 0
134+
float32: 0
135+
install-numba: 0
136+
install-jax: 0
137+
install-torch: 0
138+
part: "tests/tensor/test_blas.py tests/tensor/test_elemwise.py tests/tensor/test_math_scipy.py"
139+
130140
steps:
131141
- uses: actions/checkout@v4
132142
with:
@@ -146,15 +156,19 @@ jobs:
146156
MATRIX_CONTEXT: ${{ toJson(matrix) }}
147157
run: |
148158
echo $MATRIX_CONTEXT
149-
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32`
159+
export MATRIX_ID=`echo $MATRIX_CONTEXT | sha256sum | cut -c 1-32`
150160
echo $MATRIX_ID
151161
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
152162
153163
- name: Install dependencies
154164
shell: micromamba-shell {0}
155165
run: |
156166
157-
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock
167+
if [[ $OS == "macos-latest" ]]; then
168+
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" numpy scipy pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock libblas=*=*accelerate;
169+
else
170+
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock;
171+
fi
158172
if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi
159173
if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi
160174
if [[ $INSTALL_TORCH == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" pytorch pytorch-cuda=12.1 "mkl<=2024.0" -c pytorch -c nvidia; fi
@@ -163,7 +177,10 @@ jobs:
163177
pip install -e ./
164178
micromamba list && pip freeze
165179
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
166-
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"'
180+
if [[ $OS == "macos-latest" ]]; then
181+
python -c 'import pytensor; assert pytensor.config.blas__ldflags.startswith("-framework Accelerate"), "Blas flags are not set to MacOS Accelerate"';
182+
else
183+
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"';
167184
env:
168185
PYTHON_VERSION: ${{ matrix.python-version }}
169186
INSTALL_NUMBA: ${{ matrix.install-numba }}
@@ -249,10 +266,10 @@ jobs:
249266
if: ${{ always() }}
250267
runs-on: ubuntu-latest
251268
name: "All tests"
252-
needs: [changes, style, test_ubuntu]
269+
needs: [changes, style, test]
253270
steps:
254271
- name: Check build matrix status
255-
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test_ubuntu.result != 'success') }}
272+
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }}
256273
run: exit 1
257274

258275
upload-coverage:

0 commit comments

Comments
 (0)