Question about omp_get_wtime

Use this forum to discuss the book: Using OpenMP - Portable Shared Memory Parallel Programming, by Barbara Chapman, Gabriele Jost and Ruud van der Pas Read the http://openmp.org/forum/viewtopic.php?f=8&t=465 for book info and to download the examples. Post your feedback about the book and examples to this forum
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Locked
juaninf

Question about omp_get_wtime

Post by juaninf »

in this function omp_get_wtime
For example if two treads A and B, A takes 5 and the other 5 and running at the same time, it will get 5 or 10?

cswb625

Re: Question about omp_get_wtime

Post by cswb625 »

hello,
you get two times 5 for the two threads.

ruud

Re: Question about omp_get_wtime

Post by ruud »

It all depends on how you use this function. The most common use is something like this:

Code: Select all

t_start = omp_get_wtime();
#pragma omp parallel
{
  .....
}
t_end = omp_get_wtime() - t_start;
That will give you the elapsed time of the parallel region.

Kind regards, Ruud

Locked