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