[SciPy-dev] Re: scipy / SGI MIPSpro compiler (part 3)

Steve M. Robbins steven.robbins at videotron.ca
Sun Aug 25 23:19:37 EDT 2002


On Sun, Aug 25, 2002 at 01:32:27PM -0500, Pearu wrote:

> I am just ignoring these failures as they may be due to too strict 
> conditions for estimating the success of the statistical methods in stats. 
> Sometimes the random data for testing functions is not very favorable..

Interesting.  Okay, so I'll ignore the stats failures and the two
failures due to no "cblas" module.  That leaves me with
three failures to consider.


======================================================================
FAIL: check_asum (test_blas.test_fblas1_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy/linalg/tests/test_blas.py", line 59, in check_asum
    assert_almost_equal(f([3,-4,5]),12)
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy_base/testing.py", line 283, in assert_almost_equal
    assert round(abs(desired - actual),decimal) == 0, msg
AssertionError: 
Items are not equal:
DESIRED: 12
ACTUAL: 0.0

The failure comes from sasum() -- the single precision version.
The code using dasum() works OK.


======================================================================
FAIL: check_dot (test_blas.test_fblas1_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy/linalg/tests/test_blas.py", line 66, in check_dot
    assert_almost_equal(f([3,-4,5],[2,5,1]),-9)
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy_base/testing.py", line 283, in assert_almost_equal
    assert round(abs(desired - actual),decimal) == 0, msg
AssertionError: 
Items are not equal:
DESIRED: -9
ACTUAL: 0.0

Same pattern: sdot() fails, but ddot() works.


======================================================================
FAIL: check_nrm2 (test_blas.test_fblas1_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy/linalg/tests/test_blas.py", line 75, in check_nrm2
    assert_almost_equal(f([3,-4,5]),math.sqrt(50))
  File "/usr/local/unstable/lib/python2.1/site-packages/scipy_base/testing.py", line 283, in assert_almost_equal
    assert round(abs(desired - actual),decimal) == 0, msg
AssertionError: 
Items are not equal:
DESIRED: 7.07106781187
ACTUAL: 3.73560645334e+270

Same again: snrm2() fails but dnrm2() works.


I figure there is something systematically wrong with the single
precision wrappers.  But I don't know what it could be --- some
of them appear to work: saxpy, sscal, isamax.

I tried a small test case in the style of f2py's tests/f77 for a
"sasum"-like function (see below).  It works fine.  However, in this
test case, I just use the default f2py-generated signature file.  It
turns out to be quite different from the signature for sasum() in
linalg/fblas.pyf.  For one thing, the f2py-generated files create a C
wrapper in which "f2py_func" returns void and has an extra "float*"
parameter (presumably to return the value) while the fblas.pyf version
returns float.

But I'm way out of my depth now.  Is there some strange linker
problem with "extern float" functions?

-Steve


__usage__ = """
Run:
  python test_asum.py [<f2py options>]
Examples:
  python test_asum.py --fcompiler=Gnu --no-wrap-functions
  python test_asum.py --quiet
"""


import f2py2e
import sys
f2py_opts = ' '.join(sys.argv[1:])

try:
    import ext_test_asum
except ImportError:
    assert not f2py2e.compile('''\
       function t0(n,sx)
         integer n
         real sx(*),stemp
         do 10 i = 1,n,1
           stemp = stemp + abs(sx(i))
10       continue
         t0 = stemp
       end
       function t4(n,sx)
         integer n
         real*4 sx(*),stemp
         do 20 i = 1,n,1
           stemp = stemp + abs(sx(i))
20       continue
         t4 = stemp
       end
''','ext_test_asum',f2py_opts,source_fn='test_asum.f')

from ext_test_asum import t0,t4
from Numeric import array



def runtest(t):
    if t in [t0,t4]:
        err = 1e-5
    else:
        err = 0.0

    print t(3,[1,-2,3])
    assert t(3,[3,-4,5]) == 12


for t in [t0,t4]:
    runtest(t)

print 'ok'





More information about the SciPy-Dev mailing list