/[MITgcm]/MITgcm/tools/OAD_support/ad_template.exch1_rl.F
ViewVC logotype

Contents of /MITgcm/tools/OAD_support/ad_template.exch1_rl.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Sep 20 23:12:47 2012 UTC (11 years, 6 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64o, checkpoint64a, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint64n, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64c, checkpoint64g, checkpoint64f, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64, checkpoint65, checkpoint64j, checkpoint64m, checkpoint64l, HEAD
* Merge OAD_support from MITgcm_contrib/heimbach/OpenAD/OAD_support/
  to tools/OAD_support/
* Adjust genmake2 to reflect path change (attempt with ${OADTOOLS})
* Adjust insertTemplateDir.bash to reflect path change
Seems to work.

1 #include "CPP_EEOPTIONS.h"
2 subroutine template()
3 use OAD_tape
4 use OAD_rev
5
6 !$TEMPLATE_PRAGMA_DECLARATIONS
7
8 type(modeType) :: our_orig_mode
9
10 c lovcal vars:
11 INTEGER , PARAMETER :: nArgsHelper=9
12 INTEGER argsHelper(nArgsHelper)
13 _RL array_p( 1-myOLw:sNx+myOLe,
14 & 1-myOLs:sNy+myOLn,
15 & myNz, nSx, nSy )
16
17 #ifdef OAD_DEBUG_SPLIT1
18 character*(80):: indentation='
19 + '
20 our_indent=our_indent+1
21
22 write(standardmessageunit, '(A,A,A)', ADVANCE='NO')
23 +'OAD:',indentation(1:our_indent), 'enter __SRNAME__:'
24 call oad_dump_revmod(); call oad_dump_tapestats()
25 write(standardmessageunit,*)
26 #endif
27
28 if (our_rev_mode%plain) then
29 #ifdef OAD_DEBUG_SPLIT1
30 write(standardmessageunit,'(A,A,A)')
31 +'OAD:',indentation(1:our_indent),
32 +' __SRNAME__: entering plain'
33 #endif
34 c copy the values
35 array_p = array%v
36 c keep the mode
37 our_orig_mode=our_rev_mode
38 c set up for plain execution
39 call OAD_revPlain()
40 c do it
41 call EXCH1_RL(
42 U array_p,
43 I myOLw, myOLe, myOLs, myOLn, myNz,
44 I exchWidthX, exchWidthY,
45 I cornerMode, myThid )
46 c reset the mode
47 our_rev_mode=our_orig_mode
48 c copy back
49 array%v = array_p
50 end if
51 if (our_rev_mode%tape) then
52 #ifdef OAD_DEBUG_SPLIT1
53 write(standardmessageunit,'(A,A,A)')
54 +'OAD:',indentation(1:our_indent),
55 +' __SRNAME__: entering tape'
56 #endif
57 c copy the values
58 array_p = array%v
59 c copy the args in case they are overwritte
60 argsHelper=(/myOLw, myOLe, myOLs, myOLn, myNz,exchWidthX,
61 +exchWidthY,cornerMode, myThid/)
62 c keep the mode
63 our_orig_mode=our_rev_mode
64 c set up for plain execution
65 call OAD_revPlain()
66 c do it
67 call EXCH1_RL(
68 U array_p,
69 I myOLw, myOLe, myOLs, myOLn, myNz,
70 I exchWidthX, exchWidthY,
71 I cornerMode, myThid )
72 c reset the mode
73 our_rev_mode=our_orig_mode
74 c copy back
75 array%v = array_p
76 c store the args:
77 if(oad_it_sz.lt. oad_it_ptr+nArgsHelper) call oad_it_grow()
78 oad_it(oad_it_ptr:oad_it_ptr+nArgsHelper-1)=argsHelper
79 oad_it_ptr=oad_it_ptr+nArgsHelper
80 end if
81 if (our_rev_mode%adjoint) then
82 c restore the args:
83 oad_it_ptr=oad_it_ptr-nArgsHelper
84 argsHelper=oad_it(oad_it_ptr:oad_it_ptr+nArgsHelper-1)
85 #ifdef OAD_DEBUG_SPLIT1
86 write(standardmessageunit,'(A,A,A)')
87 +'OAD:',indentation(1:our_indent),
88 +' __SRNAME__: entering adjoint'
89 #endif
90 c copy the adjoints
91 array_p = array%d
92 c keep the mode
93 our_orig_mode=our_rev_mode
94 c set up for plain execution
95 call OAD_revPlain()
96 c call the manual adjoint
97 call EXCH1_RL_AD(
98 U array_p,
99 I argsHelper(1),argsHelper(2),argsHelper(3),
100 I argsHelper(4),argsHelper(5),argsHelper(6),
101 I argsHelper(7),argsHelper(8),argsHelper(9) )
102 c reset the mode
103 our_rev_mode=our_orig_mode
104 c copy back
105 array%d = array_p
106 end if
107
108 #ifdef OAD_DEBUG_SPLIT1
109 write(standardmessageunit,'(A,A,A)', ADVANCE='NO')
110 +'OAD:',indentation(1:our_indent), 'leave __SRNAME__:'
111 call oad_dump_revmod(); call oad_dump_tapestats()
112 write(standardmessageunit,*)
113
114 our_indent=our_indent-1
115 #endif
116
117 end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22