Skip to main content
QUICK REVIEW

[Paper Review] Building the Tangent and Adjoint codes of the Ocean General Circulation Model OPA with the Automatic Differentiation tool TAPENADE

Moulay Hicham Tber, Laurent Hascoët|ArXiv.org|Nov 28, 2007
Reservoir Engineering and Simulation MethodsEngineering10 citations
TL;DR

This paper presents the automatic generation of tangent and adjoint models for the OPA ocean general circulation model using the TAPENADE automatic differentiation tool. By applying reverse-mode AD and the Griewank-Walther binomial checkpointing algorithm, the authors achieve high-accuracy derivatives with reasonable computational cost, validated through twin experiments and divided differences, significantly reducing development time compared to manual coding.

ABSTRACT

The ocean general circulation model OPA is developed by the LODYC team at Paris VI university. OPA has recently undergone a major rewriting, migrating to FORTRAN95, and its adjoint code needs to be rebuilt. For earlier versions, the adjoint of OPA was written by hand at a high development cost. We use the Automatic Differentiation tool TAPENADE to build mechanicaly the tangent and adjoint codes of OPA. We validate the differentiated codes by comparison with divided differences, and also with an identical twin experiment. We apply state-of-the-art methods to improve the performance of the adjoint code. In particular we implement the Griewank and Walther's binomial checkpointing algorithm which gives us an optimal trade-off between time and memory consumption. We apply a specific strategy to differentiate the iterative linear solver that comes from the implicit time stepping scheme

Motivation & Objective

  • To automate the generation of tangent and adjoint codes for the OPA ocean model, which previously required months of manual implementation.
  • To reduce development cost and error risk associated with hand-coding adjoint models in large-scale ocean models.
  • To validate the accuracy and performance of automatically generated derivatives using numerical comparisons and twin experiments.
  • To optimize the adjoint code's efficiency using advanced checkpointing strategies like the binomial method.
  • To demonstrate the feasibility and scalability of TAPENADE for large FORTRAN95 scientific codes in oceanography.

Proposed method

  • Application of TAPENADE's reverse-mode automatic differentiation to the OPA 9 model written in FORTRAN95.
  • Use of the Griewank and Walther binomial checkpointing algorithm to minimize memory and time overhead in adjoint computation.
  • Adaptation of a specific differentiation strategy for the iterative linear solver used in the implicit time-stepping scheme.
  • Validation of derivatives via comparison with divided differences and twin experiments with synthetic observations.
  • Integration of the differentiated code into a variational data assimilation framework using a gradient-based optimization loop.
  • Use of profiling to identify and optimize non-essential checkpointing calls, improving adjoint performance.

Experimental results

Research questions

  • RQ1Can automatic differentiation tools like TAPENADE effectively generate accurate tangent and adjoint models for large-scale ocean general circulation models?
  • RQ2How does the performance of automatically generated adjoint codes compare to hand-coded versions in terms of memory and execution time?
  • RQ3What checkpointing strategy optimally balances memory and computational cost in long-time simulations of ocean models?
  • RQ4How can iterative solvers within implicit time-stepping schemes be effectively differentiated using automatic differentiation?
  • RQ5To what extent can automatic differentiation be applied to complex scientific codes using preprocessor directives and modern language features?

Key findings

  • The automatically generated adjoint code achieved high accuracy, with derivatives validated against divided differences and twin experiments.
  • The cost function in the twin experiment decreased by two orders of magnitude, indicating successful convergence to the true initial state.
  • The binomial checkpointing strategy provided an optimal trade-off between memory consumption and computational time, outperforming multi-level approaches.
  • The adjoint code ran with a slowdown factor of only 7 compared to the forward model over 1000 time steps, which is considered excellent for ocean modeling.
  • The use of TAPENADE reduced development time significantly compared to manual implementation, which previously took several months.
  • The differentiated code successfully recovered the true initial sea surface temperature from a noisy perturbation in the twin experiment, confirming derivative quality.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.