nested parallelism

General OpenMP discussion

nested parallelism

Postby yoav naveh » Tue Jul 29, 2008 8:07 am

Hello All,

I run into a weird problem using OMP with nested parallelism. I'v run the following code:

omp_set_dynamic(1);
omp_set_num_threads(4);
omp_set_nested(1);

int id;
#pragma omp parallel for schedule(static)
for (ii = 0; ii < 5; ++ii) // for more averaged time measurements
{
int i, j, k;
#pragma omp parallel for private(j, k, i) schedule(static)
for (k = 0; k < loopSize; ++k)
{

#pragma omp parallel for private(j, i)
for (i = 0; i < loopSize2; ++i)
{
// DO SOME WORK
}
}
}

in short, there are 3 levels of parallelism.
when I run it on a 2-core CPU (in VS2005) the program run infinitely with the CPU worling 100%. looks like some kind of deadlock!
when breaking the run with the debuger and looking at the stack, I saw that the topmost location of each of the threads was
vcompd.dll!_vcomp::PartialBarrier1_Poll::Block() + 0x3f bytes

what is the problem ?
if I use only 2 levels of parallelisation everything works o.k., is there a limit to the number of nested omp directives ?

thanks!!!
yoav naveh
 

Re: nested parallelism

Postby ejd » Wed Aug 13, 2008 11:05 pm

Unfortunately I do not have the particular software you are using setup to try this out. This forum is really to answer OpenMP questions and not questions about specific vendor implementations. I have tried your code using a couple of other implementations and it runs fine. I see that you have dynamic set to true. Some early implementations had some problems with this so you might try setting it to false. I also see you are using 4 threads with three levels of nesting. This could require up to 64 threads which is the maximum that the Microsoft implementation supports. You might try using 3 threads and see what happens. The only other suggestion I have is to post your problem in a Microsoft forum and see if you get an answer.
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 6 guests