← Back to team overview

ffc team mailing list archive

FFC vs. SFC

 

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





Follow ups