Optimized code generation for finite element local assembly using symbolic manipulation

Automated code generators for finite element local assembly have facilitated exploration of alternative implementation strategies within generated code. However, even for a theoretical performance indicator such as operation count, an optimal strategy for local assembly is unknown. We explore a code generation strategy based on symbolic integration and polynomial common subexpression elimination (CSE). We present our implementation of a local assembly code generator using these techniques. We systematically evaluate the approach, measuring operation count, execution time and numerical error using a benchmark suite of synthetic variational forms, comparing against the FEniCS Form Compiler (FFC). Our benchmark forms span complexities chosen to expose the performance characteristics of different code generation approaches. We show that it is possible with additional computational cost, to consistently achieve much of, and sometimes substantially exceed, the performance of alternative approaches without compromising precision. Although the approach of using symbolic integration and CSE for optimizing local assembly is not new, we distinguish our work through our strategies for maintaining numerical precision and detecting common subexpressions. We discuss the benefits of the symbolic approach for inferring numerical relationships, and analyze the relationship to other proposed techniques which also have greater computational complexity than those of FFC.

[1]  Garth N. Wells,et al.  Optimizations for quadrature representations of finite element tensors through automated code generation , 2011, TOMS.

[2]  Ryan Kastner,et al.  Optimizing Polynomial Expressions by Algebraic Factorization and Common Subexpression Elimination , 2006, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.

[3]  Richard Kreckel,et al.  Introduction to the GiNaC Framework for Symbolic Computation within the C++ Programming Language , 2000, J. Symb. Comput..

[4]  Paul S. Wang,et al.  FINGER: A Symbolic System for Automatic Generation of Numerical Programs in Finite Element Analysis , 1986, J. Symb. Comput..

[5]  W. Bangerth,et al.  deal.II—A general-purpose object-oriented finite element library , 2007, TOMS.

[6]  Andy R. Terrel,et al.  Topological Optimization of the Evaluation of Finite Element Matrices , 2012, SIAM J. Sci. Comput..

[7]  James R. Slagle,et al.  A Heuristic Program that Solves Symbolic Integration Problems in Freshman Calculus , 1963, JACM.

[8]  Moshe Dubiner Spectral methods on triangles and other domains , 1991 .

[9]  Robert C. Kirby,et al.  Geometric Optimization of the Evaluation of Finite Element Matrices , 2007, SIAM J. Sci. Comput..

[10]  A. Bruaset,et al.  A Comprehensive Set of Tools for Solving Partial Differential Equations; Diffpack , 1997 .

[11]  Jack J. Dongarra,et al.  Collecting Performance Data with PAPI-C , 2009, Parallel Tools Workshop.

[12]  Richard J. Fateman,et al.  A Review of Macsyma , 1989, IEEE Trans. Knowl. Data Eng..

[13]  Anders Logg,et al.  Unified framework for finite element assembly , 2009, Int. J. Comput. Sci. Eng..

[14]  MICHAEL M. WOLF,et al.  Combinatorial Optimization of Matrix-Vector Multiplication in Finite Element Assembly , 2009, SIAM J. Sci. Comput..

[15]  Anders Logg,et al.  A compiler for variational forms , 2006, TOMS.

[16]  Kent-André Mardal,et al.  On the efficiency of symbolic computations combined with code generation for finite element methods , 2010, TOMS.

[17]  G. Karniadakis,et al.  Spectral/hp Element Methods for Computational Fluid Dynamics , 2005 .

[18]  Robert C. Kirby,et al.  Algorithm 839: FIAT, a new paradigm for computing finite element basis functions , 2004, TOMS.

[19]  Steven J. Harrington A New Symbolic Integration System in Reduce , 1979, Comput. J..