8000 CI Fixes check_regressors_train on prescott OpenBlas (#21781) · samronsin/scikit-learn@d8ec30c · GitHub
[go: up one dir, main page]

Skip to content

Commit d8ec30c

Browse files
thomasjpfansamronsin
authored andcommitted
CI Fixes check_regressors_train on prescott OpenBlas (scikit-learn#21781)
1 parent 26d6e17 commit d8ec30c

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

sklearn/utils/estimator_checks.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,22 @@ def check_classifiers_one_label(name, classifier_orig):
20692069
assert_array_equal(classifier.predict(X_test), y, err_msg=error_string_predict)
20702070

20712071

2072+
def _create_memmap_backed_data(numpy_arrays):
2073+
# OpenBLAS is known to segfault with unaligned data on the Prescott architecture
2074+
# See: https://github.com/scipy/scipy/issues/14886
2075+
has_prescott_openblas = any(
2076+
True
2077+
for info in threadpool_info()
2078+
if info["internal_api"] == "openblas"
2079+
# Prudently assume Prescott might be the architecture if it is unknown.
2080+
and info.get("architecture", "prescott").lower() == "prescott"
2081+
)
2082+
return [
2083+
create_memmap_backed_data(array, aligned=has_prescott_openblas)
2084+
for array in numpy_arrays
2085+
]
2086+
2087+
20722088
@ignore_warnings # Warnings are raised by decision function
20732089
def check_classifiers_train(
20742090
name, classifier_orig, readonly_memmap=False, X_dtype="float64"
@@ -2086,19 +2102,7 @@ def check_classifiers_train(
20862102
X_b -= X_b.min()
20872103

20882104
if readonly_memmap:
2089-
# OpenBLAS is known to segfault with unaligned data on the Prescott architecture
2090-
# See: https://github.com/scipy/scipy/issues/14886
2091-
has_prescott_openblas = any(
2092-
True
2093-
for info in threadpool_info()
2094-
if info["internal_api"] == "openblas"
2095-
# Prudently assume Prescott might be the architecture if it is unknown.
2096-
and info.get("architecture", "prescott").lower() == "prescott"
2097-
)
2098-
X_m = create_memmap_backed_data(data=X_m, aligned=has_prescott_openblas)
2099-
y_m = create_memmap_backed_data(data=y_m, aligned=has_prescott_openblas)
2100-
X_b = create_memmap_backed_data(data=X_b, aligned=has_prescott_openblas)
2101-
y_b = create_memmap_backed_data(data=y_b, aligned=has_prescott_openblas)
2105+
X_m, y_m, X_b, y_b = _create_memmap_backed_data([X_m, y_m, X_b, y_b])
21022106

21032107
problems = [(X_b, y_b)]
21042108
tags = _safe_tags(classifier_orig)
@@ -2766,7 +2770,7 @@ def check_regressors_train(
27662770
y_ = y
27672771

27682772
if readonly_memmap:
2769-
X, y, y_ = create_memmap_backed_data([X, y, y_])
2773+
X, y, y_ = _create_memmap_backed_data([X, y, y_])
27702774

27712775
if not hasattr(regressor, "alphas") and hasattr(regressor, "alpha"):
27722776
# linear regressors need to set alpha, but not generalized CV ones

0 commit comments

Comments
 (0)
0