[mpich-discuss] measuring time in mpi program

Gus Correa gus at ldeo.columbia.edu
Fri Feb 25 12:48:44 CST 2011


hatem Elshazly wrote:
> hey guys,
> 
> does anybody know how to measure execution time of mpi program?
> is there any option we can append in the mpirun\mpiexec command to 
> measure time?
> is there any time command that measure clock cycle time, execution 
> time,etc..?
> 
> 
> thank u very much
> hatem
> 
> 
>

Hi Hatem

The standard outline is something like this:

... initialize your MPI environment ...
start=MPI_Wtime()
... do your work (including MPI calls)...
end=MPI_Wtime()
if (myrank .eq. 0) then
   print *, "Time spent (in seconds) is: ", end - start
endif
... finalize MPI ...

(You could also print the results from all ranks, if you want.)

I my experience, perfomance tends to be quite variable if you don't have
a 'critical mass' of "do your work", i.e., if you do just a
couple of send/recv and get out.  Works better if your MPI calls
are on a loop in "do your work".

I hope this helps.
Gus Correa

PS - It looks like you managed to troubleshoot your network problems.
I hope so.
You never got back to the list on that subject.


More information about the mpich-discuss mailing list