55 |
INTEGER tN |
INTEGER tN |
56 |
#endif /* ALLOW_EXCH2 */ |
#endif /* ALLOW_EXCH2 */ |
57 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
58 |
INTEGER np0, np |
INTEGER np, pId |
59 |
_RX temp(1:sNx,1:sNy,nSx,nSy) |
_RX temp(1:sNx,1:sNy,nSx,nSy) |
60 |
INTEGER istatus(MPI_STATUS_SIZE), ierr |
INTEGER istatus(MPI_STATUS_SIZE), ierr |
61 |
INTEGER lbuff, idest, itag, ready_to_receive |
INTEGER lbuff, idest, itag, ready_to_receive |
139 |
ENDIF |
ENDIF |
140 |
|
|
141 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
142 |
|
IF ( usingMPI ) THEN |
143 |
|
|
144 |
lbuff = sNx*nSx*sNy*nSy |
lbuff = sNx*nSx*sNy*nSy |
145 |
idest = 0 |
idest = 0 |
146 |
itag = 0 |
itag = 0 |
147 |
ready_to_receive = 0 |
ready_to_receive = 0 |
148 |
|
|
149 |
IF( mpiMyId .EQ. 0 ) THEN |
IF( mpiMyId .EQ. 0 ) THEN |
150 |
|
|
151 |
C-- Process 0 polls and receives data from each process in turn |
C-- Process 0 polls and receives data from each process in turn |
152 |
DO np = 2, numberOfProcs |
DO np = 2, nPx*nPy |
153 |
np0 = np - 1 |
pId = np - 1 |
154 |
#ifndef DISABLE_MPI_READY_TO_RECEIVE |
#ifndef DISABLE_MPI_READY_TO_RECEIVE |
155 |
CALL MPI_SEND (ready_to_receive, 1, MPI_INTEGER, |
CALL MPI_SEND (ready_to_receive, 1, MPI_INTEGER, |
156 |
& np0, itag, MPI_COMM_MODEL, ierr) |
& pId, itag, MPI_COMM_MODEL, ierr) |
157 |
#endif |
#endif |
158 |
CALL MPI_RECV (temp, lbuff, _MPI_TYPE_RX, |
CALL MPI_RECV (temp, lbuff, _MPI_TYPE_RX, |
159 |
& np0, itag, MPI_COMM_MODEL, istatus, ierr) |
& pId, itag, MPI_COMM_MODEL, istatus, ierr) |
160 |
|
|
161 |
C-- Process 0 gathers the local arrays into the global buffer. |
C-- Process 0 gathers the local arrays into the global buffer. |
162 |
#ifdef ALLOW_EXCH2 |
#ifdef ALLOW_EXCH2 |
222 |
C- end loop on np |
C- end loop on np |
223 |
ENDDO |
ENDDO |
224 |
|
|
225 |
ELSE |
ELSE |
226 |
|
|
227 |
C-- All proceses except 0 wait to be polled then send local array |
C-- All proceses except 0 wait to be polled then send local array |
228 |
#ifndef DISABLE_MPI_READY_TO_RECEIVE |
#ifndef DISABLE_MPI_READY_TO_RECEIVE |
232 |
CALL MPI_SEND (myField, lbuff, _MPI_TYPE_RX, |
CALL MPI_SEND (myField, lbuff, _MPI_TYPE_RX, |
233 |
& idest, itag, MPI_COMM_MODEL, ierr) |
& idest, itag, MPI_COMM_MODEL, ierr) |
234 |
|
|
235 |
ENDIF |
ENDIF |
236 |
|
|
237 |
|
ENDIF |
238 |
#endif /* ALLOW_USE_MPI */ |
#endif /* ALLOW_USE_MPI */ |
239 |
|
|
240 |
_END_MASTER( myThid ) |
_END_MASTER( myThid ) |