Automatic Differentiation of C++ Codes for Large-Scale Scientific Computing

  • Roscoe A. Bartlett
  • David M. Gay
  • Eric T. Phipps
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3994)


We discuss computing first derivatives for models based on elements, such as large-scale finite-element PDE discretizations, implemented in the C++ programming language. We use a hybrid technique of automatic differentiation (AD) and manual assembly, with local element-level derivatives computed via AD and manually summed into the global derivative. C++ templating and operator overloading work well for both forward- and reverse-mode derivative computations. We found that AD derivative computations compared favorably in time to finite differencing for a scalable finite-element discretization of a convection-diffusion problem in two dimensions.


Application Code Residual Evaluation Derivative Computation Implicit Time Integration Manual Assembly 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Abate, J., Benson, S., Grignon, L., Hovland, P.D., McInnes, L.C., Norris, B.: Integrating AD with object-oriented toolkits for high-performance scientific computing. In: Corliss, G., Faure, C., Griewank, A., Hascoët, L., Naumann, U. (eds.) Automatic Differentiation of Algorithms: From Simulation to Optimization. Computer and Information Science, pp. 173–178. Springer, New York (2002)Google Scholar
  2. 2.
    Tijskens, E., Roose, D., Ramon, H., De Baerdemaeker, J.: Automatic differentiation for nonlinear partial differential equations: An efficient operator overloading approach. Numerical Algorithms 30, 259–301 (2002)MATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Griewank, A.: Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation. Frontiers in Appl. Math., vol. 19. SIAM, Philadelphia (2000)MATHGoogle Scholar
  4. 4.
    Aubert, P., Di Césaré, N., Pironneau, O.: Automatic differentiation in C++ using expression templates and application to a flow control problem. Computing and Visualisation in Sciences 3, 197–208 (2001)MATHCrossRefGoogle Scholar
  5. 5.
    Gay, D.M.: Semiautomatic differentiation for efficient gradient computations. In: Bücker, H.M., Corliss, G., Hovland, P., Naumann, U., Norris, B. (eds.) Automatic Differentiation: Applications, Theory, and Tools. Lecture Notes in Computational Science and Engineering. Springer, Heidelberg (2005)Google Scholar
  6. 6.
    Kee, R.J., Rupley, F.M., Miller, J.A., Coltrin, M.E., Grcar, J.F., Meeks, E., Moffat, H.K., Lutz, A.E., Dixon-Lewis, G., Smooke, M.D., Warnatz, J., Evans, G.H., Larson, R.S., Mitchell, R.E., Petzold, L.R., Reynolds, W.C., Caracotsios, M., Stewart, W.E., Glarborg, P., Wang, C., Adigun, O., Houf, W.G., Chou, C.P., Miller, S.F., Ho, P., Young, D.J.: CHEMKIN Release 4.0, San Diego, CA (2004)Google Scholar
  7. 7.
    Bischof, C.H., Carle, A., Khademi, P., Mauer, A.: ADIFOR 2.0: Automatic differentiation of Fortran 77 programs. IEEE Computational Science & Engineering 3(3), 18–32 (1996)CrossRefGoogle Scholar
  8. 8.
    Utke, J.: OpenAD: Algorithm implementation user guide. Technical Memorandum ANL/MCS–TM–274, Mathematics and Computer Science Division, Argonne National Laboratory, Argonne, Ill (2004)Google Scholar
  9. 9.
    Hascoët, L., Pascual, V.: TAPENADE 2.1 user’s guide. Rapport technique 300, INRIA, Sophia-Antipolis (2004)Google Scholar
  10. 10.
    Hughes, T.J.R., Franca, L.P., Hulbert, G.M.: A new finite element formulation for computational fluid dynamics: VIII. the Galerkin/least-squares method for advective-diffusive equations. Computational Methods Applied Mechanics and Engineering 73, 173–189 (1989)MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Roscoe A. Bartlett
    • 1
  • David M. Gay
    • 1
  • Eric T. Phipps
    • 1
  1. 1.Sandia National LaboratoriesAlbuquerqueUSA

Personalised recommendations