--- trunk/src/profiling/mdProfile.cpp 2004/09/24 16:27:58 3 +++ trunk/src/profiling/mdProfile.cpp 2006/05/17 21:51:42 963 @@ -1,3 +1,44 @@ +/* + * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. + * + * The University of Notre Dame grants you ("Licensee") a + * non-exclusive, royalty free, license to use, modify and + * redistribute this software in source and binary code form, provided + * that the following conditions are met: + * + * 1. Acknowledgement of the program authors must be made in any + * publication of scientific results based in part on use of the + * program. An acceptable form of acknowledgement is citation of + * the article in which the program was described (Matthew + * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher + * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented + * Parallel Simulation Engine for Molecular Dynamics," + * J. Comput. Chem. 26, pp. 252-271 (2005)) + * + * 2. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 3. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * This software is provided "AS IS," without a warranty of any + * kind. All express or implied conditions, representations and + * warranties, including any implied warranty of merchantability, + * fitness for a particular purpose or non-infringement, are hereby + * excluded. The University of Notre Dame and its licensors shall not + * be liable for any damages suffered by licensee as a result of + * using, modifying or distributing the software or its + * derivatives. In no event will the University of Notre Dame or its + * licensors be liable for any lost revenue, profit or data, or for + * direct, indirect, special, consequential, incidental or punitive + * damages, however caused and regardless of the theory of liability, + * arising out of the use of or inability to use software, even if the + * University of Notre Dame has been advised of the possibility of + * such damages. + */ + #include #include #include @@ -26,10 +67,10 @@ namespace mdProfileSpace { struct timeval startTime[N_PROFILES]; struct timeval endTime[N_PROFILES]; - double accumTime[N_PROFILES]; + RealType accumTime[N_PROFILES]; #ifdef IS_MPI - double globalTime[N_PROFILES]; + RealType globalTime[N_PROFILES]; #endif //is_mpi @@ -37,8 +78,8 @@ extern "C"{ extern "C"{ - void F90_FUNC(gettimes, GETTIMES)(double* forceTime, - double* commTime); + void FC_FUNC(gettimes, GETTIMES)(RealType* forceTime, + RealType* commTime); } @@ -77,15 +118,15 @@ void endProfile( proNames theProfile ){ void endProfile( proNames theProfile ){ struct timezone tz; - double startVal, endVal; + RealType startVal, endVal; gettimeofday( &endTime[theProfile], &tz ); - startVal = (double)startTime[theProfile].tv_sec - + (double)startTime[theProfile].tv_usec / 1000000.0; + startVal = (RealType)startTime[theProfile].tv_sec + + (RealType)startTime[theProfile].tv_usec / 1000000.0; - endVal = (double)endTime[theProfile].tv_sec - + (double)endTime[theProfile].tv_usec / 1000000.0; + endVal = (RealType)endTime[theProfile].tv_sec + + (RealType)endTime[theProfile].tv_usec / 1000000.0; accumTime[theProfile] += endVal - startVal; } @@ -94,25 +135,25 @@ void writeProfiles( void ){ void writeProfiles( void ){ int i; - double totalTime; - double percentTime[N_PROFILES]; + RealType totalTime; + RealType percentTime[N_PROFILES]; int days, hours, minutes, secs, msecs; - double donkey; + RealType donkey; - double forceTime, commTime; + RealType forceTime, commTime; #ifdef IS_MPI int j; MPI_Status istatus; - double nodeTime, nodeForceTime, nodeCommTime; - double nodeAccum[N_PROFILES]; - double nodePercent[N_PROFILES]; + RealType nodeTime, nodeForceTime, nodeCommTime; + RealType nodeAccum[N_PROFILES]; + RealType nodePercent[N_PROFILES]; - double globalTime, globalForceTime, globalCommTime; - double globalAccum[N_PROFILES]; - double globalPercent[N_PROFILES]; + RealType globalTime, globalForceTime, globalCommTime; + RealType globalAccum[N_PROFILES]; + RealType globalPercent[N_PROFILES]; #endif // is_mpi @@ -150,7 +191,7 @@ void writeProfiles( void ){ secs = (int)donkey; msecs = (int)( (donkey - secs) * 1000 ); - F90_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); + FC_FUNC(gettimes, GETTIMES)(&forceTime, &commTime); fprintf( stdout, "----------------------------------------------------------------------------\n" @@ -170,8 +211,8 @@ void writeProfiles( void ){ if( worldRank == 0 ){ - double *nodeTots = new double[mpiSim->getNProcessors()]; - double *nodePercentTots = new double[mpiSim->getNProcessors()]; + RealType *nodeTots = new RealType[mpiSim->getNProcessors()]; + RealType *nodePercentTots = new RealType[mpiSim->getNProcessors()]; totalTime = 0.0; for(i=0;i