GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: use scipy-openblas wheel (#24839) · numpy/numpy@21d29c5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • meson_actions
      • action.yml
    • workflows
      • linux.yml
      • linux_blas.yml
      • linux_compiler_sanitizers.yml
      • linux_musl.yml
      • windows.yml
  • .gitignore
  • .spin
    • cmds.py
  • azure-pipelines.yml
  • azure-steps-windows.yml
  • doc/source/dev
    • development_environment.rst
  • numpy
    • _distributor_init.py
    • meson.build
  • pyproject.toml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/meson_actions/action.yml‎

Copy file name to clipboardExpand all lines: .github/meson_actions/action.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ runs:
77
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
88
env:
99
TERM: xterm-256color
10+
PKG_CONFIG_PATH: ./.openblas
1011
run: |
1112
echo "::group::Installing Build Dependencies"
1213
pip install -r build_requirements.txt
Collapse file

‎.github/workflows/linux.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/linux.yml
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ jobs:
7373
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
7474
with:
7575
python-version: 'pypy3.9-v7.3.12'
76-
- name: Install system dependencies
76+
- name: Setup using scipy-openblas
7777
run: |
78-
sudo apt-get update
79-
sudo apt-get install libopenblas-dev ninja-build
78+
python -m pip install scipy-openblas32 spin
79+
spin config-openblas --with-scipy-openblas=32
8080
- uses: ./.github/meson_actions
8181

8282
debug:
@@ -124,15 +124,16 @@ jobs:
124124
run: |
125125
pip install -r build_requirements.txt
126126
pip install -r test_requirements.txt
127-
- name: Install gfortran and OpenBLAS (MacPython build)
127+
- name: Install gfortran and setup OpenBLAS (MacPython build)
128128
run: |
129129
set -xe
130130
sudo apt update
131131
sudo apt install gfortran libgfortran5
132-
target=$(python tools/openblas_support.py)
133-
sudo cp -r $target/lib/* /usr/lib
134-
sudo cp $target/include/* /usr/include
132+
pip install scipy-openblas32
133+
spin config-openblas --with-scipy-openblas=32
135134
- name: Build a wheel
135+
env:
136+
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
136137
run: |
137138
python -m build --wheel --no-isolation --skip-dependency-check
138139
pip install dist/numpy*.whl
@@ -185,7 +186,7 @@ jobs:
185186
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
186187
with:
187188
python-version: '3.11'
188-
- name: Install gfortran and OpenBLAS (MacPython build)
189+
- name: Install gfortran and setup OpenBLAS (MacPython build)
189190
run: |
190191
set -xe
191192
sudo apt update
Collapse file

‎.github/workflows/linux_blas.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/linux_blas.yml
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ name: BLAS tests (Linux)
77
#
88
# Jobs and their purpose:
99
#
10-
# - openblas64_setuppy:
11-
# This job uses the default 64-bit build of OpenBLAS with the
12-
# `numpy.distutils`-based build. It can be removed once we remove
13-
# support for those builds.
1410
# - openblas32_stable_nightly:
15-
# Uses the 32-bit OpenBLAS builds, both the latest stable release and a
16-
# nightly build.
11+
# Uses the 32-bit OpenBLAS builds, both the latest stable release
12+
# and a nightly build.
1713
#
1814
# TODO: coverage here is limited, we should add non-OpenBLAS libraries and
1915
# exercise the BLAS-related build options (see `meson_options.txt`).
Collapse file

‎.github/workflows/linux_compiler_sanitizers.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/linux_compiler_sanitizers.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ jobs:
3535
- name: Install dependencies
3636
run: |
3737
pip install -r build_requirements.txt
38-
sudo apt-get update
39-
sudo apt-get install -y libopenblas-serial-dev
38+
pip install scipy-openblas32 spin
4039
- name: Build
4140
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
4241
env:
4342
TERM: xterm-256color
43+
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
4444
run:
45-
spin build -- --werror -Db_sanitize=address,undefined
45+
spin build --with-scipy-openblas=32 -- --werror -Db_sanitize=address,undefined
4646
- name: Test
4747
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
4848
env:
Collapse file

‎.github/workflows/linux_musl.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/linux_musl.yml
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ jobs:
4848
4949
ln -s /usr/local/bin/python3.10 /usr/local/bin/python
5050
51-
- name: test musllinux_x86_64
51+
- name: test-musllinux_x86_64
52+
env:
53+
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
5254
run: |
5355
python -m venv test_env
5456
source test_env/bin/activate
5557
56-
# required for figuring out the system tags in openblas_support
57-
pip install packaging
58-
59-
# install openblas by co-opting the CIBW setup script
60-
RUNNER_OS=Linux sh tools/wheels/cibw_before_build.sh .
58+
pip install scipy-openblas64
6159
62-
pip install -r build_requirements.txt
63-
pip install pytest pytest-xdist hypothesis typing_extensions
60+
pip install -r build_requirements.txt -r test_requirements.txt
6461
6562
# use meson to build and test
66-
spin build
63+
spin build --with-scipy-openblas=64
6764
spin test -j auto
65+
66+
- name: Meson Log
67+
shell: bash
68+
run: |
69+
cat build/meson-logs/meson-log.txt
Collapse file

‎.github/workflows/windows.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/windows.yml
+14-21Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,9 @@ jobs:
3737
run: |
3838
python -m pip install spin Cython
3939
40-
- name: Install OpenBLAS (MacPython build)
40+
- name: Install pkg-config
4141
run: |
42-
# Download and install pre-built OpenBLAS library with 32-bit
43-
# interfaces. Unpack it in the pkg-config hardcoded path
44-
choco install unzip -y
45-
choco install wget -y
4642
choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
47-
wget https://anaconda.org/multibuild-wheels-staging/openblas-libs/v0.3.21/download/openblas-v0.3.21-win_amd64-gcc_10_3_0.zip
48-
unzip -d c:\opt openblas-v0.3.21-win_amd64-gcc_10_3_0.zip
49-
echo "PKG_CONFIG_PATH=c:\opt\64\lib\pkgconfig;" >> $env:GITHUB_ENV
5043
5144
- name: Install Clang-cl
5245
if: matrix.compiler == 'Clang-cl'
@@ -55,26 +48,26 @@ jobs:
5548
5649
- name: Install NumPy (MSVC)
5750
if: matrix.compiler == 'MSVC'
51+
env:
52+
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
5853
run: |
59-
spin build -j2 -- --vsenv
54+
python -m pip install scipy-openblas32
55+
spin build --with-scipy-openblas=32 -j2 -- --vsenv
6056
6157
- name: Install NumPy (Clang-cl)
6258
if: matrix.compiler == 'Clang-cl'
59+
env:
60+
PKG_CONFIG_PATH: ${{ github.workspace }}/.openblas
6361
run: |
6462
"[binaries]","c = 'clang-cl'","cpp = 'clang-cl'","ar = 'llvm-lib'","c_ld = 'lld-link'","cpp_ld = 'lld-link'" | Out-File $PWD/clang-cl-build.ini -Encoding ascii
65-
spin build -j2 -- --vsenv --native-file=$PWD/clang-cl-build.ini
63+
python -m pip install scipy-openblas32
64+
spin build --with-scipy-openblas=32 -j2 -- --vsenv --native-file=$PWD/clang-cl-build.ini
6665
67-
- name: Copy OpenBLAS DLL, write _distributor_init.py
66+
- name: Meson Log
67+
shell: bash
68+
if: ${{ failure() }}
6869
run: |
69-
# Getting the OpenBLAS DLL to the right place so it loads
70-
$installed_path = "$PWD\build-install\usr\Lib\site-packages"
71-
$numpy_path = "${installed_path}\numpy"
72-
$libs_path = "${installed_path}\numpy.libs"
73-
mkdir ${libs_path}
74-
$ob_path = "C:/opt/64/bin/"
75-
cp $ob_path/*.dll $libs_path
76-
# Write _distributor_init.py to load .libs DLLs.
77-
python -c "from tools import openblas_support; openblas_support.make_init(r'${numpy_path}')"
70+
cat build/meson-logs/meson-log.txt
7871
7972
- name: Install test dependencies
8073
run: |
@@ -85,7 +78,7 @@ jobs:
8578
run: |
8679
spin test
8780
88-
msvc_32bit_python_openblas:
81+
msvc_32bit_python_no_openblas:
8982
name: MSVC, 32-bit Python, no BLAS
9083
runs-on: windows-2019
9184
if: "github.repository == 'numpy/numpy'"
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ doc/source/**/generated/
118118

119119
# Things specific to this project #
120120
###################################
121-
# The line below should change to numpy/_version.py for NumPy 2.0
122121
benchmarks/results
123122
benchmarks/html
124123
benchmarks/env
@@ -139,3 +138,5 @@ tools/swig/test/Tensor.py
139138
tools/swig/test/Vector.py
140139
tools/swig/test/Vector_wrap.cxx
141140
tools/swig/test/Array.py
141+
.openblas
142+
numpy/_distributor_init_local.py
Collapse file

‎.spin/cmds.py‎

Copy file name to clipboardExpand all lines: .spin/cmds.py
+47-2Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@
3737
"-v", "--verbose", is_flag=True,
3838
help="Print all build output, even installation"
3939
)
40+
@click.option(
41+
"--with-scipy-openblas", type=click.Choice(["32", "64"]),
42+
default=None,
43+
help="Build with pre-installed scipy-openblas32 or scipy-openblas64 wheel"
44+
)
4045
@click.argument("meson_args", nargs=-1)
4146
@click.pass_context
42-
def build(ctx, meson_args, jobs=None, clean=False, verbose=False, quiet=False):
47+
def build(ctx, meson_args, with_scipy_openblas, jobs=None, clean=False, verbose=False, quiet=False):
4348
"""🔧 Build package with Meson/ninja and install
4449
4550
MESON_ARGS are passed through e.g.:
@@ -53,6 +58,10 @@ def build(ctx, meson_args, jobs=None, clean=False, verbose=False, quiet=False):
5358
5459
CFLAGS="-O0 -g" spin build
5560
"""
61+
# XXX keep in sync with upstream build
62+
if with_scipy_openblas:
63+
_config_openblas(with_scipy_openblas)
64+
ctx.params.pop("with_scipy_openblas", None)
5665
ctx.forward(meson.build)
5766

5867

@@ -413,7 +422,7 @@ def ipython(ctx, ipython_args):
413422
util.run(["ipython", "--ignore-cwd",
414423
f"--TerminalIPythonApp.exec_lines={preimport}"] +
415424
list(ipython_args))
416-
425+
417426

418427
@click.command(context_settings={"ignore_unknown_options": True})
419428
@click.pass_context
@@ -425,3 +434,39 @@ def mypy(ctx):
425434
ctx.params['pytest_args'] = [os.path.join('numpy', 'typing')]
426435
ctx.params['markexpr'] = 'full'
427436
ctx.forward(test)
437+
438+
@click.command(context_settings={
439+
'ignore_unknown_options': True
440+
})
441+
@click.option(
442+
"--with-scipy-openblas", type=click.Choice(["32", "64"]),
443+
default=None, required=True,
444+
help="Build with pre-installed scipy-openblas32 or scipy-openblas64 wheel"
445+
)
446+
def config_openblas(with_scipy_openblas):
447+
"""🔧 Create .openblas/scipy-openblas.pc file
448+
449+
Also create _distributor_init_local.py
450+
451+
Requires a pre-installed scipy-openblas64 or scipy-openblas32
452+
"""
453+
_config_openblas(with_scipy_openblas)
454+
455+
456+
def _config_openblas(blas_variant):
457+
import importlib
458+
basedir = os.getcwd()
459+
openblas_dir = os.path.join(basedir, ".openblas")
460+
pkg_config_fname = os.path.join(openblas_dir, "scipy-openblas.pc")
461+
if blas_variant:
462+
module_name = f"scipy_openblas{blas_variant}"
463+
try:
464+
openblas = importlib.import_module(module_name)
465+
except ModuleNotFoundError:
466+
raise RuntimeError(f"'pip install {module_name} first")
467+
local = os.path.join(basedir, "numpy", "_distributor_init_local.py")
468+
with open(local, "wt", encoding="utf8") as fid:
469+
fid.write(f"import {module_name}\n")
470+
os.makedirs(openblas_dir, exist_ok=True)
471+
with open(pkg_config_fname, "wt", encoding="utf8") as fid:
472+
fid.write(openblas.get_pkg_config().replace("\\", "/"))
Collapse file

