/[MITgcm]/MITgcm/pkg/flt/exch_recv_get_vec.F
ViewVC logotype

Diff of /MITgcm/pkg/flt/exch_recv_get_vec.F

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

revision 1.7 by jmc, Tue Aug 4 16:14:09 2009 UTC revision 1.8 by jmc, Wed Aug 31 21:35:11 2011 UTC
# Line 2  C $Header$ Line 2  C $Header$
2  C $Name$  C $Name$
3    
4  #include "CPP_EEOPTIONS.h"  #include "CPP_EEOPTIONS.h"
5    #undef EXCH_USE_SPINNING
6  #undef DBUG_EXCH_VEC  #undef DBUG_EXCH_VEC
7    
8  C--   Contents  C--   Contents
# Line 77  C--   iii. Set data read flag + memory s Line 78  C--   iii. Set data read flag + memory s
78    
79        ioUnit = errorMessageUnit        ioUnit = errorMessageUnit
80    
81        DO bj=myByLo(myThid),myByHi(myThid)        _BEGIN_MASTER(myThid)
82         DO bi=myBxLo(myThid),myBxHi(myThid)  
83          DO bj=1,nSy
84           DO bi=1,nSx
85          westCommMode  = _tileCommModeW(bi,bj)          westCommMode  = _tileCommModeW(bi,bj)
86          eastCommMode  = _tileCommModeE(bi,bj)          eastCommMode  = _tileCommModeE(bi,bj)
87  #ifdef DBUG_EXCH_VEC  #ifdef DBUG_EXCH_VEC
# Line 151  c         endif Line 154  c         endif
154        write(ioUnit,'(A,5I6,I12)') 'RECV_X:',myProcId        write(ioUnit,'(A,5I6,I12)') 'RECV_X:',myProcId
155  #endif  #endif
156    
157  C--   Wait for buffers I am going read to be ready.        IF ( .NOT.exchUsesBarrier  ) THEN
158           DO bj=1,nSy
159            DO bi=1,nSx
160             IF ( exchNReqsX(1,bi,bj) .GT. 0 ) THEN
161    #ifdef ALLOW_USE_MPI
162    #ifndef ALWAYS_USE_MPI
163              IF ( usingMPI ) THEN
164    #endif
165              CALL MPI_Waitall( exchNReqsX(1,bi,bj), exchReqIdX(1,1,bi,bj),
166         &                      mpiStatus, mpiRC )
167    #ifndef ALWAYS_USE_MPI
168              ENDIF
169    #endif
170    #endif /* ALLOW_USE_MPI */
171             ENDIF
172    C        Clear outstanding requests counter
173             exchNReqsX(1,bi,bj) = 0
174            ENDDO
175           ENDDO
176          ENDIF
177    
178          _END_MASTER(myThid)
179    
180    C--   need to sync threads after master has received data ;
181    C     (done after mpi waitall in case waitall is really needed)
182          _BARRIER
183    
184    C--   Threads wait for buffers I am going to read to be ready.
185    C     note: added BARRIER in exch_send_put S/R and here above (message
186    C     mode) so that we no longer needs this (undef EXCH_USE_SPINNING)
187    #ifdef EXCH_USE_SPINNING
188        IF ( exchUsesBarrier  ) THEN        IF ( exchUsesBarrier  ) THEN
189  C      o On some machines ( T90 ) use system barrier rather than spinning.  C      o On some machines ( T90 ) use system barrier rather than spinning.
190         CALL BARRIER( myThid )         CALL BARRIER( myThid )
# Line 182  C        i.e. we only lock waiting for d Line 215  C        i.e. we only lock waiting for d
215  C        Clear outstanding requests  C        Clear outstanding requests
216           westRecvAck(1,bi,bj) = 0           westRecvAck(1,bi,bj) = 0
217           eastRecvAck(1,bi,bj) = 0           eastRecvAck(1,bi,bj) = 0
   
          IF ( exchNReqsX(1,bi,bj) .GT. 0 ) THEN  
 #ifdef ALLOW_USE_MPI  
 #ifndef ALWAYS_USE_MPI  
           IF ( usingMPI ) THEN  
 #endif  
           CALL MPI_Waitall( exchNReqsX(1,bi,bj), exchReqIdX(1,1,bi,bj),  
      &                      mpiStatus, mpiRC )  
 #ifndef ALWAYS_USE_MPI  
           ENDIF  
 #endif  
 #endif /* ALLOW_USE_MPI */  
          ENDIF  
 C        Clear outstanding requests counter  
          exchNReqsX(1,bi,bj) = 0  
 C        Update statistics  
