[mpich-discuss] measuring time in mpi program
Gus Correa
gus at ldeo.columbia.edu
Fri Feb 25 22:04:54 CST 2011
Jain, Rohit wrote:
> Is there any performance data on using MPI_WTime()? How much time does
> it typically take?
>
> We have lot of 'wait-send' and 'wait-receive' code at lot of places, and
> we need to measure time spent in this sections. We currently use
> gettimeofday() function to measure this time. Would MPI_WTime be faster
> than that?
>
> Regards,
> Rohit
>
>
> -----Original Message-----
> From: mpich-discuss-bounces at mcs.anl.gov
> [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Gus Correa
> Sent: Friday, February 25, 2011 10:49 AM
> To: Mpich Discuss
> Subject: Re: [mpich-discuss] measuring time in mpi program
>
> 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.
Hi Rohit
I did a quick look at src/mpi/timer/mpidtime.c in MPICH2 1.3.1.
You can check by yourself.
It seems to me that MPI_WTime wraps gettimeofday.
(For portability, perhaps?)
The MPICH2 developers may clarify.
Gus Correa
More information about the mpich-discuss
mailing list