--- trunk/src/profiling/mdProfile.cpp 2004/09/24 04:16:43 2 +++ branches/heatflux/src/profiling/mdProfile.cpp 2012/01/27 19:07:19 1670 @@ -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. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [4] Vardeman & Gezelter, in progress (2009). + */ + #include #include #include @@ -7,12 +48,12 @@ #ifdef IS_MPI #include -#include "mpiSimulation.hpp" +#include "brains/mpiSimulation.hpp" #endif //is_mpi #include "config.h" -#include "simError.h" -#include "mdProfile.hpp" +#include "utils/simError.h" +#include "profiling/mdProfile.hpp" namespace mdProfileSpace { @@ -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