/[MITgcm]/MITgcm/pkg/exch2/exch2_rx1_cube.template
ViewVC logotype

Annotation of /MITgcm/pkg/exch2/exch2_rx1_cube.template

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


Revision 1.1 - (hide annotations) (download)
Fri Jan 9 20:46:09 2004 UTC (20 years, 5 months ago) by afe
Branch: MAIN
CVS Tags: checkpoint52l_pre, hrcube4, checkpoint52j_post, checkpoint52l_post, checkpoint52k_post, checkpoint52f_post, hrcube5, checkpoint52i_post, checkpoint52j_pre, checkpoint52i_pre, checkpoint52h_pre, hrcube_2, hrcube_3
Added exch2 routines and pointed hs94.cs-32x32x5 at them

1 afe 1.1 C $Header: /u/u0/gcmpack/MITgcm_contrib/high_res_cube/code-mods/exch2_rl1_cube.F,v 1.2 2003/11/21 04:01:55 cnh Exp $
2     C $Name: $
3    
4     #include "CPP_EEOPTIONS.h"
5    
6     #undef Dbg
7    
8     CBOP
9     C !ROUTINE: EXCH_RX_CUBE
10    
11     C !INTERFACE:
12     SUBROUTINE EXCH2_RX1_CUBE(
13     U array, fieldCode,
14     I myOLw, myOLe, myOLn, myOLs, myNz,
15     I exchWidthX, exchWidthY,
16     I simulationMode, cornerMode, myThid )
17     IMPLICIT NONE
18    
19     C !DESCRIPTION:
20    
21     C !USES:
22     C == Global data ==
23     #include "SIZE.h"
24     #include "EEPARAMS.h"
25     #include "EESUPPORT.h"
26     #include "EXCH.h"
27     #include "W2_EXCH2_TOPOLOGY.h"
28     #include "W2_EXCH2_PARAMS.h"
29    
30     C !INPUT/OUTPUT PARAMETERS:
31     C array :: Array with edges to exchange.
32     C myOLw :: West, East, North and South overlap region sizes.
33     C myOLe
34     C myOLn
35     C myOLs
36     C exchWidthX :: Width of data region exchanged in X.
37     C exchWidthY :: Width of data region exchanged in Y.
38     C myThid :: Thread number of this instance of S/R EXCH...
39     CHARACTER*2 fieldCode
40     INTEGER myOLw
41     INTEGER myOLe
42     INTEGER myOLs
43     INTEGER myOLn
44     INTEGER myNz
45     INTEGER exchWidthX
46     INTEGER exchWidthY
47     INTEGER simulationMode
48     INTEGER cornerMode
49     INTEGER myThid
50     _RX array(1-myOLw:sNx+myOLe,
51     & 1-myOLs:sNy+myOLn,
52     & myNZ, nSx, nSy)
53    
54     C !LOCAL VARIABLES:
55     C theSimulationMode :: Holds working copy of simulation mode
56     C theCornerMode :: Holds working copy of corner mode
57     C I,J,K,bl,bt,bn,bs :: Loop and index counters
58     C be,bw
59     INTEGER theSimulationMode
60     INTEGER theCornerMode
61     INTEGER I,J,K
62     INTEGER bl,bt,bn,bs,be,bw
63     C Variables for working through W2 topology
64     INTEGER thisTile, farTile, N, nN, oN
65     INTEGER tIlo, tIhi, tJlo, tJhi, tKlo, tKhi
66     INTEGER tIStride, tJStride, tKStride
67     INTEGER i1Lo, i1Hi, j1Lo, j1Hi, k1Lo, k1Hi
68     INTEGER bi1Lo, bi1Hi, bj1Lo, bj1Hi
69     C == Statement function ==
70     C tilemod - Permutes indices to return neighboring tile index on
71     C six face cube.
72     INTEGER tilemod
73    
74     C MPI stuff (should be in a routine call)
75     #ifdef ALLOW_USE_MPI
76     INTEGER mpiStatus(MPI_STATUS_SIZE)
77     #endif
78     INTEGER mpiRc
79     INTEGER wHandle
80     CEOP
81    
82     theSimulationMode = simulationMode
83     theCornerMode = cornerMode
84    
85     C For now tile<->tile exchanges are sequentialised through
86     C thread 1. This is a temporary feature for preliminary testing until
87     C general tile decomposistion is in place (CNH April 11, 2001)
88     CALL BAR2( myThid )
89    
90     C Post sends as messages or buffer copies
91     DO I=myBxLo(myThid), myBxHi(myThid)
92     thisTile=W2_myTileList(I)
93     nN=exch2_nNeighbours(thisTile)
94     DO N=1,nN
95     farTile=exch2_neighbourId(N,thisTile)
96     tIlo =exch2_itlo_c(N,thisTile)
97     tIhi =exch2_ithi_c(N,thisTile)
98     tJlo =exch2_jtlo_c(N,thisTile)
99     tJhi =exch2_jthi_c(N,thisTile)
100     CALL EXCH2_GET_SEND_BOUNDS(
101     I fieldCode, exchWidthX,
102     O tiStride, tjStride,
103     U tIlo, tiHi, tjLo, tjHi )
104     tKLo=1
105     tKHi=myNz
106     tKStride=1
107     i1Lo = 1-myOLw
108     i1Hi = sNx+myOLe
109     j1Lo = 1-myOLs
110     j1Hi = sNy+myOLs
111     k1Lo = 1
112     k1Hi = myNz
113     bi1Lo = I
114     bi1Hi = I
115     bj1Lo = 1
116     bj1Hi = 1
117     C Send to neighbour N to fill neighbor points
118     C (tIlo:tIhi:tiStride,tJlo:tJhi,tJStride,tKlo:tKhi,tKStride)
119     C in its copy of "array".
120     CALL EXCH2_SEND_RX1(
121     I tIlo, tIhi, tiStride,
122     I tJlo, tJhi, tjStride,
123     I tKlo, tKhi, tkStride,
124     I thisTile, N,
125     I e2Bufr1_RX(1,N,I,1), e2BufrRecSize,
126     I array(1-myOLw,1-myOLs,1,I,1),
127     I i1Lo, i1Hi, j1Lo, j1Hi, k1Lo, k1Hi,
128     O e2_msgHandles(1,N,I),
129     I W2_myCommFlag(N,I),
130     I myThid )
131     ENDDO
132     ENDDO
133    
134     C Receive messages or extract buffer copies
135     DO I=myBxLo(myThid), myBxHi(myThid)
136     thisTile=W2_myTileList(I)
137     nN=exch2_nNeighbours(thisTile)
138     DO N=1,nN
139     farTile=exch2_neighbourId(N,thisTile)
140     oN=exch2_opposingSend_Record(N,thisTile)
141     tIlo =exch2_itlo_c(oN,farTile)
142     tIhi =exch2_ithi_c(oN,farTile)
143     tJlo =exch2_jtlo_c(oN,farTile)
144     tJhi =exch2_jthi_c(oN,farTile)
145     CALL EXCH2_GET_RECV_BOUNDS(
146     I fieldCode, exchWidthX,
147     O tiStride, tjStride,
148     U tIlo, tiHi, tjLo, tjHi )
149     tKLo=1
150     tKHi=myNz
151     tKStride=1
152     i1Lo = 1-myOLw
153     i1Hi = sNx+myOLe
154     j1Lo = 1-myOLs
155     j1Hi = sNy+myOLs
156     k1Lo = 1
157     k1Hi = myNz
158     bi1Lo = I
159     bi1Hi = I
160     bj1Lo = 1
161     bj1Hi = 1
162    
163     C Receive from neighbour N to fill my points
164     C (tIlo:tIhi:tiStride,tJlo:tJhi,tJStride,tKlo:tKhi,tKStride)
165     C in "array".
166     C Note: when transferring data within a process:
167     C o e2Bufr entry to read is entry associated with opposing send record
168     C o e2_msgHandle entry to read is entry associated with opposing send
169     C record.
170     CALL EXCH2_RECV_RX1(
171     I tIlo, tIhi, tiStride,
172     I tJlo, tJhi, tjStride,
173     I tKlo, tKhi, tkStride,
174     I thisTile, I, N,
175     I e2Bufr1_RX, e2BufrRecSize,
176     I MAX_NEIGHBOURS, nSx,
177     I array(1-myOLw,1-myOLs,1,I,1),
178     I i1Lo, i1Hi, j1Lo, j1Hi, k1Lo, k1Hi,
179     U e2_msgHandles,
180     I W2_myTileList,
181     I W2_myCommFlag(N,I),
182     I myThid )
183     ENDDO
184     ENDDO
185    
186     C Clear message handles/locks
187     DO I=1,nSx
188     thisTile=W2_myTileList(I)
189     nN=exch2_nNeighbours(thisTile)
190     DO N=1,nN
191     C Note: In a between process tile-tile data transport using
192     C MPI the sender needs to clear an Isend wait handle here.
193     C In a within process tile-tile data transport using true
194     C shared address space/or direct transfer through commonly
195     C addressable memory blocks the receiver needs to assert
196     C that is has consumed the buffer the sender filled here.
197     farTile=exch2_neighbourId(N,thisTile)
198     IF ( W2_myCommFlag(N,I) .EQ. 'M' ) THEN
199     #ifdef ALLOW_USE_MPI
200     wHandle = e2_msgHandles(1,N,I)
201     CALL MPI_Wait( wHandle, mpiStatus, mpiRc )
202     #endif
203     ELSEIF ( W2_myCommFlag(N,I) .EQ. 'P' ) THEN
204     ELSE
205     ENDIF
206     ENDDO
207     ENDDO
208    
209     CALL BAR2(myThid)
210    
211     RETURN
212     END
213    
214     C ----------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.22