
Hi, I just tried to port my code to the new SciPy (scipy 0.4.7.1715 / numpy 0.9.7.2248). I got some problems with weave which are usually hard to track down. So I looked at the tests: scipy.test(10, 10) runs without any errors. But I was really surprised when I got a few errors running: scipy.weave.test(1) Found 16 tests for scipy.weave.slice_handler Found 0 tests for scipy.weave.c_spec Found 9 tests for scipy.weave.build_tools Found 0 tests for scipy.weave.inline_tools Found 1 tests for scipy.weave.ast_tools Found 0 tests for scipy.weave.wx_spec Found 2 tests for scipy.weave.blitz_tools building extensions here: /home/bittrich/.python23_compiled/m15 Found 1 tests for scipy.weave.ext_tools Found 3 tests for scipy.weave.standard_array_spec Found 26 tests for scipy.weave.catalog Found 74 tests for scipy.weave.size_check Found 0 tests for __main__ ................warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations ...warning: specified build_dir '..' does not exist or is not writable. Trying default locations ..warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations ...warning: specified build_dir '..' does not exist or is not writable. Trying default locations .....F....copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmpIvzGBO copying /tmp/tmpIvzGBO/linux223compiled_catalog -> /home/bittrich/.python23_compiled .........copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmpvpgFD0 copying /tmp/tmpvpgFD0/linux223compiled_catalog -> /home/bittrich/.python23_compiled .copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmp2Mm4v7 copying /tmp/tmp2Mm4v7/linux223compiled_catalog -> /home/bittrich/.python23_compiled ............removing '/tmp/tmp2vO62Qcat_test' (and everything under it) Exception bsddb._db.DBNoSuchFileError: <bsddb._db.DBNoSuchFileError instance at 0x4a279bec> in ignored .removing '/tmp/tmpuIJkqocat_test' (and everything under it) .............................E..E........E................EEEE............. ====================================================================== ERROR: check_1d_3 (scipy.weave.tests.test_size_check.test_dummy_array_indexing) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 207, in check_1d_3 if nx.which[0] != "numarray": AttributeError: 'module' object has no attribute 'which' ====================================================================== ERROR: check_1d_6 (scipy.weave.tests.test_size_check.test_dummy_array_indexing) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 214, in check_1d_6 if nx.which[0] != "numarray": AttributeError: 'module' object has no attribute 'which' ====================================================================== ERROR: through a bunch of different indexes at it for good measure. ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 265, in check_1d_random self.generic_1d('a[%s:%s:%s]' %(beg,end,step)) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 174, in generic_1d self.generic_wrap(a,expr) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 164, in generic_wrap desired = array(eval(expr).shape) File "<string>", line 0, in ? ValueError: slice step cannot be zero ====================================================================== ERROR: through a bunch of different indexes at it for good measure. ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 289, in check_2d_random self.generic_2d(expr) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 177, in generic_2d self.generic_wrap(a,expr) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 164, in generic_wrap desired = array(eval(expr).shape) File "<string>", line 0, in ? ValueError: slice step cannot be zero ====================================================================== ERROR: through a bunch of different indexes at it for good measure. ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 303, in check_3d_random self.generic_3d(expr) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 180, in generic_3d self.generic_wrap(a,expr) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 164, in generic_wrap desired = array(eval(expr).shape) File "<string>", line 0, in ? ValueError: slice step cannot be zero ====================================================================== ERROR: check_calculated_index (scipy.weave.tests.test_size_check.test_expressions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 410, in check_calculated_index size_check.check_expr(expr,locals()) File "/usr/lib/python2.3/site-packages/weave/size_check.py", line 52, in check_expr exec(expr,values) File "<string>", line 1, in ? NameError: name 'a' is not defined ====================================================================== ERROR: check_calculated_index2 (scipy.weave.tests.test_size_check.test_expressions) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 415, in check_calculated_index2 size_check.check_expr(expr,locals()) File "/usr/lib/python2.3/site-packages/weave/size_check.py", line 52, in check_expr exec(expr,values) File "<string>", line 1, in ? NameError: name 'a' is not defined ====================================================================== FAIL: check_type_match_array (scipy.weave.tests.test_standard_array_spec.test_array_converter) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_standard_array_spec.py", line 40, in check_type_match_array assert(s.type_match(arange(4))) AssertionError ---------------------------------------------------------------------- Ran 132 tests in 0.804s FAILED (failures=1, errors=7) I wondered why there is no such test already in scipy.test(10, 10). I also tried scipy.weave.test(10, 10). That test really takes a long time and breaks with a segmentation fault. Using gdb I got: [...] None .file changed None .file changed None after and after2 should be equal in the following before, after, after2: 2 3 3 .file changed None .file changed None .file changed None .file changed None hash: 123 .file changed None ..file changed None /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp:648: error: parse error before `!' token /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7942.cpp:648: error: parse error before `!' token Efile changed None /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp:648: error: parse error before `!' token /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_47e62d08f4ce8af8a6c67863d921b7943.cpp:648: error: parse error before `!' token Efile changed None .file changed None .file changed None .file changed None .file changed None .file changed None .file changed None .file changed None Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1075425408 (LWP 23435)] 0x400cde50 in clearerr () from /lib/tls/libc.so.6 (gdb) (gdb) bt #0 0x400cde50 in clearerr () from /lib/tls/libc.so.6 #1 0x08079725 in PyDict_DelItemString () #2 0x0807b5b5 in PyObject_Print () #3 0x4363f962 in compiled_func (self=0x0, args=0x0) at object.h:175 #4 0x080fde6a in PyCFunction_Call () #5 0x0805b989 in PyObject_Call () #6 0x080ab5c7 in PyEval_CallObjectWithKeywords () #7 0x080a0df6 in _PyBuiltin_Init () #8 0x080fde6a in PyCFunction_Call () #9 0x080ab834 in PyEval_CallObjectWithKeywords () #10 0x080a9bee in Py_MakePendingCalls () #11 0x080ab96d in PyEval_CallObjectWithKeywords () #12 0x080ab72c in PyEval_CallObjectWithKeywords () #13 0x080a9bee in Py_MakePendingCalls () #14 0x080aa77c in PyEval_EvalCodeEx () #15 0x080ab8e9 in PyEval_CallObjectWithKeywords () #16 0x080ab72c in PyEval_CallObjectWithKeywords () #17 0x080a9bee in Py_MakePendingCalls () #18 0x080aa77c in PyEval_EvalCodeEx () #19 0x080ab8e9 in PyEval_CallObjectWithKeywords () #20 0x080ab72c in PyEval_CallObjectWithKeywords () #21 0x080a9bee in Py_MakePendingCalls () #22 0x080aa77c in PyEval_EvalCodeEx () #23 0x080fd9b7 in PyStaticMethod_New () #24 0x0805b989 in PyObject_Call () #25 0x080623d8 in PyMethod_Fini () #26 0x0805b989 in PyObject_Call () #27 0x080aba52 in PyEval_CallObjectWithKeywords () #28 0x080ab6b9 in PyEval_CallObjectWithKeywords () #29 0x080a9bee in Py_MakePendingCalls () #30 0x080aa77c in PyEval_EvalCodeEx () #31 0x080fd9b7 in PyStaticMethod_New () #32 0x0805b989 in PyObject_Call () #33 0x080623d8 in PyMethod_Fini () #34 0x0805b989 in PyObject_Call () #35 0x0808e6fb in _PyObject_SlotCompare () #36 0x0805b989 in PyObject_Call () #37 0x080aba52 in PyEval_CallObjectWithKeywords () #38 0x080ab6b9 in PyEval_CallObjectWithKeywords () #39 0x080a9bee in Py_MakePendingCalls () #40 0x080aa77c in PyEval_EvalCodeEx () #41 0x080fd9b7 in PyStaticMethod_New () #42 0x0805b989 in PyObject_Call () #43 0x080623d8 in PyMethod_Fini () #44 0x0805b989 in PyObject_Call () #45 0x0808e6fb in _PyObject_SlotCompare () #46 0x0805b989 in PyObject_Call () #47 0x080aba52 in PyEval_CallObjectWithKeywords () #48 0x080ab6b9 in PyEval_CallObjectWithKeywords () #49 0x080a9bee in Py_MakePendingCalls () I am using Debian Sarge and have already installed the patch glibc package. So there are no problems with weave while using old scipy (debian stable package). Best regards, Lars

Lars Bittrich wrote:
Hi,
I just tried to port my code to the new SciPy (scipy 0.4.7.1715 / numpy 0.9.7.2248). I got some problems with weave which are usually hard to track down. So I looked at the tests:
scipy.test(10, 10)
runs without any errors. But I was really surprised when I got a few errors running:
scipy.weave.test(1)
Found 16 tests for scipy.weave.slice_handler Found 0 tests for scipy.weave.c_spec Found 9 tests for scipy.weave.build_tools Found 0 tests for scipy.weave.inline_tools Found 1 tests for scipy.weave.ast_tools Found 0 tests for scipy.weave.wx_spec Found 2 tests for scipy.weave.blitz_tools building extensions here: /home/bittrich/.python23_compiled/m15 Found 1 tests for scipy.weave.ext_tools Found 3 tests for scipy.weave.standard_array_spec Found 26 tests for scipy.weave.catalog Found 74 tests for scipy.weave.size_check Found 0 tests for __main__ ................warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations ...warning: specified build_dir '..' does not exist or is not writable. Trying default locations ..warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations ...warning: specified build_dir '..' does not exist or is not writable. Trying default locations .....F....copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmpIvzGBO copying /tmp/tmpIvzGBO/linux223compiled_catalog -> /home/bittrich/.python23_compiled .........copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmpvpgFD0 copying /tmp/tmpvpgFD0/linux223compiled_catalog -> /home/bittrich/.python23_compiled .copying /home/bittrich/.python23_compiled/linux223compiled_catalog -> /tmp/tmp2Mm4v7 copying /tmp/tmp2Mm4v7/linux223compiled_catalog -> /home/bittrich/.python23_compiled ............removing '/tmp/tmp2vO62Qcat_test' (and everything under it) Exception bsddb._db.DBNoSuchFileError: <bsddb._db.DBNoSuchFileError instance at 0x4a279bec> in ignored .removing '/tmp/tmpuIJkqocat_test' (and everything under it) .............................E..E........E................EEEE............. ====================================================================== ERROR: check_1d_3 (scipy.weave.tests.test_size_check.test_dummy_array_indexing) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/cp/lib/python2.3/site-packages/scipy/weave/tests/test_size_check.py", line 207, in check_1d_3 if nx.which[0] != "numarray": AttributeError: 'module' object has no attribute 'which'
These weave tests have apparently not been checked because they are not updated. Why don't you let us know what problems you are having with weave directly. I've fixed the tests in SVN for this particular problem now.
I wondered why there is no such test already in scipy.test(10, 10). I also tried scipy.weave.test(10, 10). That test really takes a long time and breaks with a segmentation fault. Using gdb I got:
weave is tested separately. There may still be lingering issues with weave as my once-twice over of it may have missed a couple of things in specific corners. Please let us know what trouble you are having. -Travis

Hi again, On Friday 24 March 2006 20:22, Travis Oliphant wrote: [...]
Please let us know what trouble you are having.
finally I have isolated a very strange behavior. Sorry about the delay but I was not able to answer during the weekend. My code example looks as follows: ------------------------------------------------------------------------------ from scipy import * from scipy.weave import inline,converters N = 10 arr = zeros(N, Float) factor = sqrt(1./pi) #factor = pi code= \ """ double tmp = 1.0; for (int i=0; i < N; i++) { arr(i) = tmp*factor; } """ inline(code, ['arr', 'N', 'factor'], type_converters = converters.blitz) print arr ------------------------------------------------------------------------------ When I run that file I get: ------------------------------------------------------------------------------ <weave: compiling> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: ambiguous overload for 'operator*' in 'tmp * factor' /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: candidates are: operator*(double, double) <built-in> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: operator*(double, float) <built-in> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: operator*(double, int) <built-in> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp: In function `PyObject* compiled_func(PyObject*, PyObject*)': /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: ambiguous overload for 'operator*' in 'tmp * factor' /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: candidates are: operator*(double, double) <built-in> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: operator*(double, float) <built-in> /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp:715: error: operator*(double, int) <built-in> Traceback (most recent call last): File "test.py", line 18, in ? inline(code, ['arr', 'N', 'factor'], type_converters = converters.blitz) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/inline_tools.py", line 334, in inline auto_downcast = auto_downcast, File "/opt/cp/lib/python2.3/site-packages/scipy/weave/inline_tools.py", line 442, in compile_function verbose=verbose, **kw) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/ext_tools.py", line 353, in compile verbose = verbose, **kw) File "/opt/cp/lib/python2.3/site-packages/scipy/weave/build_tools.py", line 274, in build_extension setup(name = module_name, ext_modules = [ext],verbose=verb) File "/opt/cp/lib/python2.3/site-packages/numpy/distutils/core.py", line 85, in setup return old_setup(**new_attr) File "/usr/lib/python2.3/distutils/core.py", line 166, in setup raise SystemExit, "error: " + str(msg) scipy.weave.build_tools.CompileError: error: Command "g++ -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wstrict-prototypes -fPIC -I/opt/cp/lib/python2.3/site-packages/scipy/weave -I/opt/cp/lib/python2.3/site-packages/scipy/weave/scxx -I/opt/cp/lib/python2.3/site-packages/scipy/weave/blitz -I/opt/cp/lib/python2.3/site-packages/numpy/core/include -I/usr/include/python2.3 -c /home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.cpp -o /tmp/bittrich/python23_intermediate/compiler_cae5f1e251cd037a19f0234c558d6f0e/home/bittrich/.python23_compiled/sc_42e1646ad2085e8e2fc33f53a826fe5a0.o" failed with exit status 1 ------------------------------------------------------------------------------ Uncommenting 'factor = pi' it simply works fine. Even if I remove that line once again and leave the c part unchanged so that there is no recompile needed, the program just works. Now I have found a solution for me. I just have to add some line like: double tmpfactor = factor; and do not use 'factor' again in the code. But that behavior remains odd in my eyes. Maybe it has something to do with my compiler. Maybe I can try the newest svn-version of scipy during the next few days. I will keep reporting anything alike. Thank you for your help. Best regards, Lars
participants (2)
-
Lars Bittrich
-
Travis Oliphant