Timing results mixed between processes
sometimes the output from different CPUs is mixed up.
The timing output should be in order, but sometime it is not even so we are using a right to left blocking com:
void show(const MPI_Comm inComm) const {
int myRank, nbProcess;
int retMpi = MPI_Comm_rank( inComm, &myRank);
assert(retMpi == MPI_SUCCESS);
retMpi = MPI_Comm_size( inComm, &nbProcess);
assert(retMpi == MPI_SUCCESS);
if((&outputStream == &std::cout || &outputStream == &std::clog) && myrank != nbProcess-1){
// Print in reverse order
char tmp;
MPI_Recv(&tmp, 1, MPI_BYTE, myrank+1, 99, inComm, MPI_STATUS_IGNORE);
}
std::stack<std::pair<int, const std::shared_ptr<CoreEvent>>> events;
for (int idx = static_cast<int>(root->getChildren().size()) - 1; idx >= 0; --idx) {
events.push({0, root->getChildren()[idx]});
}
outputStream << "[TIMING-" << myRank<< "] Local times.\n";
outputStream << "[TIMING-" << myRank<< "] :" << root->getName() << "\n";
// output here
outputStream.flush();
if((&outputStream == &std::cout || &outputStream == &std::clog) && myrank != 0){
// Print in reverse order
char tmp;
MPI_Send(&tmp, 1, MPI_BYTE, myrank-1, 99, inComm);
}
}