← Back to team overview

ffc team mailing list archive

Re: JIT compile strangeness

 


Anders Logg wrote:
> On Tue, Feb 02, 2010 at 12:08:51PM +0000, Harish Narayanan wrote:
>> On 02/02/2010 11:29, Marie Rognes wrote:
>>> More compile strangeness:  Clean cache, error at first run,
>>> things running at second run:
>>>
>>> meg@localhost ~/local/src/fenics/adaptivity/demo $ instant-clean
>>> Instant cache is empty
>>> meg@localhost ~/local/src/fenics/adaptivity/demo $ python test.py
>>> Calling FFC just-in-time (JIT) compiler, this may take some time.
>>> Traceback (most recent call last):
>>>  File "test.py", line 6, in <module>
>>>    L = assemble(v*dx)
>>>  File
>>> "/home/meg/local/lib64/python2.6/site-packages/dolfin/fem/assemble.py",
>>> line 88, in assemble
>>>    dolfin_form = Form(form, function_spaces, coefficients,
>>> form_compiler_parameters)
>>>  File
>>> "/home/meg/local/lib64/python2.6/site-packages/dolfin/fem/form.py", line
>>> 39, in __init__
>>>    function_spaces)
>>>  File
>>> "/home/meg/local/lib64/python2.6/site-packages/dolfin/fem/form.py", line
>>> 60, in _extract_function_spaces
>>>    if not isinstance(func.function_space(), cpp.FunctionSpace):
>>> AttributeError: 'Argument' object has no attribute 'function_space'
>>> meg@localhost ~/local/src/fenics/adaptivity/demo $ python test.py
>>> L =  <PETScVector of size 24>
>>>
>>> Anyone else experience this?
>>>
>>> from dolfin import *
>>> mesh = UnitSquare(2,2)
>>> V_h = FunctionSpace(mesh, "DG", 1)
>>> v = TestFunction(V_h)
>>> L = assemble(v*dx)
>>> print "L = ", L
>> Me, me, me! :)
>>
>> Harish
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~ffc
>> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~ffc
>> More help   : https://help.launchpad.net/ListHelp
> 
> This is fixed now. It was an intricate caching problem relating to
> reuse of the dummy form v*dx that FFC creates when JIT compiling
> elements (for use in DOLFIN FunctionSpace).
> 
> I fixed it by making sure FormData is not cached when compiling
> elements but a proper solution (removal of the FFC dummy form) should
> be implemented instead. I've added a FIXME in jit.py.
> 

This works for Marie's form, but the it's broken for the below form.

Garth


from dolfin import *
from numpy import random

mesh = UnitSquare(24, 24)
n = FacetNormal(mesh)
V = FunctionSpace(mesh, "DG", 1)
v = TestFunction(V)
u = Function(V)

# Fill vector with some numbers
random.seed(2)
u.vector().set_local( random.rand(u.vector().size()) )

flux = variable(grad(u))

L2 = dot(jump(v, n), avg(flux))*dS
print "Norm case 2 (using variable): ", assemble(L2).norm("l2")


> --
> Anders
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp





References