Measuring time

General OpenMP discussion

Measuring time

Postby xino » Tue Dec 09, 2008 8:42 am

My main purpose is to measure the speed up between a sequential version and its equivalent parallel version of a program. I would like to do this as accurate as possible.

First is a question on the time command. It generally produces 3 values (real time, user time and system time). Which value should I look at?

Also, is there any other method of measuring time that will give a better idea of speed up? I also use omp_get_wtime(), but still wonder if there is a better way to do it since the elapse between 2 wallclock time might be affected by other processes (it's a shared station) right?

Thanks a lot.
xino
 

Re: Measuring time

Postby ejd » Tue Dec 09, 2008 10:14 am

If you look at the amount of processor time used to run a parallel version of a program, it will be larger than the amount of processor time needed to run a sequential version of a program (assuming that the parallel program is "sequentially equivalent" to the sequential version - i.e., the two versions are essentially the same code). The reason of course, is that the parallel version of the program is doing all the same work as in the sequential version of the program plus the work needed for the parallel implementation (e.g., split and join overhead). Therefore looking at the amount of processor time used, will not give you any speedup and in fact will show a slow down.

But, usually when we talk about speedup, we mean that the program has run faster than before (using elapsed time). Therefore, "wall clock time" or "elapsed time" is what you need to look at. There are many ways of getting this value. The time command is one way, but the "real time" value is very coarse grained (i.e., not very accurate). The OpenMP specification provides omp_get_wtime() to give a more exact value (though it is interesting to see how few people posting to this forum use it). I am afraid that it depends on the implementation of omp_get_wtime(0 as to whether or not there is something on the system that will give a more precise value.

As for other processes on the system getting in the way of your measurements, this is always the problem with doing benchmarks. I do not run benchmarks normally, but know the people who do and the pains they go through to do the best they can to get reproducible numbers. They have to do things like stop all processes on the system that are not needed, re-ipl the system before running a benchmark, run it multiple times to see if they get the same result, bind threads to processors, set implementation specific environment variables so that the threads spin or sleep appropriately, make sure they use the "best" compiler options, etc. They also usual run the benchmarks on systems that are dedicated for that purpose.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 2 guests