Skip to content

Commit 488d535

Browse files
committed
BLD: fix issue ILP64 OpenBLAS detection, disable BLAS for PyPy job
Disable using BLAS in the PyPy job on Azure because it was broken. Before this PR, it uses to silently not find OpenBLAS and continue, now we have to be explicit about it.
1 parent 826a378 commit 488d535

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ stages:
227227
TEST_MODE: fast
228228
BITS: 64
229229
NPY_USE_BLAS_ILP64: '1'
230+
# Broken - it builds but _multiarray_umath doesn't import - needs investigating
231+
DISABLE_BLAS: '1'
230232

231233
steps:
232234
- template: azure-steps-windows.yml

azure-steps-windows.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ steps:
3838
# Note: ensure the `pip install .` command remains the last one here, to
3939
# avoid "green on failure" issues
4040
python -c "from tools import openblas_support; openblas_support.make_init('numpy')"
41-
If ( Test-Path env:NPY_USE_BLAS_ILP64 ) {
42-
python -m pip install . -Csetup-args="--vsenv" -Csetup-args="-Duse-ilp64=true" -Csetup-args="-Dblas-symbol-suffix=64_"
41+
If ( Test-Path env:DISABLE_BLAS ) {
42+
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none" -Csetup-args="-Dallow-noblas=true"
43+
}
44+
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_"
4346
} else {
44-
python -m pip install . -Csetup-args="--vsenv"
47+
python -m pip install . -v -Csetup-args="--vsenv"
4548
}
4649
displayName: 'Build NumPy'
4750

numpy/meson.build

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ endif
5353
# (see cibuildwheel settings in pyproject.toml), but used by CI jobs already
5454
blas_symbol_suffix = get_option('blas-symbol-suffix')
5555

56+
use_ilp64 = get_option('use-ilp64')
57+
if not use_ilp64
58+
# For now, keep supporting this environment variable too (same as in setup.py)
59+
# `false is the default for the CLI flag, so check if env var was set
60+
use_ilp64 = run_command(py,
61+
[
62+
'-c',
63+
'import os; print(1) if os.environ.get("NPY_USE_BLAS_ILP64", "0") != "0" else print(0)'
64+
],
65+
check: true
66+
).stdout().strip() == '1'
67+
endif
68+
5669

5770
# TODO: 64-bit (ILP64) BLAS and LAPACK support (e.g., check for more .pc files
5871
# so we detect `openblas64_.so` directly). Partially supported now, needs more
@@ -70,7 +83,12 @@ lapack_name = get_option('lapack')
7083
# pkg-config uses a lower-case name while CMake uses a capitalized name, so try
7184
# that too to make the fallback detection with CMake work
7285
if blas_name == 'openblas'
73-
blas = dependency(['openblas', 'OpenBLAS'], required: false)
86+
if use_ilp64
87+
_openblas_names = ['openblas64', 'openblas', 'OpenBLAS']
88+
else
89+
_openblas_names = ['openblas', 'OpenBLAS']
90+
endif
91+
blas = dependency(_openblas_names, required: false)
7492
else
7593
blas = dependency(blas_name, required: false)
7694
endif
@@ -121,19 +139,6 @@ if have_blas
121139
endif
122140
endif
123141

124-
use_ilp64 = get_option('use-ilp64')
125-
if not use_ilp64
126-
# For now, keep supporting this environment variable too (same as in setup.py)
127-
# `false is the default for the CLI flag, so check if env var was set
128-
use_ilp64 = run_command(py,
129-
[
130-
'-c',
131-
'import os; print(1) if os.environ.get("NPY_USE_BLAS_ILP64", "0") != "0" else print(0)'
132-
],
133-
check: true
134-
).stdout().strip() == '1'
135-
endif
136-
137142
# BLAS and LAPACK are dependencies for NumPy. Since NumPy 2.0, by default the
138143
# build will fail if they are missing; the performance impact is large, so
139144
# using fallback routines must be explicitly opted into by the user. xref

tools/openblas_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def test_version(expected_version=None):
324324
data = threadpoolctl.threadpool_info()
325325
if len(data) != 1:
326326
if platform.python_implementation() == 'PyPy':
327-
print(f"Check broken in CI on PyPy, data is: {data}")
327+
print(f"Not using OpenBLAS for PyPy in Azure CI, so skip this")
328328
return
329329
raise ValueError(f"expected single threadpool_info result, got {data}")
330330
if not expected_version:

0 commit comments

Comments
 (0)