second order adjoints with the nag fortran 95 compiler
play

Second Order Adjoints with the NAG Fortran 95 Compiler Uwe Naumann, - PowerPoint PPT Presentation

Second Order Adjoints with the NAG Fortran 95 Compiler Uwe Naumann, Michael Maier RWTH Aachen, Germany Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, UK riehme@stce.rwth-aachen.de May 22, 2007 Outline COMPAD-II


  1. Second Order Adjoints with the NAG Fortran 95 Compiler Uwe Naumann, Michael Maier RWTH Aachen, Germany Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, UK riehme@stce.rwth-aachen.de May 22, 2007

  2. Outline COMPAD-II 1 Tangent linear mode by parsetree manipulation 2 Adjoint code generation 3 Second Order Adjoints 4 Outlook 6 Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 2 / 29

  3. COMPAD-II Followup of COMPAD-I project (2002-2004) Funded be EPSRC and QinetiQ Duration : 2006/10 – 2008/10 2 full time (Dima, me) + 1 student (Micheal) Target (A): COMPAD : Compiler AD / Adjoints robust adjoint compiler based on the NAGWare Fortran 95 compiler simple checkpointing of loops Target (B) : ADAC : Automatic Differentiation of Assembler Code differentiate a top-level function given as assembler code control file specifies independent and dependend variables coupling with NAGWare Fortran 95 compiler to get second order adjoints based on source transformation only but this is the sound of the future Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 3 / 29

  4. COMPAD-II Followup of COMPAD-I project (2002-2004) Funded be EPSRC and QinetiQ Duration : 2006/10 – 2008/10 2 full time (Dima, me) + 1 student (Micheal) Target (A): COMPAD : Compiler AD / Adjoints robust adjoint compiler based on the NAGWare Fortran 95 compiler simple checkpointing of loops Target (B) : ADAC : Automatic Differentiation of Assembler Code differentiate a top-level function given as assembler code control file specifies independent and dependend variables coupling with NAGWare Fortran 95 compiler to get second order adjoints based on source transformation only but this is the sound of the future Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 3 / 29

  5. COMPAD-II Followup of COMPAD-I project (2002-2004) Funded be EPSRC and QinetiQ Duration : 2006/10 – 2008/10 2 full time (Dima, me) + 1 student (Micheal) Target (A): COMPAD : Compiler AD / Adjoints robust adjoint compiler based on the NAGWare Fortran 95 compiler simple checkpointing of loops Target (B) : ADAC : Automatic Differentiation of Assembler Code differentiate a top-level function given as assembler code control file specifies independent and dependend variables coupling with NAGWare Fortran 95 compiler to get second order adjoints based on source transformation only but this is the sound of the future Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 3 / 29

  6. COMPAD-II — Basic setup Modified NAGWare Fortran 95 compiler with builtin AD Provide a (couple of) COMPAD MODULE (s) defining a COMPAD TYPE Any source code compiled with the a -ad flag get differentiated, no special top-level routine, no changes required by the user passive driver program, explicitely using a COMPAD MODULE , all active variables have to be of COMPAD TYPE Two modes: Tangent linear mode by compiler generated overloading adjoint mode with compiler generated adjoint code (source trafo) Two flavors each selected by choosing a specific COMPAD MODULE : pure mode with scalar adjoints derived mode where values and adjoints are represented by derived types Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 4 / 29

  7. COMPAD-II — Basic setup Modified NAGWare Fortran 95 compiler with builtin AD Provide a (couple of) COMPAD MODULE (s) defining a COMPAD TYPE Any source code compiled with the a -ad flag get differentiated, no special top-level routine, no changes required by the user passive driver program, explicitely using a COMPAD MODULE , all active variables have to be of COMPAD TYPE Two modes: Tangent linear mode by compiler generated overloading adjoint mode with compiler generated adjoint code (source trafo) Two flavors each selected by choosing a specific COMPAD MODULE : pure mode with scalar adjoints derived mode where values and adjoints are represented by derived types Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 4 / 29

  8. COMPAD-II — Basic setup Modified NAGWare Fortran 95 compiler with builtin AD Provide a (couple of) COMPAD MODULE (s) defining a COMPAD TYPE Any source code compiled with the a -ad flag get differentiated, no special top-level routine, no changes required by the user passive driver program, explicitely using a COMPAD MODULE , all active variables have to be of COMPAD TYPE Two modes: Tangent linear mode by compiler generated overloading adjoint mode with compiler generated adjoint code (source trafo) Two flavors each selected by choosing a specific COMPAD MODULE : pure mode with scalar adjoints derived mode where values and adjoints are represented by derived types Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 4 / 29

  9. COMPAD MODULE s and COMPAD TYPE s For pure mode COMPAD MODULE has to provide Derived type COMPAD TYPE with double precision component val Adjoint mode: COMPAD TYPE with additional drv (double) Overloaded operators and intrinsic functions for the COMPAD TYPE A COMPAD MODULE for the derived mode has to provide COMPAD TYPE with component val of arbitrary VALUE TYPE Overloaded operators and intrinsic functions for the COMPAD TYPE Adjoint mode: COMPAD TYPE with additional component drv of arbitrary DERIV TYPE Overloaded operators and intrinsic funcitions for the DERIV TYPE Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 5 / 29

  10. COMPAD MODULE s and COMPAD TYPE s For pure mode COMPAD MODULE has to provide Derived type COMPAD TYPE with double precision component val Adjoint mode: COMPAD TYPE with additional drv (double) Overloaded operators and intrinsic functions for the COMPAD TYPE A COMPAD MODULE for the derived mode has to provide COMPAD TYPE with component val of arbitrary VALUE TYPE Overloaded operators and intrinsic functions for the COMPAD TYPE Adjoint mode: COMPAD TYPE with additional component drv of arbitrary DERIV TYPE Overloaded operators and intrinsic funcitions for the DERIV TYPE Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 5 / 29

  11. COMPAD-II — Current status Overloading mode MINPACK-II , scalar valued problems only working, that is gradients are correct need to replace statement functions (deprecated feature) with internal subprograms by hand CNS - code from J¨ org Stiller, TU Dresden 10000 lines of Fortran 95 code uses allocatable arrays and other Fortran 95 features derivatives checked against divided differences Runtime: factor 12 with gcc and factor 4 with Intel C compiler Adjoint mode we have just started very simple test programs (Rosenbrock function) works just one MINPACK-II problems tested / works (Elastic plastic torsion) Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 6 / 29

  12. COMPAD-II — Current status Overloading mode MINPACK-II , scalar valued problems only working, that is gradients are correct need to replace statement functions (deprecated feature) with internal subprograms by hand CNS - code from J¨ org Stiller, TU Dresden 10000 lines of Fortran 95 code uses allocatable arrays and other Fortran 95 features derivatives checked against divided differences Runtime: factor 12 with gcc and factor 4 with Intel C compiler Adjoint mode we have just started very simple test programs (Rosenbrock function) works just one MINPACK-II problems tested / works (Elastic plastic torsion) Uwe Naumann, Michael Maier RWTH Aachen, Germany[1ex] Bruce Christianson, Dmitrij Gendler, Jan Riehme University of Hertfordshire, Second Order Adjoints with the NAG Fortran 95 Compiler May 22, 2007 6 / 29

Recommend


More recommend