‎azure-pipelines.yml‎

Copy file name to clipboardExpand all lines: azure-pipelines.yml
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,12 @@ stages:
7373
cd /numpy && \
7474
/opt/python/cp39-cp39/bin/python -mvenv venv && \
7575
source venv/bin/activate && \
76-
target=\$(python3 tools/openblas_support.py) && \
77-
cp -r \$target/lib/* /usr/lib && \
78-
cp \$target/include/* /usr/include && \
79-
python3 -m pip install ninja && \
76+
python3 -m pip install ninja scipy-openblas32 spin && \
8077
python3 -m pip install -r test_requirements.txt && \
8178
echo CFLAGS \$CFLAGS && \
82-
python3 -m pip install -v . && \
79+
spin config-openblas --with-scipy-openblas=32 && \
80+
export PKG_CONFIG_PATH=/numpy/.openblas && \
81+
python3 -m pip install . && \
8382
cd tools && \
8483
python3 -m pytest --pyargs numpy"
8584
displayName: 'Run 32-bit manylinux2014 Docker Build / Tests'
@@ -107,8 +106,6 @@ stages:
107106
TEST_MODE: fast
108107
BITS: 64
109108
NPY_USE_BLAS_ILP64: '1'
110-
# Broken - it builds but _multiarray_umath doesn't import - needs investigating
111-
DISABLE_BLAS: '1'
112109

113110
steps:
114111
- template: azure-steps-windows.yml
Collapse file

‎azure-steps-windows.yml‎

Copy file name to clipboardExpand all lines: azure-steps-windows.yml
+10-29Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,24 @@ steps:
2424
displayName: 'Install utilities'
2525

2626
- powershell: |
27-
$ErrorActionPreference = "Stop"
28-
mkdir C:/opt/openblas/openblas_dll
29-
mkdir C:/opt/32/lib/pkgconfig
30-
mkdir C:/opt/64/lib/pkgconfig
31-
$target=$(python -c "import tools.openblas_support as obs; plat=obs.get_plat(); ilp64=obs.get_ilp64(); target=f'openblas_{plat}.zip'; obs.download_openblas(target, plat, ilp64);print(target)")
32-
unzip -o -d c:/opt/ $target
33-
echo "##vso[task.setvariable variable=PKG_CONFIG_PATH]c:/opt/64/lib/pkgconfig"
34-
copy C:/opt/64/bin/*.dll C:/opt/openblas/openblas_dll
35-
displayName: 'Download / Install OpenBLAS'
36-
37-
- powershell: |
38-
# Note: ensure the `pip install .` command remains the last one here, to
39-
# avoid "green on failure" issues
40-
python -c "from tools import openblas_support; openblas_support.make_init('numpy')"
27+
# Note: ensure the `pip install .` command remains the last one here,
28+
# to avoid "green on failure" issues
4129
If ( Test-Path env:DISABLE_BLAS ) {
4230
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none" -Csetup-args="-Dallow-noblas=true"
4331
}
4432
elseif ( Test-Path env:NPY_USE_BLAS_ILP64 ) {
45-
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_"
46-
} else {
33+
python -m pip install scipy-openblas64 spin
34+
spin config-openblas --with-scipy-openblas=64
35+
$env:PKG_CONFIG_PATH="$pwd/.openblas"
4736
python -m pip install . -v -Csetup-args="--vsenv"
37+
} else {
38+
python -m pip install scipy-openblas32 spin
39+
spin config-openblas --with-scipy-openblas=32
40+
$env:PKG_CONFIG_PATH="$pwd/.openblas"
41+
python -m pip install . -v -Csetup-args="--vsenv"
4842
}
4943
displayName: 'Build NumPy'
5044

51-
- powershell: |
52-
# copy from c:/opt/openblas/openblas_dll to numpy/../numpy.libs to ensure it can
53-
# get loaded when numpy is imported (no RPATH on Windows)
54-
$target = $(python -c "import sysconfig; print(sysconfig.get_path('platlib'))")
55-
mkdir $target/numpy.libs
56-
copy C:/opt/openblas/openblas_dll/*.dll $target/numpy.libs
57-
displayName: 'Copy OpenBLAS DLL to site-packages'
58-
59-
- script: |
60-
python -m pip install threadpoolctl
61-
python tools/openblas_support.py --check_version
62-
displayName: 'Check OpenBLAS version'
63-
6445
- powershell: |
6546
cd tools # avoid root dir to not pick up source tree
6647
# Get a gfortran onto the path for f2py tests

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.