提交 e6554291 authored 作者: Luciano Paz's avatar Luciano Paz

Add workflow job on mac to check blas

上级 b4e95319
...@@ -61,16 +61,17 @@ jobs: ...@@ -61,16 +61,17 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- uses: pre-commit/action@v3.0.1 - uses: pre-commit/action@v3.0.1
test_ubuntu: test:
name: "Test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}" name: "${{ matrix.os }} test py${{ matrix.python-version }} : fast-compile ${{ matrix.fast-compile }} : float32 ${{ matrix.float32 }} : ${{ matrix.part }}"
needs: needs:
- changes - changes
- style - style
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }} if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: ["ubuntu-latest"]
python-version: ["3.10", "3.12"] python-version: ["3.10", "3.12"]
fast-compile: [0, 1] fast-compile: [0, 1]
float32: [0, 1] float32: [0, 1]
...@@ -103,30 +104,44 @@ jobs: ...@@ -103,30 +104,44 @@ jobs:
fast-compile: 1 fast-compile: 1
include: include:
- install-numba: 1 - install-numba: 1
os: "ubuntu-latest"
python-version: "3.10" python-version: "3.10"
fast-compile: 0 fast-compile: 0
float32: 0 float32: 0
part: "tests/link/numba" part: "tests/link/numba"
- install-numba: 1 - install-numba: 1
os: "ubuntu-latest"
python-version: "3.12" python-version: "3.12"
fast-compile: 0 fast-compile: 0
float32: 0 float32: 0
part: "tests/link/numba" part: "tests/link/numba"
- install-jax: 1 - install-jax: 1
os: "ubuntu-latest"
python-version: "3.10" python-version: "3.10"
fast-compile: 0 fast-compile: 0
float32: 0 float32: 0
part: "tests/link/jax" part: "tests/link/jax"
- install-jax: 1 - install-jax: 1
os: "ubuntu-latest"
python-version: "3.12" python-version: "3.12"
fast-compile: 0 fast-compile: 0
float32: 0 float32: 0
part: "tests/link/jax" part: "tests/link/jax"
- install-torch: 1 - install-torch: 1
os: "ubuntu-latest"
python-version: "3.10" python-version: "3.10"
fast-compile: 0 fast-compile: 0
float32: 0 float32: 0
part: "tests/link/pytorch" part: "tests/link/pytorch"
- os: macos-latest
python-version: "3.12"
fast-compile: 0
float32: 0
install-numba: 0
install-jax: 0
install-torch: 0
part: "tests/tensor/test_blas.py tests/tensor/test_elemwise.py tests/tensor/test_math_scipy.py"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
...@@ -146,7 +161,7 @@ jobs: ...@@ -146,7 +161,7 @@ jobs:
MATRIX_CONTEXT: ${{ toJson(matrix) }} MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: | run: |
echo $MATRIX_CONTEXT echo $MATRIX_CONTEXT
export MATRIX_ID=`echo $MATRIX_CONTEXT | md5sum | cut -c 1-32` export MATRIX_ID=`echo $MATRIX_CONTEXT | sha256sum | cut -c 1-32`
echo $MATRIX_ID echo $MATRIX_ID
echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT echo "id=$MATRIX_ID" >> $GITHUB_OUTPUT
...@@ -154,7 +169,11 @@ jobs: ...@@ -154,7 +169,11 @@ jobs:
shell: micromamba-shell {0} shell: micromamba-shell {0}
run: | run: |
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock if [[ $OS == "macos-latest" ]]; then
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" numpy scipy pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock libblas=*=*accelerate;
else
micromamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock;
fi
if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57"; fi
if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro && pip install tensorflow-probability; fi
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 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,12 +182,17 @@ jobs: ...@@ -163,12 +182,17 @@ jobs:
pip install -e ./ pip install -e ./
micromamba list && pip freeze micromamba list && pip freeze
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))' python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"' if [[ $OS == "macos-latest" ]]; then
python -c 'import pytensor; assert pytensor.config.blas__ldflags.startswith("-framework Accelerate"), "Blas flags are not set to MacOS Accelerate"';
else
python -c 'import pytensor; assert pytensor.config.blas__ldflags != "", "Blas flags are empty"';
fi
env: env:
PYTHON_VERSION: ${{ matrix.python-version }} PYTHON_VERSION: ${{ matrix.python-version }}
INSTALL_NUMBA: ${{ matrix.install-numba }} INSTALL_NUMBA: ${{ matrix.install-numba }}
INSTALL_JAX: ${{ matrix.install-jax }} INSTALL_JAX: ${{ matrix.install-jax }}
INSTALL_TORCH: ${{ matrix.install-torch}} INSTALL_TORCH: ${{ matrix.install-torch}}
OS: ${{ matrix.os}}
- name: Run tests - name: Run tests
shell: micromamba-shell {0} shell: micromamba-shell {0}
...@@ -249,10 +273,10 @@ jobs: ...@@ -249,10 +273,10 @@ jobs:
if: ${{ always() }} if: ${{ always() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: "All tests" name: "All tests"
needs: [changes, style, test_ubuntu] needs: [changes, style, test]
steps: steps:
- name: Check build matrix status - name: Check build matrix status
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test_ubuntu.result != 'success') }} if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }}
run: exit 1 run: exit 1
upload-coverage: upload-coverage:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论