It looks like my "fix" did not help. 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