/[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.2 - (show annotations) (download)
Tue May 29 14:01:36 2001 UTC (22 years, 11 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint40pre3, checkpoint40pre1, checkpoint40pre7, checkpoint40pre6, checkpoint40pre9, checkpoint40pre8, checkpoint40pre2, checkpoint40pre4, checkpoint40pre5, checkpoint40
Changes since 1.1: +201 -0 lines
Merge from branch pre38:
 o essential mods for cubed sphere
 o debugged atmosphere, dynamcis + physics (aim)
 o new packages (mom_vecinv, mom_fluxform, ...)

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

  ViewVC Help
Powered by ViewVC 1.1.22