Skip to main content

AD in Fortran: Implementation via Prepreprocessor

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computational Science and Engineering ((LNCSE,volume 87))

Abstract

We describe an implementation of the Farfel Fortran77 AD extensions (Radul et al. AD in Fortran, Part 1: Design (2012), http://arxiv.org/abs/1203.1448). These extensions integrate forward and reverse AD directly into the programming model, with attendant benefits to flexibility, modularity, and ease of use. The implementation we describe is a “prepreprocessor” that generates input to existing Fortran-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 arguments, rendering them amenable to existing AD preprocessors, which are then invoked, possibly repeatedly if the AD is nested.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   109.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Backus, J.W., Bauer, F.L., Green, J., Katz, C., McCarthy, J., Naur, P., Perlis, A.J., Rutishauser, H., Samelson, K., Vauquois, B., Wegstein, J.H., van Wijngaarden, A., Woodger, M.: Revised report on the algorithmic language ALGOL 60. The Computer Journal 5(4), 349–367 (1963). DOI 10.1093/comjnl/5.4.349

    Google Scholar 

  2. Bischof, C.H., Carle, A., Corliss, G.F., Griewank, A., Hovland, P.D.: ADIFOR: Generating derivative codes from Fortran programs. Scientific Programming 1(1), 11–29 (1992)

    Google Scholar 

  3. Hascoët, L., Pascual, V.: TAPENADE 2.1 user’s guide. Rapport technique 300, INRIA, Sophia Antipolis (2004). URL http://www.inria.fr/rrrt/rt-0300.html

  4. Johnsson, T.: Lambda lifting: Transforming programs to recursive equations. In: Functional Programming Languages and Computer Architecture. Springer Verlag, Nancy, France (1985)

    Google Scholar 

  5. Naumann, U., Riehme, J.: A differentiation-enabled Fortran 95 compiler. ACM Transactions on Mathematical Software 31(4), 458–474 (2005). URL http://doi.acm.org/10.1145/1114268.1114270

    Google Scholar 

  6. Pearlmutter, B.A., Siskind, J.M.: Using programming language theory to make automatic differentiation sound and efficient. In: C.H. Bischof, H.M. Bücker, P.D. Hovland, U. Naumann, J. Utke (eds.) Advances in Automatic Differentiation, Lecture Notes in Computational Science and Engineering, vol. 64, pp. 79–90. Springer, Berlin (2008). DOI 10.1007/ 978-3-540-68942-3{ _}8

    Google Scholar 

  7. Radul, A., Pearlmutter, B.A., Siskind, J.M.: AD in Fortran, Part 1: Design (2012). URL http://arxiv.org/abs/1203.1448

  8. Siskind, J.M., 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. Tech. Rep. TR-ECE-08-01, School of Electrical and Computer Engineering, Purdue University, West Lafayette, IN, USA (2008). URL http://docs.lib.purdue.edu/ecetr/367

Download references

Acknowledgements

This work was supported, in part, by Science Foundation Ireland grant 09/IN.1/I2637, National Science Foundation grant CCF-0438806, Naval Research Laboratory Contract Number N00173-10-1-G023, and Army Research Laboratory Cooperative Agreement Number W911NF-10-2-0060. Any views, opinions, findings, conclusions, or recommendations contained or expressed in this document or material are those of the authors and do not necessarily reflect or represent the views or official policies, either expressed or implied, of SFI, NSF, NRL, ONR, ARL, or the Irish or U.S. Governments. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexey Radul .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Radul, A., Pearlmutter, B.A., Siskind, J.M. (2012). AD in Fortran: Implementation via Prepreprocessor. In: Forth, S., Hovland, P., Phipps, E., Utke, J., Walther, A. (eds) Recent Advances in Algorithmic Differentiation. Lecture Notes in Computational Science and Engineering, vol 87. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-30023-3_25

Download citation

Publish with us

Policies and ethics