Skip to content

Commit

Permalink
remove tools/openblas_support.py, use scipy-openblas32 wheels, put sc…
Browse files Browse the repository at this point in the history
…ipy-openblas.pc in top-level directory [wheel build]
  • Loading branch information
mattip committed May 12, 2024
1 parent 30c9033 commit 9928b0a
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 531 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,9 @@ jobs:
# (it can be put back after matplotlib has made a 2.0-compatible
# release on PyPI.
python -m pip install --pre --upgrade pytest pytest-cov pytest-xdist mpmath gmpy2 threadpoolctl pooch hypothesis
# TODO: once the scipy_ symbol prefix issue is fixed, install
# scipy-openblas32 from the pre-releases bucket again (see gh-19640)
python -m pip install "scipy-openblas32<=0.3.23.293.2"
# Install numpy last, to ensure we get 2.0.0-dev (avoid possible <2.0 constraints).
python -m pip install --pre --upgrade --timeout=60 -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
python -m pip install -r requirements/openblas.txt
# Install numpy last, to ensure we get 2.0.0-rc1 (avoid possible <2.0 constraints).
python -m pip install --pre --upgrade --timeout=60 numpy
- name: Prepare compiler cache
id: prep-ccache
Expand Down Expand Up @@ -377,13 +375,10 @@ jobs:
docker pull quay.io/pypa/manylinux2014_i686
docker run -v $(pwd):/scipy --platform=linux/i386 quay.io/pypa/manylinux2014_i686 /bin/bash -c "cd /scipy && \
uname -a && \
basedir=\$(python3.10 tools/openblas_support.py) && \
cp -r \$basedir/lib/* /usr/local/lib && \
cp \$basedir/include/* /usr/local/include && \
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && \
python3.10 -m venv test && \
source test/bin/activate && \
python -m pip install doit click rich_click pydevtool meson ninja && \
python -m pip install numpy==1.23.5 cython pybind11 pytest pytest-timeout pytest-xdist pytest-env 'Pillow<10.0.0' mpmath pythran pooch meson hypothesis && \
LD_LIBRARY_PATH=/usr/local/lib python dev.py build && \
LD_LIBRARY_PATH=/usr/local/lib python dev.py test"
python -m pip install -r requirements/openblas.txt && \
python dev.py build --with-scipy-openblas && \
python dev.py --no-build test"
9 changes: 4 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,13 @@ jobs:
ln -s $GFORTRAN_LOC gfortran
export PATH=$PWD:$PATH
# make sure we have openblas and gfortran dylibs
bash tools/wheels/cibw_before_build_macos.sh $PWD
# Ensure we have gfortran dylib
GFORTRAN_LIB=$(dirname `gfortran --print-file-name libgfortran.dylib`)
export DYLD_LIBRARY_PATH=$GFORTRAN_LIB:/opt/arm64-builds/lib
export PKG_CONFIG_PATH=$PWD/.openblas
export DYLD_LIBRARY_PATH=$GFORTRAN_LIB
pip install click doit pydevtool rich_click meson cython pythran pybind11 ninja numpy
python dev.py build
pip install -r requirements/openblas.txt
python dev.py build --with-scipy-openblas

pip install pooch pytest hypothesis
python dev.py -n test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/musllinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ jobs:
cd $RUNNER_TEMP
source test_env/bin/activate
cd $GITHUB_WORKSPACE
export PKG_CONFIG_PATH=$PWD/.openblas
export PKG_CONFIG_PATH=$PWD
python dev.py test
28 changes: 2 additions & 26 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ jobs:
echo "PATH=$PATH" >> "$GITHUB_ENV"
LIB_PATH=$(dirname $(gfortran --print-file-name libgfortran.dylib))
fi
# Add libraries installed by cibw_before_build_macos.sh to path
if [[ ${{ matrix.buildplat[2] }} == 'arm64' ]]; then
LIB_PATH=$LIB_PATH:/opt/arm64-builds/lib
else
LIB_PATH=$LIB_PATH:/usr/local/lib
fi
if [[ ${{ matrix.buildplat[4] }} == '10.9' ]]; then
# Newest version of Xcode that supports macOS 10.9
XCODE_VER='13.4.1'
Expand All @@ -144,18 +138,16 @@ jobs:
# installed in cibw_before_build_macos.sh
sudo xcode-select -s /Applications/Xcode_${XCODE_VER}.app
CIBW="MACOSX_DEPLOYMENT_TARGET=${{ matrix.buildplat[4] }}\
LD_LIBRARY_PATH=$LIB_PATH:$LD_LIBRARY_PATH\
SDKROOT=$(xcrun --sdk macosx --show-sdk-path)\
PIP_PRE=1\
PIP_NO_BUILD_ISOLATION=false\
PKG_CONFIG_PATH=$LIB_PATH/pkgconfig\
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
echo "CIBW_ENVIRONMENT_MACOS=$CIBW" >> "$GITHUB_ENV"
echo "REPAIR_PATH=$LIB_PATH" >> "$GITHUB_ENV"
GFORTRAN_LIB="\$(dirname \$(gfortran --print-file-name libgfortran.dylib))"
CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB:$LIB_PATH delocate-wheel --require-archs \
CIBW="DYLD_LIBRARY_PATH=$GFORTRAN_LIB delocate-listdeps {wheel} &&\
DYLD_LIBRARY_PATH=$GFORTRAN_LIB delocate-wheel --require-archs \
{delocate_archs} -w {dest_dir} {wheel}"
# Rename x86 Accelerate wheel to test on macOS 13 runner
if [[ ${{ matrix.buildplat[0] }} == 'macos-13' && ${{ matrix.buildplat[4] }} == '14.0' ]]; then
Expand All @@ -172,22 +164,6 @@ jobs:
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_PRERELEASE_PYTHONS: True

# TODO remove the CIBW_BEFORE_BUILD_* lines once there are
# numpy2.0 wheels available on PyPI. Also remove/comment out the
# PIP_NO_BUILD_ISOLATION and PIP_EXTRA_INDEX_URL from CIBW_ENVIRONMENT
# (also for _MACOS and _WINDOWS below)
CIBW_BEFORE_BUILD_WINDOWS: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja && bash {project}/tools/wheels/cibw_before_build_win.sh {project}"
CIBW_BEFORE_BUILD_MACOS: "pip install numpy>=2.0.0.dev0 meson-python cython pythran pybind11 ninja; bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
# Allow pip to find install nightly wheels if necessary
# Setting PIP_NO_BUILD_ISOLATION=false makes pip use build-isolation.
CIBW_ENVIRONMENT: "PIP_NO_BUILD_ISOLATION=false PIP_PRE=1 PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"

CIBW_ENVIRONMENT_WINDOWS: >
PKG_CONFIG_PATH=c:/opt/64/lib/pkgconfig
PIP_PRE=1
PIP_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
PIP_NO_BUILD_ISOLATION=false
- name: Rename after test (macOS x86 Accelerate only)
# Rename x86 Accelerate wheel back so it targets macOS >= 14
if: matrix.buildplat[0] == 'macos-13' && matrix.buildplat[4] == '14.0'
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:
- name: pip-packages
run: |
pip install numpy cython pybind11 pythran meson ninja pytest pytest-xdist pytest-timeout pooch rich_click click doit pydevtool hypothesis "scipy-openblas32<=0.3.23.293.2"
pip install numpy cython pybind11 pythran meson ninja pytest pytest-xdist pytest-timeout pooch rich_click click doit pydevtool hypothesis
pip install -r requirements/openblas.txt
- name: Build
run: |
Expand Down Expand Up @@ -130,15 +131,15 @@ jobs:
- name: Install OpenBLAS
shell: bash
run: |
# Keep this using the OpenBLAS tarballs for now, as long as we use those for wheel builds
set -xe
python -m pip install -r requirements/openblas.txt
bash tools/wheels/cibw_before_build_win.sh .
echo "PKG_CONFIG_PATH=c:\opt\64\lib\pkgconfig;" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ github.workspace }}" >> $GITHUB_ENV
- name: pip-packages
run: |
python -m pip install build delvewheel cython pybind11 meson-python meson ninja pytest pytest-xdist pytest-timeout pooch hypothesis
python -m pip install --pre --upgrade --timeout=60 -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
python -m pip install --pre --upgrade --timeout=60 numpy
- name: Build
run: |
Expand All @@ -148,7 +149,7 @@ jobs:
# Ignore `libsf_error_state.dll` for special function error handling;
# it will be loaded using ctypes in scipy/special/__init__.py.
$env:wheel_name=Get-ChildItem -Path dist/* -Include *.whl
delvewheel repair --add-path c:\opt\openblas\openblas_dll --no-dll libsf_error_state.dll -w dist $env:wheel_name
delvewheel repair --no-dll libsf_error_state.dll -w dist $env:wheel_name
python -m pip install $env:wheel_name
Expand Down
2 changes: 1 addition & 1 deletion dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def setup_build(cls, dirs, args):
if args.with_scipy_openblas:
cls.configure_scipy_openblas()
env['PKG_CONFIG_PATH'] = os.pathsep.join([
os.path.join(os.getcwd(), '.openblas'),
os.getcwd(),
env.get('PKG_CONFIG_PATH', '')
])

Expand Down
24 changes: 8 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,25 +144,17 @@ before-build = "bash {project}/tools/wheels/cibw_before_build_linux.sh {project}
# RUNNER_OS is a GitHub Actions specific env var; define it here so it works on Cirrus CI too
RUNNER_OS="Linux"
# /project will be the $PWD equivalent inside the docker used to build the wheel
PKG_CONFIG_PATH="/project/.openblas"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/project/.openblas/lib"
PKG_CONFIG_PATH="/project/
[tool.cibuildwheel.macos]
before-build = "bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"
before-build = "pip install ninja; bash {project}/tools/wheels/cibw_before_build_macos.sh {project}"

[tool.cibuildwheel.macos.environment]
PKG_CONFIG_PATH="{project}"

[tool.cibuildwheel.windows]
before-build = "bash {project}/tools/wheels/cibw_before_build_win.sh {project}"
before-build = "pip install ninja && bash {project}/tools/wheels/cibw_before_build_win.sh {project}"
repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"

[[tool.cibuildwheel.overrides]]
select = "*-win32"

[[tool.cibuildwheel.overrides]]
select = "*-win_amd64"
# can use pkg-config detection for win_amd64 because the installed rtools
# provide a working pkg-config.
# An alternative is to set CMAKE_PREFIX_PATH="c:/opt/openblas/if_32/32"
# Don't use double backslash for path separators, they don't get passed
# to the build correctly
# environment = { CMAKE_PREFIX_PATH="c:/opt/64" }
environment = { PKG_CONFIG_PATH = "c:/opt/64/lib/pkgconfig" }
[tool.cibuildwheel.windows.environment]
PKG_CONFIG_PATH="{project}"

0 comments on commit 9928b0a

Please sign in to comment.