[MITgcm-support] How to use OpenAD to run adjoint experiment?

Mike Fan ifanliming at outlook.com
Thu Jan 28 05:45:56 EST 2021


Hi everyone,

I'm new to adjoint modeling, and the related document I read in here[https://www.archer.ac.uk/training/virtual/2016-11-30-Adjoint-ocean-modelling/eCSE03-09_presentation.pdf].
Adjoint ocean modelling with MITgcm and OpenAD<https://www.archer.ac.uk/training/virtual/2016-11-30-Adjoint-ocean-modelling/eCSE03-09_presentation.pdf>
Adjoint ocean modelling with MITgcm and OpenAD Dan Jones (British Antarctic Survey) Webinar starts at 15:00 eCSE03-09 dannes at bas.ac.uk @DanJonesOcean
www.archer.ac.uk
Then I downloaded and unpacked the OpenAD_2014-03-15.tgz.

After that, I did the things below. Noted: the MITgcm model can run normally without adjoint.

mice at DESKTOP-S2HNSPD:~/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build$ cd /home/mice/software/OpenAD/
mice at DESKTOP-S2HNSPD:~/software/OpenAD$ source ./setenv.sh
mice at DESKTOP-S2HNSPD:~/software/OpenAD$ cd /home/mice/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build
mice at DESKTOP-S2HNSPD:~/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build$ ../../../tools/genmake2 -mods=../code_oad -oad -mpi

GENMAKE :

A program for GENerating MAKEfiles for the MITgcm project.
   For a quick list of options, use "genmake2 -h"
or for more detail see the documentation, section "Building the model"
   (under "Getting Started") at:  https://mitgcm.readthedocs.io/

===  Processing options files and arguments  ===
  getting local config information:  none found
Warning: ROOTDIR was not specified ; try using a local copy of MITgcm found at "../../.."
  getting OPTFILE information:
Warning: no OPTFILE specified so we'll look for possible settings

===  Searching for possible settings for OPTFILE  ===
  The platform appears to be:  linux_amd64
  The possible FORTRAN compilers found in your path are:  gfortran f77 f95 mpif77
  Setting OPTFILE to: ../../../tools/build_options/linux_amd64_gfortran
    using OPTFILE="../../../tools/build_options/linux_amd64_gfortran"
  getting AD_OPTFILE information:
    using AD_OPTFILE="../../../tools/adjoint_options/adjoint_oad"
  check Fortran Compiler...  pass  (set FC_CHECK=5/5)
  check makedepend (local: 0, system: 1, 1)
  Turning on MPI cpp macros

===  Checking system libraries  ===
  Do we have the system() command using mpif77...  yes
  Do we have the fdate() command using mpif77...  yes
  Do we have the etime() command using mpif77... c,r: yes (SbR)
  Can we call simple C routines (here, "cloc()") using mpif77...  yes
  Can we unlimit the stack size using mpif77...  yes
  Can we register a signal handler using mpif77...  yes
  Can we use stat() through C calls...  yes
  Can we create NetCDF-enabled binaries...  yes
    skip check for LAPACK Libs
  Can we call FLUSH intrinsic subroutine...  yes

===  Setting defaults  ===
  Adding MODS directories: ../code_oad
  Making source files in eesupp from templates
  Making source files in pkg/exch2 from templates
  Making source files in pkg/regrid from templates

===  Determining package settings  ===
  getting package dependency info from  ../../../pkg/pkg_depend
  getting package groups info from      ../../../pkg/pkg_groups
  checking list of packages to compile:
    using PKG_LIST="../code_oad/packages.conf"
    before group expansion packages are: gfd -monitor cd_code gmredi ptracers openad autodiff cost ctrl grdchk
    replacing "gfd" with:  mom_common mom_fluxform mom_vecinv generic_advdiff debug mdsio rw monitor
    after group expansion packages are:  mom_common mom_fluxform mom_vecinv generic_advdiff debug mdsio rw monitor -monitor cd_code gmredi ptracers openad autodiff cost ctrl grdchk
  applying DISABLE settings
  applying ENABLE settings
    packages are:  autodiff cd_code cost ctrl debug generic_advdiff gmredi grdchk mdsio mom_common mom_fluxform mom_vecinv openad ptracers rw
  applying package dependency rules
    packages are:  autodiff cd_code cost ctrl debug generic_advdiff gmredi grdchk mdsio mom_common mom_fluxform mom_vecinv openad ptracers rw
  Adding STANDARDDIRS='eesupp model'
  Searching for *OPTIONS.h files in order to warn about the presence
    of "#define "-type statements that are no longer allowed:
    found CPP_OPTIONS="./CPP_OPTIONS.h"
    found CPP_EEOPTIONS="./CPP_EEOPTIONS.h"
  Creating the list of files for the adjoint compiler.

