← Back to team overview

ffc team mailing list archive

Re: FFC vs. SFC

 



On 21/06/10 17:29, Kristian Oelgaard 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.

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.

It looks like quadrature optimisations are already switched on,

. . . if the latest versions of ffc-dev and dolfin-dev are installed. There was a change in how the compiler options are passed.

Garth

but
you can try the other optimisations:

# 1
parameters["form_compiler"]["optimize"] = True
parameters["form_compiler"]["eliminate_zeros"] = True
parameters["form_compiler"]["precompute_ip_const"] = True

# 2
parameters["form_compiler"]["optimize"] = True
parameters["form_compiler"]["eliminate_zeros"] = True
parameters["form_compiler"]["precompute_basis_const"] = True

also try without the

parameters["form_compiler"]["eliminate_zeros"] = True

option.

Kristian

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



References