1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/inc/EXCH.h,v 1.1 1998/09/29 18:54:26 cnh Exp $ |
2 |
C |
3 |
C /==========================================================\ |
4 |
C | EXCH.h | |
5 |
C |==========================================================| |
6 |
C | Support data structures for the MITgcm UV "exchange | |
7 |
C | routines" code. This data should be private to the | |
8 |
C | execution environment routines. |
9 |
C \==========================================================/ |
10 |
|
11 |
#ifndef _RL |
12 |
#define _RL Real*8 |
13 |
#endif |
14 |
|
15 |
#ifndef _RS |
16 |
#define _RS Real*4 |
17 |
#endif |
18 |
|
19 |
#ifndef _tileCommModeW |
20 |
#define _tileCommModeW(a,b) tileCommModeW(a,b) |
21 |
#endif |
22 |
|
23 |
#ifndef _tileCommModeE |
24 |
#define _tileCommModeE(a,b) tileCommModeE(a,b) |
25 |
#endif |
26 |
|
27 |
#ifndef _tileBiE |
28 |
#define _tileBiE(a,b) tileBiE(a,b) |
29 |
#endif |
30 |
|
31 |
#ifndef _tileBiW |
32 |
#define _tileBiW(a,b) tileBiW(a,b) |
33 |
#endif |
34 |
|
35 |
#ifndef _tileBjE |
36 |
#define _tileBjE(a,b) tileBjE(a,b) |
37 |
#endif |
38 |
|
39 |
#ifndef _tileBjW |
40 |
#define _tileBjW(a,b) tileBjW(a,b) |
41 |
#endif |
42 |
|
43 |
#ifndef _mpiPidW |
44 |
#define _mpiPidW(a,b) pidW(a,b) |
45 |
#endif |
46 |
|
47 |
#ifndef _mpiIdE |
48 |
#define _mpiIdE(a,b) pidE(a,b) |
49 |
#endif |
50 |
|
51 |
#ifndef _tileTagSendW |
52 |
#define _tileTagSendW(a,b) tileTagSendW(a,b) |
53 |
#endif |
54 |
|
55 |
#ifndef _tileTagSendE |
56 |
#define _tileTagSendE(a,b) tileTagSendE(a,b) |
57 |
#endif |
58 |
|
59 |
#ifndef _tileTagRecvW |
60 |
#define _tileTagRecvW(a,b) tileTagRecvW(a,b) |
61 |
#endif |
62 |
|
63 |
#ifndef _tileTagRecvE |
64 |
#define _tileTagRecvE(a,b) tileTagRecvE(a,b) |
65 |
#endif |
66 |
|
67 |
#ifndef _tileCommModeS |
68 |
#define _tileCommModeS(a,b) tileCommModeS(a,b) |
69 |
#endif |
70 |
|
71 |
#ifndef _tileCommModeN |
72 |
#define _tileCommModeN(a,b) tileCommModeN(a,b) |
73 |
#endif |
74 |
|
75 |
#ifndef _tileBiN |
76 |
#define _tileBiN(a,b) tileBiN(a,b) |
77 |
#endif |
78 |
|
79 |
#ifndef _tileBiS |
80 |
#define _tileBiS(a,b) tileBiS(a,b) |
81 |
#endif |
82 |
|
83 |
#ifndef _tileBjN |
84 |
#define _tileBjN(a,b) tileBjN(a,b) |
85 |
#endif |
86 |
|
87 |
#ifndef _tileBjS |
88 |
#define _tileBjS(a,b) tileBjS(a,b) |
89 |
#endif |
90 |
|
91 |
#ifndef _mpiPidS |
92 |
#define _mpiPidS(a,b) pidS(a,b) |
93 |
#endif |
94 |
|
95 |
#ifndef _mpiIdN |
96 |
#define _mpiIdN(a,b) pidN(a,b) |
97 |
#endif |
98 |
|
99 |
#ifndef _tileTagSendS |
100 |
#define _tileTagSendS(a,b) tileTagSendS(a,b) |
101 |
#endif |
102 |
|
103 |
#ifndef _tileTagSendN |
104 |
#define _tileTagSendN(a,b) tileTagSendN(a,b) |
105 |
#endif |
106 |
|
107 |
#ifndef _tileTagRecvS |
108 |
#define _tileTagRecvS(a,b) tileTagRecvS(a,b) |
109 |
#endif |
110 |
|
111 |
#ifndef _tileTagRecvN |
112 |
#define _tileTagRecvN(a,b) tileTagRecvN(a,b) |
113 |
#endif |
114 |
|
115 |
#ifndef _theSimulationMode |
116 |
#define _theSimulationMode theSimulationMode |
117 |
#endif |
118 |
|
119 |
#ifndef _EXCH_SPIN_LIMIT |
120 |
#define _EXCH_SPIN_LIMIT EXCH_SPIN_LIMIT |
121 |
#endif |
122 |
|
123 |
C MAX_OLX_EXCH - Maximum overlap region allowed in X |
124 |
C MAX_OLY_EXCH - Maximum overlap region allowed in Y |
125 |
C MAX_NR_EXCH - Maximum number of vertical levels allowed |
126 |
C NUMBER_OF_BUFFER_LEVELS - Number of levels of buffer allowed. |
127 |
C EXCH_SPIN_LIMIT - Error trapping threshold for deadlocked exchange |
128 |
INTEGER MAX_OLX_EXCH |
129 |
PARAMETER ( MAX_OLX_EXCH = MAX_OLX ) |
130 |
INTEGER MAX_OLY_EXCH |
131 |
PARAMETER ( MAX_OLY_EXCH = MAX_OLY ) |
132 |
INTEGER MAX_NR_EXCH |
133 |
PARAMETER ( MAX_NR_EXCH = nR + 1 ) |
134 |
INTEGER NUMBER_OF_BUFFER_LEVELS |
135 |
PARAMETER ( NUMBER_OF_BUFFER_LEVELS = 1 ) |
136 |
INTEGER EXCH_SPIN_LIMIT |
137 |
PARAMETER ( EXCH_SPIN_LIMIT = 100000000 ) |
138 |
|
139 |
C |
140 |
C L_BUFFER[XY] - Maximum size for exchange buffer in |
141 |
C L_WBUFFER west, |
142 |
C L_EBUFFER east, |
143 |
C L_SBUFFER south, |
144 |
C L_NBUFFER north. |
145 |
INTEGER L_BUFFERX |
146 |
PARAMETER ( L_BUFFERX = |
147 |
& (sNy+2*MAX_OLY_EXCH)*MAX_OLX_EXCH*MAX_NR_EXCH ) |
148 |
INTEGER L_BUFFERY |
149 |
PARAMETER ( L_BUFFERY = |
150 |
& (sNx+2*MAX_OLX_EXCH)*MAX_OLY_EXCH*MAX_NR_EXCH ) |
151 |
INTEGER L_WBUFFER |
152 |
INTEGER L_EBUFFER |
153 |
INTEGER L_SBUFFER |
154 |
INTEGER L_NBUFFER |
155 |
PARAMETER ( L_WBUFFER = L_BUFFERX, |
156 |
& L_EBUFFER = L_BUFFERX, |
157 |
& L_SBUFFER = L_BUFFERY, |
158 |
& L_NBUFFER = L_BUFFERY ) |
159 |
|
160 |
C-- COMMON / EXCH_L / LOGICAL number common arrays for exchanges |
161 |
C exchNeedsMemSync - TRUE if memory sync. required to ensure |
162 |
C memory consistency during exchange |
163 |
C exchUsesBarrier - TRUE if we use a call to BAR to do sync. |
164 |
C between processes. On some machines we wont |
165 |
C spin on the Ack setting ( the T90 ), |
166 |
C instead we will use s system barrier. |
167 |
C On the T90 the system barrier is very fast and |
168 |
C switches out the thread while it waits. On most |
169 |
C machines the system barrier is much too slow and if |
170 |
C we own the machine and have one thread per process |
171 |
C preemption is not a problem. |
172 |
C exchCollectStatistics - Turns exchange statistics collecting on and off. |
173 |
|
174 |
COMMON / EXCH_L / exchNeedsMemSync, exchUsesBarrier, |
175 |
& exchCollectStatistics |
176 |
LOGICAL exchNeedsMemSync |
177 |
LOGICAL exchUsesBarrier |
178 |
LOGICAL exchCollectStatistics |
179 |
|
180 |
C-- COMMON / EXCH_R / REAL number common arrays for exchanges |
181 |
C xxxxSendBuf - Buffer used for sending data to another tile. |
182 |
C xxxxRecvBuf - Buffer used for receiving data from another tile. |
183 |
COMMON / EXCH_R / |
184 |
& westSendBuf_RL, eastSendBuf_RL, |
185 |
& southSendBuf_RL, northSendBuf_RL, |
186 |
& westRecvBuf_RL, eastRecvBuf_RL, |
187 |
& southRecvBuf_RL, northRecvBuf_RL, |
188 |
& westSendBuf_RS, eastSendBuf_RS, |
189 |
& southSendBuf_RS, northSendBuf_RS, |
190 |
& westRecvBuf_RS, eastRecvBuf_RS, |
191 |
& southRecvBuf_RS, northRecvBuf_RS |
192 |
_RL westSendBuf_RL( L_WBUFFER, NUMBER_OF_BUFFER_LEVELS, |
193 |
& nSx, nSy ) |
194 |
_RL eastSendBuf_RL( L_EBUFFER, NUMBER_OF_BUFFER_LEVELS, |
195 |
& nSx, nSy ) |
196 |
_RL southSendBuf_RL( L_SBUFFER, NUMBER_OF_BUFFER_LEVELS, |
197 |
& nSx, nSy ) |
198 |
_RL northSendBuf_RL( L_NBUFFER, NUMBER_OF_BUFFER_LEVELS, |
199 |
& nSx, nSy ) |
200 |
_RL westRecvBuf_RL( L_WBUFFER, NUMBER_OF_BUFFER_LEVELS, |
201 |
& nSx, nSy ) |
202 |
_RL eastRecvBuf_RL( L_EBUFFER, NUMBER_OF_BUFFER_LEVELS, |
203 |
& nSx, nSy ) |
204 |
_RL southRecvBuf_RL( L_SBUFFER, NUMBER_OF_BUFFER_LEVELS, |
205 |
& nSx, nSy ) |
206 |
_RL northRecvBuf_RL( L_NBUFFER, NUMBER_OF_BUFFER_LEVELS, |
207 |
& nSx, nSy ) |
208 |
_RS westSendBuf_RS( L_WBUFFER, NUMBER_OF_BUFFER_LEVELS, |
209 |
& nSx, nSy ) |
210 |
_RS eastSendBuf_RS( L_EBUFFER, NUMBER_OF_BUFFER_LEVELS, |
211 |
& nSx, nSy ) |
212 |
_RS southSendBuf_RS( L_SBUFFER, NUMBER_OF_BUFFER_LEVELS, |
213 |
& nSx, nSy ) |
214 |
_RS northSendBuf_RS( L_NBUFFER, NUMBER_OF_BUFFER_LEVELS, |
215 |
& nSx, nSy ) |
216 |
_RS westRecvBuf_RS( L_WBUFFER, NUMBER_OF_BUFFER_LEVELS, |
217 |
& nSx, nSy ) |
218 |
_RS eastRecvBuf_RS( L_EBUFFER, NUMBER_OF_BUFFER_LEVELS, |
219 |
& nSx, nSy ) |
220 |
_RS southRecvBuf_RS( L_SBUFFER, NUMBER_OF_BUFFER_LEVELS, |
221 |
& nSx, nSy ) |
222 |
_RS northRecvBuf_RS( L_NBUFFER, NUMBER_OF_BUFFER_LEVELS, |
223 |
& nSx, nSy ) |
224 |
|
225 |
C-- COMMON / EXCH_I / INTEGER common arrays for exchanges |
226 |
C xxxxSendAck - Flag indicating ready to send data. |
227 |
C xxxxRecvAck - Falg indicating receive data is ready. |
228 |
C exchBufferLevel - Current cyclic buffer level. |
229 |
C exchNReqsX, exchNReqsY - Pending message counts |
230 |
C exchReqIdX, exchReqIdY -Pending message identifiers |
231 |
C *Spin* - Exchange statistics holder |
232 |
C Count - No. spins for each thread |
233 |
C Max - Maximum spins for an exchange |
234 |
C Min - Minimum spins for an exchange |
235 |
COMMON / EXCH_I / |
236 |
& westSendAck, eastSendAck, southSendAck, northSendAck, |
237 |
& westRecvAck, eastRecvAck, southRecvAck, northRecvAck, |
238 |
& exchangeBufLevel, |
239 |
& exchNReqsX, exchNReqsY, exchReqIdX, exchReqIdY, |
240 |
& exchRecvXSpinCount, exchRecvXSpinMax, exchRecvXSpinMin, |
241 |
& exchRecvXExchCount, |
242 |
& exchRecvYSpinCount, exchRecvYSpinMax, exchRecvYSpinMin, |
243 |
& exchRecvYExchCount |
244 |
INTEGER westSendAck( NUMBER_OF_BUFFER_LEVELS, |
245 |
& nSx, nSy ) |
246 |
INTEGER eastSendAck( NUMBER_OF_BUFFER_LEVELS, |
247 |
& nSx, nSy ) |
248 |
INTEGER southSendAck( NUMBER_OF_BUFFER_LEVELS, |
249 |
& nSx, nSy ) |
250 |
INTEGER northSendAck( NUMBER_OF_BUFFER_LEVELS, |
251 |
& nSx, nSy ) |
252 |
INTEGER westRecvAck( NUMBER_OF_BUFFER_LEVELS, |
253 |
& nSx, nSy ) |
254 |
INTEGER eastRecvAck( NUMBER_OF_BUFFER_LEVELS, |
255 |
& nSx, nSy ) |
256 |
INTEGER southRecvAck( NUMBER_OF_BUFFER_LEVELS, |
257 |
& nSx, nSy ) |
258 |
INTEGER northRecvAck( NUMBER_OF_BUFFER_LEVELS, |
259 |
& nSx, nSy ) |
260 |
INTEGER exchangeBufLevel( cacheLineSize/4, nSx, nSy ) |
261 |
INTEGER exchNReqsX(cacheLineSize/4,nSx,nSy) |
262 |
INTEGER exchNReqsY(cacheLineSize/4,nSx,nSy) |
263 |
INTEGER exchReqIdX(2*nSx+2*nSy,cacheLineSize/4,nSx,nSy) |
264 |
INTEGER exchReqIdY(2*nSx+2*nSy,cacheLineSize/4,nSx,nSy) |
265 |
INTEGER exchRecvXSpinCount(cacheLineSize/4, nSx, nSy) |
266 |
INTEGER exchRecvXExchCount(cacheLineSize/4, nSx, nSy) |
267 |
INTEGER exchRecvXSpinMax (cacheLineSize/4, nSx, nSy) |
268 |
INTEGER exchRecvXSpinMin (cacheLineSize/4, nSx, nSy) |
269 |
INTEGER exchRecvYSpinCount(cacheLineSize/4, nSx, nSy) |
270 |
INTEGER exchRecvYExchCount(cacheLineSize/4, nSx, nSy) |
271 |
INTEGER exchRecvYSpinMax (cacheLineSize/4, nSx, nSy) |
272 |
INTEGER exchRecvYSpinMin (cacheLineSize/4, nSx, nSy) |
273 |
|