← Back to team overview

dolfin team mailing list archive

Re: Generic meta-programming, faster than form compiler?

 

On Mon, Mar 23, 2009 at 02:47:19PM +0000, A Navaei wrote:

> [snip]
> 
> The compile-time has the benefit of avoiding double-compilation (lib +
> jit) and implementing a code generator. Whether the above concepts are
> the same or not, my original question is still unanswered: what's the
> benefit of FFC runtime code-generation over compile-time template
> meta-programming?

1. The benefit is that FFC (and other form compilers like SFC) can do
*domain-specific* optimizations that no compiler in the world can
manage. On top of this, the C++ code generated by FFC is handed to GCC
for compilation which allows GCC to perform any number of generic
optimizations.

2. It's not a question about run-time vs compile-time code
generation. Both FFC and template meta-programming generate code at
compile-time:

  ffc myform.form && g++ -o myprogram myprogram.cpp

The DOLFIN JIT compiler allows this to happen at run-time (with
efficient caching of previously generated code) but that's just a
feature.

3. Matt's comments on templates are valid. I don't want to touch
templates unless I have to. I have never seen a compiler template
error message I could understand (but I've learnt to recognize a
few). It would be a terrible nightmare to implement even a tiny bit of
FFC in C++. Python is ideal for that kind of stuff.

4. Matrix insertion already dominates assembly (it didn't before FFC)
so it makes little sense to invest resources in reimplementing the
form evaluation using templates until (i) it's been proved that
templates may improve the performance for at least one simple
example and (ii) the insertion bottle-neck has been removed.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


References