1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/gsum_jam.F,v 1.3 2001/02/04 14:38:43 cnh Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_EEOPTIONS.h" |
5 |
|
6 |
#undef USE_MPI_GSUM |
7 |
#define USE_JAM_GSUM |
8 |
|
9 |
CBOP |
10 |
C !ROUTINE: GLOBAL_SUM_R8_JAM |
11 |
|
12 |
C !INTERFACE: |
13 |
SUBROUTINE GLOBAL_SUM_R8_JAM( ans, myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C *=========================================================================* |
17 |
C | SUBROUTINE GLOBAL_SUM_R8_JAM |
18 |
C | o JAM binding of global sum routine |
19 |
C *=========================================================================* |
20 |
C | Does a super fast global sum over the JAM library. With JAM |
21 |
C | timings for dual proc SMP nodes over Arctic are about |
22 |
C | 4.3usecs log2(NP/2). When it was done this was faster than any other |
23 |
C | cluster on the planet :-). |
24 |
C *=========================================================================* |
25 |
|
26 |
C !USES: |
27 |
#ifdef ALLOW_MPI |
28 |
#include "mpif.h" |
29 |
#endif |
30 |
|
31 |
C !INPUT/OUTPUT PARAMETERS: |
32 |
C ans :: Returned sum value |
33 |
C myThid :: Thread number of this instance |
34 |
Real*8 ans |
35 |
INTEGER myThid |
36 |
|
37 |
#ifdef LETS_MAKE_JAM |
38 |
|
39 |
C !LOCAL VARIABLES: |
40 |
C phi :: Temp. for accumulating sum |
41 |
C RC :: Return code |
42 |
Real*8 phi |
43 |
INTEGER RC |
44 |
|
45 |
phi = ans |
46 |
|
47 |
#ifdef USE_MPI_GSUM |
48 |
CALL MPI_Allreduce( phi, |
49 |
& ans, |
50 |
& 1, |
51 |
& MPI_REAL8, |
52 |
& MPI_SUM, |
53 |
& MPI_COMM_WORLD, |
54 |
& rc |
55 |
& ) |
56 |
#endif |
57 |
|
58 |
#ifdef USE_JAM_GSUM |
59 |
C JAM global sum |
60 |
CALL JAM_barrier_start( phi ) |
61 |
CALL JAM_barrier_done( ans ) |
62 |
#endif |
63 |
|
64 |
C WRITE(6,*) ' phi = ', phi, ' Sum = ', ans |
65 |
C CALL MPI_Finalize( rc ) |
66 |
C STOP |
67 |
|
68 |
#endif /* LETS_MAKE_JAM */ |
69 |
|
70 |
RETURN |
71 |
END |