WIP: do not merge #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Array API | |
on: | |
push: | |
branches: | |
- maintenance/** | |
pull_request: | |
branches: | |
- main | |
- maintenance/** | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
CCACHE_DIR: "${{ github.workspace }}/.ccache" | |
INSTALLDIR: "build-install" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
get_commit_message: | |
name: Get commit message | |
uses: ./.github/workflows/commit_message.yml | |
pytorch_cpu: | |
name: Linux PyTorch CPU | |
needs: get_commit_message | |
if: > | |
needs.get_commit_message.outputs.message == 1 | |
&& (github.repository == 'scipy/scipy' || github.repository == '') | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
maintenance-branch: | |
- ${{ contains(github.ref, 'maintenance/') || contains(github.base_ref, 'maintenance/') }} | |
exclude: | |
- maintenance-branch: true | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' # not using a path to also cache pytorch | |
- name: Install Ubuntu dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libopenblas-dev libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache libmpc-dev | |
- name: Install Python packages | |
run: | | |
python -m pip install numpy cython pytest pytest-xdist pytest-timeout pybind11 mpmath gmpy2 pythran ninja meson click rich-click doit pydevtool pooch hypothesis | |
- name: Install PyTorch CPU | |
run: | | |
python -m pip install "torch<2.1" --index-url https://download.pytorch.org/whl/cpu | |
- name: Prepare compiler cache | |
id: prep-ccache | |
shell: bash | |
run: | | |
mkdir -p "${CCACHE_DIR}" | |
echo "dir=$CCACHE_DIR" >> $GITHUB_OUTPUT | |
NOW=$(date -u +"%F-%T") | |
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT | |
- name: Setup compiler cache | |
uses: actions/cache@v3 | |
id: cache-ccache | |
with: | |
path: ${{ steps.prep-ccache.outputs.dir }} | |
key: ${{ github.workflow }}-${{ matrix.python-version }}-ccache-linux-${{ steps.prep-ccache.outputs.timestamp }} | |
restore-keys: | | |
${{ github.workflow }}-${{ matrix.python-version }}-ccache-linux- | |
- name: Setup build and install scipy | |
run: | | |
python dev.py build | |
- name: Test SciPy | |
run: | | |
export OMP_NUM_THREADS=2 | |
export SCIPY_USE_PROPACK=1 | |
# expand as new modules are added | |
# --array-api-backend == -b | |
python dev.py --no-build test -b pytorch -b numpy -b numpy.array_api -s cluster -- --durations 3 --timeout=60 | |
python dev.py --no-build test -b pytorch -b numpy -b numpy.array_api -s fft -- --durations 3 --timeout=60 | |
python dev.py --no-build test --array-api-backend all --tests scipy/_lib/tests/test_array_api.py |