| 1 | 
heimbach | 
1.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 | 
heimbach | 
1.2 | 
STEP 3: | 
| 79 | 
  | 
  | 
###### | 
| 80 | 
  | 
  | 
Compare reference outputs. | 
| 81 | 
  | 
  | 
 | 
| 82 | 
  | 
  | 
# uncompress outputs in results_... directories: | 
| 83 | 
  | 
  | 
gunzip ../results_shallow_*/output.txt.gz | 
| 84 | 
  | 
  | 
 | 
| 85 | 
  | 
  | 
# extract gradients from TAF-generated adjoint: | 
| 86 | 
  | 
  | 
grep grad-res ../results_shallow_taf/output.txt | 
| 87 | 
  | 
  | 
 | 
| 88 | 
  | 
  | 
# extract gradients from OpenAD-generated adjoint: | 
| 89 | 
  | 
  | 
grep ' salt/theta ' ../results_shallow_openad/output.txt | 
| 90 | 
  | 
  | 
 | 
| 91 | 
  | 
  | 
The two positions tested via gradient checks (results_shallow_taf) are | 
| 92 | 
  | 
  | 
(i,j,k) = (43,2,1) and (44,2,1) | 
| 93 | 
  | 
  | 
Find corresponding locations in ' salt/theta ' output  | 
| 94 | 
  | 
  | 
(which outputs whole theta, salt gradient) |