ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/profiling/mdProfile.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/profiling/mdProfile.cpp (file contents):
Revision 1490 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
Revision 2759 by tim, Wed May 17 21:51:42 2006 UTC

# Line 1 | Line 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
5 + * non-exclusive, royalty free, license to use, modify and
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
19 + *    notice, this list of conditions and the following disclaimer.
20 + *
21 + * 3. Redistributions in binary form must reproduce the above copyright
22 + *    notice, this list of conditions and the following disclaimer in the
23 + *    documentation and/or other materials provided with the
24 + *    distribution.
25 + *
26 + * This software is provided "AS IS," without a warranty of any
27 + * kind. All express or implied conditions, representations and
28 + * warranties, including any implied warranty of merchantability,
29 + * fitness for a particular purpose or non-infringement, are hereby
30 + * excluded.  The University of Notre Dame and its licensors shall not
31 + * be liable for any damages suffered by licensee as a result of
32 + * using, modifying or distributing the software or its
33 + * derivatives. In no event will the University of Notre Dame or its
34 + * licensors be liable for any lost revenue, profit or data, or for
35 + * direct, indirect, special, consequential, incidental or punitive
36 + * damages, however caused and regardless of the theory of liability,
37 + * arising out of the use of or inability to use software, even if the
38 + * University of Notre Dame has been advised of the possibility of
39 + * such damages.
40 + */
41 +
42   #include <sys/time.h>
43   #include <string.h>
44   #include <stdio.h>
# Line 7 | Line 48
48   #ifdef IS_MPI
49   #include <mpi.h>
50  
51 < #include "mpiSimulation.hpp"
51 > #include "brains/mpiSimulation.hpp"
52   #endif //is_mpi
53  
54   #include "config.h"
55 < #include "simError.h"
56 < #include "mdProfile.hpp"
55 > #include "utils/simError.h"
56 > #include "profiling/mdProfile.hpp"
57  
58   namespace mdProfileSpace {
59  
# Line 26 | 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 37 | 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 77 | 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 94 | 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 150 | 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 170 | 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 209 | 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 240 | 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 378 | 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    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines