/[MITgcm]/MITgcm_contrib/cg2d_bench/gsum.F
ViewVC logotype

Annotation of /MITgcm_contrib/cg2d_bench/gsum.F

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


Revision 1.2 - (hide annotations) (download)
Fri May 12 22:23:10 2006 UTC (19 years, 2 months ago) by ce107
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +22 -3 lines
Fixed for single/double precision and also mixed precision (double for
global sums only)

1 ce107 1.2 C $Id$
2 ce107 1.1 SUBROUTINE GSUM_R8( ans, phi )
3    
4 ce107 1.2 #include "EEPARAMS.h"
5 ce107 1.1 #ifdef ALLOW_MPI
6     #include "mpif.h"
7 ce107 1.2 #include "MPI_INFO.h"
8 ce107 1.1 #endif
9    
10 ce107 1.2 #ifdef USE_MIXED_PRECISION
11     REAL*8 ans
12     REAL*8 phi
13     #else
14     Real ans
15     Real phi
16     #endif
17 ce107 1.1
18     INTEGER RC
19    
20     ans = phi
21    
22     #ifdef USE_MPI_GSUM
23 ce107 1.2 #ifdef USE_MIXED_PRECISION
24 ce107 1.1 CALL MPI_Allreduce( phi,
25     & ans,
26     & 1,
27     & MPI_REAL8,
28     & MPI_SUM,
29 ce107 1.2 & comm_use,
30     & rc
31     & )
32     #else
33     CALL MPI_Allreduce( phi,
34     & ans,
35     & 1,
36     & _MPI_TYPE_REAL,
37     & MPI_SUM,
38     & comm_use,
39 ce107 1.1 & rc
40     & )
41     #endif
42 ce107 1.2 #endif
43 ce107 1.1
44     #ifdef USE_JAM_GSUM
45     C JAM global sum
46     CALL JAM_barrier_start( phi )
47     CALL JAM_barrier_done( ans )
48     #endif
49    
50     C WRITE(6,*) ' phi = ', phi, ' Sum = ', ans
51     C CALL MPI_Finalize( rc )
52     C STOP
53    
54     RETURN
55     END

  ViewVC Help
Powered by ViewVC 1.1.22