| 1 | 
Starting a configuration for OpenAD | 
| 2 | 
19-Aug-2005, heimbach@mit.edu, utke@mcs.anl.gov, cnh@mit.edu | 
| 3 | 
############################################################ | 
| 4 | 
                                                                                                                                                       | 
| 5 | 
This experiment is derived from global_ocean.90x40x15, | 
| 6 | 
but excludes packages gmredi, kpp. | 
| 7 | 
                                                                                                                                                       | 
| 8 | 
STEP 1: | 
| 9 | 
###### | 
| 10 | 
To bypass incomplete canonicalizer, convert COMMON blocks to MODULES. | 
| 11 | 
Successfully completed. | 
| 12 | 
The built process needed to be modified, and some routines | 
| 13 | 
needed changes. Most changes were commited to default routines, | 
| 14 | 
the remaining changes are kept in code/ for now. | 
| 15 | 
                                                                                                                                                       | 
| 16 | 
To build: | 
| 17 | 
-------- | 
| 18 | 
o short version: | 
| 19 | 
--------------- | 
| 20 | 
make makefile ; make depend ; make cb2m ; make makefile ; make small_f ; make allmods ; make | 
| 21 | 
 | 
| 22 | 
o long version: | 
| 23 | 
-------------- | 
| 24 | 
# (chdir to built/; assume we are in built/) | 
| 25 | 
# | 
| 26 | 
# generate makefile using ifort and modified genmake2 in ../code/ | 
| 27 | 
../code/genmake2  -of ../../../tools/build_options/linux_ia32_ifort -mods ../code | 
| 28 | 
# | 
| 29 | 
# make dependencies | 
| 30 | 
make depend | 
| 31 | 
# | 
| 32 | 
# invoke script to convert COMMON block headers to MODULE headers | 
| 33 | 
# converts FILE.h to FILE_mod.h which uses newi module FILE_mod.F90 | 
| 34 | 
make cb2m | 
| 35 | 
# | 
| 36 | 
# re-generate makefile which takes into account newly created files | 
| 37 | 
# FILE_mod.h, FILE_mod.F90 | 
| 38 | 
make makefile | 
| 39 | 
# | 
| 40 | 
# make .f, .f90 | 
| 41 | 
make small_f | 
| 42 | 
# | 
| 43 | 
# first compile all module files .f90 | 
| 44 | 
make allmods | 
| 45 | 
# | 
| 46 | 
# compile everything else | 
| 47 | 
make | 
| 48 | 
 | 
| 49 | 
To clean: | 
| 50 | 
-------- | 
| 51 | 
# Since soft links get overwritten, for now do: | 
| 52 | 
make CLEAN ; rm *.F *.F90 *.h | 
| 53 | 
 | 
| 54 | 
to run: | 
| 55 | 
------ | 
| 56 | 
# paremeter files are in input/ | 
| 57 | 
ln -s ../input/* . | 
| 58 | 
# initial and forcing fields are elsewhere; | 
| 59 | 
# get these from verif. exp. global_ocean.90x40x15/input/*.bin | 
| 60 | 
ln -s ../../global_ocean.90x40x15/input/*.bin . | 
| 61 | 
./mitgcmuv >! output.txt | 
| 62 | 
 | 
| 63 | 
STEP 2: | 
| 64 | 
###### | 
| 65 | 
Generate code for AD-related routines. | 
| 66 | 
 | 
| 67 | 
Similar to step 1, but look in code_ad/ instead of code/ | 
| 68 | 
 | 
| 69 | 
To build: | 
| 70 | 
-------- | 
| 71 | 
o short version: | 
| 72 | 
--------------- | 
| 73 | 
 | 
| 74 | 
../code_ad/genmake2  -of ../../../tools/build_options/linux_ia32_ifort -adof ../../../tools/adjoint_options/adjoint_f95 -mods ../code_ad | 
| 75 | 
 | 
| 76 | 
make adall | 
| 77 | 
 | 
| 78 | 
STEP 3: | 
| 79 | 
###### | 
| 80 | 
Compare reference outputs. | 
| 81 | 
 | 
| 82 | 
------------------ | 
| 83 | 
SINGLE-LAYER SETUP: _openad, _taf | 
| 84 | 
------------------ | 
| 85 | 
 | 
| 86 | 
# uncompress outputs in results_... directories: | 
| 87 | 
gunzip ../results_shallow_*/output.txt.gz | 
| 88 | 
 | 
| 89 | 
# extract gradients from TAF-generated adjoint: | 
| 90 | 
grep grad-res ../results_shallow_taf/output.txt | 
| 91 | 
 | 
| 92 | 
# extract gradients from OpenAD-generated adjoint: | 
| 93 | 
grep ' salt/theta ' ../results_shallow_openad/output.txt | 
| 94 | 
 | 
| 95 | 
The two positions tested via gradient checks (results_shallow_taf) are | 
| 96 | 
(i,j,k) = (43,2,1) and (44,2,1) | 
| 97 | 
Find corresponding locations in ' salt/theta ' output  | 
| 98 | 
(which outputs whole theta, salt gradient) | 
| 99 | 
 | 
| 100 | 
------------------ | 
| 101 | 
15-LAYER-SETUP    :  _openad2, _taf2 | 
| 102 | 
------------------ | 
| 103 | 
 | 
| 104 | 
first working setup of 05-Aug-2006 ran for 12 timesteps  | 
| 105 | 
on itrda.acesgrid.org under | 
| 106 | 
/net/ds-06/scratch-0/utke/cvs/MITgcm/verification/OpenAD/run_ph_baroclin/ | 
| 107 | 
uses Atlantic heat transport cost function; | 
| 108 | 
 | 
| 109 | 
* OpenAD output is in results_shallow_openad2/ | 
| 110 | 
grep ' salt/theta ' ../results_shallow_openad2/output.txt | 
| 111 | 
 | 
| 112 | 
* TAF    output is in results_shallow_taf2/ | 
| 113 | 
grep grad-res ../results_shallow_taf2/output.txt | 
| 114 | 
 | 
| 115 | 
The positions tested via gradient checks (results_shallow_taf2) are | 
| 116 | 
(i,j,k) = (78,26,1) | 
| 117 | 
 | 
| 118 | 
------------------ | 
| 119 | 
15-LAYER-SETUP WITH GMREDI:  _openad3, _taf3 | 
| 120 | 
------------------ | 
| 121 | 
 | 
| 122 | 
not yet run. |