/[MITgcm]/MITgcm/pkg/autodiff/exch_uv_ad.F
ViewVC logotype

Contents of /MITgcm/pkg/autodiff/exch_uv_ad.F

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


Revision 1.4 - (show annotations) (download)
Fri Jun 20 21:43:19 2008 UTC (16 years ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint62c, checkpoint62a, checkpoint61, checkpoint62, checkpoint62b, checkpoint61f, checkpoint61n, checkpoint61q, checkpoint61z, checkpoint61e, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61x, checkpoint61y
Changes since 1.3: +32 -2 lines
o autodiff
  Change default for TAF usage by removing argument '-nonew_arg'
  This changes TAF subroutine argument list (ordering of active var.)
  Omission of this flag leads to incompatibility w.r.t. TAMC
  To restore TAMC-compatibility, need following modifs:
  * use adoptfile tools/adjoint_options/adjoint_tamc_compatibility
  * use CPP option #define AUTODIFF_TAMC_COMPATIBILITY
  Tested TAF version is 1.9.22
  N.B.: exch2 hand-written adjoint code currently not TAMC compatible

1 C $Header: /u/gcmpack/MITgcm/pkg/autodiff/exch_uv_ad.F,v 1.3 2008/06/14 16:15:04 heimbach Exp $
2 C $Name: $
3
4 C /==========================================================\
5 C | SUBROUTINEs adexch_uv_xy_rs adexch_uv_xyz_rs |
6 C | adexch_uv_xy_rl adexch_uv_xyz_rl |
7 C | o adjoint routines to exchange routines |
8 C |==========================================================|
9 C | These routines essentially are calling the original |
10 C | routines in reverse mode. |
11 C | These are regular adjoint routines with no innermost |
12 C | dimension added. |
13 C | Calls to these routines will be generated automatically |
14 C | by TAMC if correct flow directives are given |
15 C | tamc -reverse .... |
16 C | |
17 C | written and tested by Ralf Giering, Jan. 14th 1999 |
18 C | added new S/R's for _xz_ , _yz_ heimbach@mit.edu May-01 |
19 C \==========================================================/
20
21 #include "CPP_OPTIONS.h"
22
23 #ifdef ALLOW_EXCH2
24
25 C For exch2 all exch_xy* routines are shown to TAF
26 C and hand-written code below is not needed.
27
28 SUBROUTINE DUMMY_EXCH_UV_AD
29
30 RETURN
31 END
32
33 #else
34
35 CStartOfInterface
36 #ifdef AUTODIFF_TAMC_COMPATIBILITY
37 SUBROUTINE adexch_uv_xy_rs(
38 I withSigns, myThid,
39 U aduphi, advphi
40 & )
41 #else
42 SUBROUTINE adexch_uv_xy_rs(
43 U aduphi, advphi,
44 I withSigns, myThid
45 & )
46 #endif
47 C /==========================================================\
48 C | SUBROUTINE ADEXCH_UV_XY_RS adjoint of EXCH_UV_XY_RS |
49 C | o Handle exchanges for real*4, two-dimensional arrays. |
50 C |==========================================================|
51 C === Global data ===
52 implicit none
53 #include "SIZE.h"
54 #include "EEPARAMS.h"
55 #include "EESUPPORT.h"
56
57 C === Routine arguments ===
58 C phi - Array who's overlap regions are to be exchanged
59 C myThid - My thread id.
60 _RS aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
61 _RS advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
62 LOGICAL withSigns
63 INTEGER myThid
64 CEndOfInterface
65 C == Local variables ==
66 C OL[wens] - Overlap extents in west, east, north, south.
67 C exchWidth[XY] - Extent of regions that will be exchanged.
68 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
69 INTEGER mysNx, mysNy, myNz
70
71 OLw = OLx
72 OLe = OLx
73 OLn = OLy
74 OLs = OLy
75 exchWidthX = OLx
76 exchWidthY = OLy
77 mysNx = sNx
78 mysNy = sNy
79 myNz = 1
80 C ** NOTE ** The exchange routine we use here does not
81 C require the preceeding and following barriers.
82 C However, the slow, simple exchange interface
83 C that is calling it here is meant to ensure
84 C that threads are synchronised before exchanges
85 C begine.
86 IF (useCubedSphereExchange) THEN
87 CALL EXCH_UV_RS_CUBE( aduphi, advphi, withSigns,
88 I OLw, OLe, OLs, OLn, myNz,
89 I exchWidthX, exchWidthY,
90 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
91 ELSE
92 CALL EXCH_RS( aduphi,
93 I OLw, OLe, OLs, OLn, myNz,
94 I exchWidthX, exchWidthY,
95 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
96 CALL EXCH_RS( advphi,
97 I OLw, OLe, OLs, OLn, myNz,
98 I exchWidthX, exchWidthY,
99 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
100 c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs:
101 c _EXCH_XY_RS( aduphi, myThid )
102 c _EXCH_XY_RS( advphi, myThid )
103 ENDIF
104
105 RETURN
106 END
107
108
109 CStartOfInterface
110 #ifdef AUTODIFF_TAMC_COMPATIBILITY
111 SUBROUTINE adexch_uv_xy_rl(
112 I withSigns, myThid,
113 U aduphi, advphi
114 & )
115 #else
116 SUBROUTINE adexch_uv_xy_rl(
117 U aduphi, advphi,
118 I withSigns, myThid
119 & )
120 #endif
121
122 C /==========================================================\
123 C | SUBROUTINE ADEXCH_UV_XY_RL adjoint of EXCH_UV_XY_RL |
124 C | o Handle exchanges for real*8, two-dimensional arrays. |
125 C |==========================================================|
126 C === Global data ===
127 #include "SIZE.h"
128 #include "EEPARAMS.h"
129 #include "EESUPPORT.h"
130
131 C === Routine arguments ===
132 C phi - Array who's overlap regions are to be exchanged
133 C myThid - My thread id.
134 _RL aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
135 _RL advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
136 LOGICAL withSigns
137 INTEGER myThid
138 CEndOfInterface
139 C == Local variables ==
140 C OL[wens] - Overlap extents in west, east, north, south.
141 C exchWidth[XY] - Extent of regions that will be exchanged.
142 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
143 INTEGER mysNx, mysNy, myNz
144
145 OLw = OLx
146 OLe = OLx
147 OLn = OLy
148 OLs = OLy
149 exchWidthX = OLx
150 exchWidthY = OLy
151 mysNx = sNx
152 mysNy = sNy
153 myNz = 1
154 C ** NOTE ** The exchange routine we use here does not
155 C require the preceeding and following barriers.
156 C However, the slow, simple exchange interface
157 C that is calling it here is meant to ensure
158 C that threads are synchronised before exchanges
159 C begine.
160 IF (useCubedSphereExchange) THEN
161 CALL EXCH_UV_RL_CUBE( aduphi, advphi, withSigns,
162 I OLw, OLe, OLs, OLn, myNz,
163 I exchWidthX, exchWidthY,
164 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
165 ELSE
166 CALL EXCH_RL( aduphi,
167 I OLw, OLe, OLs, OLn, myNz,
168 I exchWidthX, exchWidthY,
169 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
170 CALL EXCH_RL( advphi,
171 I OLw, OLe, OLs, OLn, myNz,
172 I exchWidthX, exchWidthY,
173 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
174 c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs:
175 c _EXCH_XY_RL( aduphi, myThid )
176 c _EXCH_XY_RL( advphi, myThid )
177 ENDIF
178
179 RETURN
180 END
181
182
183 CStartOfInterface
184 #ifdef AUTODIFF_TAMC_COMPATIBILITY
185 SUBROUTINE adexch_uv_xyz_rs(
186 I withSigns, myThid,
187 U aduphi, advphi
188 & )
189 #else
190 SUBROUTINE adexch_uv_xyz_rs(
191 U aduphi, advphi,
192 I withSigns, myThid
193 & )
194 #endif
195 C /==========================================================\
196 C | SUBROUTINE ADEXCH_UV_XYZ_RS adjoint of EXCH_UV_XYZ_RS |
197 C | o Handle exchanges for real*4, two-dimensional arrays. |
198 C |==========================================================|
199 C === Global data ===
200 #include "SIZE.h"
201 #include "EEPARAMS.h"
202 #include "EESUPPORT.h"
203
204 C === Routine arguments ===
205 C phi - Array who's overlap regions are to be exchanged
206 C myThid - My thread id.
207 _RS aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
208 _RS advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
209 LOGICAL withSigns
210 INTEGER myThid
211 CEndOfInterface
212 C == Local variables ==
213 C OL[wens] - Overlap extents in west, east, north, south.
214 C exchWidth[XYZ] - Extent of regions that will be exchanged.
215 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
216 INTEGER mysNx, mysNy, myNz
217
218 OLw = OLx
219 OLe = OLx
220 OLn = OLy
221 OLs = OLy
222 exchWidthX = OLx
223 exchWidthY = OLy
224 mysNx = sNx
225 mysNy = sNy
226 myNz = Nr
227 C ** NOTE ** The exchange routine we use here does not
228 C require the preceeding and following barriers.
229 C However, the slow, simple exchange interface
230 C that is calling it here is meant to ensure
231 C that threads are synchronised before exchanges
232 C begine.
233 IF (useCubedSphereExchange) THEN
234 CALL EXCH_UV_RS_CUBE( aduphi, advphi, withSigns,
235 I OLw, OLe, OLs, OLn, myNz,
236 I exchWidthX, exchWidthY,
237 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
238 ELSE
239 CALL EXCH_RS( aduphi,
240 I OLw, OLe, OLs, OLn, myNz,
241 I exchWidthX, exchWidthY,
242 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
243 CALL EXCH_RS( advphi,
244 I OLw, OLe, OLs, OLn, myNz,
245 I exchWidthX, exchWidthY,
246 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
247 c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs:
248 c _EXCH_XY_RS( aduphi, myThid )
249 c _EXCH_XY_RS( advphi, myThid )
250 ENDIF
251
252 RETURN
253 END
254
255
256 CStartOfInterface
257 #ifdef AUTODIFF_TAMC_COMPATIBILITY
258 SUBROUTINE adexch_uv_xyz_rl(
259 I withSigns, myThid,
260 U aduphi, advphi
261 & )
262 #else
263 SUBROUTINE adexch_uv_xyz_rl(
264 U aduphi, advphi,
265 I withSigns, myThid
266 & )
267 #endif
268
269 C /==========================================================\
270 C | SUBROUTINE ADEXCH_UV_XYZ_RL adjoint of EXCH_UV_XYZ_RL |
271 C | o Handle exchanges for real*8, two-dimensional arrays. |
272 C |==========================================================|
273 C === Global data ===
274 #include "SIZE.h"
275 #include "EEPARAMS.h"
276 #include "EESUPPORT.h"
277
278 C === Routine arguments ===
279 C phi - Array who's overlap regions are to be exchanged
280 C myThid - My thread id.
281 _RL aduphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
282 _RL advphi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
283 LOGICAL withSigns
284 INTEGER myThid
285 CEndOfInterface
286 C == Local variables ==
287 C OL[wens] - Overlap extents in west, east, north, south.
288 C exchWidth[XYZ] - Extent of regions that will be exchanged.
289 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
290 INTEGER mysNx, mysNy, myNz
291
292 OLw = OLx
293 OLe = OLx
294 OLn = OLy
295 OLs = OLy
296 exchWidthX = OLx
297 exchWidthY = OLy
298 mysNx = sNx
299 mysNy = sNy
300 myNz = Nr
301 C ** NOTE ** The exchange routine we use here does not
302 C require the preceeding and following barriers.
303 C However, the slow, simple exchange interface
304 C that is calling it here is meant to ensure
305 C that threads are synchronised before exchanges
306 C begine.
307 IF (useCubedSphereExchange) THEN
308 CALL EXCH_UV_RL_CUBE( aduphi, advphi, withSigns,
309 I OLw, OLe, OLs, OLn, myNz,
310 I exchWidthX, exchWidthY,
311 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
312 ELSE
313 CALL EXCH_RL( aduphi,
314 I OLw, OLe, OLs, OLn, myNz,
315 I exchWidthX, exchWidthY,
316 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
317 CALL EXCH_RL( advphi,
318 I OLw, OLe, OLs, OLn, myNz,
319 I exchWidthX, exchWidthY,
320 I REVERSE_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
321 c_jmc: for JAM compatibility, replace the 2 CALLs above by the 2 CPP_MACROs:
322 c _EXCH_XY_RL( aduphi, myThid )
323 c _EXCH_XY_RL( advphi, myThid )
324 ENDIF
325
326 RETURN
327 END
328
329 #endif /* ALLOW_EXCH2 */

  ViewVC Help
Powered by ViewVC 1.1.22