← Back to team overview

ffc team mailing list archive

Re: FFC vs. SFC

 

On 22 June 2010 13:07, Johannes Ring <johannr@xxxxxxxxx> wrote:
> On Tue, Jun 22, 2010 at 11:40 AM, Kristian Oelgaard
> <k.b.oelgaard@xxxxxxxxx> wrote:
>> On 21 June 2010 23:16, Kent Andre <kent-and@xxxxxxxxx> wrote:
>>>
>>> Strange. I used dorsal to compile the dev versions of the various
>>> packages. Dolfin, ffc, and sfc are only a few days old.
>>
>> I removed fenics-syfi and cloned a new one, then I got a little
>> further but crashed on swiginac, I removed the python-swiginac 1.5.1-2
>> which I got through synaptic and had Dorsal install swiginac 1.5.1
>> (thank you Dorsal!) after which the demo.py file ran without
>> complaints.
>
> What was the problem with python-swiginac? I'm maintaining the package
> in Debian so I would be interested to know about any problems with it
> (also in Ubuntu).

I got the error:

Traceback (most recent call last):
  File "demo.py", line 16, in <module>
    V = FunctionSpace(mesh, "CG", 1)
  File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/function/functionspace.py",
line 230, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/function/functionspace.py",
line 44, in __init__
    ufc_element, ufc_dofmap = jit(self._ufl_element)
  File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.py",
line 44, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.py",
line 103, in jit
    return jit_compile(form, parameters=p, common_cell=common_cell)
  File "/home/oelgaard/software/fenics/fenics-syfi/local/lib/python2.6/site-packages/sfc/jit.py",
line 149, in jit
    hfilenames, cfilenames = generate_code(ufl_elements + formdatas,
None, parameters)
  File "/home/oelgaard/software/fenics/fenics-syfi/local/lib/python2.6/site-packages/sfc/codegeneration/codegeneration.py",
line 348, in generate_code
    erep = ElementRepresentation(e, quad_rule, options, element_reps,
common_cell)
  File "/home/oelgaard/software/fenics/fenics-syfi/local/lib/python2.6/site-packages/sfc/representation/elementrepresentation.py",
line 165, in __init__
    self.cell = UFCCell(self.polygon)
  File "/home/oelgaard/software/fenics/fenics-syfi/local/lib/python2.6/site-packages/sfc/geometry/UFCCell.py",
line 82, in __init__
    self.vertices        = [matrix(self.nsd, 1, polygon.vertex(i)) for
i in range(self.num_vertices)]
  File "/usr/lib/pymodules/python2.6/swiginac.py", line 1542, in __init__
    this = _swiginac.new_matrix(*args)
ValueError: Cannot convert type to ex.

It looks like we need to update some modules to work with the latest swiginac.

Kristian


> Johannes
>
>> Kristian
>>
>>> But do you have any suggestions for how to optimize the FFC generated
>>> code ? I have used quadrature here, tensor representation is not good
>>> in this application.
>>>
>>> Kent
>>>
>>>
>>> On Mon, 2010-06-21 at 23:05 +0200, Kristian Oelgaard wrote:
>>>> I tried to run the code against the dev versions of FEniCS and got the
>>>> following error after successfully finishing the FFC part:
>>>>
>>>> Traceback (most recent call last):
>>>>   File "demo.py", line 15, in <module>
>>>>     V = FunctionSpace(mesh, "CG", 1)
>>>>   File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/function/functionspace.py",
>>>> line 230, in __init__
>>>>     FunctionSpaceBase.__init__(self, mesh, element)
>>>>   File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/function/functionspace.py",
>>>> line 44, in __init__
>>>>     ufc_element, ufc_dofmap = jit(self._ufl_element)
>>>>   File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.py",
>>>> line 44, in mpi_jit
>>>>     return local_jit(*args, **kwargs)
>>>>   File "/home/oelgaard/software/fenics/dolfin/local/lib/python2.6/site-packages/dolfin/compilemodules/jit.py",
>>>> line 87, in jit
>>>>     p = form_compiler.default_parameters()
>>>> AttributeError: 'module' object has no attribute 'default_parameters'
>>>>
>>>> Kristian
>>>>
>>>> On 21 June 2010 15:42,  <kent-and@xxxxxxxxx> wrote:
>>>> >
>>>> > Hi, just portet SFC to dolfin-dev and ufl-dev and made some simple
>>>> > comparisons with FFC. I
>>>> > don't know exactly how representative these are, but I thought I'd try to
>>>> > compare
>>>> > them for fun.
>>>> >
>>>> > I have used the following code:
>>>> >
>>>> > from dolfin import *
>>>> > import time
>>>> >
>>>> > for compiler in ["ffc", "sfc"]:
>>>> >
>>>> >    for N in [200, 400, 800]:
>>>> >
>>>> >        parameters["form_compiler"]["name"]=compiler
>>>> >        if compiler == "ffc":
>>>> >            parameters["form_compiler"]["optimize"] = True
>>>> >            parameters ["form_compiler"]["cpp_optimize"] = True
>>>> >
>>>> >        mesh = UnitSquare(N, N)
>>>> >        V = FunctionSpace(mesh, "CG", 1)
>>>> >
>>>> >        P=6
>>>> >        U = Function(V)
>>>> >        energy = U**6*(U*U + inner(grad(U), grad(U)))*dx
>>>> >
>>>> >        v = TestFunction(V)
>>>> >        u = TrialFunction(V)
>>>> >
>>>> >        F = derivative(energy, U, v)
>>>> >        J = derivative(F, U, u)
>>>> >
>>>> >        print ""
>>>> >        print "First time"
>>>> >        print ""
>>>> >        t0 = time.time()
>>>> >        A = assemble(J)
>>>> >        t1 = time.time()
>>>> >        print "First time for ", compiler, " was ", t1 - t0
>>>> >
>>>> >        print ""
>>>> >        print "Second time"
>>>> >        print ""
>>>> >        t0 = time.time()
>>>> >        A = assemble(J)
>>>> >        t1 = time.time()
>>>> >
>>>> >        print "Second time for ", compiler, " was ", t1 - t0
>>>> >
>>>> >
>>>> > With these options SFC is about 3 times faster than FFC. How should I
>>>> > optimize FFC ?
>>>> >
>>>> > Kent
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Mailing list: https://launchpad.net/~ffc
>>>> > Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>>>> > Unsubscribe : https://launchpad.net/~ffc
>>>> > More help   : https://help.launchpad.net/ListHelp
>>>> >
>>>
>>>
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~ffc
>> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~ffc
>> More help   : https://help.launchpad.net/ListHelp
>>
>



Follow ups

References