From 6bb799b6a759a8cdcc5a7c9765de4a4a02f644ff Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 13 Aug 2023 22:21:49 +0200 Subject: [PATCH 1/4] MAINT: Split up .github/workflows to match main This is a backport of #24493 and #24291. The purpose of this is to ease future backports that expect these files. - CI: move some jobs in `build_test.yml` to Meson - CI: split `build_test.yml` into three GHA jobs files Also documents better what is being run. See gh-24410 for the overall restructuring plan for GitHub Actions CI. - CI: merge `linux_meson.yml` into `linux_blas.yml` - TST: disable mypy tests in test suite unless an environment variable is set These tests are super slow, and they're effectively always passing in CI. Running them on all "full" test suite runs is too expensive. Note that SciPy has an XSLOW mark, NumPy does not. So use an env var for now. - CI: add new GHA CI jobs to run MyPy across OS/Python flavors --- .github/actions/action.yml | 1 - .github/workflows/linux.yml | 208 ++++++++++ .github/workflows/linux_blas.yml | 109 ++++++ .github/workflows/linux_meson.yml | 355 ------------------ .../{build_test.yml => linux_simd.yml} | 287 ++++++++++---- .github/workflows/mypy.yml | 67 ++++ numpy/typing/tests/test_typing.py | 14 + 7 files changed, 622 insertions(+), 419 deletions(-) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/linux_blas.yml delete mode 100644 .github/workflows/linux_meson.yml rename .github/workflows/{build_test.yml => linux_simd.yml} (64%) create mode 100644 .github/workflows/mypy.yml diff --git a/.github/actions/action.yml b/.github/actions/action.yml index 20a239026e4f..2c271c0c5726 100644 --- a/.github/actions/action.yml +++ b/.github/actions/action.yml @@ -11,7 +11,6 @@ runs: echo DOWNLOAD_OPENBLAS $DOWNLOAD_OPENBLAS echo USE_DEBUG $USE_DEBUG echo NPY_USE_BLAS_ILP64 $NPY_USE_BLAS_ILP64 - echo NUMPY_EXPERIMENTAL_ARRAY_FUNCTION $NUMPY_EXPERIMENTAL_ARRAY_FUNCTION echo USE_ASV $USE_ASV echo PATH $PATH echo python `which python` diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000000..d73de33c7640 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,208 @@ +name: Linux tests + +# This file is meant for testing across supported Python versions, build types +# and interpreters (PyPy, python-dbg, a pre-release Python in summer time), +# build-via-sdist, run benchmarks, measure code coverage, and other build +# options like relaxed-strides. + +on: + push: + branches: + # coverage comparison in the "full" step needs to run on main after merges + - main + pull_request: + branches: + - main + - maintenance/** + +defaults: + run: + shell: bash + +env: + DOWNLOAD_OPENBLAS: 1 + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + lint: + if: github.repository == 'numpy/numpy' && github.event_name != 'push' + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - name: Install linter requirements + run: + python -m pip install -r linter_requirements.txt + - name: Run linter on PR diff + run: + python tools/linter.py --branch origin/${{ github.base_ref }} + + smoke_test: + if: "github.repository == 'numpy/numpy'" + runs-on: ubuntu-latest + env: + MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - uses: ./.github/meson_actions + + basic: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + strategy: + matrix: + python-version: ["3.9", "pypy3.9-v7.3.12"] + env: + EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: ${{ matrix.python-version }} + - uses: ./.github/actions + + debug: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + env: + USE_DEBUG: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + + - uses: ./.github/actions + + full: + # Build a wheel, install it, then run the full test suite with code coverage + needs: [smoke_test] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - name: Install build and test dependencies from PyPI + run: | + pip install -r build_requirements.txt + pip install -r test_requirements.txt + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel + run: | + python -m build --wheel --no-isolation --skip-dependency-check + pip install dist/numpy*.whl + - name: Run full test suite + run: | + cd tools + pytest --pyargs numpy --cov-report=html:build/coverage + # TODO: gcov + + benchmark: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + env: + PYTHONOPTIMIZE: 2 + BLAS: None + LAPACK: None + ATLAS: None + NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas + NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK + USE_ASV: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - uses: ./.github/actions + + relaxed_strides_debug: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + env: + CHECK_BLAS: 1 + NPY_USE_BLAS_ILP64: 1 + NPY_RELAXED_STRIDES_DEBUG: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + - uses: ./.github/actions + + sdist: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel via an sdist + run: | + pip install build + python -m build + pip install dist/numpy*.whl + - name: Install test dependencies + run: | + pip install -r test_requirements.txt + pip install ninja + - name: Run test suite + run: | + cd tools + pytest --pyargs numpy -m "not slow" + diff --git a/.github/workflows/linux_blas.yml b/.github/workflows/linux_blas.yml new file mode 100644 index 000000000000..699381f6584f --- /dev/null +++ b/.github/workflows/linux_blas.yml @@ -0,0 +1,109 @@ +name: BLAS tests (Linux) + +# This file is meant for testing different BLAS/LAPACK flavors and build +# options on Linux. All other yml files for Linux will only test without BLAS +# (mostly because that's easier and faster to build) or with the same 64-bit +# OpenBLAS build that is used in the wheel jobs. +# +# Jobs and their purpose: +# +# - openblas64_setuppy: +# This job uses the default 64-bit build of OpenBLAS with the +# `numpy.distutils`-based build. It can be removed once we remove +# support for those builds. +# - openblas32_stable_nightly: +# Uses the 32-bit OpenBLAS builds, both the latest stable release and a +# nightly build. +# +# TODO: coverage here is limited, we should add non-OpenBLAS libraries and +# exercise the BLAS-related build options (see `meson_options.txt`). + +on: + pull_request: + branches: + - main + - maintenance/** + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + openblas64_setuppy: + runs-on: ubuntu-latest + if: "github.repository == 'numpy/numpy'" + env: + DOWNLOAD_OPENBLAS: 1 + NPY_USE_BLAS_ILP64: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + - uses: ./.github/actions + + openblas32_stable_nightly: + if: "github.repository == 'numpy/numpy'" + runs-on: ubuntu-latest + strategy: + matrix: + USE_NIGHTLY_OPENBLAS: [false, true] + env: + USE_NIGHTLY_OPENBLAS: ${{ matrix.USE_NIGHTLY_OPENBLAS }} + name: "Test Linux (${{ matrix.USE_NIGHTLY_OPENBLAS && 'nightly' || 'stable' }} OpenBLAS)" + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install -r build_requirements.txt + # Install OpenBLAS + set -xe + if [[ $USE_NIGHTLY_OPENBLAS == "true" ]]; then + target=$(python tools/openblas_support.py --nightly) + else + target=$(python tools/openblas_support.py) + fi + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + + - name: Build + shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' + env: + TERM: xterm-256color + run: + spin build -- --werror + + - name: Check build-internal dependencies + run: + ninja -C build -t missingdeps + + - name: Check installed test and stub files + run: + python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy') + + - name: Test + shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' + env: + TERM: xterm-256color + LD_LIBRARY_PATH: "/usr/local/lib/" # to find libopenblas.so.0 + + run: | + pip install pytest pytest-xdist hypothesis typing_extensions + spin test -j auto diff --git a/.github/workflows/linux_meson.yml b/.github/workflows/linux_meson.yml deleted file mode 100644 index ebbd52997e42..000000000000 --- a/.github/workflows/linux_meson.yml +++ /dev/null @@ -1,355 +0,0 @@ -name: BLAS tests (Linux) - -# This file is meant for testing different BLAS/LAPACK flavors and build -# options on Linux. All other yml files for Linux will only test without BLAS -# (mostly because that's easier and faster to build) or with the same 64-bit -# OpenBLAS build that is used in the wheel jobs. -# -# Jobs and their purpose: -# -# - openblas32_stable_nightly: -# Uses the 32-bit OpenBLAS builds, both the latest stable release -# and a nightly build. -# - openblas_no_pkgconfig_fedora: -# Test OpenBLAS on Fedora. Fedora doesn't ship .pc files for OpenBLAS, -# hence this exercises the "system dependency" detection method. -# - flexiblas_fedora: -# Tests FlexiBLAS (the default on Fedora for its own packages), via -# pkg-config. FlexiBLAS allows runtime switching of BLAS/LAPACK -# libraries, which is a useful capability (not tested in this job). -# - openblas_cmake: -# Tests whether OpenBLAS LP64 is detected correctly when only CMake -# and not pkg-config is installed. -# - netlib: -# Installs vanilla blas/lapack, which is the last option tried in -# auto-detection. -# - mkl: -# Tests MKL installed from PyPI (because easiest/fastest, if broken) in -# 3 ways: both LP64 and ILP64 via pkg-config, and then using the -# Single Dynamic Library (SDL, or `libmkl_rt`). -# - blis: -# Simple test for LP64 via pkg-config -# - atlas: -# Simple test for LP64 via pkg-config - -on: - pull_request: - branches: - - main - - maintenance/** - -defaults: - run: - shell: bash - -env: - PYTHON_VERSION: 3.11 - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - meson_spin: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - strategy: - matrix: - USE_NIGHTLY_OPENBLAS: [false, true] - env: - USE_NIGHTLY_OPENBLAS: ${{ matrix.USE_NIGHTLY_OPENBLAS }} - name: "Test Linux (${{ matrix.USE_NIGHTLY_OPENBLAS && 'nightly' || 'stable' }} OpenBLAS)" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Install dependencies - run: | - pip install -r build_requirements.txt - # Install OpenBLAS - set -xe - if [[ $USE_NIGHTLY_OPENBLAS == "true" ]]; then - target=$(python tools/openblas_support.py --nightly) - else - target=$(python tools/openblas_support.py) - fi - sudo cp -r $target/lib/* /usr/lib - sudo cp $target/include/* /usr/include - - name: Build - shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' - env: - TERM: xterm-256color - run: - spin build -- --werror - - name: Check build-internal dependencies - run: - ninja -C build -t missingdeps - - name: Check installed test and stub files - run: - python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy') - - name: Test - shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' - env: - TERM: xterm-256color - LD_LIBRARY_PATH: "/usr/local/lib/" # to find libopenblas.so.0 - run: | - export NPY_RUN_MYPY_IN_TESTSUITE=1 - pip install pytest pytest-xdist hypothesis typing_extensions - spin test -j auto - - - openblas_no_pkgconfig_fedora: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - container: fedora:39 - name: "OpenBLAS (Fedora, no pkg-config, LP64/ILP64)" - steps: - - name: Install system dependencies - run: | - dnf install git gcc-gfortran g++ python3-devel openblas-devel -y - - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest hypothesis typing_extensions - - - name: Build (LP64) - run: spin build -- -Dblas=openblas -Dlapack=openblas -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - - name: Build (ILP64) - run: | - rm -rf build - spin build -- -Duse-ilp64=true -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - - flexiblas_fedora: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - container: fedora:39 - name: "FlexiBLAS (LP64, ILP64 on Fedora)" - steps: - - name: Install system dependencies - run: | - dnf install git gcc-gfortran g++ python3-devel flexiblas-devel -y - - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest hypothesis typing_extensions - - - name: Build - run: spin build -- -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - - name: Build (ILP64) - run: | - rm -rf build - spin build -- -Ddisable-optimization=true -Duse-ilp64=true - - - name: Test (ILP64) - run: spin test -- numpy/linalg - - - openblas_cmake: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - name: "OpenBLAS with CMake" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest pytest-xdist hypothesis typing_extensions - sudo apt-get install libopenblas-dev cmake - sudo apt-get remove pkg-config - - - name: Build - run: spin build -- -Ddisable-optimization=true - - - name: Test - run: spin test -j auto -- numpy/linalg - - - netlib: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - name: "Netlib BLAS/LAPACK" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - sudo apt-get install liblapack-dev pkg-config - - - name: Build - run: | - spin build -- -Ddisable-optimization=true - - - name: Test - run: | - pip install pytest pytest-xdist hypothesis typing_extensions - spin test -j auto -- numpy/linalg - - - mkl: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - name: "MKL (LP64, ILP64, SDL)" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest pytest-xdist hypothesis typing_extensions - pip install mkl mkl-devel - - - name: Repair MKL pkg-config files and symlinks - run: | - # MKL 2023.2 works when installed from conda-forge (except for `-iomp` - # and `-tbb` pkg-config files), Spack, or with the standalone Intel - # installer. The standalone installer is the worst option, since it's - # large and clumsy to install and requires running a setvars.sh script - # before things work. The PyPI MKL packages are broken and need the - # fixes in this step. For details, see - # https://github.com/conda-forge/intel_repack-feedstock/issues/34 - cd $Python3_ROOT_DIR/lib/pkgconfig - sed -i 's/\/intel64//g' mkl*.pc - # add the expected .so -> .so.2 symlinks to fix linking - cd .. - for i in $( ls libmkl*.so.2 ); do ln -s $i ${i%.*}; done - - - name: Build with defaults (LP64) - run: | - pkg-config --libs mkl-dynamic-lp64-seq # check link flags - spin build -- -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - - name: Build with ILP64 - run: | - git clean -xdf > /dev/null - pkg-config --libs mkl-dynamic-ilp64-seq - spin build -- -Duse-ilp64=true -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - - name: Build without pkg-config (default options, SDL) - run: | - git clean -xdf > /dev/null - pushd $Python3_ROOT_DIR/lib/pkgconfig - rm mkl*.pc - popd - export MKLROOT=$Python3_ROOT_DIR - spin build -- -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - blis: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - name: "BLIS" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest pytest-xdist hypothesis typing_extensions - sudo apt-get install libblis-dev libopenblas-dev pkg-config - - - name: Add BLIS pkg-config file - run: | - # Needed because blis.pc missing in Debian: - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=989076 - # The alternative here would be to use another distro or Miniforge - sudo cp tools/ci/_blis_debian.pc /usr/lib/x86_64-linux-gnu/pkgconfig/blis.pc - # Check if the patch works: - pkg-config --libs blis - pkg-config --cflags blis - - - name: Build - run: spin build -- -Dblas=blis -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - - atlas: - if: "github.repository == 'numpy/numpy'" - runs-on: ubuntu-latest - name: "ATLAS" - steps: - - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - pip install -r build_requirements.txt - pip install pytest pytest-xdist hypothesis typing_extensions - sudo apt-get install libatlas-base-dev pkg-config - - - name: Build - run: spin build -- -Dblas=blas-atlas -Dlapack=lapack-atlas -Ddisable-optimization=true - - - name: Test - run: spin test -- numpy/linalg - diff --git a/.github/workflows/build_test.yml b/.github/workflows/linux_simd.yml similarity index 64% rename from .github/workflows/build_test.yml rename to .github/workflows/linux_simd.yml index e570c5540415..2c238d66b10d 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/linux_simd.yml @@ -1,10 +1,38 @@ -name: Build_Test +name: SIMD tests (Linux) + +# This file is meant for testing different SIMD-related build options and +# optimization levels. See `meson_options.txt` for the available build options. +# +# Jobs and their purpose: +# +# - smoke_test: +# Meant to complete as quickly as possible, and acts as a filter for +# the other, more expensive jobs (those only start once `smoke_test` +# passes). +# - old_gcc: +# Tests the oldest supported GCC version with the default build +# settings. +# - without_optimizations: +# Completely disables both all SIMD optimizations and other compiler +# optimizations like loop unrolling. +# - with_baseline_only: +# Only uses the baseline SIMD settings, but no runtime dispatch based +# on compiler features detected at runtime. +# - without_avx512_avx2_fma3: +# Uses runtime SIMD dispatching, with AVX2, FMA3 and AVX512 disabled. +# - without_avx512: +# Uses runtime SIMD dispatching, with AVX512 disabled. +# - armv7_simd_test: +# Cross-compiles from x86-64 to armv7, and then runs only the +# SIMD-specific tests under QEMU. +# - sde_simd_avx512_test: +# Runs only the SIMD tests for several AVX512-xxx instruction sets +# under the Intel Software Development Emulator (SDE). +# - intel_spr_sde_test: +# Similar to the SDE test above, but for AVX512-SPR which requires some +# special-casing. on: - push: - branches: - # coverage comparison in the "full" step needs to run on main after merges - - main pull_request: branches: - main @@ -16,7 +44,6 @@ defaults: env: DOWNLOAD_OPENBLAS: 1 - PYTHON_VERSION: 3.9 concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -26,10 +53,11 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - lint: - if: github.repository == 'numpy/numpy' && github.event_name != 'push' + smoke_test: + if: "github.repository == 'numpy/numpy'" runs-on: ubuntu-latest - continue-on-error: true + env: + MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: @@ -37,19 +65,19 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Install linter requirements - run: - python -m pip install -r linter_requirements.txt - - name: Run linter on PR diff - run: - python tools/linter.py --branch origin/${{ github.base_ref }} + python-version: '3.9' + - uses: ./.github/meson_actions - smoke_test: - if: "github.repository == 'numpy/numpy'" +<<<<<<< HEAD:.github/workflows/build_test.yml + basic: + needs: [smoke_test] runs-on: ubuntu-latest + if: github.event_name != 'push' + strategy: + matrix: + python-version: ["3.9", "pypy3.9-v7.3.12"] env: - MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" + EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: @@ -57,20 +85,21 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} - - uses: ./.github/meson_actions + python-version: ${{ matrix.python-version }} + - uses: ./.github/actions +||||||| parent of 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/build_test.yml basic: needs: [smoke_test] runs-on: ubuntu-latest if: github.event_name != 'push' strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "pypy3.9-v7.3.12"] + python-version: ["3.9", "pypy3.9-v7.3.12"] env: EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: submodules: recursive fetch-depth: 0 @@ -79,9 +108,11 @@ jobs: python-version: ${{ matrix.python-version }} - uses: ./.github/actions +======= +>>>>>>> 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/linux_simd.yml old_gcc: needs: [smoke_test] - # provides GCC 7, 8 + # provides GCC 8 runs-on: ubuntu-20.04 if: github.event_name != 'push' steps: @@ -89,7 +120,6 @@ jobs: with: submodules: recursive fetch-depth: 0 - # comes with python3.6 - name: Install Python3.9 run: | sudo apt update @@ -100,21 +130,14 @@ jobs: sudo ln -s /usr/bin/python3.9 /usr/bin/pythonx pythonx -m pip install --upgrade pip setuptools wheel pythonx -m pip install -r test_requirements.txt - - name: Install Compilers - run: sudo apt install g++-7 g++-8 -y - - name: Build gcc-7 - run: | - export CC=/usr/bin/gcc-7 - export CXX=/usr/bin/g++-7 - rm -rf build && pythonx setup.py install --user - - name: Runtests gcc-7 - run: pythonx runtests.py -n + - name: Install GCC 8 + run: sudo apt install g++-8 -y - name: Build gcc-8 run: | export CC=/usr/bin/gcc-8 export CXX=/usr/bin/g++-8 rm -rf build && pythonx setup.py install --user - - name: Runtests gcc-8 + - name: Run test suite run: pythonx runtests.py -n without_optimizations: @@ -146,7 +169,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.10' - uses: ./.github/meson_actions without_avx512: @@ -162,7 +185,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.10' - uses: ./.github/meson_actions without_avx512_avx2_fma3: @@ -178,9 +201,10 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.10' - uses: ./.github/meson_actions +<<<<<<< HEAD:.github/workflows/build_test.yml debug: needs: [smoke_test] runs-on: ubuntu-latest @@ -194,7 +218,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.11' - uses: ./.github/actions @@ -211,17 +235,13 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.11' - uses: ./.github/actions full: + # Build a wheel, install it, then run the full test suite with code coverage needs: [smoke_test] runs-on: ubuntu-22.04 - env: - USE_WHEEL: 1 - RUN_FULL_TESTS: 1 - RUN_COVERAGE: 1 - INSTALL_PICKLE5: 1 steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: @@ -229,8 +249,27 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} - - uses: ./.github/actions + python-version: '3.9' + - name: Install build and test dependencies from PyPI + run: | + pip install -r build_requirements.txt + pip install -r test_requirements.txt + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel + run: | + python -m build --wheel --no-isolation --skip-dependency-checks + - name: Run full test suite + run: | + cd doc + pytest --pyargs numpy --cov-report=html:build/coverage + # TODO: gcov + benchmark: needs: [smoke_test] @@ -251,7 +290,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.9' - uses: ./.github/actions relaxed_strides_debug: @@ -269,15 +308,13 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.11' - uses: ./.github/actions - use_wheel: + sdist: needs: [smoke_test] runs-on: ubuntu-latest if: github.event_name != 'push' - env: - USE_WHEEL: 1 steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: @@ -285,44 +322,168 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.12' + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel via an sdist + run: | + python -m build + pip install dist/numpy*.whl + - name: Install test dependencies + run: | + pip install -r test_requirements.txt + - name: Run test suite + run: | + cd doc + pytest --pyargs numpy -m "not slow" + + +||||||| parent of 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/build_test.yml + debug: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + env: + USE_DEBUG: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' + + - uses: ./.github/actions + + blas64: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + env: + NPY_USE_BLAS_ILP64: 1 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.11' - uses: ./.github/actions - no_openblas: + full: + # Build a wheel, install it, then run the full test suite with code coverage + needs: [smoke_test] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - name: Install build and test dependencies from PyPI + run: | + pip install -r build_requirements.txt + pip install -r test_requirements.txt + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel + run: | + python -m build --wheel --no-isolation --skip-dependency-checks + - name: Run full test suite + run: | + cd doc + pytest --pyargs numpy --cov-report=html:build/coverage + # TODO: gcov + + + benchmark: needs: [smoke_test] runs-on: ubuntu-latest if: github.event_name != 'push' env: + PYTHONOPTIMIZE: 2 BLAS: None LAPACK: None ATLAS: None - DOWNLOAD_OPENBLAS: '' + NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas + NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK + USE_ASV: 1 steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: submodules: recursive fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.9' - uses: ./.github/actions - sdist: + relaxed_strides_debug: needs: [smoke_test] runs-on: ubuntu-latest if: github.event_name != 'push' env: - USE_SDIST: 1 + CHECK_BLAS: 1 + NPY_USE_BLAS_ILP64: 1 + NPY_RELAXED_STRIDES_DEBUG: 1 steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: submodules: recursive fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.11' - uses: ./.github/actions + sdist: + needs: [smoke_test] + runs-on: ubuntu-latest + if: github.event_name != 'push' + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.12' + - name: Install gfortran and OpenBLAS (MacPython build) + run: | + set -xe + sudo apt install gfortran libgfortran5 + target=$(python tools/openblas_support.py) + sudo cp -r $target/lib/* /usr/lib + sudo cp $target/include/* /usr/include + - name: Build a wheel via an sdist + run: | + python -m build + pip install dist/numpy*.whl + - name: Install test dependencies + run: | + pip install -r test_requirements.txt + - name: Run test suite + run: | + cd doc + pytest --pyargs numpy -m "not slow" + + +======= +>>>>>>> 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/linux_simd.yml armv7_simd_test: needs: [smoke_test] # make sure this matches the base docker image below @@ -391,7 +552,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.9' - name: Install Intel SDE run: | curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz @@ -420,7 +581,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.11' - name: Install Intel SDE run: | curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/784319/sde-external-9.24.0-2023-07-13-lin.tar.xz diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000000..c89b8e11ec95 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,67 @@ +name: Run MyPy + +# Mypy is too slow to run as part of regular CI. The purpose of the jobs in +# this file is to cover running Mypy across: +# +# - OSes: Linux, Windows and macOS +# - Python versions: lowest/highest supported versions, and an intermediate one +# +# The build matrix aims for sparse coverage across those two dimensions. +# Use of BLAS/LAPACK and SIMD is disabled on purpose, because those things +# don't matter for static typing and this speeds up the builds. +# +# This is a separate job file so it's easy to trigger by hand. + +on: + pull_request: + branches: + - main + - maintenance/** + paths-ignore: + - 'benchmarks/' + - '.circlecl/' + - 'docs/' + - 'meson_cpu/' + - 'tools/' + workflow_dispatch: + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + mypy: + if: "github.repository == 'numpy/numpy'" + name: "MyPy" + runs-on: ${{ matrix.os_python[0] }} + strategy: + matrix: + os_python: + - [ubuntu-latest, '3.10'] # switch to 3.12-dev after mypy is upgraded (see gh-23764) + - [windows-2019, '3.11'] + - [macos-12, '3.9'] + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + submodules: recursive + fetch-depth: 0 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: ${{ matrix.os_python[1] }} + - name: Install dependencies + run: | + pip install -r build_requirements.txt + pip install -r test_requirements.txt + - name: Build + run: | + spin build -j2 -- -Dallow-noblas=true -Ddisable-optimization=true --vsenv + - name: Run Mypy + run: | + spin mypy diff --git a/numpy/typing/tests/test_typing.py b/numpy/typing/tests/test_typing.py index cd009bb6e7f2..68c6f5d03fab 100644 --- a/numpy/typing/tests/test_typing.py +++ b/numpy/typing/tests/test_typing.py @@ -26,6 +26,20 @@ ) +# Only trigger a full `mypy` run if this environment variable is set +# Note that these tests tend to take over a minute even on a macOS M1 CPU, +# and more than that in CI. +RUN_MYPY = "NPY_RUN_MYPY_IN_TESTSUITE" in os.environ +if RUN_MYPY and RUN_MYPY not in ('0', '', 'false'): + RUN_MYPY = True + +# Skips all functions in this file +pytestmark = pytest.mark.skipif( + not RUN_MYPY, + reason="`NPY_RUN_MYPY_IN_TESTSUITE` not set" +) + + try: from mypy import api except ImportError: From 81f1758791a384a7ae03b890bc860ba3d2f075aa Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 5 Nov 2023 13:45:19 -0700 Subject: [PATCH 2/4] MAINT: Fix spelling error that slipped in somewhere typing_nptensions -> typing_extensions --- numpy/typing/tests/data/reveal/warnings_and_errors.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/typing/tests/data/reveal/warnings_and_errors.pyi b/numpy/typing/tests/data/reveal/warnings_and_errors.pyi index 16492c2fb41b..b026e4f6e3b0 100644 --- a/numpy/typing/tests/data/reveal/warnings_and_errors.pyi +++ b/numpy/typing/tests/data/reveal/warnings_and_errors.pyi @@ -5,7 +5,7 @@ import numpy as np if sys.version_info >= (3, 11): from typing import assert_type else: - from typing_nptensions import assert_type + from typing_extensions import assert_type assert_type(np.ModuleDeprecationWarning(), np.ModuleDeprecationWarning) assert_type(np.VisibleDeprecationWarning(), np.VisibleDeprecationWarning) From c40e98cc15d95b1f5fe48af691cfc005773d8a4c Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 5 Nov 2023 14:54:19 -0700 Subject: [PATCH 3/4] CI: Switch SIMD tests to meson Backport of #24625. --- .github/meson_actions/action.yml | 36 +- .github/workflows/linux_simd.yml | 662 +++++++------------------------ 2 files changed, 155 insertions(+), 543 deletions(-) diff --git a/.github/meson_actions/action.yml b/.github/meson_actions/action.yml index aff70da169bc..fb3042c0ade2 100644 --- a/.github/meson_actions/action.yml +++ b/.github/meson_actions/action.yml @@ -3,27 +3,35 @@ description: "checkout repo, build, and test numpy" runs: using: composite steps: - - name: Install dependencies - shell: bash - run: pip install -r build_requirements.txt - name: Build shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' env: TERM: xterm-256color - run: - spin build -- ${MESON_ARGS[@]} - - name: Check build-internal dependencies - shell: bash - run: - ninja -C build -t missingdeps - - name: Check installed test and stub files + PKG_CONFIG_PATH: ./.openblas + run: | + echo "::group::Installing Build Dependencies" + pip install -r build_requirements.txt + echo "::endgroup::" + echo "::group::Building NumPy" + spin build --clean -- ${MESON_ARGS[@]} + echo "::endgroup::" + + - name: Meson Log shell: bash - run: - python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy') + if: always() + run: | + echo "::group::Meson Log" + cat build/meson-logs/meson-log.txt + echo "::endgroup::" + - name: Test shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' env: TERM: xterm-256color run: | - pip install pytest pytest-xdist hypothesis typing_extensions - spin test -j auto + echo "::group::Installing Test Dependencies" + pip install pytest pytest-xdist hypothesis typing_extensions setuptools + echo "::endgroup::" + echo "::group::Test NumPy" + spin test + echo "::endgroup::" diff --git a/.github/workflows/linux_simd.yml b/.github/workflows/linux_simd.yml index 2c238d66b10d..f8b694124d41 100644 --- a/.github/workflows/linux_simd.yml +++ b/.github/workflows/linux_simd.yml @@ -1,37 +1,35 @@ -name: SIMD tests (Linux) +name: Linux SIMD tests # This file is meant for testing different SIMD-related build options and # optimization levels. See `meson_options.txt` for the available build options. # -# Jobs and their purpose: +# Jobs and their purposes: +# +# - baseline_only: +# Focuses on completing as quickly as possible and acts as a filter for other, more resource-intensive jobs. +# Utilizes only the default baseline targets (e.g., SSE3 on X86_64) without enabling any runtime dispatched features. +# +# - old_gcc: +# Tests the oldest supported GCC version with default CPU/baseline/dispatch settings. +# +# - without_optimizations: +# Completely disables all SIMD optimizations and other compiler optimizations such as loop unrolling. +# +# - native: +# Tests against the host CPU features set as the baseline without enabling any runtime dispatched features. +# Intended to assess the entire NumPy codebase against host flags, even for code sections lacking handwritten SIMD intrincis. +# +# - without_avx512/avx2/fma3: +# Uses runtime SIMD dispatching but disables AVX2, FMA3, and AVX512. +# Intended to evaluate 128-bit SIMD extensions without FMA support. +# +# - without_avx512: +# Uses runtime SIMD dispatching but disables AVX512. +# Intended to evaluate 128-bit/256-bit SIMD extensions. +# +# - intel_sde: +# Executes only the SIMD tests for various AVX512 SIMD extensions under the Intel Software Development Emulator (SDE). # -# - smoke_test: -# Meant to complete as quickly as possible, and acts as a filter for -# the other, more expensive jobs (those only start once `smoke_test` -# passes). -# - old_gcc: -# Tests the oldest supported GCC version with the default build -# settings. -# - without_optimizations: -# Completely disables both all SIMD optimizations and other compiler -# optimizations like loop unrolling. -# - with_baseline_only: -# Only uses the baseline SIMD settings, but no runtime dispatch based -# on compiler features detected at runtime. -# - without_avx512_avx2_fma3: -# Uses runtime SIMD dispatching, with AVX2, FMA3 and AVX512 disabled. -# - without_avx512: -# Uses runtime SIMD dispatching, with AVX512 disabled. -# - armv7_simd_test: -# Cross-compiles from x86-64 to armv7, and then runs only the -# SIMD-specific tests under QEMU. -# - sde_simd_avx512_test: -# Runs only the SIMD tests for several AVX512-xxx instruction sets -# under the Intel Software Development Emulator (SDE). -# - intel_spr_sde_test: -# Similar to the SDE test above, but for AVX512-SPR which requires some -# special-casing. - on: pull_request: branches: @@ -40,10 +38,10 @@ on: defaults: run: - shell: bash + shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' env: - DOWNLOAD_OPENBLAS: 1 + TERM: xterm-256color concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -53,556 +51,162 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - smoke_test: + baseline_only: if: "github.repository == 'numpy/numpy'" runs-on: ubuntu-latest env: - MESON_ARGS: "-Dallow-noblas=true -Dcpu-baseline=none -Dcpu-dispatch=none" + MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=none" steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: python-version: '3.9' - uses: ./.github/meson_actions + name: Build/Test -<<<<<<< HEAD:.github/workflows/build_test.yml - basic: - needs: [smoke_test] - runs-on: ubuntu-latest + old_gcc: if: github.event_name != 'push' - strategy: - matrix: - python-version: ["3.9", "pypy3.9-v7.3.12"] - env: - EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: ${{ matrix.python-version }} - - uses: ./.github/actions - -||||||| parent of 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/build_test.yml - basic: - needs: [smoke_test] + needs: [baseline_only] runs-on: ubuntu-latest - if: github.event_name != 'push' - strategy: - matrix: - python-version: ["3.9", "pypy3.9-v7.3.12"] env: - EXPECT_CPU_FEATURES: "SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" + MESON_ARGS: "-Dallow-noblas=true" steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: - python-version: ${{ matrix.python-version }} - - uses: ./.github/actions + python-version: '3.9' -======= ->>>>>>> 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/linux_simd.yml - old_gcc: - needs: [smoke_test] - # provides GCC 8 - runs-on: ubuntu-20.04 - if: github.event_name != 'push' - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - name: Install Python3.9 + - name: Install GCC/8/9 run: | + echo "deb http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee /etc/apt/sources.list.d/focal.list sudo apt update - # for add-apt-repository - sudo apt install software-properties-common -y - sudo add-apt-repository ppa:deadsnakes/ppa -y - sudo apt install python3.9-dev ninja-build -y - sudo ln -s /usr/bin/python3.9 /usr/bin/pythonx - pythonx -m pip install --upgrade pip setuptools wheel - pythonx -m pip install -r test_requirements.txt - - name: Install GCC 8 - run: sudo apt install g++-8 -y - - name: Build gcc-8 - run: | - export CC=/usr/bin/gcc-8 - export CXX=/usr/bin/g++-8 - rm -rf build && pythonx setup.py install --user - - name: Run test suite - run: pythonx runtests.py -n - - without_optimizations: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - MESON_ARGS: "-Dallow-noblas=true -Ddisable-optimization=true" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - - uses: ./.github/meson_actions - - with_baseline_only: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=none" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.10' - - uses: ./.github/meson_actions + sudo apt install -y g++-8 g++-9 - without_avx512: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,AVX2,FMA3" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.10' - - uses: ./.github/meson_actions - - without_avx512_avx2_fma3: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - MESON_ARGS: "-Dallow-noblas=true -Dcpu-dispatch=SSSE3,SSE41,POPCNT,SSE42,AVX,F16C" - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.10' - - uses: ./.github/meson_actions - -<<<<<<< HEAD:.github/workflows/build_test.yml - debug: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - USE_DEBUG: 1 - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - uses: ./.github/actions - - blas64: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - NPY_USE_BLAS_ILP64: 1 - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - uses: ./.github/actions - - full: - # Build a wheel, install it, then run the full test suite with code coverage - needs: [smoke_test] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.9' - - name: Install build and test dependencies from PyPI + - name: Enable gcc-8 run: | - pip install -r build_requirements.txt - pip install -r test_requirements.txt - - name: Install gfortran and OpenBLAS (MacPython build) - run: | - set -xe - sudo apt install gfortran libgfortran5 - target=$(python tools/openblas_support.py) - sudo cp -r $target/lib/* /usr/lib - sudo cp $target/include/* /usr/include - - name: Build a wheel - run: | - python -m build --wheel --no-isolation --skip-dependency-checks - - name: Run full test suite - run: | - cd doc - pytest --pyargs numpy --cov-report=html:build/coverage - # TODO: gcov - - - benchmark: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - PYTHONOPTIMIZE: 2 - BLAS: None - LAPACK: None - ATLAS: None - NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas - NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK - USE_ASV: 1 - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.9' - - uses: ./.github/actions + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 1 - relaxed_strides_debug: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - CHECK_BLAS: 1 - NPY_USE_BLAS_ILP64: 1 - NPY_RELAXED_STRIDES_DEBUG: 1 - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - uses: ./.github/actions + - uses: ./.github/meson_actions + name: Build/Test against gcc-8 - sdist: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.12' - - name: Install gfortran and OpenBLAS (MacPython build) - run: | - set -xe - sudo apt install gfortran libgfortran5 - target=$(python tools/openblas_support.py) - sudo cp -r $target/lib/* /usr/lib - sudo cp $target/include/* /usr/include - - name: Build a wheel via an sdist - run: | - python -m build - pip install dist/numpy*.whl - - name: Install test dependencies + - name: Enable gcc-9 run: | - pip install -r test_requirements.txt - - name: Run test suite - run: | - cd doc - pytest --pyargs numpy -m "not slow" + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 2 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 2 + - uses: ./.github/meson_actions + name: Build/Test against gcc-9 -||||||| parent of 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/build_test.yml - debug: - needs: [smoke_test] + specialize: + needs: [baseline_only] runs-on: ubuntu-latest if: github.event_name != 'push' - env: - USE_DEBUG: 1 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - - uses: ./.github/actions + continue-on-error: true + strategy: + matrix: + BUILD_PROP: + #- [ + #"without optimizations", + #"-Dallow-noblas=true -Ddisable-optimization=true", + #"3.12" + #] + - [ + "native", + "-Dallow-noblas=true -Dcpu-baseline=native -Dcpu-dispatch=none", + "3.11" + ] + - [ + "without avx512", + "-Dallow-noblas=true -Dcpu-dispatch=SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,AVX2,FMA3", + "3.10" + ] + - [ + "without avx512/avx2/fma3", + "-Dallow-noblas=true -Dcpu-dispatch=SSSE3,SSE41,POPCNT,SSE42,AVX,F16C", + "3.9" + ] - blas64: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' env: - NPY_USE_BLAS_ILP64: 1 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - - uses: ./.github/actions + MESON_ARGS: ${{ matrix.BUILD_PROP[1] }} - full: - # Build a wheel, install it, then run the full test suite with code coverage - needs: [smoke_test] - runs-on: ubuntu-22.04 + name: "${{ matrix.BUILD_PROP[0] }}" steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: - python-version: '3.9' - - name: Install build and test dependencies from PyPI - run: | - pip install -r build_requirements.txt - pip install -r test_requirements.txt - - name: Install gfortran and OpenBLAS (MacPython build) - run: | - set -xe - sudo apt install gfortran libgfortran5 - target=$(python tools/openblas_support.py) - sudo cp -r $target/lib/* /usr/lib - sudo cp $target/include/* /usr/include - - name: Build a wheel - run: | - python -m build --wheel --no-isolation --skip-dependency-checks - - name: Run full test suite - run: | - cd doc - pytest --pyargs numpy --cov-report=html:build/coverage - # TODO: gcov - + python-version: "${{ matrix.BUILD_PROP[2] }}" + - uses: ./.github/meson_actions + name: Build/Test - benchmark: - needs: [smoke_test] + intel_sde: + needs: [baseline_only] runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - PYTHONOPTIMIZE: 2 - BLAS: None - LAPACK: None - ATLAS: None - NPY_BLAS_ORDER: mkl,blis,openblas,atlas,blas - NPY_LAPACK_ORDER: MKL,OPENBLAS,ATLAS,LAPACK - USE_ASV: 1 steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.9' - - uses: ./.github/actions - - relaxed_strides_debug: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - env: - CHECK_BLAS: 1 - NPY_USE_BLAS_ILP64: 1 - NPY_RELAXED_STRIDES_DEBUG: 1 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 with: python-version: '3.11' - - uses: ./.github/actions - - sdist: - needs: [smoke_test] - runs-on: ubuntu-latest - if: github.event_name != 'push' - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.12' - - name: Install gfortran and OpenBLAS (MacPython build) - run: | - set -xe - sudo apt install gfortran libgfortran5 - target=$(python tools/openblas_support.py) - sudo cp -r $target/lib/* /usr/lib - sudo cp $target/include/* /usr/include - - name: Build a wheel via an sdist - run: | - python -m build - pip install dist/numpy*.whl - - name: Install test dependencies - run: | - pip install -r test_requirements.txt - - name: Run test suite - run: | - cd doc - pytest --pyargs numpy -m "not slow" - - -======= ->>>>>>> 1a81895ae6 (CI: split `build_test.yml` into three GHA jobs files):.github/workflows/linux_simd.yml - armv7_simd_test: - needs: [smoke_test] - # make sure this matches the base docker image below - runs-on: ubuntu-22.04 - if: github.event_name != 'push' - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - name: Initialize binfmt_misc for qemu-user-static - run: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - name: Creates new container - run: | - # use x86_64 cross-compiler to speed up the build - sudo apt update - sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf gfortran-arm-linux-gnueabihf - - docker run --name the_container --interactive -v /:/host -v $(pwd):/numpy arm32v7/ubuntu:22.04 /bin/bash -c " - apt update && - apt install -y git python3 python3-dev python3-pip && - python3 -m pip install -r /numpy/test_requirements.txt - ln -s /host/lib64 /lib64 && - ln -s /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu && - ln -s /host/usr/arm-linux-gnueabihf /usr/arm-linux-gnueabihf && - rm -rf /usr/lib/gcc/arm-linux-gnueabihf && ln -s /host/usr/lib/gcc-cross/arm-linux-gnueabihf /usr/lib/gcc/arm-linux-gnueabihf && - rm -f /usr/bin/arm-linux-gnueabihf-gcc && ln -s /host/usr/bin/arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc && - rm -f /usr/bin/arm-linux-gnueabihf-g++ && ln -s /host/usr/bin/arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++ && - rm -f /usr/bin/arm-linux-gnueabihf-gfortran && ln -s /host/usr/bin/arm-linux-gnueabihf-gfortran /usr/bin/arm-linux-gnueabihf-gfortran && - rm -f /usr/bin/arm-linux-gnueabihf-ar && ln -s /host/usr/bin/arm-linux-gnueabihf-ar /usr/bin/arm-linux-gnueabihf-ar && - rm -f /usr/bin/arm-linux-gnueabihf-as && ln -s /host/usr/bin/arm-linux-gnueabihf-as /usr/bin/arm-linux-gnueabihf-as && - rm -f /usr/bin/arm-linux-gnueabihf-ld && ln -s /host/usr/bin/arm-linux-gnueabihf-ld /usr/bin/arm-linux-gnueabihf-ld && - rm -f /usr/bin/arm-linux-gnueabihf-ld.bfd && ln -s /host/usr/bin/arm-linux-gnueabihf-ld.bfd /usr/bin/arm-linux-gnueabihf-ld.bfd - " - docker commit the_container the_container - - name: Build - run: | - sudo docker run --name the_build --interactive -v $(pwd):/numpy -v /:/host the_container /bin/bash -c " - uname -a && - gcc --version && - g++ --version && - arm-linux-gnueabihf-gfortran --version && - python3 --version && - git config --global --add safe.directory /numpy - cd /numpy && - python3 setup.py install - " - docker commit the_build the_build - - name: Run SIMD Tests - run: | - docker run --rm --interactive -v $(pwd):/numpy the_build /bin/bash -c " - cd /numpy && F90=arm-linux-gnueabihf-gfortran python3 runtests.py -n -v -- -k 'test_simd or test_kind' - " - - sde_simd_avx512_test: - # Intel Software Development Emulator (SDE) is used to run a given program - # on a specific instruction set architecture and capture various performance details. - # see https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html - needs: [smoke_test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.9' - - name: Install Intel SDE - run: | - curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/732268/sde-external-9.7.0-2022-05-09-lin.tar.xz - mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/ - sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde - - name: Install dependencies - run: python -m pip install -r test_requirements.txt - - name: Build - run: python setup.py build - --simd-test="\$werror AVX512F AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL" - install - # KNM implies KNL - - name: Run SIMD tests (Xeon PHI) - run: sde -knm -- python runtests.py -n -v -- -k test_simd - # ICL implies SKX, CLX and CNL - - name: Run SIMD tests (Ice Lake) - run: sde -icl -- python runtests.py -n -v -- -k test_simd - intel_spr_sde_test: - needs: [smoke_test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - with: - submodules: recursive - fetch-depth: 0 - - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 - with: - python-version: '3.11' - name: Install Intel SDE run: | curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/784319/sde-external-9.24.0-2023-07-13-lin.tar.xz mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/ sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde + - name: Install dependencies run: | - python -m pip install -r test_requirements.txt - sudo apt install gcc-12 g++-12 - - name: Build and install NumPy - run: | - export CC=/usr/bin/gcc-12 - export CXX=/usr/bin/g++-12 - python setup.py develop - - name: Show config - run: | - python -c "import numpy as np; np.show_config()" - # Run only a few tests, running everything in an SDE takes a long time - # Using pytest directly, unable to use python runtests.py -n -t ... - - name: Run linalg/ufunc/umath tests - run: | - python -m pytest numpy/core/tests/test_umath* numpy/core/tests/test_ufunc.py numpy/linalg/tests/test_* - # Can't run on SDE just yet: see https://github.com/numpy/numpy/issues/23545#issuecomment-1659047365 - #sde -spr -- python -m pytest numpy/core/tests/test_umath* numpy/core/tests/test_ufunc.py numpy/linalg/tests/test_* + sudo apt update + sudo apt install -y g++-13 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 1 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 1 + python -m pip install -r build_requirements.txt + python -m pip install pytest pytest-xdist hypothesis typing_extensions + + - name: Build + run: spin build -- -Dallow-noblas=true -Dcpu-baseline=avx512f -Dtest-simd='BASELINE,AVX512_KNL,AVX512_KNM,AVX512_SKX,AVX512_CLX,AVX512_CNL,AVX512_ICL,AVX512_SPR' + + - name: Meson Log + if: always() + run: cat build/meson-logs/meson-log.txt + + - name: SIMD tests (KNM) + run: | + export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/) + export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE" + cd build-install && + sde -knm -- python -c "import numpy; numpy.show_config()" && + sde -knm -- python -m pytest $NUMPY_SITE/numpy/core/tests/test_simd* + + - name: SIMD tests (SPR) + run: | + export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/) + export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE" + cd build-install && + sde -spr -- python -c "import numpy; numpy.show_config()" && + sde -spr -- python -m pytest $NUMPY_SITE/numpy/core/tests/test_simd* + + # Can't run on SDE just yet: see https://github.com/numpy/numpy/issues/23545#issuecomment-1659047365 + # + #- name: linalg/ufunc/umath tests (SPR) + # run: | + # export NUMPY_SITE=$(realpath build-install/usr/lib/python*/site-packages/) + # export PYTHONPATH="$PYTHONPATH:$NUMPY_SITE" + # cd build-install && + # sde -spr -- python -c "import numpy; numpy.show_config()" && + # sde -spr -- python -m pytest $NUMPY_SITE/numpy/core/tests/test_umath* \ + # $NUMPY_SITE/numpy/core/tests/test_ufunc.py \ + # $NUMPY_SITE/numpy/linalg/tests/test_* + From 39d854f62ffa65ba233e8d83ae051a2fe2a45805 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 5 Nov 2023 19:05:47 -0700 Subject: [PATCH 4/4] MAINT: Update vendored-meson/meson to ea5809096. --- vendored-meson/meson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored-meson/meson b/vendored-meson/meson index 66ba7dbbfe28..ea5809096404 160000 --- a/vendored-meson/meson +++ b/vendored-meson/meson @@ -1 +1 @@ -Subproject commit 66ba7dbbfe2838983f65ad8fe16da1535ebf5b9d +Subproject commit ea580909640457450e03d8b84d1fec9f035d7acb