1 |
C $Header: /u/gcmpack/MITgcm/pkg/exch2/W2_EXCH2_TOPOLOGY.h,v 1.12 2012/09/04 00:43:13 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
CBOP |
5 |
C !ROUTINE: W2_EXCH2_TOPOLOGY.h |
6 |
C !INTERFACE: |
7 |
C #include W2_EXCH2_TOPOLOGY.h |
8 |
|
9 |
C !DESCRIPTION: |
10 |
C *==========================================================* |
11 |
C | W2_EXCH2_TOPOLOGY.h |
12 |
C | o Header defining tile exchange and mapping for W2_EXCH2 |
13 |
C *==========================================================* |
14 |
C | 1rst part holds the full topology structure (same for all |
15 |
C | process) and is independent of tile-processor repartition |
16 |
C | (needs W2_EXCH2_SIZE.h to be included before) |
17 |
C | 2nd part (put in this header for convenience) holds |
18 |
C | Tile Ids and is function of tile-process repartition |
19 |
C | (needs SIZE.h to be included before) |
20 |
C *==========================================================* |
21 |
CEOP |
22 |
|
23 |
C--- Parameters for enumerating directions |
24 |
INTEGER W2_NORTH, W2_SOUTH, W2_EAST, W2_WEST |
25 |
PARAMETER ( W2_NORTH = 1 ) |
26 |
PARAMETER ( W2_SOUTH = 2 ) |
27 |
PARAMETER ( W2_EAST = 3 ) |
28 |
PARAMETER ( W2_WEST = 4 ) |
29 |
|
30 |
C--- Topology data structures |
31 |
C exch2_global_Nx :: Global-file domain length. |
32 |
C exch2_global_Ny :: Global-file domain height. |
33 |
C exch2_xStack_Nx :: Length of domain used for north/south OBCS. |
34 |
C exch2_xStack_Ny :: Height of domain used for north/south OBCS. |
35 |
C exch2_yStack_Nx :: Length of domain used for east/west OBCS. |
36 |
C exch2_yStack_Ny :: Height of domain used for east/west OBCS. |
37 |
C--- Tiling and Exch data structures |
38 |
C exch2_nTiles :: Number of tiles in this topology |
39 |
C exch2_myFace :: Face number for each tile (used for I/O). |
40 |
C exch2_mydNx :: Face size in X for each tile (for I/O). |
41 |
C exch2_mydNy :: Face size in Y for each tile (for I/O). |
42 |
C exch2_tNx :: Size in X for each tile. |
43 |
C exch2_tNy :: Size in Y for each tile. |
44 |
C exch2_tBasex :: Tile offset in X within its sub-domain (cube face) |
45 |
C exch2_tBasey :: Tile offset in Y within its sub-domain (cube face) |
46 |
C exch2_txGlobalo :: Tile base X index within global index space. |
47 |
C exch2_tyGlobalo :: Tile base Y index within global index space. |
48 |
C exch2_txXStackLo :: Tile base X index within N/S OBCS index space. |
49 |
C exch2_tyXStackLo :: Tile base Y index within N/S OBCS index space. |
50 |
C exch2_txYStackLo :: Tile base X index within E/W OBCS index space. |
51 |
C exch2_tyYStackLo :: Tile base Y index within E/W OBCS index space. |
52 |
C exch2_isWedge :: 1 if West is at domain edge, 0 if not. |
53 |
C exch2_isNedge :: 1 if North is at domain edge, 0 if not. |
54 |
C exch2_isEedge :: 1 if East is at domain edge, 0 if not. |
55 |
C exch2_isSedge :: 1 if South is at domain edge, 0 if not. |
56 |
C exch2_nNeighbours :: Tile neighbour entries count. |
57 |
C exch2_neighbourId :: Tile number for each neighbour entry. |
58 |
C exch2_opposingSend:: Neighbour entry in target tile send |
59 |
C :: which has this tile and neighbour as its target. |
60 |
C exch2_pij(:,n,t) :: Matrix which applies to target-tile indices to get |
61 |
C :: source-tile "t" indices, for neighbour entry "n". |
62 |
C exch2_oi(n,t) :: Source-tile "t" X index offset in target |
63 |
C :: to source connection (neighbour entry "n"). |
64 |
C exch2_oj(n,t) :: Source-tile "t" Y index offset in target |
65 |
C :: to source connection (neighbour entry "n"). |
66 |
INTEGER exch2_global_Nx |
67 |
INTEGER exch2_global_Ny |
68 |
INTEGER exch2_xStack_Nx |
69 |
INTEGER exch2_xStack_Ny |
70 |
INTEGER exch2_yStack_Nx |
71 |
INTEGER exch2_yStack_Ny |
72 |
INTEGER exch2_nTiles |
73 |
INTEGER exch2_myFace( W2_maxNbTiles ) |
74 |
INTEGER exch2_mydNx( W2_maxNbTiles ) |
75 |
INTEGER exch2_mydNy( W2_maxNbTiles ) |
76 |
INTEGER exch2_tNx( W2_maxNbTiles ) |
77 |
INTEGER exch2_tNy( W2_maxNbTiles ) |
78 |
INTEGER exch2_tBasex( W2_maxNbTiles ) |
79 |
INTEGER exch2_tBasey( W2_maxNbTiles ) |
80 |
INTEGER exch2_txGlobalo(W2_maxNbTiles ) |
81 |
INTEGER exch2_tyGlobalo(W2_maxNbTiles ) |
82 |
INTEGER exch2_txXStackLo(W2_maxNbTiles ) |
83 |
INTEGER exch2_tyXStackLo(W2_maxNbTiles ) |
84 |
INTEGER exch2_txYStackLo(W2_maxNbTiles ) |
85 |
INTEGER exch2_tyYStackLo(W2_maxNbTiles ) |
86 |
INTEGER exch2_isWedge( W2_maxNbTiles ) |
87 |
INTEGER exch2_isNedge( W2_maxNbTiles ) |
88 |
INTEGER exch2_isEedge( W2_maxNbTiles ) |
89 |
INTEGER exch2_isSedge( W2_maxNbTiles ) |
90 |
INTEGER exch2_nNeighbours( W2_maxNbTiles ) |
91 |
INTEGER exch2_neighbourId( W2_maxNeighbours, W2_maxNbTiles ) |
92 |
INTEGER exch2_opposingSend( W2_maxNeighbours, W2_maxNbTiles ) |
93 |
INTEGER exch2_neighbourDir( W2_maxNeighbours, W2_maxNbTiles ) |
94 |
INTEGER exch2_pij(4,W2_maxNeighbours, W2_maxNbTiles ) |
95 |
INTEGER exch2_oi ( W2_maxNeighbours, W2_maxNbTiles ) |
96 |
INTEGER exch2_oj ( W2_maxNeighbours, W2_maxNbTiles ) |
97 |
|
98 |
COMMON /W2_EXCH2_TOPO_I/ |
99 |
& exch2_global_Nx, exch2_global_Ny, |
100 |
& exch2_xStack_Nx, exch2_xStack_Ny, |
101 |
& exch2_yStack_Nx, exch2_yStack_Ny, |
102 |
& exch2_nTiles, |
103 |
& exch2_myFace, exch2_mydNx, exch2_mydNy, |
104 |
& exch2_tNx, exch2_tNy, |
105 |
& exch2_tBasex, exch2_tBasey, |
106 |
& exch2_txGlobalo,exch2_tyGlobalo, |
107 |
& exch2_txXStackLo,exch2_tyXStackLo, |
108 |
& exch2_txYStackLo,exch2_tyYStackLo, |
109 |
& exch2_isWedge, exch2_isNedge, |
110 |
& exch2_isEedge, exch2_isSedge, |
111 |
& exch2_nNeighbours, exch2_neighbourId, |
112 |
& exch2_opposingSend, exch2_neighbourDir, |
113 |
& exch2_pij, |
114 |
& exch2_oi, exch2_oj |
115 |
|
116 |
C--- Exchange execution loop data structures |
117 |
C exch2_iLo,iHi(n,t) :: X-index range of this tile "t" halo-region |
118 |
C :: to be updated with neighbour entry "n". |
119 |
C exch2_jLo,jHi(n,t) :: Y-index range of this tile "t" halo-region |
120 |
C :: to be updated with neighbour entry "n". |
121 |
INTEGER exch2_iLo( W2_maxNeighbours, W2_maxNbTiles ) |
122 |
INTEGER exch2_iHi( W2_maxNeighbours, W2_maxNbTiles ) |
123 |
INTEGER exch2_jLo( W2_maxNeighbours, W2_maxNbTiles ) |
124 |
INTEGER exch2_jHi( W2_maxNeighbours, W2_maxNbTiles ) |
125 |
COMMON /W2_EXCH2_HALO_SPEC/ |
126 |
& exch2_iLo, exch2_iHi, |
127 |
& exch2_jLo, exch2_jHi |
128 |
|
129 |
C--- Cumulated Sum operator |
130 |
C W2_tMC1, W2_tMC2 :: tile that holds Missing Corners (=f1.NW,f2.SE) |
131 |
C W2_cumSum_facet(1,f1,f2) :: cum-sum at facet f2 origin function of |
132 |
C facet f1 X-increment |
133 |
C W2_cumSum_facet(2,f1,f2) :: cum-sum at tile f2 origin function of |
134 |
C facet f1 Y-increment |
135 |
C W2_cumSum_tiles(1,t1,t2) :: cum-sum at tile t2 origin function of |
136 |
C tile t1 X-increment |
137 |
C W2_cumSum_tiles(2,t1,t2) :: cum-sum at tile t2 origin function of |
138 |
C tile t1 Y-increment |
139 |
INTEGER W2_tMC1, W2_tMC2 |
140 |
INTEGER W2_cumSum_facet( 2, W2_maxNbFacets,W2_maxNbFacets) |
141 |
COMMON /W2_CUMSUM_TOPO_I/ |
142 |
& W2_tMC1, W2_tMC2, |
143 |
& W2_cumSum_facet |
144 |
#ifdef W2_CUMSUM_USE_MATRIX |
145 |
INTEGER W2_cumSum_tiles( 2, W2_maxNbTiles, W2_maxNbTiles ) |
146 |
COMMON /W2_CUMSUM_MATRIX/ |
147 |
& W2_cumSum_tiles |
148 |
#endif /* W2_CUMSUM_USE_MATRIX */ |
149 |
|
150 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
151 |
|
152 |
C-- COMMON /W2_MAP_TILE2PROC/ mapping of tiles to process: |
153 |
C get W2 tile Id from process Id + subgrid indices (bi,bj) or the reverse |
154 |
C (tile ids are no longer a simple function of process and subgrid indices). |
155 |
C |
156 |
C W2_tileProc(tN) :: Rank of process owning tile tN (filled at run time). |
157 |
C W2_tileIndex(tN):: local subgrid index of tile tN |
158 |
C W2_tileRank(tN) :: rank of tile tN in full-tile list (without blank) |
159 |
C W2_myTileList :: list of tiles owned by this process |
160 |
C W2_procTileList :: same as W2_myTileList, but contains |
161 |
C information for all processes |
162 |
INTEGER W2_tileProc ( W2_maxNbTiles ) |
163 |
INTEGER W2_tileIndex( W2_maxNbTiles ) |
164 |
c INTEGER W2_tileRank ( W2_maxNbTiles ) |
165 |
INTEGER W2_myTileList ( nSx,nSy ) |
166 |
INTEGER W2_procTileList(nSx,nSy,nPx*nPy ) |
167 |
COMMON /W2_MAP_TILE2PROC/ |
168 |
& W2_tileProc, |
169 |
& W2_tileIndex, |
170 |
c & W2_tileRank, |
171 |
& W2_myTileList, W2_procTileList |
172 |
|
173 |
C-- COMMON /W2_EXCH2_COMMFLAG/ EXCH2 character Flag for type of communication |
174 |
CHARACTER W2_myCommFlag( W2_maxNeighbours, nSx, nSy ) |
175 |
COMMON /W2_EXCH2_COMMFLAG/ W2_myCommFlag |
176 |
|
177 |
C-- COMMON /EXCH2_FILLVAL_RX/ real type filling value used by EXCH2 |
178 |
C e2FillValue_RX :: filling value for null regions (facet-corner |
179 |
C :: halo regions) |
180 |
_RL e2FillValue_RL |
181 |
_RS e2FillValue_RS |
182 |
_R4 e2FillValue_R4 |
183 |
_R8 e2FillValue_R8 |
184 |
COMMON /EXCH2_FILLVAL_RL/ e2FillValue_RL |
185 |
COMMON /EXCH2_FILLVAL_RS/ e2FillValue_RS |
186 |
COMMON /EXCH2_FILLVAL_R4/ e2FillValue_R4 |
187 |
COMMON /EXCH2_FILLVAL_R8/ e2FillValue_R8 |
188 |
|
189 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |