shunwang / numexpr

Automatically exported from code.google.com/p/numexpr
MIT License
0 stars 0 forks source link

Test failure of 1.4.2 on 32bit platforms #72

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Unit tests fails on 32 bit platforms.

numexpr v. 1.4.2

The error is generated by the following code:

x = zeros(1e5)+.01   # checks issue #41
assert_equal(evaluate("sum(x+2,axis=0)"), sum(x+2,axis=0))

See also
https://groups.google.com/group/numexpr/browse_thread/thread/bb777b53da34bbd0?hl
=it

Console output:

set -e -x;\
    for py in 2.6 2.7; do \
        cd /tmp/buildd/numexpr-1.4.2/build/lib.*-$py;\
        env PYTHONPATH=. python$py numexpr/tests/test_numexpr.py;\
        cd /tmp/buildd/numexpr-1.4.2/build/lib.*-$py-pydebug;\
        env PYTHONPATH=. python$py-dbg numexpr/tests/test_numexpr.py;\
    done
+ cd /tmp/buildd/numexpr-1.4.2/build/lib.linux-i686-2.6
+ env PYTHONPATH=. python2.6 numexpr/tests/test_numexpr.py
...F......F.....................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.....................................
.
.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.....................................
.
.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.....................................
.
.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.....................................
.
.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.....................................
.
.
................................................................................
....................................................................-=-=-=-=-=-=
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Numexpr version:   1.4.2
NumPy version:     1.5.1
Python version:    2.6.7 (r267:88850, Aug  3 2011, 15:19:01)
[GCC 4.6.1]
Platform:          linux2-i686
AMD/Intel CPU?     True
VML available?     False
Detected cores:    1
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
..
======================================================================
FAIL: test_reductions (__main__.test_numexpr1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "numexpr/tests/test_numexpr.py", line 76, in test_reductions
    assert_equal(evaluate("sum(x+2,axis=0)"), sum(x+2,axis=0))
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 256,
in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 686,
in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 618,
in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 100.0%)
 x: array(201000.00000017491)
 y: array(201000.00000000009)

======================================================================
FAIL: test_reductions (__main__.test_numexpr2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "numexpr/tests/test_numexpr.py", line 76, in test_reductions
    assert_equal(evaluate("sum(x+2,axis=0)"), sum(x+2,axis=0))
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 256,
in assert_equal
    return assert_array_equal(actual, desired, err_msg, verbose)
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 686,
in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/usr/lib/pymodules/python2.6/numpy/testing/utils.py", line 618,
in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 100.0%)
 x: array(201000.00000017491)
 y: array(201000.00000000009)

----------------------------------------------------------------------
Ran 5145 tests in 16.368s

FAILED (failures=2)

Original issue reported on code.google.com by a.valent...@gmail.com on 15 Feb 2012 at 8:30

GoogleCodeExporter commented 9 years ago
The following path was applied in debian packages to workaround the issue:

http://anonscm.debian.org/gitweb/?p=debian-science/packages/numexpr.git;a=blob;f
=debian/patches/0001-fix-unittests.patch;h=ae4ffc7bb33d48ecb3c668364adb10f58cd05
e64;hb=74ee7bb647d92066658d64d691d64e3aa8e3a7e1

Original comment by a.valent...@gmail.com on 22 Apr 2012 at 5:41

GoogleCodeExporter commented 9 years ago
As per:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.assert_approx_
equal.html

I'd say that it is better to use `assert_close` than `assert_approx_equal`.  
See 193acd1c79e5 changeset.

Original comment by fal...@gmail.com on 22 Apr 2012 at 10:09

GoogleCodeExporter commented 9 years ago
Yes, you are right.
Anyway, in the specific case of the debian package we chose to use 
assert_approx_equal that is also supported by numpy < 1.5.x.

Original comment by a.valent...@gmail.com on 23 Apr 2012 at 6:08