Stalingrad Examples 2009

Run Times

Source Code

Source code of the examples, for the various languages and implementations
common particle saddle probabilistic-lambda-calculus probabilistic-prolog backprop
FF FR RF RR FF FR RF RR F R F R Fs Fv R
Stalingrad html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
adifor html
text
html
text
html
text
html
text
B B B html
text
html
text
html
text
B B B G B G B html
text
html
text
html
text
html
text
B
Tapenade html
text
html
text
R G R html
text
R G R G G G G html
text
html
text
html
text
html
text
html
text
html
text
adic R R R R R R R R G B G B html
text html
text html
text
html
text html
text html
text
B
adol-c R R R R R R R R G G G G html
text
html
text
html
text
CppAD R R R R R R R R G G G G html
text
B html
text
fadbad++ html
text
html
text
G G G html
text
G G G G G G G html
text
html
text
html
text
MLton html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
OCaml html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
sml/nj html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
ghc html
text
html
text
R R R html
text
R R R G R G R G G R
Bigloo html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
Chicken html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
Gambit html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
Ikarus html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
Larceny html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
MIT Scheme html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
MzC html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
MzScheme html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
Scheme->C html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text
scmutils html
text
html
text
B B B html
text
B B B html
text
B html
text
B html
text
B B
Stalin html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
html
text
G html
text

"scmutils" refers to MIT Scheme running the scmutils implementation of forward AD. "MIT Scheme" refers to MIT Scheme running the same implementation of AD as the other Scheme implementations. Many Scheme implementations do not allow redefinition of builtin arithmetic procedures. Thus the Scheme variants of our examples (except for scmutils) are written using alternate arithmetic procedures d+, d-, etc. scmutils incorrectly implements, or fails to implement, the overloaded versions of =, <=, zero?, and positive?. Thus the scmutils variants of our examples are written using alternate procedures d=, d<=, dzero?, and dpositive?. It is conjectured to be impossible to implement AD in ml in a fashion that applies to unmodified source code. Thus the ml variants of our examples require that (a) all code which implements the function whose derivative is taken, including all code called by such code, be syntactically nested inside the redefinition of the primitives and (b) all real constants in that code be syntactically wrapped with the BASE constructor. It is conjectured to be impossible to implement nestable forward AD in Haskell in a fashion that applies to unmodified source code. Thus the Haskell variants of our examples require that the code that implements the functions whose derivatives are taken be manually annotated with appropriate calls to lift to properly handle nesting. Code must be written with templates in fadbad++ to support taking derivatives of different orders. Code that is transformed by Tapenade multiple times must be post-edited. The flow analysis used by adifor yields incorrect derivative code that produces the wrong answer, without warning, when using the same file organization as all of the other variants, where each example is contained in a single file. Thus the adifor variants of our examples circumvent this flaw by manually partitioning each example into three files that contain the code that is transformed zero, one, and two times. Tapenade cannot transform code that relies on indirect (i.e., external) subroutine calls. Thus the Tapenade variants of our examples require manual specialization of the multivariate_argmin subroutine. We could not construct adic variants of particle-FF and saddle-FF because we were unsuccessful in getting adic to transform its own generated code. http://docs.lib.purdue.edu/ecetr/368 discusses the limitations of adifor, Tapenade, adic, and fadbad++ in greater detail. These AD-specific limitations of existing languages and systems are in addition to the standard limitations of languages like Fortran, c, and c++ relative to higher-order functional-programming languages. For example, since our particle and saddle examples make use of nested lambda expressions with lexically-scoped free variables to implement the potential function in particle and the nested minimax optimization in saddle, the adifor, Tapenade, and fadbad++ variants of these examples manually implement the requisite closures by way of common blocks in Fortran and global variables in c++.

Relevant Publications

  • Siskind, J.M. and Pearlmutter, B.A., `Perturbation Confusion and Referential Transparency: Correct Functional Implementation of Forward-Mode AD,' Draft Proceedings of the 17th International Workshop on Implementation and Application of Functional Languages (IFL2005), Dublin, Ireland, 19-21 September 2005.

  • Pearlmutter, B.A. and Siskind, J.M., `Lazy Multivariate Higher-Order Forward-Mode AD,' Proceedings of the 34th Annual Symposium on Principles of Programming Languages (POPL), pp. 155-60, Nice, France, 17-19 January 2007.

  • Siskind, J.M. and Pearlmutter, B.A., `First-Class Nonstandard Interpretations by Opening Closures,' Proceedings of the 34th Annual Symposium on Principles of Programming Languages (POPL), pp. 71-6, Nice, France, 17-19 January 2007.

  • Siskind, J.M. and Pearlmutter, B.A., `Using Polyvariant Union-Free Flow Analysis to Compile a Higher-Order Functional-Programming Language with a First-Class Derivative Operator to Efficient Fortran-like Code,' Technical Report TR-ECE-08-01, School of Electrical and Computer Engineering, Purdue University, 2008.

  • Siskind, J.M. and Pearlmutter, B.A., `Putting the Automatic Back into AD: Part I, What's Wrong,' Technical Report TR-ECE-08-02, School of Electrical and Computer Engineering, Purdue University, 2008.

  • Pearlmutter, B.A. and Siskind, J.M., `Putting the Automatic Back into AD: Part II, Dynamic, Automatic, Nestable, and Fast,' Technical Report TR-ECE-08-03, School of Electrical and Computer Engineering, Purdue University, 2008.

  • Pearlmutter, B.A. and Siskind, J.M., `Reverse-Mode AD in a Functional Framework: Lambda the Ultimate Backpropagator,' ACM Transactions on Programming Languages and Systems (TOPLAS), 30(2):1-36, April 2008.

  • Pearlmutter, B.A. and Siskind, J.M., `Using Programming Language Theory to Make AD Sound and Efficient,' Proceedings of the 5th International Conference on Automatic Differentiation (AD2008), pp. 79-90, Bonn, Germany, 11-15 August 2008.

  • Siskind, J.M. and Pearlmutter, B.A., `Nesting Forward-Mode AD in a Functional Framework,' Technical Report TR-ECE-08-09, School of Electrical and Computer Engineering, Purdue University, 2008.

  • Siskind, J.M. and Pearlmutter, B.A., `Nesting Forward-Mode AD in a Functional Framework,' Higher-Order and Symbolic Computation (HOSC), 21(4):361-76, December 2008.
    Parts of this web site were were written by Andrei Barbu, Shawn Brownfield, Anchal Dube, Barak A. Pearlmutter, and Jeffrey Mark Siskind.
    This material is based upon work supported by the National Science Foundation under Grant No. 0438806. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.