Technical Essentials

OpenAD is an infrastructure for the development of source transformation tools for automatic differentiation (AD). Currently, there is a tool for generating tangent-linear and adjoint versions of numerical simulation programs written in a subset of Fortran 90. Work is underway to provide similar functionalities for C/C++ in the form of the next version of ADIC, that is built on OpenAD. Motivated by our main target application, the MIT general circulation model, the main focus has been on Fortran 90 so far.

The automatic generation of an adjoint of a given Fortran code involves a sequence of transformations guided by various syntactic and semantic rules. We use the Fortran 90 front-end of the open-source Open64 compiler collection to transform a given code into Open64's abstract intermediate representation called 'WHIRL'. The language-independent numerical kernel [ Hovland2002AXB, Utke2004SLD ] is extracted in the form of XAIF code that is syntactically defined by an XML schema. XAIF separates the numerical from the programming-language-specific features of the given code.

The semantic transformations that define the transition from the original code to its adjoint are performed by the software tool xaifBooster. It builds a C++ object image of the XAIF code and provides a convenient interface for programmers of AD algorithms [ Utke2003STI, Utke2004OAI, Naumann2004AIt ]. The tangent-linear and adjoint codes that are generated by xaifBooster use preaccumulation of local Jacobians [ Naumann2003CTL, Utke2005FBB ] followed by the propagation of directional derivatives or adjoints. The Jacobian accumulation code is based on a representation of relevant sections of the code (statements, basic blocks) as a directed acyclic computational graph with expressions for computing local partial derivatives attached to its edges. Vertex, edge, and face elimination techniques are applied to obtain an efficient derivative code. Moreover, linearities are eliminated at compile time [ Naumann2005OPE ]. The flow of control is reversed explicitly in the adjoint code [ Naumann2004CFR ]. Various reversal modes can be used at the call graph level allowing for the implementation of different checkpointing schemes as trade offs between storing vs. recomputing values required by the adjoint code.

The quality of the adjoint code generated by xaifBooster depends on semantic analyses of the code that can be performed at compile time. AD-specific static data-flow analyses [ Hascoet2005TAi ] are implemented in a programming-language-independent manner in the OpenAnalysis tool.

The semantically transformed XAIF code is translated back into WHIRL [ Fagan2003DaI ]. The unparser of Open64 is used in conjunction with various support tools to write out the final adjoint code in Fortran 90.

The tools and the vocabulary used in this extremely brief description are explained in the "Technical Details" section (see left frame). Further references to related publications on AD issues can be found in the OpenAD Bibliography. Feel free to contact us to learn more about the general approach as well as the algorithmic details and interesting open theoretical problems in the field.