Skip to content

MAINT: Backport numpy._core stubs. Remove NumpyUnpickler #16382

MAINT: Backport numpy._core stubs. Remove NumpyUnpickler

MAINT: Backport numpy._core stubs. Remove NumpyUnpickler #16382

Workflow file for this run

name: Build_Test
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
PYTHON_VERSION: 3.9
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@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 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@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
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"]
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
old_gcc:
needs: [smoke_test]
# provides GCC 7, 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
# comes with python3.6
- name: Install Python3.9
run: |
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 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: 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
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: ${{ env.PYTHON_VERSION }}
- uses: ./.github/meson_actions
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: ${{ env.PYTHON_VERSION }}
- 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: ${{ env.PYTHON_VERSION }}
- uses: ./.github/meson_actions
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: ${{ env.PYTHON_VERSION }}
- 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: ${{ env.PYTHON_VERSION }}
- uses: ./.github/actions
full:
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:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: ./.github/actions
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: ${{ env.PYTHON_VERSION }}
- 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@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/actions
use_wheel:
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:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: ./.github/actions
no_openblas:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
env:
BLAS: None
LAPACK: None
ATLAS: None
DOWNLOAD_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 }}
- uses: ./.github/actions
sdist:
needs: [smoke_test]
runs-on: ubuntu-latest
if: github.event_name != 'push'
env:
USE_SDIST: 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: ${{ env.PYTHON_VERSION }}
- uses: ./.github/actions
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: ${{ env.PYTHON_VERSION }}
- 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: ${{ env.PYTHON_VERSION }}
- 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_*