← Back to team overview

ffc team mailing list archive

Re: Large generated code

 

On 6 July 2011 13:17, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
> FFC can generated *very* large files with the tensor contraction
> approach, especially when auxiliary problems like error estimation are
> used. This makes compilation slow, and possibly fail.
>
> The array A in the generated code often has a lot of zeroes. Would it be
> sensible to
>
> 1. Initialise A to zero and then fill non-zero entries
>
>  // Initialise (size is known at runtime, so compiler can optimise)
>  for (unsigned int i = 0; i < size; ++i)
>      A[i] = 0.0;
>
>  // Nonzero terms of in
>  A[0]  = 1.0;
>  A[22] = 2.0;
>  A[23] = 1.0;

Yes.

>
> 2. Format floating point numbers for compactness, e.g.
>
>  A[0] = 0.0;
>  A[1] = 1.0;
>
> instead of
>
>  A[0] = 0.00000000000;
>  A[1] = 1.00000000000;

I think Martin recently changed the formatting of floats in UFL to
achieve this for the signatures.
We can do the same for floats in the code, although I don't know if it
will have implications with respect to the regression tests?
We currently lower the precision when running the tests to make it
work across multiple platforms, versions of Python etc. but this is
perhaps easy to adopt in the new format?

Kristian

> Garth
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp
>


Follow ups

References