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

Diff of /MITgcm/pkg/exch2/exch2_rx1_cube_ad.template

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

revision 1.6 by jmc, Sun Jun 28 01:00:23 2009 UTC revision 1.8 by jmc, Fri Apr 23 20:21:07 2010 UTC
# Line 61  C                   :: coordinate access Line 61  C                   :: coordinate access
61  C                   :: buffering. In PUT communication sender will increment  C                   :: buffering. In PUT communication sender will increment
62  C                   :: handle entry once data is ready in buffer. Receiver will  C                   :: handle entry once data is ready in buffer. Receiver will
63  C                   :: decrement handle once data is consumed from buffer.  C                   :: decrement handle once data is consumed from buffer.
64  C                   :: For MPI MSG communication MPI_Wait uses hanlde to check  C                   :: For MPI MSG communication MPI_Wait uses handle to check
65  C                   :: Isend has cleared. This is done in routine after receives.  C                   :: Isend has cleared. This is done in routine after receives.
66  C     note: a) current implementation does not use e2_msgHandles for communication  C     note: a) current implementation does not use e2_msgHandles for communication
67  C              between threads: all-threads barriers are used (see CNH note below).  C              between threads: all-threads barriers are used (see CNH note below).
# Line 95  C-    Tile size of array to exchange: Line 95  C-    Tile size of array to exchange:
95        k1Lo  = 1        k1Lo  = 1
96        k1Hi  = myNz        k1Hi  = myNz
97    
 C     For now tile <-> tile exchanges are sequentialised through  
 C     thread 1. This is a temporary feature for preliminary testing until  
 C     general tile decomposition is in place (CNH April 11, 2001)  
       CALL BAR2( myThid )  
   
98  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
99    
100    C     Prevent anyone to access shared buffer while an other thread modifies it
101          CALL BAR2( myThid )
102    
103  C--    Extract from buffer (either from level 1 if local exch,  C--    Extract from buffer (either from level 1 if local exch,
104  C                           or level 2 if coming from an other Proc)  C                           or level 2 if coming from an other Proc)
105  C  AD: = fill buffer from my-tile-edge overlap-region, level 1 or 2 depending  C  AD: = fill buffer from my-tile-edge overlap-region, level 1 or 2 depending
# Line 142  C       o e2_msgHandle entry to read is Line 140  C       o e2_msgHandle entry to read is
140         ENDDO         ENDDO
141        ENDDO        ENDDO
142    
143    C     Wait until all threads finish filling buffer
144          CALL BAR2( myThid )
145    
146  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
147    
148  #ifdef ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
149  C  AD: all MPI part is acting on buffer and is identical to forward code,  C  AD: all MPI part is acting on buffer and is identical to forward code,
150  C  AD: except a) the buffer level: send from lev.2, receive into lev.1  C  AD: except a) the buffer level: send from lev.2, receive into lev.1
151  C  AD:        b) the length of transfered buffer (<- match the ad_put/ad_get)  C  AD:        b) the length of transferred buffer (<- match the ad_put/ad_get)
152    
 C     Wait until all threads finish filling buffer  
       CALL BAR2( myThid )  
153        _BEGIN_MASTER( myThid )        _BEGIN_MASTER( myThid )
154    
155  C--   Send my data (in buffer, level 2) to target Process  C--   Send my data (in buffer, level 2) to target Process
# Line 228  c        farTile=exch2_neighbourId(N,thi Line 227  c        farTile=exch2_neighbourId(N,thi
227        ENDDO        ENDDO
228    
229        _END_MASTER( myThid )        _END_MASTER( myThid )
230    C     Everyone waits until master-thread finishes receiving
231          CALL BAR2( myThid )
232    
233  #endif /* ALLOW_USE_MPI */  #endif /* ALLOW_USE_MPI */
234    
235  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
 C     Wait until all threads finish receiving or filling buffer  
       CALL BAR2( myThid )  
236    
237  C--   Post sends into buffer (buffer level 1):  C--   Post sends into buffer (buffer level 1):
238  C- AD: = get exch-data from buffer (level 1), formerly in source tile  C- AD: = get exch-data from buffer (level 1), formerly in source tile
# Line 271  C     in its copy of "array". Line 271  C     in its copy of "array".
271         ENDDO         ENDDO
272        ENDDO        ENDDO
273    
       CALL BAR2(myThid)  
   
274        RETURN        RETURN
275        END        END
276    

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

  ViewVC Help
Powered by ViewVC 1.1.22