Repository: scipy/scipy

Issue:
TestDifferentialEvolutionSolver::test_L4 failing in CI
Example PR with this failure in 32-bit Windows Azure CI: https://github.com/scipy/scipy/pull/11682

Full raw log: https://dev.azure.com/scipy-org/df8ffb44-7275-43bc-90f9-aa5c93ef5c51/_apis/build/builds/5298/logs/68

I can reproduce locally 100 % of the time when running this test on a Mac with OpenBLAS 0.3.7, and it passes 100 % of the time when I bump to OpenBLAS 0.3.9, so I may try that bump in a PR shortly here.

```
2020-03-19T13:32:37.3995374Z ================================== FAILURES ===================================
2020-03-19T13:32:37.3997425Z ___________________ TestDifferentialEvolutionSolver.test_L4 ___________________
2020-03-19T13:32:37.3998666Z [gw2] win32 -- Python 3.6.8 C:\hostedtoolcache\windows\Python\3.6.8\x86\python.exe
2020-03-19T13:32:37.4001801Z C:\hostedtoolcache\windows\Python\3.6.8\x86\lib\site-packages\scipy\optimize\tests\test__differential_evolution.py:1001: in test_L4
2020-03-19T13:32:37.4003370Z     assert_allclose(res.x, x_opt, atol=0.002)
2020-03-19T13:32:37.4004368Z E   AssertionError: 
2020-03-19T13:32:37.4005230Z E   Not equal to tolerance rtol=1e-07, atol=0.002
2020-03-19T13:32:37.4005905Z E   
2020-03-19T13:32:37.4006456Z E   Mismatched elements: 2 / 8 (25%)
2020-03-19T13:32:37.4007191Z E   Max absolute difference: 0.0032599
2020-03-19T13:32:37.4007895Z E   Max relative difference: 2.39703589e-06
2020-03-19T13:32:37.4008620Z E    x: array([ 579.306632, 1359.97389 , 5109.9675  ,  182.017695,  295.6013  ,
2020-03-19T13:32:37.4009627Z E           217.982305,  286.416395,  395.6013  ])
2020-03-19T13:32:37.4010631Z E    y: array([ 579.306692, 1359.97063 , 5109.9707  ,  182.0177  ,  295.601172,
2020-03-19T13:32:37.4011714Z E           217.9823  ,  286.416528,  395.601172])
2020-03-19T13:32:37.4013507Z         A          = array([[ 0.    ,  0.    ,  0.    ,  0.0025,  0.    ,  0.0025,  0.    ,
2020-03-19T13:32:37.4014304Z          0.    ],
2020-03-19T13:32:37.4015019Z        [ 0.    ,  0.    ,  0.... ,  0.0025,
2020-03-19T13:32:37.4015702Z          0.    ],
2020-03-19T13:32:37.4016407Z        [ 0.    ,  0.    ,  0.    ,  0.    , -0.01  ,  0.    ,  0.    ,
2020-03-19T13:32:37.4017162Z          0.01  ]])
2020-03-19T13:32:37.4017832Z         L          = <scipy.optimize._constraints.LinearConstraint object at 0x17BBB0D0>
2020-03-19T13:32:37.4019057Z         N          = <scipy.optimize._constraints.NonlinearConstraint object at 0x17BBB130>
2020-03-19T13:32:37.4019993Z         b          = array([1, 1, 1])
2020-03-19T13:32:37.4020922Z         bounds     = [(100, 10000), (1000, 10000), (1000, 10000), (10, 1000), (10, 1000), (10, 1000), ...]
2020-03-19T13:32:37.4022130Z         c1         = <function TestDifferentialEvolutionSolver.test_L4.<locals>.c1 at 0x18CCCF18>
2020-03-19T13:32:37.4023914Z         constraints = (<scipy.optimize._constraints.LinearConstraint object at 0x17BBB0D0>, <scipy.optimize._constraints.NonlinearConstraint object at 0x17BBB130>)
2020-03-19T13:32:37.4025357Z         f          = <function TestDifferentialEvolutionSolver.test_L4.<locals>.f at 0x18CCC9C0>
2020-03-19T13:32:37.4026588Z         f_opt      = 7049.248
2020-03-19T13:32:37.4027680Z         res        =            constr: [array([0., 0., 0.]), array([0., 0., 0.])]
2020-03-19T13:32:37.4028441Z  constr_violation: 0.0
2020-03-19T13:32:37.4030556Z               fun: 7049.248021850...63151, 1359.9738899 , 5109.96750045,  182.01769512,
2020-03-19T13:32:37.4031714Z         295.6013    ,  217.98230483,  286.41639511,  395.60129999])
2020-03-19T13:32:37.4032742Z         self       = <scipy.optimize.tests.test__differential_evolution.TestDifferentialEvolutionSolver object at 0x17BBBD70>
2020-03-19T13:32:37.4033854Z         sup        = <numpy.testing._private.utils.suppress_warnings object at 0x17BBB350>
2020-03-19T13:32:37.4035247Z         x_opt      = [579.306692, 1359.97063, 5109.9707, 182.0177, 295.601172, 217.9823, ...]
2020-03-19T13:32:37.5032480Z ============================== warnings summary ===============================
```


Discussion:

Resolving patch:
diff --git a/tools/openblas_support.py b/tools/openblas_support.py
--- a/tools/openblas_support.py
+++ b/tools/openblas_support.py
@@ -11,8 +11,8 @@
 import zipfile
 import tarfile
 
-OPENBLAS_V = 'v0.3.8'
-OPENBLAS_LONG = 'v0.3.5-605-gc815b8fb'  # the 0.3.5 is misleading
+OPENBLAS_V = 'v0.3.9'
+OPENBLAS_LONG = 'v0.3.9'
 BASE_LOC = ''
 ANACONDA = 'https://anaconda.org/multibuild-wheels-staging/openblas-libs'
 ARCHITECTURES = ['', 'windows', 'darwin', 'aarch64', 'x86', 'ppc64le', 's390x']


Test patch:
diff --git a/scipy/optimize/tests/test__differential_evolution.py b/scipy/optimize/tests/test__differential_evolution.py
--- a/scipy/optimize/tests/test__differential_evolution.py
+++ b/scipy/optimize/tests/test__differential_evolution.py
@@ -998,7 +998,14 @@ def c1(x):
 
         assert_allclose(f(x_opt), f_opt, atol=0.001)
         assert_allclose(res.fun, f_opt, atol=0.001)
-        assert_allclose(res.x, x_opt, atol=0.002)
+
+        # selectively use higher tol here for 32-bit
+        # Windows based on gh-11693
+        if (platform.system() == 'Windows' and np.dtype(np.intp).itemsize < 8):
+            assert_allclose(res.x, x_opt, rtol=2.4e-6, atol=0.0035)
+        else:
+            assert_allclose(res.x, x_opt, atol=0.002)
+
         assert res.success
         assert_(np.all(A @ res.x <= b))
         assert_(np.all(np.array(c1(res.x)) >= 0))