mirror of https://github.com/QMCPACK/qmcpack.git
Adding checks to print only one set of timing data, summed over all cores.
git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@2590 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
parent
bb8244e4dc
commit
132c3df548
|
@ -1,5 +1,6 @@
|
|||
#include "Utilities/NewTimer.h"
|
||||
#include "Message/Communicate.h"
|
||||
#include "Message/CommOperators.h"
|
||||
|
||||
namespace qmcplusplus {
|
||||
TimerManagerClass TimerManager;
|
||||
|
@ -32,32 +33,38 @@ namespace qmcplusplus {
|
|||
}
|
||||
// Now, we collect date from all nodes in the communicator, and
|
||||
// add it up.
|
||||
// int numToSend = numDistinct;
|
||||
// comm->bcast(numToSend);
|
||||
// for (int i=0; i<numToSend; i++) {
|
||||
// std::string myName = nameList[i];
|
||||
// comm->bcast(myName);
|
||||
// double myTime = 0.0;
|
||||
// long myCalls = 0;
|
||||
// for (int j=0; j<nameList.size(); j++)
|
||||
// if (nameList[j] == myName) {
|
||||
// myTime += timeList[j];
|
||||
// myCalls += callList[j];
|
||||
// }
|
||||
// comm->allreduce(myTime);
|
||||
// comm->allreduce(myCalls);
|
||||
// if (comm->rank() == 0) {
|
||||
// timeList[i] = myTime;
|
||||
// callList[i] = myCalls;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
fprintf (stderr, "Routine name Total time"
|
||||
" Num Calls Time per call\n");
|
||||
for (int i=0; i<numDistinct; i++) {
|
||||
fprintf (stderr, "%-40s %9.4f %13ld %16.9f\n", nameList[i].c_str(),
|
||||
timeList[i], callList[i], timeList[i]/(double)callList[i]);
|
||||
int numToSend = numDistinct;
|
||||
comm->bcast(numToSend);
|
||||
for (int i=0; i<numToSend; i++) {
|
||||
std::string myName = nameList[i];
|
||||
comm->bcast(myName);
|
||||
double myTime = 0.0;
|
||||
long myCalls = 0;
|
||||
for (int j=0; j<nameList.size(); j++)
|
||||
if (nameList[j] == myName) {
|
||||
myTime += timeList[j];
|
||||
myCalls += callList[j];
|
||||
}
|
||||
comm->allreduce(myTime);
|
||||
comm->allreduce(myCalls);
|
||||
if (comm->rank() == 0) {
|
||||
timeList[i] = myTime;
|
||||
callList[i] = myCalls;
|
||||
}
|
||||
}
|
||||
|
||||
bool omp_rank0 = true;
|
||||
#ifdef ENABLE_OPENMP
|
||||
if (omp_get_thread_num() != 0)
|
||||
omp_rank0 = false;
|
||||
#endif
|
||||
if (omp_rank0 && comm->rank() == 0) {
|
||||
fprintf (stderr, "Routine name Total time"
|
||||
" Num Calls Time per call\n");
|
||||
for (int i=0; i<numDistinct; i++) {
|
||||
fprintf (stderr, "%-40s %9.4f %13ld %16.9f\n", nameList[i].c_str(),
|
||||
timeList[i], callList[i], timeList[i]/(double)callList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue