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

Diff of /MITgcm/eesupp/src/exch_z_rx_cube.template

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

revision 1.1 by adcroft, Wed Mar 28 19:48:51 2001 UTC revision 1.2 by adcroft, Tue May 29 14:01:36 2001 UTC
# Line 0  Line 1 
1    C $Header$
2    C $Name$
3    
4    #include "CPP_EEOPTIONS.h"
5    
6          SUBROUTINE EXCH_Z_RX_CUBE(
7         U            array,
8         I            myOLw, myOLe, myOLn, myOLs, myNz,
9         I            exchWidthX, exchWidthY,
10         I            simulationMode, cornerMode, myThid )
11    C     /==========================================================\
12    C     | SUBROUTINE EXCH_Z_RX_CUBE                                |
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,repeat
85          INTEGER bl,bt,bn,bs,be,bw
86    
87    C     == Statement function ==
88          INTEGER tilemod
89          tilemod(I)=1+mod(I-1+6,6)
90    
91          theSimulationMode = simulationMode
92          theCornerMode     = cornerMode
93    
94    C     For now tile<->tile exchanges are sequentialised through
95    C     thread 1. This is a temporary feature for preliminary testing until
96    C     general tile decomposistion is in place (CNH April 11, 2001)
97          CALL BAR2( myThid )
98          IF ( myThid .EQ. 1 ) THEN
99    
100           DO repeat=1,2
101    
102           DO bl = 1, 5, 2
103    
104            bt = bl
105            bn=tilemod(bt+2)
106            bs=tilemod(bt-1)
107            be=tilemod(bt+1)
108            bw=tilemod(bt-2)
109    
110            DO K = 1, myNz
111             DO J = 1, sNy+1
112              DO I = 0, exchWidthX-1
113    
114    C          Tile Odd:Odd+2 [get] [North<-West]
115               array(J,sNy+I+1,K,bt,1) = array(I+1,sNy+2-J,K,bn,1)
116    C          Tile Odd:Odd+1 [get] [East<-West]
117               array(sNx+I+1,J,K,bt,1) = array(I+1,J,K,be,1)
118    
119    cs- these above loop should really have the same range the lower one
120              ENDDO
121              DO I = 1, exchWidthX-0
122    cs- but this replaces the missing I/O routines for now
123    
124    C          Tile Odd:Odd-1 [get] [South<-North]
125               array(J,1-I,K,bt,1) = array(J,sNy+1-I,K,bs,1)
126    C          Tile Odd:Odd-2 [get] [West<-North]
127               array(1-I,J,K,bt,1) = array(sNx+2-J,sNy+1-I,K,bw,1)
128    
129              ENDDO
130             ENDDO
131            ENDDO
132    
133            bt = bl+1
134            bn=tilemod(bt+1)
135            bs=tilemod(bt-2)
136            be=tilemod(bt+2)
137            bw=tilemod(bt-1)
138    
139            DO K = 1, myNz
140             DO J = 1, sNy+1
141              DO I = 0, exchWidthX-1
142    
143    C          Tile Even:Even+1 [get] [North<-South]
144               array(J,sNy+I+1,K,bt,1) = array(J,I+1,K,bn,1)
145    C          Tile Even:Even+2 [get] [East<-South]
146               array(sNx+I+1,J,K,bt,1) = array(sNx+2-J,I+1,K,be,1)
147    
148    cs- these above loop should really have the same range the lower one
149              ENDDO
150              DO I = 1, exchWidthX-0
151    cs- but this replaces the missing I/O routines for now
152    
153    C          Tile Even:Even-2 [get] [South<-East]
154               array(J,1-I,K,bt,1) = array(sNx+1-I,sNy+2-J,K,bs,1)
155    C          Tile Even:Even-1 [get] [West<-East]
156               array(1-I,J,K,bt,1) = array(sNx+1-I,J,K,bw,1)
157    
158              ENDDO
159             ENDDO
160            ENDDO
161    
162           ENDDO
163    
164           ENDDO
165    
166          ENDIF
167          CALL BAR2(myThid)
168    
169          RETURN
170          END

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22