8000 DEBUG TST Try removing handling of unstable OpenBLAS configuration · scikit-learn/scikit-learn@9ba06e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ba06e4

Browse files
DEBUG TST Try removing handling of unstable OpenBLAS configuration
This was introduced once a long time ago for a failure which was happening in a single configuration (see the comments). Let's see if this has been fixed. Co-authored-by: Christian Lorentzen <lorentzen.ch@gmail.com>
1 parent b60e897 commit 9ba06e4

File tree

4 files changed

+2
-55
lines changed

4 files changed

+2
-55
lines changed

sklearn/metrics/_pairwise_distances_reduction.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ from numbers import Integral, Real
4343
from typing import List
4444
from scipy.sparse import issparse
4545
from ._dist_metrics import BOOL_METRICS, METRIC_MAPPING
46-
from ..utils import check_scalar, _in_unstable_openblas_configuration
4746
from ..utils.fixes import threadpool_limits
4847
from ..utils._openmp_helpers import _openmp_effective_n_threads
4948
from 8000 ..utils._typedefs import ITYPE, DTYPE

sklearn/metrics/tests/test_pairwise_distances_reduction.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
_sqeuclidean_row_norms,
1010
)
1111

12-
from sklearn.utils import _in_unstable_openblas_configuration
1312
from sklearn.utils.fixes import sp_version, parse_version
14-
from sklearn.utils._testing import fails_if_unstable_openblas
1513

1614

1715
def _get_dummy_metric_params_list(metric: str, n_features: int):
@@ -140,7 +138,6 @@ def test_argkmin_factory_method_wrong_usages():
140138
)
141139

142140

143-
@fails_if_unstable_openblas
144141
@pytest.mark.parametrize("seed", range(5))
145142
@pytest.mark.parametrize("n_samples", [100, 1000])
146143
@pytest.mark.parametrize("chunk_size", [50, 512, 1024])
@@ -187,7 +184,6 @@ def test_chunk_size_agnosticism(
187184
ASSERT_RESULT[PairwiseDistancesReduction](ref_dist, dist, ref_indices, indices)
188185

189186

190-
@fails_if_unstable_openblas
191187
@pytest.mark.parametrize("seed", range(5))
192188
@pytest.mark.parametrize("n_samples", [100, 1000])
193189
@pytest.mark.parametrize("chunk_size", [50, 512, 1024])
@@ -245,11 +241,6 @@ def test_strategies_consistency(
245241
n_features=10,
246242
dtype=np.float64,
247243
):
248-
# Results obtained using both parallelization strategies must be identical
249-
if _in_unstable_openblas_configuration() and metric in ("sqeuclidean", "euclidean"):
250-
pytest.xfail(
251-
"OpenBLAS (used for '(sq)euclidean') is unstable in this configuration"
252-
)
253244

254245
rng = np.random.RandomState(seed)
255246
spread = 100
@@ -302,7 +293,6 @@ def test_strategies_consistency(
302293
)
303294

304295

305-
@fails_if_unstable_openblas
306296
@pytest.mark.parametrize("n_features", [50, 500])
307297
@pytest.mark.parametrize("translation", [10 ** i for i in [4, 8]])
308298
@pytest.mark.parametrize("metric", PairwiseDistancesReduction.valid_metrics())

sklearn/utils/__init__.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from . import _joblib
2727
from ..exceptions import DataConversionWarning
2828
from .deprecation import deprecated
29-
from .fixes import np_version, parse_version, threadpool_info
29+
from .fixes import np_version, parse_version
3030
from ._estimator_html_repr import estimator_html_repr
3131
from .validation import (
3232
as_float_array,
@@ -81,39 +81,6 @@
8181
_IS_32BIT = 8 * struct.calcsize("P") == 32
8282

8383

84-
def _in_unstable_openblas_configuration():
85-
"""Return True if in an unstable configuration for OpenBLAS"""
86-
87-
# Import libraries which might load OpenBLAS.
88-
import numpy # noqa
89-
import scipy # noqa
90-
91-
modules_info = threadpool_info()
92-
93-
open_blas_used = any(info["internal_api"] == "openblas" for info in modules_info)
94-
if not open_blas_used:
95-
return False
96-
97-
# OpenBLAS 0.3.16 fixed unstability for arm64, see:
98-
# https://github.com/xianyi/OpenBLAS/blob/1b6db3dbba672b4f8af935bd43a1ff6cff4d20b7/Changelog.txt#L56-L58 # noqa
99-
openblas_arm64_stable_version = parse_version("0.3.16")
100-
for info in modules_info:
101-
if info["internal_api"] != "openblas":
102-
continue
103-
openblas_version = info.get("version")
104-
openblas_architecture = info.get("architecture")
105-
if openblas_version is None or openblas_architecture is None:
106-
# Cannot be sure that OpenBLAS is good enough. Assume unstable:
107-
return True
108-
if (
109-
openblas_architecture == "neoversen1"
110-
and parse_version(openblas_version) < openblas_arm64_stable_version
111-
):
112-
# See discussions in https://github.com/numpy/numpy/issues/19411
113-
return True
114-
return False
115-
116-
11784
class Bunch(dict):
11885
"""Container object exposing keys as attributes.
11986

sklearn/utils/_testing.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@
4848
import joblib
4949

5050
import sklearn
51-
from sklearn.utils import (
52-
IS_PYPY,
53-
_IS_32BIT,
54-
deprecated,
55-
_in_unstable_openblas_configuration,
56-
)
51+
from sklearn.utils import IS_PYPY, _IS_32BIT, deprecated
5752
from sklearn.utils.multiclass import check_classification_targets
5853
from sklearn.utils.validation import (
5954
check_array,
@@ -453,10 +448,6 @@ def set_random_state(estimator, random_state=0):
453448
os.environ.get("TRAVIS") == "true", reason="skip on travis"
454449
)
455450
fails_if_pypy = pytest.mark.xfail(IS_PYPY, reason="not compatible with PyPy")
456-
fails_if_unstable_openblas = pytest.mark.xfail(
457-
_in_unstable_openblas_configuration(),
458-
reason="OpenBLAS is unstable for this configuration",
459-
)
460451
skip_if_no_parallel = pytest.mark.skipif(
461452
not joblib.parallel.mp, reason="joblib is in serial mode"
462453
)

0 commit comments

Comments
 (0)
0