Firedrake: combining symbolic and computational mathematics for high performance, high productivity simulation

Dr David Ham, Imperial College London. Part of the applied mathematics seminar

There is a productivity problem in simulation science. Creating simulation code which deploys advanced numerical methods on complex PDEs coupled to sophisticated solvers and preconditioners is laborious, tedious, and error-prone. Far too many PhD students and researchers spend most of their time re-implementing and debugging known techniques rather than advancing their research goals, and the high cost of implementation impedes innovation: the first approach attempted, however poor, is frequently the only attempt as the resources required to try again are unavailable. As with many productivity problems across the economy, the root problem here is that processes which could and should be automated are instead being done by hand.
 
Numerically solving a PDE has two components: mathematically deriving the discrete computation, and then the actual calculation. The prevailing approach in scientific computing is to derive by hand and then code the calculation. However, this approach neglects  the fact that the tools required to have a computed conduct symbolic mathematics are well-established. Firedrake, in contrast, brings together computer algebra with scientific computing to deliver a system which automates the numerical solution of PDEs by the finite element method. The user with a PDE to solve specifies the weak form of that equation in high level mathematical notation, including the choices of function spaces, boundary and initial conditions. Firedrake generates, compiles, and executes high performance parallel C code implementations of the discrete operators. The resulting linear and nonlinear systems are solved with the user-programmable and symbolically composable PETSc system. The symbolic interface to the solver system enables sophisticated operator preconditioners to be generated symbolically on the fly. The code generation layer employs advanced compiler technology which generates algorithmically optimal vectorised implementations which would be prohibitively complex to code by hand. Firedrake also composes with higher level tools which can exploit its symbolic reasoning capabilities to, for example, automatically execute the adjoint to a simulation.
 
In this talk I will present the core automated mathematical approach of the Firedrake and discuss in some detail recent advances in algorithmically optimal operator generation and hybridising solver capabilities.