minimum complexity for parallelization to work

General OpenMP discussion

minimum complexity for parallelization to work

Postby s.gautam » Sat Mar 29, 2008 2:43 am

What is the minimum complexity/execution time of a task for it to benefit from parallelization? Can a program which takes 0.005 s to run possibly benefit from parallelization?
s.gautam
 
Posts: 3
Joined: Sat Mar 22, 2008 7:17 am

Re: minimum complexity for parallelization to work

Postby ejd » Sat Mar 29, 2008 11:12 am

Unfortunately there is no simple answer to your question. For your example of a program that runs serially in 0.005 seconds, the answer is most likely no. HOWEVER, if the parallel overhead were much smaller than that and each processor could execute it's piece of work more quickly than that, then it might be worth it. It really depends on the hardware, the OpenMP software implementation and your code. What might be worth parallelizing in one situation might not in another.

That is one reason for things like the "if clause" on the parallel construct. Executing a for loop as a "parallel for" might make sense if the loop bounds are 10,000, but not if it is less than that. So you can specify:

Code: Select all
#pragma omp parallel for if (N > 10000)
for (i = 0; i < N; i++) {
...

But you might have to be more creative than this if you run on different hardware or using different vendors implementations, because it might be different for each one.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 14 guests