1 |
subroutine template() |
2 |
use OAD_cp |
3 |
use OAD_tape |
4 |
use OAD_rev |
5 |
|
6 |
c we may need these for the checkpointing |
7 |
use SIZE_mod |
8 |
use EEPARAMS_mod |
9 |
use PARAMS_mod |
10 |
use BAR2_mod |
11 |
use BARRIER_mod |
12 |
use CD_CODE_VARS_mod |
13 |
use CG2D_mod |
14 |
use CG3D_mod |
15 |
use DYNVARS_mod |
16 |
use EESUPPORT_mod |
17 |
use EOS_mod |
18 |
use EXCH_mod |
19 |
use FC_NAMEMANGLE_mod |
20 |
use FFIELDS_mod |
21 |
use GAD_mod |
22 |
use GLOBAL_MAX_mod |
23 |
use GLOBAL_SUM_mod |
24 |
use GMREDI_mod |
25 |
use GMREDI_TAVE_mod |
26 |
use GRID_mod |
27 |
use MPI_INFO_mod |
28 |
use SOLVE_FOR_PRESSURE3D_mod |
29 |
use SOLVE_FOR_PRESSURE_mod |
30 |
use SURFACE_mod |
31 |
use tamc_mod |
32 |
use tamc_keys_mod |
33 |
use cost_mod |
34 |
use g_cost_mod |
35 |
use ctrl_mod |
36 |
use ctrl_dummy_mod |
37 |
use ctrl_weights_mod |
38 |
use optim_mod |
39 |
use grdchk_mod |
40 |
|
41 |
!$TEMPLATE_PRAGMA_DECLARATIONS |
42 |
|
43 |
integer :: cp_loop_variable_1,cp_loop_variable_2, |
44 |
+ cp_loop_variable_3,cp_loop_variable_4,cp_loop_variable_5 |
45 |
|
46 |
type(modeType) :: our_orig_mode |
47 |
|
48 |
integer iaddr |
49 |
external iaddr |
50 |
|
51 |
#ifdef OAD_DEBUG_JOINT |
52 |
character*(80):: indentation=' |
53 |
+ ' |
54 |
our_indent=our_indent+1 |
55 |
|
56 |
write(standardmessageunit, '(A,A,A)', ADVANCE='NO') |
57 |
+'OAD:',indentation(1:our_indent), 'enter __SRNAME__:' |
58 |
call oad_dump_revmod(); call oad_dump_tapestats() |
59 |
write(standardmessageunit,*) |
60 |
#endif |
61 |
|
62 |
if (our_rev_mode%switchedToCheckpoint) then |
63 |
|
64 |
if (our_rev_mode%arg_store) then |
65 |
#ifdef OAD_DEBUG_JOINT |
66 |
write(standardmessageunit,'(A,A,A)') |
67 |
+'OAD:',indentation(1:our_indent), |
68 |
+' __SRNAME__: c2s entering arg store' |
69 |
#endif |
70 |
call cp_write_open() |
71 |
!$PLACEHOLDER_PRAGMA$ id=8 |
72 |
call cp_close() |
73 |
end if |
74 |
if (our_rev_mode%arg_restore) then |
75 |
#ifdef OAD_DEBUG_JOINT |
76 |
write(standardmessageunit,'(A,A,A)') |
77 |
+'OAD:',indentation(1:our_indent), |
78 |
+' __SRNAME__: c2s entering arg restore' |
79 |
#endif |
80 |
call cp_read_open() |
81 |
!$PLACEHOLDER_PRAGMA$ id=9 |
82 |
call cp_close() |
83 |
end if |
84 |
if (our_rev_mode%plain) then |
85 |
#ifdef OAD_DEBUG_JOINT |
86 |
write(standardmessageunit,'(A,A,A)') |
87 |
+'OAD:',indentation(1:our_indent), |
88 |
+' __SRNAME__: c2s run plain, down plain' |
89 |
#endif |
90 |
our_orig_mode=our_rev_mode |
91 |
our_rev_mode%arg_store=.FALSE. |
92 |
!$PLACEHOLDER_PRAGMA$ id=1 |
93 |
our_rev_mode=our_orig_mode |
94 |
end if |
95 |
if (our_rev_mode%tape) then |
96 |
#ifdef OAD_DEBUG_JOINT |
97 |
write(standardmessageunit,'(A,A,A)') |
98 |
+'OAD:',indentation(1:our_indent), |
99 |
+' __SRNAME__: c2s run tape, down tape' |
100 |
#endif |
101 |
our_orig_mode=our_rev_mode |
102 |
our_rev_mode%arg_store=.FALSE. |
103 |
our_rev_mode%arg_restore=.FALSE. |
104 |
our_rev_mode%plain=.FALSE. |
105 |
our_rev_mode%tape=.TRUE. |
106 |
our_rev_mode%adjoint=.FALSE. |
107 |
our_rev_mode%strictAnonymous=.FALSE. |
108 |
!$PLACEHOLDER_PRAGMA$ id=2 |
109 |
our_rev_mode%arg_store=.FALSE. |
110 |
our_rev_mode%arg_restore=.FALSE. |
111 |
our_rev_mode%plain=.FALSE. |
112 |
our_rev_mode%tape=.FALSE. |
113 |
our_rev_mode%adjoint=.TRUE. |
114 |
#ifdef OAD_DEBUG_JOINT |
115 |
write(standardmessageunit,'(A,A,A)') |
116 |
+'OAD:',indentation(1:our_indent), |
117 |
+' __SRNAME__: c2s following with adjoint, down adjoint' |
118 |
#endif |
119 |
!$PLACEHOLDER_PRAGMA$ id=3 |
120 |
call openad_dumpAdjoint(myTime, myIter, myThid ) |
121 |
our_rev_mode=our_orig_mode |
122 |
end if |
123 |
|
124 |
else |
125 |
|
126 |
write(errorMessageUnit,'(A)') |
127 |
+'OAD ERROR __SRNAME__: c2s not switched is the wrong logic' |
128 |
stop |
129 |
|
130 |
end if |
131 |
|
132 |
#ifdef OAD_DEBUG_JOINT |
133 |
write(standardmessageunit,'(A,A,A)', ADVANCE='NO') |
134 |
+'OAD:',indentation(1:our_indent), 'leave __SRNAME__:' |
135 |
call oad_dump_revmod(); call oad_dump_tapestats() |
136 |
write(standardmessageunit,*) |
137 |
|
138 |
our_indent=our_indent-1 |
139 |
#endif |
140 |
|
141 |
end subroutine template |