Case Studies

The applicability of OpenAD as a tool for the automatic generation of robust and efficient adjoint code is best illustrated by a few example applications. We refer the reader to "Application" section in the manual (see under Documentation). We consider the following three example codes:
  1. an example from the MINPACK test suite, see manual section "Flow in a Driven Cavity"
  2. a box model for thermohaline circulation, see manual section "Box Model"
  3. a shallow water model, see manual section "Shallow Water Model"
In addition to what is explained in the manual regarding the Shallow Water Model we show here the relative discrepancies between an AD gradient and a finite difference approximation to the gradient as the plot below for a small setup with only 160 gradient elements.
shallow water FD AD relative discrepancy
The following table illustrates the relative effects of a sequence of various changes (as the capabilities of the OpenAD tool evolved) to the code generation on storage requirements and run time of the adjoint model. The blue numbers indicate a testing setup with with a 20x20 resolution, the green numbers refer to a setup with a 180x80 resolution.
sequence of changes to the adjoint model
run time
doubles tape storage requirements
comments
doubles
integers
strict joint mode (1 template);
trivial activity analysis;
checkpoint storage local to subroutine
3:39
143:37

9.803
317.803
30.574
1.080.754
a pure split mode is infeasible due to the implied memory requirements for the tape
2 level checkpointing (4 templates);
2:59
141:20
30.287
1.052.527
91.293
3.256.033
the low level subroutines in the call tree are handled by split mode, therefore the maximal size of the tape held at a particular point in time increases. Note in particular that the time for the 180x80 configuration does not decrease in this experiment as the data access dominates the run time
modified reversal for "simple" loops;
improved taping/checkpointing code;
0:45
46:02
30.287
1.052.527
7.794
259.854
in "simple" loops we avoid storing certain addresses
inter-procedural activity analysis
0:30
21:51
10.801
388.801
904
14.964
reducing the set of active variables, i.e. the amount of
values to be taped.

For the configuration that is of practical interest we show, as an example output, a map of sensitivities of zonal volume transport through the Drake Passage to changes in bottom topography everywhere in a barotropic ocean model (thanks to P. Heimbach).

OpenAD generate sensitivity map