← Back to team overview

dolfin team mailing list archive

Re: src/demo/fem/python/demo.py ffc jit error

 

On Tue, Jan 15, 2008 at 06:36:07PM +0100, Ola Skavhaug wrote:
> Anders Logg skrev den 15/01-2008 følgende:
> > On Tue, Jan 15, 2008 at 05:47:11PM +0100, Kent-Andre Mardal wrote:
> > > 
> > > tir, 15.01.2008 kl. 15.16 +0100, skrev Ola Skavhaug:
> > > > I have all the most recent versions of the FEniCS modules. However (or perhaps
> > > > therefore), I get the following error when running the python demo under
> > > > demo/fem:
> > > > 
> > > > skavhaug@blakken:~/devel/dolfin/src/demo/fem/python$ python demo.py 
> > > > Found form in cache, reusing previously built module (checksum
> > > > 5a01ea61f6a36a6c4cf3d35fe9d4f1e9)
> > > > Traceback (most recent call last):
> > > >   File "demo.py", line 36, in <module>
> > > >     A, dofmapset_a = assemble(stiff, mesh)
> > > >   File
> > > > "/home/skavhaug/extsoft/lib/python2.5/site-packages/dolfin/assemble.py", line
> > > > 24, in assemble
> > > >     (compiled_form, module, form_data) = jit(form)
> > > >   File "/usr/lib/python2.5/site-packages/ffc/jit/jit.py", line 80, in jit
> > > >     exec("import %s as compiled_module" % (md5sum + "_module"))
> > > >   File "<string>", line 1, in <module>
> > > > ImportError: No module named form_5a01ea61f6a36a6c4cf3d35fe9d4f1e9_module
> > > > 
> > > > 
> > > > By some reason ffc thinks I have this form cached, but can't import it. Is
> > > > there a directory I should add to PYTHONPATH? The most elegant solution would
> > > > perhaps be that ffc adds the correct path to sys.path in Python?
> > > > 
> > > > Ola
> > > 
> > > Try to remove the cache, 
> > > rm -r /tmp/instant $HOME/.instant
> > > 
> > > I am not sure where ffc has its cache. 
> > > 
> > > Kent
> > 
> > Just run
> > 
> >   ffc-clean
> > 
> > If you press ctrl-c when running the JIT compiler, it will break the
> > next time since it will think it has generated the code before (which
> > it didn't since you pressed ctrl-c). This needs to be fixed but I
> > haven't gotten to it yet.
> 
> Thanks, it fixed the problem.
> 
> However, the src/demo/fem/python/demo.py script looks to be out of sync with
> PyDOLFIN:
> 
> Line 37: 
> A, dofmapset_a = assemble(stiff, mesh)
> should be
> A = assemble(stiff, mesh)
> 
> Similar on line 38.
> 
> Line 55 / 56:
> Traceback (most recent call last):
>   File "demo.py", line 55, in <module>
>     A0.set(A0_array, 4, position, 4, position)
>   File "/home/skavhaug/extsoft/lib/python2.5/site-packages/dolfin/dolfin.py",
> line 2418, in set
>     return _dolfin.Matrix_set(*args)
> TypeError: Matrix_set() takes exactly 4 arguments (6 given)
> 
> Should be:
> A0.set(A0_array, position, position)
> M0.set(M0_array, position, position)
> 
> At last, line 51 should read (for cross platform reasons):
> position = numpy.array([0, 1, 2, 3], 'uint32')
> 
> 
> Ola

Thanks, works fine now (but with 'I' instead of 'uint32').

Kristian made a good job before Christmas porting quite a few of the
C++ demos to Python. There are still a few demos left to be fixed:

  find src/demo -name '*.py' | xargs grep WORKING

-- 
Anders


Follow ups

References