/[MITgcm]/MITgcm/eesupp/src/global_sum.F
ViewVC logotype

Diff of /MITgcm/eesupp/src/global_sum.F

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

revision 1.15 by jmc, Tue Apr 27 16:09:47 2010 UTC revision 1.16 by jmc, Thu Sep 6 15:25:01 2012 UTC
# Line 55  C     I      :: Loop counters Line 55  C     I      :: Loop counters
55  C     mpiRC  :: MPI return code  C     mpiRC  :: MPI return code
56        INTEGER I        INTEGER I
57        Real*4  tmp        Real*4  tmp
58  #ifdef   ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
59        INTEGER mpiRC        INTEGER mpiRC
60  #endif /* ALLOW_USE_MPI */  #endif /* ALLOW_USE_MPI */
61  CEOP  CEOP
# Line 73  C--   Sum within the process first Line 73  C--   Sum within the process first
73          tmp = tmp + phiGSR4(1,I)          tmp = tmp + phiGSR4(1,I)
74         ENDDO         ENDDO
75         sumPhi = tmp         sumPhi = tmp
76  #ifdef  ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
 #ifndef ALWAYS_USE_MPI  
77         IF ( usingMPI ) THEN         IF ( usingMPI ) THEN
 #endif  
78          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_REAL,MPI_SUM,          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_REAL,MPI_SUM,
79       &                   MPI_COMM_MODEL,mpiRC)       &                   MPI_COMM_MODEL,mpiRC)
 #ifndef ALWAYS_USE_MPI  
80         ENDIF         ENDIF
81  #endif  #endif /* ALLOW_USE_MPI */
 #endif /*  ALLOW_USE_MPI */  
82  C--     Write solution to place where all threads can see it  C--     Write solution to place where all threads can see it
83         phiGSR4(1,0) = sumPhi         phiGSR4(1,0) = sumPhi
84    
# Line 142  C     I      :: Loop counters Line 138  C     I      :: Loop counters
138  C     mpiRC  :: MPI return code  C     mpiRC  :: MPI return code
139        INTEGER I        INTEGER I
140        Real*8  tmp        Real*8  tmp
141  #ifdef   ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
142        INTEGER mpiRC        INTEGER mpiRC
143  #endif   /* ALLOW_USE_MPI */  #endif   /* ALLOW_USE_MPI */
144  CEOP  CEOP
# Line 165  C--   Sum within the process first Line 161  C--   Sum within the process first
161          tmp = tmp + phiGSR8(1,I)          tmp = tmp + phiGSR8(1,I)
162         ENDDO         ENDDO
163         sumPhi = tmp         sumPhi = tmp
164  #ifdef  ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
 #ifndef ALWAYS_USE_MPI  
165         IF ( usingMPI ) THEN         IF ( usingMPI ) THEN
 #endif  
166          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_DOUBLE_PRECISION,MPI_SUM,          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_DOUBLE_PRECISION,MPI_SUM,
167       &                   MPI_COMM_MODEL,mpiRC)       &                   MPI_COMM_MODEL,mpiRC)
 #ifndef ALWAYS_USE_MPI  
168         ENDIF         ENDIF
169  #endif  #endif /* ALLOW_USE_MPI */
 #endif /*  ALLOW_USE_MPI */  
170  C--     Write solution to place where all threads can see it  C--     Write solution to place where all threads can see it
171         phiGSR8(1,0) = sumPhi         phiGSR8(1,0) = sumPhi
172        _END_MASTER( myThid )        _END_MASTER( myThid )
# Line 237  C     I      :: Loop counters Line 229  C     I      :: Loop counters
229  C     mpiRC  :: MPI return code  C     mpiRC  :: MPI return code
230        INTEGER I        INTEGER I
231        INTEGER  tmp        INTEGER  tmp
232  #ifdef   ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
233        INTEGER mpiRC        INTEGER mpiRC
234  #endif   /* ALLOW_USE_MPI */  #endif   /* ALLOW_USE_MPI */
235  CEOP  CEOP
# Line 255  C--   Sum within the process first Line 247  C--   Sum within the process first
247          tmp = tmp + phiGSI(1,I)          tmp = tmp + phiGSI(1,I)
248         ENDDO         ENDDO
249         sumPhi = tmp         sumPhi = tmp
250  #ifdef  ALLOW_USE_MPI  #ifdef ALLOW_USE_MPI
 #ifndef ALWAYS_USE_MPI  
251         IF ( usingMPI ) THEN         IF ( usingMPI ) THEN
 #endif  
252          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_INTEGER,MPI_SUM,          CALL MPI_Allreduce(tmp,sumPhi,1,MPI_INTEGER,MPI_SUM,
253       &                   MPI_COMM_MODEL,mpiRC)       &                   MPI_COMM_MODEL,mpiRC)
 #ifndef ALWAYS_USE_MPI  
254         ENDIF         ENDIF
255  #endif  #endif /* ALLOW_USE_MPI */
 #endif /*  ALLOW_USE_MPI */  
256  C--     Write solution to place where all threads can see it  C--     Write solution to place where all threads can see it
257         phiGSI(1,0) = sumPhi         phiGSI(1,0) = sumPhi
258        _END_MASTER( myThid )        _END_MASTER( myThid )

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22