Part 2: Implementation via Prepreprocessor
暂无分享,去创建一个
We describe an implementation of the FARFEL FORTRAN AD extensions (Radul et al., 2012). These extensions integrate forward and reverse AD directly into the programming model, with attendant benefits to flexibilit y, modularity, and ease of use. The implementation we describe is a "prepreprocessor" that generates input to existing F ORTRAN-based AD tools. In essence, blocks of code which are targeted for AD by FARFEL constructs are put into subprograms which capture their lexical variable context, and these are closure-converted into top -level subprograms and specialized to eliminate EXTERNAL arguments, rendering them amenable to existing AD preprocessors, which are then invoked, possibly repeatedly if the AD is nested.
[1] John McCarthy,et al. Recursive functions of symbolic expressions and their computation by machine, Part I , 1959, Commun. ACM.
[2] Barak A. Pearlmutter,et al. Using Programming Language Theory to Make Automatic Differentiation Sound and Efficient , 2008 .
[3] Thomas Johnsson,et al. Lambda Lifting: Treansforming Programs to Recursive Equations , 1985, FPCA.
[4] Andreas Griewank,et al. ADIFOR - Generating Derivative Codes form Fortran Programs , 1992, Sci. Program..