ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/profiling/mdProfile.cpp
(Generate patch)

Comparing trunk/src/profiling/mdProfile.cpp (file contents):
Revision 848 by gezelter, Wed Jan 11 23:06:08 2006 UTC vs.
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
35 + *                                                                      
36 + * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37 + * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 + * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 + * [4]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   #include <sys/time.h>
# 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 FC_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 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 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 421 | Line 421 | void writeProfiles( void ){
421          
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    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines