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

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

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


Revision 1.3 - (show annotations) (download)
Fri Sep 21 03:55:50 2001 UTC (22 years, 8 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint44e_post, checkpoint43a-release1mods, checkpoint44g_post, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, chkpt44d_post, release1_p1, release1_p2, release1_p3, release1_p4, checkpoint44e_pre, release1_b1, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint43, release1_chkpt44d_post, icebear5, icebear4, icebear3, icebear2, release1-branch_tutorials, ecco_c50_e28, chkpt44a_post, checkpoint44h_pre, ecco_c50_e29, chkpt44c_pre, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, ecco_c50_e33a, release1-branch-end, release1_final_v1, checkpoint44f_post, checkpoint44b_post, ecco_c51_e34, ecco_ice2, ecco_ice1, checkpoint44h_post, ecco_c44_e25, chkpt44a_pre, ecco_c44_e22, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, release1_beta1, checkpoint44b_pre, checkpoint42, checkpoint41, checkpoint44, checkpoint45, chkpt44c_post, checkpoint44f_pre, release1-branch_branchpoint
Branch point for: c24_e25_ice, release1_coupled, release1_final, release1-branch, release1, ecco-branch, icebear
Changes since 1.2: +59 -46 lines
Starting to bring comments up to date and format comments
for document extraction of "prototypes".

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/exch_rx.template,v 1.2 2001/05/29 14:01:36 adcroft Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5
6 CBOP
7
8 C !ROUTINE: EXCH_RX
9
10 C !INTERFACE:
11 SUBROUTINE EXCH_RX(
12 U array,
13 I myOLw, myOLe, myOLs, myOLn, myNz,
14 I exchWidthX, exchWidthY,
15 I simulationMode, cornerMode, myThid )
16 IMPLICIT NONE
17
18 C !DESCRIPTION:
19 C *==========================================================*
20 C | SUBROUTINE EXCH_RX
21 C | o Control edge exchanges for RX array.
22 C *==========================================================*
23 C |
24 C | Controlling routine for exchange of XY edges of an array
25 C | distributed in X and Y. The routine interfaces to
26 C | communication routines that can use messages passing
27 C | exchanges, put type exchanges or get type exchanges.
28 C | This allows anything from MPI to raw memory channel to
29 C | memmap segments to be used as a inter-process and/or
30 C | inter-thread communiation and synchronisation
31 C | mechanism.
32 C | Notes --
33 C | 1. Some low-level mechanisms such as raw memory-channel
34 C | or SGI/CRAY shmem put do not have direct Fortran bindings
35 C | and are invoked through C stub routines.
36 C | 2. Although this routine is fairly general but it does
37 C | require nSx and nSy are the same for all innvocations.
38 C | There are many common data structures ( myByLo,
39 C | westCommunicationMode, mpiIdW etc... ) tied in with
40 C | (nSx,nSy). To support arbitray nSx and nSy would require
41 C | general forms of these.
42 C | 3. RX arrays are used to generate code for both _RL and
43 C | _RS forms.
44 C *==========================================================*
45
46 C !USES:
47 C == Global data ==
48 #include "SIZE.h"
49 #include "EEPARAMS.h"
50 #include "EESUPPORT.h"
51 #include "EXCH.h"
52
53 C !INPUT/OUTPUT PARAMETERS:
54 C == Routine arguments ==
55 C array :: Array with edges to exchange.
56 C myOLw :: West, East, North and South overlap region sizes.
57 C myOLe
58 C myOLn
59 C myOLs
60 C exchWidthX :: Width of data region exchanged in X.
61 C exchWidthY :: Width of data region exchanged in Y.
62 C Note --
63 C 1. In theory one could have a send width and
64 C a receive width for each face of each tile. The only
65 C restriction woul be that the send width of one
66 C face should equal the receive width of the sent to
67 C tile face. Dont know if this would be useful. I
68 C have left it out for now as it requires additional
69 C bookeeping.
70 C simulationMode :: Forward or reverse mode exchange ( provides
71 C support for adjoint integration of code. )
72 C cornerMode :: Flag indicating whether corner updates are
73 C needed.
74 C myThid :: Thread number of this instance of S/R EXCH...
75 INTEGER myOLw
76 INTEGER myOLe
77 INTEGER myOLs
78 INTEGER myOLn
79 INTEGER myNz
80 INTEGER exchWidthX
81 INTEGER exchWidthY
82 INTEGER simulationMode
83 INTEGER cornerMode
84 INTEGER myThid
85 _RX array(1-myOLw:sNx+myOLe,
86 & 1-myOLs:sNy+myOLn,
87 & myNZ, nSx, nSy)
88
89 C !LOCAL VARIABLES:
90 C == Local variables ==
91 C theSimulationMode :: Holds working copy of simulation mode
92 C theCornerMode :: Holds working copy of corner mode
93 C I,J,K,bi,bj :: Loop counters
94 INTEGER theSimulationMode
95 INTEGER theCornerMode
96 INTEGER I,J,K,bi,bj
97 CEOP
98
99 theSimulationMode = simulationMode
100 theCornerMode = cornerMode
101
102 C-- Error checks
103 IF ( exchWidthX .GT. myOLw )
104 & STOP ' S/R EXCH_RX: exchWidthX .GT. myOLw'
105 IF ( exchWidthX .GT. myOLe )
106 & STOP ' S/R EXCH_RX: exchWidthX .GT. myOLe'
107 IF ( exchWidthY .GT. myOLs )
108 & STOP ' S/R EXCH_RX: exchWidthY .GT. myOLs'
109 IF ( exchWidthY .GT. myOLn )
110 & STOP ' S/R EXCH_RX: exchWidthY .GT. myOLn'
111 IF ( myOLw .GT. MAX_OLX_EXCH )
112 & STOP ' S/R EXCH_RX: myOLw .GT. MAX_OLX_EXCH'
113 IF ( myOLe .GT. MAX_OLX_EXCH )
114 & STOP ' S/R EXCH_RX: myOLe .GT. MAX_OLX_EXCH'
115 IF ( myOLn .GT. MAX_OLX_EXCH )
116 & STOP ' S/R EXCH_RX: myOLn .GT. MAX_OLY_EXCH'
117 IF ( myOLs .GT. MAX_OLY_EXCH )
118 & STOP ' S/R EXCH_RX: myOLs .GT. MAX_OLY_EXCH'
119 IF ( myNZ .GT. MAX_NR_EXCH )
120 & STOP ' S/R EXCH_RX: myNZ .GT. MAX_NR_EXCH '
121 IF ( theSimulationMode .NE. FORWARD_SIMULATION
122 & .AND. theSimulationMode .NE. REVERSE_SIMULATION
123 & ) STOP ' S/R EXCH_RX: Unrecognised simulationMode '
124 IF ( theCornerMode .NE. EXCH_IGNORE_CORNERS
125 & .AND. theCornerMode .NE. EXCH_UPDATE_CORNERS
126 & ) STOP ' S/R EXCH_RX: Unrecognised cornerMode '
127
128 C-- Cycle edge buffer level
129 CALL EXCH_CYCLE_EBL( myThid )
130
131 IF ( theSimulationMode .EQ. FORWARD_SIMULATION ) THEN
132 C-- "Put" east and west edges.
133 CALL EXCH_RX_SEND_PUT_X( array,
134 I myOLw, myOLe, myOLs, myOLn, myNz,
135 I exchWidthX, exchWidthY,
136 I theSimulationMode, theCornerMode, myThid )
137 C-- If corners are important then sync and update east and west edges
138 C-- before doing north and south exchanges.
139 IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) THEN
140 CALL EXCH_RX_RECV_GET_X( array,
141 I myOLw, myOLe, myOLs, myOLn, myNz,
142 I exchWidthX, exchWidthY,
143 I theSimulationMode, theCornerMode, myThid )
144 ENDIF
145 C "Put" north and south edges.
146 CALL EXCH_RX_SEND_PUT_Y( array,
147 I myOLw, myOLe, myOLs, myOLn, myNz,
148 I exchWidthX, exchWidthY,
149 I theSimulationMode, theCornerMode, myThid )
150 C-- Sync and update north, south (and east, west if corner updating
151 C-- not active).
152 IF ( theCornerMode .NE. EXCH_UPDATE_CORNERS ) THEN
153 CALL EXCH_RX_RECV_GET_X( array,
154 I myOLw, myOLe, myOLs, myOLn, myNz,
155 I exchWidthX, exchWidthY,
156 I theSimulationMode, theCornerMode, myThid )
157 ENDIF
158 CALL EXCH_RX_RECV_GET_Y( array,
159 I myOLw, myOLe, myOLs, myOLn, myNz,
160 I exchWidthX, exchWidthY,
161 I theSimulationMode, theCornerMode, myThid )
162 ENDIF
163
164 IF ( theSimulationMode .EQ. REVERSE_SIMULATION ) THEN
165 C "Put" north and south edges.
166 CALL EXCH_RX_SEND_PUT_Y( array,
167 I myOLw, myOLe, myOLs, myOLn, myNz,
168 I exchWidthX, exchWidthY,
169 I theSimulationMode, theCornerMode, myThid )
170 C-- If corners are important then sync and update east and west edges
171 C-- before doing north and south exchanges.
172 IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) THEN
173 CALL EXCH_RX_RECV_GET_Y( array,
174 I myOLw, myOLe, myOLs, myOLn, myNz,
175 I exchWidthX, exchWidthY,
176 I theSimulationMode, theCornerMode, myThid )
177 ENDIF
178 C-- "Put" east and west edges.
179 CALL EXCH_RX_SEND_PUT_X( array,
180 I myOLw, myOLe, myOLs, myOLn, myNz,
181 I exchWidthX, exchWidthY,
182 I theSimulationMode, theCornerMode, myThid )
183 C-- Sync and update east, west (and north, south if corner updating
184 C-- not active).
185 IF ( theCornerMode .NE. EXCH_UPDATE_CORNERS ) THEN
186 CALL EXCH_RX_RECV_GET_Y( array,
187 I myOLw, myOLe, myOLs, myOLn, myNz,
188 I exchWidthX, exchWidthY,
189 I theSimulationMode, theCornerMode, myThid )
190 ENDIF
191 CALL EXCH_RX_RECV_GET_X( array,
192 I myOLw, myOLe, myOLs, myOLn, myNz,
193 I exchWidthX, exchWidthY,
194 I theSimulationMode, theCornerMode, myThid )
195 ENDIF
196 C Special case for zonal average model i.e. case where sNx == 1
197 C In this case a forward mode exchange simply sets array to
198 C the i=1 value for all i.
199 IF ( sNx .EQ. 1 ) THEN
200 DO bj=myByLo(myThid),myByHi(myThid)
201 DO bi=myBxLo(myThid),myBxHi(myThid)
202 DO K = 1,myNz
203 DO J = 1-myOLs,sNy+myOLn
204 DO I = 1-myOLw,sNx+myOLe
205 array(I,J,K,bi,bj) = array(sNx,J,K,bi,bj)
206 ENDDO
207 ENDDO
208 ENDDO
209 ENDDO
210 ENDDO
211 ENDIF
212
213 RETURN
214 END

  ViewVC Help
Powered by ViewVC 1.1.22