Skip to content

Commit

Permalink
TST: fix running the test suite in builds without BLAS/LAPACK
Browse files Browse the repository at this point in the history
This was broken with `undefined symbol: dlapy3_` because the test
suite imports `linalg.lapack_lite` directly. See numpygh-24200 for more
details.
  • Loading branch information
rgommers authored and charris committed Nov 11, 2023
1 parent a962a85 commit f6812e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions numpy/linalg/tests/test_linalg.py
Expand Up @@ -21,6 +21,13 @@
assert_almost_equal, assert_allclose, suppress_warnings,
assert_raises_regex, HAS_LAPACK64, IS_WASM
)
try:
import numpy.linalg.lapack_lite
except ImportError:
# May be broken when numpy was built without BLAS/LAPACK present
# If so, ensure we don't break the whole test suite - the `lapack_lite`
# submodule should be removed, it's only used in two tests in this file.
pass


def consistent_subclass(out, in_):
Expand Down
6 changes: 6 additions & 0 deletions numpy/linalg/umath_linalg.cpp
Expand Up @@ -4597,5 +4597,11 @@ PyMODINIT_FUNC PyInit__umath_linalg(void)
return NULL;
}

#ifdef HAVE_BLAS_ILP64
PyDict_SetItemString(d, "_ilp64", Py_True);
#else
PyDict_SetItemString(d, "_ilp64", Py_False);
#endif

return m;
}
4 changes: 2 additions & 2 deletions numpy/testing/_private/utils.py
Expand Up @@ -22,7 +22,7 @@
from numpy.core import (
intp, float32, empty, arange, array_repr, ndarray, isnat, array)
from numpy import isfinite, isnan, isinf
import numpy.linalg.lapack_lite
import numpy.linalg._umath_linalg

from io import StringIO

Expand Down Expand Up @@ -54,7 +54,7 @@ class KnownFailureException(Exception):
IS_PYPY = sys.implementation.name == 'pypy'
IS_PYSTON = hasattr(sys, "pyston_version_info")
HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON
HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64
HAS_LAPACK64 = numpy.linalg._umath_linalg._ilp64

_OLD_PROMOTION = lambda: np._get_promotion_state() == 'legacy'

Expand Down

0 comments on commit f6812e7

Please sign in to comment.