On 21 June 2010 23:16, Kent Andre <kent-...@simula.no> 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.
I had a look at the generated code from FFC and SyFi (which by the way is a real pain when PyDOLFIN is involved) and realised that your comparison is not fair. FFC uses the UFL algorithm estimate_total_polynomial_degree() to compute the quadrature_degree. SFC uses (in this case) the UFL algorithm estimate_quadrature_degree() which is less conservative. This results in FFC using 25 integration points to compute the integral while SFC just uses 3. If you use the option: parameters ["form_compiler"]["quadrature_degree"] = "2" the comparison is _more_ fair and the numbers are almost the same. SFC still uses 3 points, while FFC now uses 4 points which leads to my answer to your first question: "How should I optimize FFC?" :) https://blueprints.launchpad.net/ffc/+spec/simplex-quadrature 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-...@simula.no> 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@lists.launchpad.net >> > Unsubscribe : https://launchpad.net/~ffc >> > More help : https://help.launchpad.net/ListHelp >> > > > > _______________________________________________ Mailing list: https://launchpad.net/~ffc Post to : ffc@lists.launchpad.net Unsubscribe : https://launchpad.net/~ffc More help : https://help.launchpad.net/ListHelp