Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] timing + /usr/bin/time
From: Raymond Wan (rwan_at_[hidden])
Date: 2008-11-12 00:01:23


Hi Fabian,

Fabian Hänsel wrote:
>> On a separate topic, but related to your post here, how did you do
>> the timing? [Especially to so many digits of accuracy. :-) ]
>>
>
> two things to consider:
>
> i) What do I actually (want to) measure?
> ii) How accurate can I do that?
>
> i)
> Option iA) execution time of the whole program
>
> One could use /usr/bin/time. Simple, but that is not that accurate. If
> you do not need microsecond accuracy and measure all the things you
> want to compare in the same fashion a run like "/usr/bin/time mpirun
> -np X myprog" should perfectly suits your needs.
>

So, to make sure I understand what happens... This command:

mpirun -np 2 myprog

starts the program "mpirun" and two processes of "myprog". So, what the
"real time" of /usr/bin/time reports is the wall clock for mpirun.

Does the user time have any meaning here? I'm not very good with the
theory behind multi-processor programming...but Perl (for example)has a
"times" function (http://perldoc.perl.org/functions/times.html) which
"Returns a ... list ... for this process and the children of this
process". Are the two instances of myprog considered children of mpirun?

Hmmmm, I guess user time does not matter since it is real time that we
are interested in reducing.

> Option iB) time my 'crunching core' runs
>
> Something in rank0 like
> "time1=gettime(); crunch_alot(); time2=gettime(); time_used=time2-time1;"
> is much better suited to actually measure only the important parts,
> esp. if they can run shortly compared to overall programm execution
> time. (this assumes that crunch_alot() has a barrier character, e.g. by
> collecting values from all processes at the end)
>
> ii)
> MPI_Wtime() is generally considered the best way, as it is platform
> independent and usually MPI libs try to use the most accurate
> measurement method available on every certain platform.
>

Yes, gettimg () would work also. I didn' t know there was a MPI_Wtime
() function, though. Thanks!

> I've just used gettimeofday(), because some of my demo apps are
> intended to run independent of MPI. So my accuracy is at most micro
> seconds (on some platforms that might be different; e.g. only 10ms-steps).
>
>> [Especially to so many digits of accuracy. :-) ]
>>
> By unsuitably using printf("%.9f",time) ;-)
> I've just not cleared up that part. (But still the thing
> I wanted to demonstrate became quite apparent.)
>

Ah! You demonstrated that well -- thanks!

However, I saw all those digits of accuracy and I thought you were doing
some magic with timing MPI programs that I'd like to know -- it was only
a "%.9f", after all... :-)

Thank you!

Ray