← Back to team overview

ffc team mailing list archive

Re: Large generated code

 

On Wed, Jul 06, 2011 at 12:17:15PM +0100, Garth N. Wells 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;

We have done this before in various ways, either a simple loop as
above or using std::fill. It can be done again.

--
Anders


>   // Nonzero terms of in
>   A[0]  = 1.0;
>   A[22] = 2.0;
>   A[23] = 1.0;



> 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;
>
> Garth
>
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp


References