/[MITgcm]/MITgcm/eesupp/src/exch0_rx.template
ViewVC logotype

Contents of /MITgcm/eesupp/src/exch0_rx.template

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


Revision 1.1 - (show annotations) (download)
Mon May 14 13:15:05 2012 UTC (12 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64o, checkpoint64a, checkpoint63r, 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, checkpoint63q, checkpoint64d, checkpoint64c, checkpoint64g, checkpoint64f, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint63n, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64i, checkpoint63o, checkpoint63p, checkpoint64h, checkpoint63s, checkpoint64k, checkpoint64, checkpoint65, checkpoint64j, checkpoint64m, checkpoint64l, HEAD
add new CPP option (DISCONNECTED_TILES) to disconnect tiles (no exchange
 between tiles, just fill-in edges assuming locally periodic subdomain) and
 add corresponding exchange subroutines (EXCH0);

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/exch1_rx.template,v 1.1 2010/05/19 01:43:27 jmc Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5
6 C-- File exch0_rx.template: to replace EXCH routines when using disconnected tiles
7 C-- Contents
8 C-- o EXCH0_RX
9 C-- o FILL_HALO_LOCAL_RX
10
11 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
12
13 CBOP
14
15 C !ROUTINE: EXCH0_RX
16
17 C !INTERFACE:
18 SUBROUTINE EXCH0_RX(
19 U array,
20 I myOLw, myOLe, myOLs, myOLn, myNr,
21 I exchWidthX, exchWidthY,
22 I cornerMode, myThid )
23
24 C !DESCRIPTION:
25 C *==========================================================*
26 C | SUBROUTINE EXCH0_RX
27 C | o Replace Exchange routines for the special case
28 C | where tiles are disconnected (no exchange between tiles,
29 C | just fill in edges of an array assuming locally periodic
30 C | subdomain)
31 C *==========================================================*
32 C | RX arrays are used to generate code for all 4 types
33 C | of arrays (R4, R8, RS and RL)
34 C *==========================================================*
35
36 C !USES:
37 IMPLICIT NONE
38
39 C == Global data ==
40 #include "SIZE.h"
41 #include "EEPARAMS.h"
42
43 C !INPUT/OUTPUT PARAMETERS:
44 C == Routine arguments ==
45 C array :: Array with edges to exchange.
46 C myOLw,myOLe :: West and East overlap region sizes.
47 C myOLs,myOLn :: South and North overlap region sizes.
48 C myNr :: array 3rd dimension
49 C exchWidthX :: Width of data region exchanged in X.
50 C exchWidthY :: Width of data region exchanged in Y.
51 C cornerMode :: Flag indicating whether corner updates are needed.
52 C myThid :: my Thread Id number
53
54 INTEGER myOLw, myOLe, myOLs, myOLn, myNr
55 _RX array( 1-myOLw:sNx+myOLe, 1-myOLs:sNy+myOLn,
56 & myNr, nSx, nSy )
57 INTEGER exchWidthX
58 INTEGER exchWidthY
59 INTEGER cornerMode
60 INTEGER myThid
61
62 #ifdef DISCONNECTED_TILES
63 C !LOCAL VARIABLES:
64 C == Local variables ==
65 C bi, bj :: tile indices
66 INTEGER bi, bj
67 CEOP
68
69 C-- Error checks
70 IF ( exchWidthX .GT. myOLw )
71 & STOP ' S/R EXCH0_RX: exchWidthX .GT. myOLw'
72 IF ( exchWidthX .GT. myOLe )
73 & STOP ' S/R EXCH0_RX: exchWidthX .GT. myOLe'
74 IF ( exchWidthY .GT. myOLs )
75 & STOP ' S/R EXCH0_RX: exchWidthY .GT. myOLs'
76 IF ( exchWidthY .GT. myOLn )
77 & STOP ' S/R EXCH0_RX: exchWidthY .GT. myOLn'
78 IF ( cornerMode .NE. EXCH_IGNORE_CORNERS
79 & .AND. cornerMode .NE. EXCH_UPDATE_CORNERS )
80 & STOP ' S/R EXCH0_RX: Unrecognised cornerMode '
81
82 C-- Over all tiles
83 DO bj = myByLo(myThid), myByHi(myThid)
84 DO bi = myBxLo(myThid), myBxHi(myThid)
85 CALL FILL_HALO_LOCAL_RX(
86 U array(1-myOLw,1-myOLs,1,bi,bj),
87 I myOLw, myOLe, myOLs, myOLn, myNr,
88 I cornerMode, bi, bj, myThid )
89 ENDDO
90 ENDDO
91
92 #else /* DISCONNECTED_TILES */
93 STOP 'ABNORMAL END: S/R EXCH0_RX is empty'
94 #endif /* DISCONNECTED_TILES */
95
96 RETURN
97 END
98
99 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
100 CBOP
101 C !ROUTINE: FILL_HALO_LOCAL_RX
102
103 C !INTERFACE:
104 SUBROUTINE FILL_HALO_LOCAL_RX(
105 U locFld,
106 I myOLw, myOLe, myOLs, myOLn, myNr,
107 c I exchWidthX, exchWidthY,
108 I cornerMode, bi, bj, myThid )
109
110 C !DESCRIPTION:
111 C *==========================================================*
112 C | SUBROUTINE FILL_HALO_LOCAL_RX
113 C | o Fill the halo region of a tile-local array assuming
114 C | disconnected tiles with locally periodic subdomain
115 C *==========================================================*
116
117 C !USES:
118 IMPLICIT NONE
119
120 C == Global variables ==
121 #include "SIZE.h"
122 #include "EEPARAMS.h"
123
124 C !INPUT/OUTPUT PARAMETERS:
125 C == Routine arguments ==
126 C locFld :: field local-array with edges to fill.
127 C myOLw,myOLe :: West and East overlap region sizes.
128 C myOLs,myOLn :: South and North overlap region sizes.
129 C myNr :: field local-array 3rd dimension
130 C exchWidthX :: Width of data region exchanged in X.
131 C exchWidthY :: Width of data region exchanged in Y.
132 C cornerMode :: Flag indicating whether corner updates are needed.
133 C myThid :: my Thread Id number
134 C bi, bj :: tile indices
135 C myThid :: thread number
136 INTEGER myOLw, myOLe, myOLs, myOLn, myNr
137 _RX locFld( 1-myOLw:sNx+myOLe, 1-myOLs:sNy+myOLn, myNr )
138 c INTEGER exchWidthX, exchWidthY
139 INTEGER cornerMode
140 INTEGER bi, bj
141 INTEGER myThid
142
143 #ifdef DISCONNECTED_TILES
144 C !LOCAL VARIABLES:
145 C == Local variables ==
146 C i,j,k :: loop indices
147 INTEGER i,j,k
148 INTEGER iMin,iMax,jMin,jMax
149 CEOP
150
151 IF ( cornerMode .EQ. EXCH_UPDATE_CORNERS ) THEN
152 iMin = 1 - myOLw
153 iMax = sNx + myOLe
154 jMin = 1 - myOLs
155 jMax = sNy + myOLn
156 ELSE
157 iMin = 1
158 iMax = sNx
159 jMin = 1
160 jMax = sNy
161 ENDIF
162
163 C-- Fill Edges in X direction :
164 IF ( sNx.EQ.1 ) THEN
165 C- Special case for Y-slice domain i.e. case where sNx=1 (faster than below)
166 DO k = 1,myNr
167 DO j = jMin,jMax
168 DO i = 1-myOLw,sNx+myOLe
169 locFld(i,j,k) = locFld(1,j,k)
170 ENDDO
171 ENDDO
172 ENDDO
173 ELSEIF ( sNx.LT.myOLw ) THEN
174 C- Special case if sNx<myOLw, e.g., for Y-slice domain case where sNx = 1
175 DO k = 1,myNr
176 DO j = jMin,jMax
177 C reverse loop index increment to stay valid even if sNx<myOLw;
178 C note: cannot vectorize both i loops
179 DO i = 0,1-myOLw,-1
180 locFld(i,j,k) = locFld(i+sNx,j,k)
181 ENDDO
182 DO i = 1,myOLe
183 locFld(i+sNx,j,k) = locFld(i,j,k)
184 ENDDO
185 ENDDO
186 ENDDO
187 ELSE
188 DO k = 1,myNr
189 DO j = jMin,jMax
190 DO i = 1-myOLw,0
191 locFld(i,j,k) = locFld(i+sNx,j,k)
192 ENDDO
193 DO i = 1,myOLe
194 locFld(i+sNx,j,k) = locFld(i,j,k)
195 ENDDO
196 ENDDO
197 ENDDO
198 ENDIF
199
200 C-- Fill Edges in Y direction :
201 IF ( sNy.EQ.1 ) THEN
202 C- Special case for X-slice domain i.e. case where sNy=1 (faster than below)
203 DO k = 1,myNr
204 DO j = 1-myOLs,sNy+myOLn
205 DO i = iMin,iMax
206 locFld(i,j,k) = locFld(i,1,k)
207 ENDDO
208 ENDDO
209 ENDDO
210 ELSEIF ( sNy.LT.myOLs ) THEN
211 C- Special case if sNy<myOLs, e.g., for X-slice domain case where sNy = 1
212 DO k = 1,myNr
213 C reverse loop index increment to stay valid even if sNy<myOLs;
214 C note: cannot vectorize both j loops
215 DO j = 0,1-myOLs,-1
216 DO i = iMin,iMax
217 locFld(i,j,k) = locFld(i,j+sNy,k)
218 ENDDO
219 ENDDO
220 DO j = 1,myOLn
221 DO i = iMin,iMax
222 locFld(i,j+sNy,k) = locFld(i,j,k)
223 ENDDO
224 ENDDO
225 ENDDO
226 ELSE
227 DO k = 1,myNr
228 DO j = 1-myOLs,0
229 DO i = iMin,iMax
230 locFld(i,j,k) = locFld(i,j+sNy,k)
231 ENDDO
232 ENDDO
233 DO j = 1,myOLn
234 DO i = iMin,iMax
235 locFld(i,j+sNy,k) = locFld(i,j,k)
236 ENDDO
237 ENDDO
238 ENDDO
239 ENDIF
240
241 #else /* DISCONNECTED_TILES */
242 STOP 'ABNORMAL END: S/R FILL_HALO_LOCAL_RX is empty'
243 #endif /* DISCONNECTED_TILES */
244
245 RETURN
246 END

  ViewVC Help
Powered by ViewVC 1.1.22