[SciPy-Dev] suitesparse vs scipy

Jack Howarth howarth at bromo.med.uc.edu
Tue Aug 30 12:59:12 EDT 2011


On Tue, Aug 30, 2011 at 01:32:09PM +0000, Pauli Virtanen wrote:
> Tue, 30 Aug 2011 08:55:15 -0400, Jack Howarth wrote:
> [clip]
> > On x86_64-apple-darwin11, building scypy 0.9.0 against python2.7
> > using the clang compilers and gfortran from FSF gcc 4.6.1, I get the following
> > testsuite results...
> [clip]
> > ======================================================================
> > FAIL: test_dot (test_blas.TestFBLAS1Simple)
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >   File
> >   "/sw/lib/python2.7/site-packages/scipy/lib/blas/tests/test_blas.py",
> >   line 67, in test_dot
> >     assert_almost_equal(f([3,-4,5],[2,5,1]),-9)
> >   File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line
> >   468, in assert_almost_equal
> >     raise AssertionError(msg)
> > AssertionError:
> > Arrays are not almost equal to 7 decimals
> >  ACTUAL: 0.0
> >  DESIRED: -9
> 
> Does Numpy's test suite pass?

On x86_64-apple-darwin10, numpy passes its testsuite...

[frodo:~] howarth% python2.7
Python 2.7.2 (default, Aug  4 2011, 09:22:24) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.test()
Running unit tests for numpy
NumPy version 1.6.0
NumPy is installed in /sw/lib/python2.7/site-packages/numpy
Python version 2.7.2 (default, Aug  4 2011, 09:22:24) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
nose version 1.1.2
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................../sw/lib/python2.7/site-packages/numpy/core/numeric.py:1920: RuntimeWarning: invalid value encountered in absolute
  return all(less_equal(absolute(x-y), atol + rtol * absolute(y)))
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................K.................................................................................................K......................K...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 3529 tests in 34.328s

OK (KNOWNFAIL=3, SKIP=1)
<nose.result.TextTestResult run=3529 errors=0 failures=0>
>>> 

whereas on x86_64-apple-darwin11 (building with clang), numpy fails...

[GCC 4.2.1 Compatible Apple Clang 2.1 (tags/Apple/clang-163.7.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.test()
Running unit tests for numpy
NumPy version 1.6.0
NumPy is installed in /sw/lib/python2.7/site-packages/numpy
Python version 2.7.2 (default, Jul 21 2011, 22:39:54) [GCC 4.2.1 Compatible Apple Clang 2.1 (tags/Apple/clang-163.7.1)]
nose version 1.1.2
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.........................................................................................................................................................................................................................................................................................................................................................................................................................K.................................................................................................K......................K...........FFFFFFF...F./sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py:364: RuntimeWarning: invalid value encountered in sqrt
  z = np.sqrt(np.array(np.complex(-np.inf, np.nan)))
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
======================================================================
FAIL: Test basic arithmetic function errors
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/numpy/testing/decorators.py", line 215, in knownfailer
    return f(*args, **kwargs)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_numeric.py", line 321, in test_floating_exceptions
    lambda a,b:a/b, ft_tiny, ft_max)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_numeric.py", line 271, in assert_raises_fpe
    "Type %s did not raise fpe error '%s'." % (ftype, fpeerr))
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 34, in assert_
    raise AssertionError(msg)
AssertionError: Type <type 'numpy.complex64'> did not raise fpe error ''.

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, 1, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, -1, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, 0.0, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, -0.0, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, inf, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, -inf, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, nan, inf, inf, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array((inf+infj))

======================================================================
FAIL: test_umath_complex.TestCsqrt.test_special_values(<ufunc 'sqrt'>, -inf, 1, 0.0, inf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sw/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/sw/lib/python2.7/site-packages/numpy/core/tests/test_umath_complex.py", line 578, in check_complex_value
    assert_equal(f(z1), z2)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 256, in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 707, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 605, in assert_array_compare
    chk_same_position(x_id, y_id, hasval='nan')
  File "/sw/lib/python2.7/site-packages/numpy/testing/utils.py", line 588, in chk_same_position
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

x and y nan location mismatch:
 x: array([ nan+infj])
 y: array(infj)

----------------------------------------------------------------------
Ran 3529 tests in 38.236s

FAILED (KNOWNFAIL=3, SKIP=1, failures=9)
<nose.result.TextTestResult run=3529 errors=0 failures=9>

In both cases (darwin10 and darwin11), the blas used is from /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate.

http://developer.apple.com/performance/accelerateframework.html

I doubt the system blas is at fault and more likely this is an issue with the clang compilers. I know python required an explicit
addition of -fwrapv since its test for that option is confused by clang. Perhaps numpy/scipy requires -fwrapv as well?
         Jack

> 
> Either the BLAS you linked Scipy against is broken, or there are some
> compatibility problems due to compilers or mixing compiler versions.
> 
> You could check which libraries your `fblas.so` and `cblas.so` in the
> Scipy installation are linked against. I've never used OSX, though,
> so I do not know how to do this there. You can see the same information
> in the beginning of the build logs, though.
> 
> Maybe someone who is more familiar than me with OSX knows more.
> 
> -- 
> Pauli Virtanen
> 
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev



More information about the SciPy-Dev mailing list