===  Creating the Makefile  ===
  setting INCLUDES
  Determining the list of source and include files
  looking for dontCompile file:
     found ../../../tools/OAD_support/dontCompile
  looking for dontTransform file:
     found ../../../tools/OAD_support/dontTransform
  looking for keepOriginal file:
     found ../../../tools/OAD_support/keepOriginal
  looking for cb2mFiles:
     found ../code_oad/cb2mFiles
   OpenAD exceptions:
    original to be kept  :  ctrl_init_rec.F
    not to be compiled   :  mom_u_implicit_r.F
    not to be compiled   :  mom_v_implicit_r.F
    original to be kept  :  read_fld_xy_rl.F
    original to be kept  :  read_fld_xy_rs.F
    original to be kept  :  read_fld_xyz_rl.F
    original to be kept  :  read_fld_xyz_rs.F
    original to be kept  :  read_rec.F
    not to be transformed:  different_multiple.F
    original to be kept  :  exch_3d_rl.F
    original to be kept  :  exch_uv_3d_rl.F
    original to be kept  :  exch_uv_3d_rs.F
    original to be kept  :  exch_uv_agrid_3d_rl.F
    original to be kept  :  exch_uv_dgrid_3d_rl.F
    original to be kept  :  exch_uv_xyz_rl.F
    original to be kept  :  exch_uv_xyz_rs.F
    original to be kept  :  exch_xy_rl.F
    original to be kept  :  exch_xy_rs.F
    original to be kept  :  exch_xyz_rl.F
    original to be kept  :  exch_xyz_rs.F
  Writing makefile: Makefile
  Add the source list for common block to module conversion
  Add the source list for AD code generation
  Making list of "exceptions" that need ".p" files
  Making list of NOOPTFILES
  Add rules for links
  Adding makedepend marker

===  Done  ===
  original 'Makefile' generated successfully
=> next steps:
  > make adAll    (<-- adjoint executable)

mice at DESKTOP-S2HNSPD:~/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build$ make adAll
Update AD_CONFIG.h and make mitgcmuv_ad
make -f Makefile mitgcmuv_ad
make[1]: Entering directory '/home/mice/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build'
../../../tools/OAD_support/cb2mGetHeaders.csh SIZE.h ../../../tools/OAD_support/cb2mGetHeaders.awk SIZE EEPARAMS PARAMS BAR2 BARRIER CD_CODE_VARS CG2D CG3D cost CTRL_SIZE CTRL_GENARR CTRL_OBCS ctrl_dummy ctrl ctrl_local_params ctrl_weights DYNVARS EESUPPORT EOS EXCH FC_NAMEMANGLE FFIELDS GAD g_cost GLOBAL_MAX GLOBAL_SUM GMREDI GMREDI_TAVE grdchk GRID MOM_VISC MPI_INFO optim RESTART SIGREG SOLVE_FOR_PRESSURE3D SOLVE_FOR_PRESSURE SURFACE AUTODIFF_PARAMS tamc_keys tamc PTRACERS_SIZE PTRACERS_FIELDS PTRACERS_PARAMS PTRACERS_START PTRACERS_TAVE
make[1]: ../../../tools/OAD_support/cb2mGetHeaders.csh: Command not found
Makefile:2060: recipe for target 'SIZE_mod.h' failed
make[1]: *** [SIZE_mod.h] Error 127
make[1]: Leaving directory '/home/mice/work/mitgcm/MITgcm-checkpoint67s/verification/tutorial_tracer_adjsens/build'
Makefile:2015: recipe for target 'ad_exe_target' failed
make: *** [ad_exe_target] Error 2


The main problem is "make[1]: ../../../tools/OAD_support/cb2mGetHeaders.csh: Command not found", I'm not sure how to solve the problem, what can I do?


Best,
Leming

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20210128/8213e4c4/attachment-0001.html>


More information about the MITgcm-support mailing list