7.3.1. Open source AD Tool Tapenade

Tapenade is an Automatic Differentiation Engine developed at Inria at Sophia Antipolis by the Ecuador team (formerly TROPICS team). Tapenade takes as input a computer source program, plus a request for differentiation. Tapenade builds and returns the differentiated source program, that evaluates the required derivatives.

While the SICOPOLIS source files are prepared to generate adjoint sensitivities, they will not be able to do so without an operable installation of Tapenade. Fortunately the Tapenade installation procedure is straightforward.

We detail the instructions here, but the latest instructions can always be found here.

7.3.1.1. Prerequisites for Linux or Mac OS X

Before installing Tapenade, you must check that an up-to-date Java Runtime Environment is installed. Tapenade will not run with older Java Runtime Environment.

7.3.1.2. Steps for Mac OS

Tapenade 3.16 distribution does not contain a fortranParser executable for MacOS. It uses a docker image from here. You need docker on your Mac to run the Tapenade distribution with Fortran programs. Details on how to build fortranParser is here. You may also build Tapenade on your Mac from the gitlab repository.

7.3.1.3. Steps for Linux

  1. Read the Tapenade license.

  2. Download tapenade_3.16.tar into your chosen installation directory install_dir.

NOTE: Alternatively, a Tapenade version that works correctly with SICOPOLIS-AD v2 is always available in the test_ad/tapenade_supported directory.

  1. Go to your chosen installation directory install_dir, and extract Tapenade from the tar file:

    % tar xvfz tapenade_3.16.tar
    
  2. On Linux, depending on your distribution, Tapenade may require you to set the shell variable JAVA_HOME to your java installation directory. It is often JAVA_HOME=/usr/java/default. You might also need to modify the PATH by adding the bin directory from the Tapenade installation. An example can be found here.

NOTE: Every time you wish to use the adjoint capability of SICOPOLIS-AD, you must re-source the environment. We recommend that this be done automatically in your bash or c-shell profile upon login. An example of an addition to a .bashrc file from a Linux server is given below. Luckily, shell variable JAVA_HOME was not required to be explicitly set for this particular Linux distribution, but might be necessary for some other distributions.

##set some env variables for SICOPOLIS tapenade

export TAPENADE_HOME="/home/shreyas/tapenade_3.16"
export PATH="$PATH:$TAPENADE_HOME/bin"

##Modules

module use /share/modulefiles/
module load java/jdk/16.0.1 # Java required by Tapenade

You should now have a working copy of Tapenade.

For more information on the tapenade command and its arguments, type:

tapenade -?

7.3.1.4. Prerequisites for Windows

NOTE: Although Tapenade can be built on Windows, SICOPOLIS requires a Unix-like system (e.g., Linux), as mentioned in “Getting started”.

Before installing Tapenade, you must check that an up-to-date Java Runtime Environment is installed. Tapenade will not run with older Java Runtime Environment. The Fortran parser of Tapenade uses cygwin.

7.3.1.5. Steps for Windows

  1. Read the Tapenade license.

  2. Download tapenade_3.16.zip into your chosen installation directory install_dir.

  3. Go to your chosen installation directory install_dir, and extract Tapenade from the zip file.

  4. Save a copy of the install_dir\tapenade_3.16\bin\tapenade.bat file and modify install_dir\tapenade_3.16\bin\tapenade.bat according to your installation parameters:

replace TAPENADE_HOME=.. by TAPENADE_HOME="install_dir"\tapenade_3.16
replace JAVA_HOME="C:\Progra~1\Java\jdkXXXX" by your current java directory
replace BROWSER="C:\Program Files\Internet Explorer\iexplore.exe" by your current browser.