I got confused with my recent C++ MPI program's behavior. I have an MPI
program in which I use clock() to measure the time spent between to
MPI_Barrier, just like this:
if if(rank == master) t1 = clock();
if if(rank == master) t2 = clock();
I need to measure t2-t1 to see the time spent on the code A between these
two MPI_Barriers. I notice that if I comment code B, the time seems much
less the original time (almost half). How does it happen? What is a possible
reason for it? I have no idea.
Thanks for your help.