← Back to team overview

dolfin team mailing list archive

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

 

On Mon, Mar 23, 2009 at 9:57 AM, A Navaei <axnavaei@xxxxxxxxxxxxxx> wrote:

> 2009/3/23 Matthew Knepley <knepley@xxxxxxxxx>:
> > On Mon, Mar 23, 2009 at 9:47 AM, A Navaei <axnavaei@xxxxxxxxxxxxxx>
> wrote:
> >>
> >> 2009/3/23 Matthew Knepley <knepley@xxxxxxxxx>:
> >> > I am going to agree with Garth here. There is no real difference. MTL4
> >> > uses the template engine to generate code. FFC uses Python. However,
> >> > both approaches only generate C++ code. They can be made equivalent
> >> > for any given problem. I am fairly sure the MTL guys would agree. I
> know
> >> > them very well.
> >>
> >> If you want to have a runtime code-generator which implements the
> >> features of compile-time template meta-programming one by one, such as
> >> loop unrolling, and in this way effectively end up with an equivalent;
> >> then the question is why re-inventing the wheel?
> >
> > Template programming is awful. I have done a lot of it. The programming
> > constructs that generate efficient code are non-intuitive and just about
> > undebuggable. This is the whole point behind conceptGCC (also by the MTL
> > guys). Templates are good at some jobs, but very very bad at others.
>
> Do you believe that these disadvantages are also applied to MTL?


Definitely. I have had error message that ran for almost 100 pages
programming
with Boost/MTL. Also, it is not good at choosing among algorithmic variants,
or
as good as it is choosing among data structures. I think it is a great
package, but
no one knows better than those guys the limits of template programming.
Andrew
even had a student working on a new formulation of templating not connected
to
the C++ mechanism for precisely these reasons.

  Matt


>
> -Ali
>
> >
> >   Matt
> >
> >>
> >> 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? Note that the form DSL can be still used with the
> >> latter approach and it's not specific to FFC.
> >>
> >>
> >> -Ali
> >>
> >> >
> >> >    Matt
> >> >
> >> >>
> >> >> -Ali
> >> >>
> >> >> >
> >> >> > Garth
> >> >> >
> >> >> >> Without having a concrete meta-programming implementation, it may
> be
> >> >> >> impossible to predict how much performance one would gain compared
> >> >> >> to
> >> >> >> FFC. However, MTL4 has been reported to be many times faster than
> >> >> >> code-generation means such as ATLAS.
> >> >> >>
> >> >> >> Based on this, are there any specific benefits in FFC
> >> >> >> code-generation
> >> >> >> which may not be covered by meta-programming?
> >> >> >>
> >> >> >>
> >> >> >> -Ali
> >> >> >> _______________________________________________
> >> >> >> DOLFIN-dev mailing list
> >> >> >> DOLFIN-dev@xxxxxxxxxx
> >> >> >> http://www.fenics.org/mailman/listinfo/dolfin-dev
> >> >> >
> >> >> >
> >> >> >
> >> >> _______________________________________________
> >> >> DOLFIN-dev mailing list
> >> >> DOLFIN-dev@xxxxxxxxxx
> >> >> http://www.fenics.org/mailman/listinfo/dolfin-dev
> >> >
> >> >
> >> >
> >> > --
> >> > What most experimenters take for granted before they begin their
> >> > experiments
> >> > is infinitely more interesting than any results to which their
> >> > experiments
> >> > lead.
> >> > -- Norbert Wiener
> >> >
> >
> >
> >
> > --
> > What most experimenters take for granted before they begin their
> experiments
> > is infinitely more interesting than any results to which their
> experiments
> > lead.
> > -- Norbert Wiener
> >
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener

References