Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29231 Discussions

Scipy 15.1 still fails test with -O2 or -O3 flag

Jonah_M_
Beginner
320 Views

Hello,

I am compiling numpy and scipy with the intel compiler and with MKL. I am following this guide: https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl

I am posting to confirm that the bug that plagued older versions of scipy is still present and that optimizations still prevent scipy from passing all tests. (See, e.g., https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/507583)

Numpy passes all self tests. But scipy has the following failures:

======================================================================
FAIL: test_definition (test_basic.TestIfftnSingle)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/fftpack/tests/test_basic.py", line 657, in test_definition
    assert_array_almost_equal_nulp(y,direct_idftn(x),self.maxnlp)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 1358, in assert_array_almost_equal_nulp
    raise AssertionError(msg)
AssertionError: X and Y are not equal to 3500 ULP

======================================================================
FAIL: test_lorentz (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/odr/tests/test_odr.py", line 293, in test_lorentz
    3.7798193600109009e+00]),
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 842, in assert_array_almost_equal
    precision=decimal)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 6 decimals

(mismatch 100.0%)
 x: array([  1.000000e+03,   1.000000e-01,   3.800000e+00])
 y: array([  1.430678e+03,   1.339051e-01,   3.779819e+00])

======================================================================
FAIL: test_multi (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/odr/tests/test_odr.py", line 190, in test_multi
    0.5101147161764654, 0.5173902330489161]),
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 842, in assert_array_almost_equal
    precision=decimal)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 6 decimals

(mismatch 100.0%)
 x: array([ 4. ,  2. ,  7. ,  0.4,  0.5])
 y: array([ 4.379988,  2.433306,  8.002885,  0.510115,  0.51739 ])

======================================================================
FAIL: test_pearson (test_odr.TestODR)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/odr/tests/test_odr.py", line 236, in test_pearson
    np.array([5.4767400299231674, -0.4796082367610305]),
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 842, in assert_array_almost_equal
    precision=decimal)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 6 decimals

(mismatch 100.0%)
 x: array([ 1.,  1.])
 y: array([ 5.47674 , -0.479608])

======================================================================
FAIL: test_qhull.TestDelaunay.test_incremental('pathological-1-chunk-1',)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/spatial/tests/test_qhull.py", line 507, in check
    np.arange(points.shape[0]))
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 739, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 620, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

(shapes (79,), (81,) mismatch)
 x: array([ 0,  2,  3,  4,  5,  6,  7,  8,  9, 11, 12, 13, 14, 15, 16, 17, 18,
       19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
       36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,...
 y: array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
       34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,...

======================================================================
FAIL: test_qhull.TestUtilities.test_degenerate_barycentric_transforms
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/decorators.py", line 146, in skipper_func
    return f(*args, **kwargs)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/spatial/tests/test_qhull.py", line 296, in test_degenerate_barycentric_transforms
    assert_(bad_count < 20, bad_count)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 53, in assert_
    raise AssertionError(smsg)
AssertionError: 26

======================================================================
FAIL: test_bdtrc (test_basic.TestCephes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_basic.py", line 118, in test_bdtrc
    assert_equal(cephes.bdtrc(1,3,0.5),0.5)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 334, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: 0.50000000000000011
 DESIRED: 0.5

======================================================================
FAIL: test_bdtri (test_basic.TestCephes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_basic.py", line 115, in test_bdtri
    assert_equal(cephes.bdtri(1,3,0.5),0.5)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 334, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: 0.49999999999999994
 DESIRED: 0.5

======================================================================
FAIL: test_cosm1 (test_basic.TestCephes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_basic.py", line 214, in test_cosm1
    assert_equal(cephes.cosm1(0),0.0)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 326, in assert_equal
    raise AssertionError(msg)
AssertionError: 
Items are not equal:
 ACTUAL: -0.0
 DESIRED: 0.0

======================================================================
FAIL: test_data.test_boost(<Data for eval_legendre_ld: legendre_p_ipp-legendre_p>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_data.py", line 481, in _test_factory
    test.check(dtype=dtype)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/_testutils.py", line 292, in check
    assert_(False, "\n".join(msg))
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 53, in assert_
    raise AssertionError(smsg)
AssertionError: 
Max |adiff|: 7.49401e-16
Max |rdiff|: 7.92476e-14
Bad results (1 out of 140) for the following points (in output 0):
                          18.0             -0.8049191832542419 =>          -0.009106206044325216 !=          -0.009106206044324494  (rdiff          7.924759910919454e-14)

======================================================================
FAIL: test_data.test_boost(<Data for gammaincc: igamma_int_data_ipp-igamma_int_data>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_data.py", line 481, in _test_factory
    test.check(dtype=dtype)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/_testutils.py", line 292, in check
    assert_(False, "\n".join(msg))
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 53, in assert_
    raise AssertionError(smsg)
AssertionError: 
Max |adiff|: 1.21569e-14
Max |rdiff|: 4.27465e-14
Bad results (1 out of 140) for the following points (in output 0):
                          36.5                            73.0 =>          8.570090512692315e-07 !=          8.570090512692681e-07  (rdiff          4.274654382528594e-14)

======================================================================
FAIL: test_data.test_boost(<Data for gdtrc_: igamma_int_data_ipp-igamma_int_data>,)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_data.py", line 481, in _test_factory
    test.check(dtype=dtype)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/_testutils.py", line 292, in check
    assert_(False, "\n".join(msg))
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 53, in assert_
    raise AssertionError(smsg)
AssertionError: 
Max |adiff|: 1.21569e-14
Max |rdiff|: 4.27465e-14
Bad results (1 out of 140) for the following points (in output 0):
                          36.5                            73.0 =>          8.570090512692315e-07 !=          8.570090512692681e-07  (rdiff          4.274654382528594e-14)

======================================================================
FAIL: test_orthogonal.test_js_roots
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_orthogonal.py", line 371, in test_js_roots
    verify_gauss_quad(roots(68.9, 2.25), evalf(68.9, 2.25), 5, atol=2e-14)
  File "/nfs/galaxy/unixhome/jmiller/scipy-test/lib/python2.7/site-packages/scipy/special/tests/test_orthogonal.py", line 283, in verify_gauss_quad
    assert_allclose(vv, np.eye(N), rtol, atol)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 1297, in assert_allclose
    verbose=verbose, header=header)
  File "/nfs/galaxy/unixhome/jmiller/numpy-test/lib/python2.7/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-15, atol=2e-14

(mismatch 100.0%)
 x: array([[  1.000000e+00,  -2.932083e-14,   1.628550e-14,  -5.973276e-15,
         -1.360751e-15],
       [ -2.932083e-14,   1.000000e+00,  -1.985946e-14,   1.119072e-14,...
 y: array([[ 1.,  0.,  0.,  0.,  0.],
       [ 0.,  1.,  0.,  0.,  0.],
       [ 0.,  0.,  1.,  0.,  0.],...

----------------------------------------------------------------------
Ran 17005 tests in 117.640s

FAILED (KNOWNFAIL=97, SKIP=1181, failures=13)
<nose.result.TextTestResult run=17005 errors=0 failures=13>

However if I change "-O3" flag to "-O1" in both in both "numpy/distutils/intelcompiler.py" and "numpy/distutils/fcompiler/intel.py",  both libraries pass all tests.

Scipy is mostly written in fortran. So the issue is with the fortran compiler.

Thanks.

0 Kudos
0 Replies
Reply