1 |
% $Header$ |
% $Header$ |
2 |
% $Name$ |
% $Name$ |
3 |
|
|
4 |
|
Author: Patrick Heimbach |
5 |
|
|
6 |
{\sf Automatic differentiation} (AD), also referred to as algorithmic |
{\sf Automatic differentiation} (AD), also referred to as algorithmic |
7 |
(or, more loosely, computational) differentiation, involves |
(or, more loosely, computational) differentiation, involves |
8 |
automatically deriving code to calculate |
automatically deriving code to calculate |
44 |
%********************************************************************** |
%********************************************************************** |
45 |
\section{Some basic algebra} |
\section{Some basic algebra} |
46 |
\label{sec_ad_algebra} |
\label{sec_ad_algebra} |
47 |
|
\begin{rawhtml} |
48 |
|
<!-- CMIREDIR:sec_ad_algebra: --> |
49 |
|
\end{rawhtml} |
50 |
%********************************************************************** |
%********************************************************************** |
51 |
|
|
52 |
Let $ \cal{M} $ be a general nonlinear, model, i.e. a |
Let $ \cal{M} $ be a general nonlinear, model, i.e. a |
681 |
%********************************************************************** |
%********************************************************************** |
682 |
\section{TLM and ADM generation in general} |
\section{TLM and ADM generation in general} |
683 |
\label{sec_ad_setup_gen} |
\label{sec_ad_setup_gen} |
684 |
|
\begin{rawhtml} |
685 |
|
<!-- CMIREDIR:sec_ad_setup_gen: --> |
686 |
|
\end{rawhtml} |
687 |
%********************************************************************** |
%********************************************************************** |
688 |
|
|
689 |
In this section we describe in a general fashion |
In this section we describe in a general fashion |
693 |
\input{part5/doc_ad_the_model} |
\input{part5/doc_ad_the_model} |
694 |
|
|
695 |
The basic flow is depicted in \ref{fig:adthemodel}. |
The basic flow is depicted in \ref{fig:adthemodel}. |
696 |
If CPP option {\tt ALLOW\_AUTODIFF\_TAMC} is defined, the driver routine |
If CPP option \texttt{ALLOW\_AUTODIFF\_TAMC} is defined, |
697 |
|
the driver routine |
698 |
{\it the\_model\_main}, instead of calling {\it the\_main\_loop}, |
{\it the\_model\_main}, instead of calling {\it the\_main\_loop}, |
699 |
invokes the adjoint of this routine, {\it adthe\_main\_loop}, |
invokes the adjoint of this routine, {\it adthe\_main\_loop} |
700 |
which is the toplevel routine in terms of automatic differentiation. |
(case \texttt{\#define ALLOW\_ADJOINT\_RUN}), or |
701 |
The routine {\it adthe\_main\_loop} has been generated by TAF. |
the tangent linear of this routine {\it g\_the\_main\_loop} |
702 |
|
(case \texttt{\#define ALLOW\_TANGENTLINEAR\_RUN}), |
703 |
|
which are the toplevel routines in terms of automatic differentiation. |
704 |
|
The routines {\it adthe\_main\_loop} or {\it g\_the\_main\_loop} |
705 |
|
are generated by TAF. |
706 |
It contains both the forward integration of the full model, the |
It contains both the forward integration of the full model, the |
707 |
cost function calculation, |
cost function calculation, |
708 |
any additional storing that is required for efficient checkpointing, |
any additional storing that is required for efficient checkpointing, |