On Tue, Feb 1, 2011 at 9:07 PM, Johan Hake <johan.h...@gmail.com> wrote: > It looks like my "fix" did not help.
It did indeed fix the problem with "print v[int64(0)]". The correct value (2.0) is printed out. The la unit tests reports a different error (I don't know if it's related): Testing basic PyDOLFIN linear algebra operations ------------------------------------------------ Running: MTL4Tester Calling FFC just-in-time (JIT) compiler, this may take some time. Calling FFC just-in-time (JIT) compiler, this may take some time. EE.. Running: PETScTester .Assertion failed: (dim <= 1), function size, file /Users/fenicsslave/jhbuildbot/fenics-src/dolfin/dolfin/la/PETScBaseMatrix.h, line 53. [buildbotmac:87844] *** Process received signal *** [buildbotmac:87844] Signal: Abort trap (6) [buildbotmac:87844] Signal code: (0) [buildbotmac:87844] [ 0] 2 libSystem.B.dylib 0x00007fff80f1235a _sigtramp + 26 [buildbotmac:87844] [ 1] 3 Python 0x0000000100088650 PyUnicodeUCS2_DecodeUnicodeEscape + 2608 [buildbotmac:87844] [ 2] 4 libSystem.B.dylib 0x00007fff80f8d9b4 __pthread_markcancel + 0 [buildbotmac:87844] [ 3] 5 libdolfin.0.dylib 0x00000001019d5689 _ZNK6dolfin11PETScMatrix4sizeEj + 121 [buildbotmac:87844] [ 4] 6 _cpp.so 0x0000000101583e7a _wrap_GenericTensor_size + 394 [buildbotmac:87844] [ 5] 7 Python 0x00000001000b88e3 PyEval_EvalFrameEx + 27571 [buildbotmac:87844] [ 6] 8 Python 0x00000001000b9af5 PyEval_EvalCodeEx + 2197 [buildbotmac:87844] [ 7] 9 Python 0x000000010003b4f5 function_call + 165 [buildbotmac:87844] [ 8] 10 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [ 9] 11 Python 0x000000010001de1d instancemethod_call + 365 [buildbotmac:87844] [10] 12 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [11] 13 Python 0x000000010007137b call_maybe + 315 [buildbotmac:87844] [12] 14 Python 0x000000010007308c slot_nb_multiply + 316 [buildbotmac:87844] [13] 15 Python 0x000000010000bbec binary_op1 + 156 [buildbotmac:87844] [14] 16 Python 0x000000010000e1d8 PyNumber_Multiply + 40 [buildbotmac:87844] [15] 17 Python 0x00000001000b404f PyEval_EvalFrameEx + 8991 [buildbotmac:87844] [16] 18 Python 0x00000001000b7eea PyEval_EvalFrameEx + 25018 [buildbotmac:87844] [17] 19 Python 0x00000001000b9af5 PyEval_EvalCodeEx + 2197 [buildbotmac:87844] [18] 20 Python 0x000000010003b5fd function_call + 429 [buildbotmac:87844] [19] 21 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [20] 22 Python 0x00000001000b3ec2 PyEval_EvalFrameEx + 8594 [buildbotmac:87844] [21] 23 Python 0x00000001000b9af5 PyEval_EvalCodeEx + 2197 [buildbotmac:87844] [22] 24 Python 0x000000010003b4f5 function_call + 165 [buildbotmac:87844] [23] 25 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [24] 26 Python 0x000000010001de1d instancemethod_call + 365 [buildbotmac:87844] [25] 27 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [26] 28 Python 0x000000010007523a slot_tp_call + 74 [buildbotmac:87844] [27] 29 Python 0x000000010000b902 PyObject_Call + 98 [buildbotmac:87844] [28] 30 Python 0x00000001000b4fee PyEval_EvalFrameEx + 12990 [buildbotmac:87844] [29] 31 Python 0x00000001000b9af5 PyEval_EvalCodeEx + 2197 [buildbotmac:87844] *** End of error message *** Abort trap Johannes > What we do is pretty simple and probaby error prone with different bit > architechtures. > > from dolfin/swig/typemaps.i: > > bool Py_uint_convert(PyObject* in, dolfin::uint& value) > { > if (!PyInteger_Check(in)) > return false; > long tmp = static_cast<long>(PyInt_AsLong(in)); > if (tmp<=0) > return false; > value = static_cast<dolfin::uint>(tmp); > return true; > } > > Here 'in' is the Python object that will be turned into an uint: value. > > I am happy for all suggestions on making thie typemap more robust. > > (I am not sure it is the typemap that causes the havoc but it sure looks like > it. For example: a 0 or 1 is turned into: 70378776) > > Johan > > On Tuesday February 1 2011 09:16:19 Johan Hake wrote: >> On Tuesday February 1 2011 08:38:02 Johannes Ring wrote: >> > On Tue, Feb 1, 2011 at 5:28 PM, Johan Hake <johan.h...@gmail.com> wrote: >> > > On Tuesday February 1 2011 04:02:03 Johannes Ring wrote: >> > >> The problem can be triggered by the following code: >> > >> >> > >> >> > >> >> > >> import dolfin >> > >> >> > >> from numpy import int64 >> > >> >> > >> >> > >> >> > >> v = dolfin.Vector(16) >> > >> >> > >> >> > >> >> > >> v[int(0)] = 2.0 >> > >> >> > >> print v[int(0)] >> > >> >> > >> >> > >> >> > >> v[int64(0)] = 2.0 >> > >> >> > >> print v[int64(0)] >> > >> >> > >> >> > >> >> > >> The output is: >> > >> >> > >> >> > >> >> > >> 2.0 >> > >> >> > >> 0.0 >> > >> >> > >> >> > >> >> > >> Can someone with access to a Mac try and see if they experience the >> > >> >> > >> same problem? >> > >> >> > >> >> > >> >> > >> Actually, I tried it now on my laptop (Lucid, 32 bit) and I got this >> > >> >> > >> error: >> > >> >>> print v[int64(0)] >> > >> >> > >> Traceback (most recent call last): >> > >> >> > >> File "<stdin>", line 1, in <module> >> > >> >> > >> File "/tmp/local/lib/python2.6/site-packages/dolfin/cpp.py", line >> > >> >> > >> 3648, in __getitem__ >> > >> >> > >> return _get_vector_single_item(self, indices) >> > >> >> > >> RuntimeError: index out of range >> > > >> > > It works on my 64 bit Maverick. I will see if I can find a sollution >> > > for 32 bits. Any suggestions on the fly? >> > >> > No, I don't know. >> > >> > >> It works fine when I revert back to revision 5604 (Johan's original >> > >> >> > >> 5618 was lost in a merge). >> > > >> > > Do you suggest that the error came in the original 5618 changeset? >> > >> > Yes, the Mac buildbot was green before your commit with this comment: >> > >> > "Added a typemap macro for std::vector (passed by value) = for any >> > Python sequence of scalars. = -- Enabled for value_shape, values >> > (Constant) and coloring_type" >> >> Interesting. I changed a int/float => int/uint/double conversion, from my >> own to using SWIGs built in type conversions. I have now changed back the >> typemaps for int and uint. Let see what Mr Macbot says! >> Johan >> >> > Build 1135 is green and build 1136 is red: >> > http://fenicsproject.org:8080/builders/dolfin-mac-osx/builds/1136 >> > http://fenicsproject.org:8080/builders/dolfin-mac-osx/builds/1135 >> > >> > Johannes >> > >> > > Johan >> > > >> > >> Johannes >> > >> >> > >> On Mon, Jan 31, 2011 at 10:19 AM, Johannes Ring <joha...@simula.no> >> >> wrote: >> > >> > The Python la unit test fails on the Mac buildbot with the following >> > >> > >> > >> > error after revision 5618. Any ideas? >> > >> > >> > >> > >> > >> > >> > >> > Johannes >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > Testing basic PyDOLFIN linear algebra operations >> > >> > >> > >> > ------------------------------------------------ >> > >> > >> > >> > >> > >> > >> > >> > Running: MTL4Tester >> > >> > >> > >> > Calling FFC just-in-time (JIT) compiler, this may take some time. >> > >> > >> > >> > Calling FFC just-in-time (JIT) compiler, this may take some time. >> > >> > >> > >> > ..F. >> > >> > >> > >> > Running: PETScTester >> > >> > >> > >> > ..F. >> > >> > >> > >> > Running: uBLASDenseTester >> > >> > >> > >> > ..F. >> > >> > >> > >> > Running: uBLASSparseTester >> > >> > >> > >> > ..F. >> > >> > >> > >> > ==================================================================== >> > >> > == >> > >> > >> > >> > FAIL: test_vector (__main__.MTL4Tester) >> > >> > >> > >> > -------------------------------------------------------------------- >> > >> > -- >> > >> > >> > >> > Traceback (most recent call last): >> > >> > File "test.py", line 162, in test_vector >> > >> > >> > >> > if org.owns_index(t(0)): self.assertAlmostEqual(org[t(0)], 2.0) >> > >> > >> > >> > AssertionError: 0.033607290958676872 != 2.0 within 7 places >> > >> > >> > >> > >> > >> > >> > >> > ==================================================================== >> > >> > == >> > >> > >> > >> > FAIL: test_vector (__main__.PETScTester) >> > >> > >> > >> > -------------------------------------------------------------------- >> > >> > -- >> > >> > >> > >> > Traceback (most recent call last): >> > >> > File "test.py", line 162, in test_vector >> > >> > >> > >> > if org.owns_index(t(0)): self.assertAlmostEqual(org[t(0)], 2.0) >> > >> > >> > >> > AssertionError: 0.2551242083622477 != 2.0 within 7 places >> > >> > >> > >> > >> > >> > >> > >> > ==================================================================== >> > >> > == >> > >> > >> > >> > FAIL: test_vector (__main__.uBLASDenseTester) >> > >> > >> > >> > -------------------------------------------------------------------- >> > >> > -- >> > >> > >> > >> > Traceback (most recent call last): >> > >> > File "test.py", line 162, in test_vector >> > >> > >> > >> > if org.owns_index(t(0)): self.assertAlmostEqual(org[t(0)], 2.0) >> > >> > >> > >> > AssertionError: 0.96740583429440807 != 2.0 within 7 places >> > >> > >> > >> > >> > >> > >> > >> > ==================================================================== >> > >> > == >> > >> > >> > >> > FAIL: test_vector (__main__.uBLASSparseTester) >> > >> > >> > >> > -------------------------------------------------------------------- >> > >> > -- >> > >> > >> > >> > Traceback (most recent call last): >> > >> > File "test.py", line 162, in test_vector >> > >> > >> > >> > if org.owns_index(t(0)): self.assertAlmostEqual(org[t(0)], 2.0) >> > >> > >> > >> > AssertionError: 0.23277614769655719 != 2.0 within 7 places >> > >> > >> > >> > >> > >> > >> > >> > -------------------------------------------------------------------- >> > >> > -- >> > >> > >> > >> > Ran 16 tests in 3.726s >> > >> > >> > >> > >> > >> > >> > >> > FAILED (failures=4) >> > >> > >> > >> > On Sun, Jan 30, 2011 at 4:00 AM, <build...@fenics.org> wrote: >> > >> >> The Buildbot has detected a new failure of dolfin-mac-osx on FEniCS >> > >> >> >> > >> >> Buildbot. Full details are available at: >> > >> >> http://fenicsproject.org:8080/builders/dolfin-mac-osx/builds/1136 >> > >> >> >> > >> >> Buildbot URL: http://fenicsproject.org:8080/ >> > >> >> >> > >> >> >> > >> >> >> > >> >> Buildslave for this Build: mac-osx >> > >> >> >> > >> >> >> > >> >> >> > >> >> Build Reason: >> > >> >> >> > >> >> Build Source Stamp: HEAD >> > >> >> >> > >> >> Blamelist: Johan Hake >> > >> >> >> > >> >> >> > >> >> >> > >> >> BUILD FAILED: failed dolfin check >> > >> >> >> > >> >> >> > >> >> >> > >> >> sincerely, >> > >> >> >> > >> >> -The Buildbot >> > >> >> >> > >> >> _______________________________________________ >> > >> >> >> > >> >> Mailing list: https://launchpad.net/~dolfin >> > >> >> >> > >> >> Post to : dolfin@lists.launchpad.net >> > >> >> >> > >> >> Unsubscribe : https://launchpad.net/~dolfin >> > >> >> >> > >> >> More help : https://help.launchpad.net/ListHelp >> > >> >> > >> _______________________________________________ >> > >> >> > >> Mailing list: https://launchpad.net/~dolfin >> > >> >> > >> Post to : dolfin@lists.launchpad.net >> > >> >> > >> Unsubscribe : https://launchpad.net/~dolfin >> > >> >> > >> More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp