32 |
#include "SIZE.h" |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
34 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
35 |
|
#include "GLOBAL_MAX.h" |
36 |
|
|
37 |
C == Routine arguments == |
C == Routine arguments == |
38 |
C maxPhi - Result of max. |
C maxPhi - Result of max. |
42 |
CEndOfInterface |
CEndOfInterface |
43 |
|
|
44 |
C == Local variables == |
C == Local variables == |
|
C phi - Array to be maxed. |
|
45 |
C I - Loop counters |
C I - Loop counters |
46 |
C mpiRC - MPI return code |
C mpiRC - MPI return code |
|
Real*4 phi(lShare4,MAX_NO_THREADS) |
|
47 |
INTEGER I |
INTEGER I |
48 |
Real*4 tmp |
Real*4 tmp |
49 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
50 |
INTEGER mpiRC |
INTEGER mpiRC |
51 |
#endif /* ALLOW_USE_MPI */ |
#endif /* ALLOW_USE_MPI */ |
52 |
|
|
53 |
|
CALL BAR2( myThid ) |
54 |
C-- write local max into array |
C-- write local max into array |
55 |
phi(1,myThid) = maxPhi |
phiGMRS(1,myThid) = maxPhi |
56 |
|
|
57 |
C-- Can not start until everyone is ready |
C-- Can not start until everyone is ready |
58 |
_BARRIER |
CALL BAR2( myThid ) |
59 |
|
|
60 |
C-- Max within the process first |
C-- Max within the process first |
61 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
62 |
tmp = phi(1,1) |
tmp = phiGMRS(1,1) |
63 |
DO I=2,nThreads |
DO I=2,nThreads |
64 |
tmp = MAX(tmp,phi(1,I)) |
tmp = MAX(tmp,phiGMRS(1,I)) |
65 |
ENDDO |
ENDDO |
66 |
maxPhi = tmp |
maxPhi = tmp |
67 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
74 |
ENDIF |
ENDIF |
75 |
#endif |
#endif |
76 |
#endif /* ALLOW_USE_MPI */ |
#endif /* ALLOW_USE_MPI */ |
77 |
phi(1,1) = maxPhi |
phiGMRS(1,1) = maxPhi |
78 |
_END_MASTER( myThid ) |
_END_MASTER( myThid ) |
79 |
C-- |
C-- |
80 |
_BARRIER |
CALL BAR2( myThid ) |
81 |
|
|
82 |
C-- set result for every process |
C-- set result for every process |
83 |
maxPhi = phi(1,1) |
maxPhi = phiGMRS(1,1) |
84 |
|
CALL BAR2( myThid ) |
85 |
|
|
86 |
RETURN |
RETURN |
87 |
END |
END |
111 |
#include "SIZE.h" |
#include "SIZE.h" |
112 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
113 |
#include "EESUPPORT.h" |
#include "EESUPPORT.h" |
114 |
|
#include "GLOBAL_MAX.h" |
115 |
|
|
116 |
C === Routine arguments === |
C === Routine arguments === |
117 |
C maxPhi - Result of max. |
C maxPhi - Result of max. |
121 |
CEndOfInterface |
CEndOfInterface |
122 |
|
|
123 |
C === Local variables === |
C === Local variables === |
|
C phi - Array to be maxed. |
|
124 |
C I - Loop counters |
C I - Loop counters |
125 |
C mpiRC - MPI return code |
C mpiRC - MPI return code |
|
Real*8 phi(lShare8,MAX_NO_THREADS) |
|
126 |
INTEGER I |
INTEGER I |
127 |
Real*8 tmp |
Real*8 tmp |
128 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
129 |
INTEGER mpiRC |
INTEGER mpiRC |
130 |
#endif /* ALLOW_USE_MPI */ |
#endif /* ALLOW_USE_MPI */ |
131 |
|
|
132 |
|
CALL BAR2( myThid ) |
133 |
C-- write local max into array |
C-- write local max into array |
134 |
phi(1,myThid) = maxPhi |
phiGMRL(1,myThid) = maxPhi |
135 |
|
|
136 |
C-- Can not start until everyone is ready |
C-- Can not start until everyone is ready |
137 |
_BARRIER |
CALL BAR2( myThid ) |
138 |
|
|
139 |
C-- Max within the process first |
C-- Max within the process first |
140 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
141 |
tmp = phi(1,1) |
tmp = phiGMRL(1,1) |
142 |
DO I=2,nThreads |
DO I=2,nThreads |
143 |
tmp = MAX(tmp,phi(1,I)) |
tmp = MAX(tmp,phiGMRL(1,I)) |
144 |
ENDDO |
ENDDO |
145 |
maxPhi = tmp |
maxPhi = tmp |
146 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
154 |
#endif |
#endif |
155 |
#endif /* ALLOW_USE_MPI */ |
#endif /* ALLOW_USE_MPI */ |
156 |
C-- Write solution to place where all threads can see it |
C-- Write solution to place where all threads can see it |
157 |
phi(1,1) = maxPhi |
phiGMRL(1,1) = maxPhi |
158 |
_END_MASTER( myThid ) |
_END_MASTER( myThid ) |
159 |
|
|
160 |
C-- Do not leave until we are sure that the max is done |
C-- Do not leave until we are sure that the max is done |
161 |
_BARRIER |
CALL BAR2( myThid ) |
162 |
|
|
163 |
C-- set result for every process |
C-- set result for every process |
164 |
maxPhi = phi(1,1) |
maxPhi = phiGMRL(1,1) |
165 |
|
CALL BAR2( myThid ) |
166 |
|
|
167 |
RETURN |
RETURN |
168 |
END |
END |