218          ENDDO          ENDDO
219         ENDDO         ENDDO
220        ENDIF        ENDIF
221    #endif /* EXCH_USE_SPINNING */
222    
223        RETURN        RETURN
224        END        END
# Line 274  C--   iii. Set data read flag + memory s Line 292  C--   iii. Set data read flag + memory s
292    
293        ioUnit = errorMessageUnit        ioUnit = errorMessageUnit
294    
295        DO bj=myByLo(myThid),myByHi(myThid)        _BEGIN_MASTER(myThid)
296         DO bi=myBxLo(myThid),myBxHi(myThid)  
297          DO bj=1,nSy
298           DO bi=1,nSx
299          southCommMode  = _tileCommModeS(bi,bj)          southCommMode  = _tileCommModeS(bi,bj)
300          northCommMode  = _tileCommModeN(bi,bj)          northCommMode  = _tileCommModeN(bi,bj)
301  #ifdef DBUG_EXCH_VEC  #ifdef DBUG_EXCH_VEC
# Line 331  c       bjS =  _tileBjS(bi,bj) Line 351  c       bjS =  _tileBjS(bi,bj)
351        write(ioUnit,'(A,5I6,I12)') 'RECV_Y:',myProcId        write(ioUnit,'(A,5I6,I12)') 'RECV_Y:',myProcId
352  #endif  #endif
353    
354  C--   Wait for buffers I am going read to be ready.  C--   Processes wait for buffers I am going to read to be ready.
355          IF ( .NOT.exchUsesBarrier  ) THEN
356           DO bj=1,nSy
357            DO bi=1,nSx
358             IF ( exchNReqsY(1,bi,bj) .GT. 0 ) THEN
359    #ifdef ALLOW_USE_MPI
360    #ifndef ALWAYS_USE_MPI
361              IF ( usingMPI ) THEN
362    #endif
363              CALL MPI_Waitall( exchNReqsY(1,bi,bj), exchReqIdY(1,1,bi,bj),
364         &                      mpiStatus, mpiRC )
365    #ifndef ALWAYS_USE_MPI
366              ENDIF
367    #endif
368    #endif /* ALLOW_USE_MPI */
369             ENDIF
370    C        Clear outstanding requests counter
371             exchNReqsY(1,bi,bj) = 0
372            ENDDO
373           ENDDO
374          ENDIF
375    
376          _END_MASTER(myThid)
377    
378    C--   need to sync threads after master has received data ;
379    C     (done after mpi waitall in case waitall is really needed)
380          _BARRIER
381    
382    C--   Threads wait for buffers I am going to read to be ready.
383    C     note: added BARRIER in exch_send_put S/R and here above (message
384    C     mode) so that we no longer needs this (undef EXCH_USE_SPINNING)
385    #ifdef EXCH_USE_SPINNING
386        IF ( exchUsesBarrier  ) THEN        IF ( exchUsesBarrier  ) THEN
387  C      o On some machines ( T90 ) use system barrier rather than spinning.  C      o On some machines ( T90 ) use system barrier rather than spinning.
388         CALL BARRIER( myThid )         CALL BARRIER( myThid )
# Line 362  C        i.e. we only lock waiting for d Line 413  C        i.e. we only lock waiting for d
413  C        Clear outstanding requests  C        Clear outstanding requests
414           southRecvAck(1,bi,bj) = 0           southRecvAck(1,bi,bj) = 0
415           northRecvAck(1,bi,bj) = 0           northRecvAck(1,bi,bj) = 0
   
          IF ( exchNReqsY(1,bi,bj) .GT. 0 ) THEN  
 #ifdef ALLOW_USE_MPI  
 #ifndef ALWAYS_USE_MPI  
           IF ( usingMPI ) THEN  
 #endif  
           CALL MPI_Waitall( exchNReqsY(1,bi,bj), exchReqIdY(1,1,bi,bj),  
      &                      mpiStatus, mpiRC )  
 #ifndef ALWAYS_USE_MPI  
           ENDIF  
 #endif  
 #endif /* ALLOW_USE_MPI */  
          ENDIF  
 C        Clear outstanding requests counter  
          exchNReqsY(1,bi,bj) = 0  
 C        Update statistics  
416          ENDDO          ENDDO
417         ENDDO         ENDDO
418        ENDIF        ENDIF
419    #endif /* EXCH_USE_SPINNING */
420    
421        RETURN        RETURN
422        END        END

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22