# | Line 1 | Line 1 | |
---|---|---|
1 | < | /* |
1 | > | /* |
2 | * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. | |
3 | * | |
4 | * The University of Notre Dame grants you ("Licensee") a | |
# | Line 67 | Line 67 | namespace mdProfileSpace { | |
67 | struct timeval startTime[N_PROFILES]; | |
68 | struct timeval endTime[N_PROFILES]; | |
69 | ||
70 | < | double accumTime[N_PROFILES]; |
70 | > | RealType accumTime[N_PROFILES]; |
71 | ||
72 | #ifdef IS_MPI | |
73 | < | double globalTime[N_PROFILES]; |
73 | > | RealType globalTime[N_PROFILES]; |
74 | #endif //is_mpi | |
75 | ||
76 | ||
# | Line 78 | Line 78 | extern "C"{ | |
78 | ||
79 | extern "C"{ | |
80 | ||
81 | < | void F90_FUNC(gettimes, GETTIMES)(double* forceTime, |
82 | < | double* commTime); |
81 | > | void FC_FUNC(gettimes, GETTIMES)(RealType* forceTime, |
82 | > | RealType* commTime); |
83 | } | |
84 | ||
85 | ||
# | Line 118 | Line 118 | void endProfile( proNames theProfile ){ | |
118 | ||
119 | void endProfile( proNames theProfile ){ | |
120 | struct timezone tz; | |
121 | < | double startVal, endVal; |
121 | > | RealType startVal, endVal; |
122 | ||
123 | gettimeofday( &endTime[theProfile], &tz ); | |
124 | ||
125 | < | startVal = (double)startTime[theProfile].tv_sec |
126 | < | + (double)startTime[theProfile].tv_usec / 1000000.0; |
125 | > | startVal = (RealType)startTime[theProfile].tv_sec |
126 | > | + (RealType)startTime[theProfile].tv_usec / 1000000.0; |
127 | ||
128 | < | endVal = (double)endTime[theProfile].tv_sec |
129 | < | + (double)endTime[theProfile].tv_usec / 1000000.0; |
128 | > | endVal = (RealType)endTime[theProfile].tv_sec |
129 | > | + (RealType)endTime[theProfile].tv_usec / 1000000.0; |
130 | ||
131 | accumTime[theProfile] += endVal - startVal; | |
132 | } | |
# | Line 135 | Line 135 | void writeProfiles( void ){ | |
135 | void writeProfiles( void ){ | |
136 | ||
137 | int i; | |
138 | < | double totalTime; |
139 | < | double percentTime[N_PROFILES]; |
138 | > | RealType totalTime; |
139 | > | RealType percentTime[N_PROFILES]; |
140 | int days, hours, minutes, secs, msecs; | |
141 | < | double donkey; |
141 | > | RealType donkey; |
142 | ||
143 | < | double forceTime, commTime; |
143 | > | RealType forceTime, commTime; |
144 | ||
145 | #ifdef IS_MPI | |
146 | int j; | |
147 | ||
148 | MPI_Status istatus; | |
149 | ||
150 | < | double nodeTime, nodeForceTime, nodeCommTime; |
151 | < | double nodeAccum[N_PROFILES]; |
152 | < | double nodePercent[N_PROFILES]; |
150 | > | RealType nodeTime, nodeForceTime, nodeCommTime; |
151 | > | RealType nodeAccum[N_PROFILES]; |
152 | > | RealType nodePercent[N_PROFILES]; |
153 | ||
154 | < | double globalTime, globalForceTime, globalCommTime; |
155 | < | double globalAccum[N_PROFILES]; |
156 | < | double globalPercent[N_PROFILES]; |
154 | > | RealType globalTime, globalForceTime, globalCommTime; |
155 | > | RealType globalAccum[N_PROFILES]; |
156 | > | RealType globalPercent[N_PROFILES]; |
157 | #endif // is_mpi | |
158 | ||
159 | ||
# | Line 191 | Line 191 | void writeProfiles( void ){ | |
191 | secs = (int)donkey; | |
192 | msecs = (int)( (donkey - secs) * 1000 ); | |
193 | ||
194 | < | F90_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
194 | > | FC_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
195 | ||
196 | fprintf( stdout, | |
197 | "----------------------------------------------------------------------------\n" | |
# | Line 211 | Line 211 | void writeProfiles( void ){ | |
211 | ||
212 | if( worldRank == 0 ){ | |
213 | ||
214 | < | double *nodeTots = new double[mpiSim->getNProcessors()]; |
215 | < | double *nodePercentTots = new double[mpiSim->getNProcessors()]; |
214 | > | RealType *nodeTots = new RealType[mpiSim->getNProcessors()]; |
215 | > | RealType *nodePercentTots = new RealType[mpiSim->getNProcessors()]; |
216 | ||
217 | totalTime = 0.0; | |
218 | for(i=0;i<N_PROFILES;i++) | |
# | Line 250 | Line 250 | void writeProfiles( void ){ | |
250 | secs = (int)donkey; | |
251 | msecs = (int)( (donkey - secs) * 1000 ); | |
252 | ||
253 | < | F90_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
253 | > | FC_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
254 | ||
255 | fprintf( stdout, | |
256 | "----------------------------------------------------------------------------\n" | |
# | Line 281 | Line 281 | void writeProfiles( void ){ | |
281 | ||
282 | nodeTime = 0.0; | |
283 | ||
284 | < | MPI_Recv(nodeAccum, N_PROFILES, MPI_DOUBLE, j, |
284 | > | MPI_Recv(nodeAccum, N_PROFILES, MPI_REALTYPE, j, |
285 | 1, MPI_COMM_WORLD, &istatus ); | |
286 | ||
287 | < | MPI_Recv(&nodeForceTime, 1, MPI_DOUBLE, j, |
287 | > | MPI_Recv(&nodeForceTime, 1, MPI_REALTYPE, j, |
288 | 1, MPI_COMM_WORLD, &istatus ); | |
289 | < | MPI_Recv(&nodeCommTime, 1, MPI_DOUBLE, j, |
289 | > | MPI_Recv(&nodeCommTime, 1, MPI_REALTYPE, j, |
290 | 1, MPI_COMM_WORLD, &istatus ); | |
291 | ||
292 | for(i=0;i<N_PROFILES;i++){ | |
# | Line 419 | Line 419 | void writeProfiles( void ){ | |
419 | ||
420 | if( worldRank == j ){ | |
421 | ||
422 | < | F90_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
422 | > | FC_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); |
423 | ||
424 | < | MPI_Send( accumTime, N_PROFILES, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD ); |
425 | < | MPI_Send( &forceTime, 1, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD ); |
426 | < | MPI_Send( &commTime, 1, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD ); |
424 | > | MPI_Send( accumTime, N_PROFILES, MPI_REALTYPE, 0, 1, MPI_COMM_WORLD ); |
425 | > | MPI_Send( &forceTime, 1, MPI_REALTYPE, 0, 1, MPI_COMM_WORLD ); |
426 | > | MPI_Send( &commTime, 1, MPI_REALTYPE, 0, 1, MPI_COMM_WORLD ); |
427 | } | |
428 | } | |
429 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |