parallel call within thread

General OpenMP discussion

parallel call within thread

Postby flashpixx » Fri Nov 18, 2011 10:41 am

If I use something like this:

Code: Select all
void myfunc(int i) {
    #pragma omp parallel
    {
        do something parallel
    }
}


int main() {
int i = a value
#pragma omp parallel
{
    myfunc(i);
}

}



is there a problem with the parallel calls? My understanding is, that each thread creates new thread, so if omp_get_max_threads() returns 4, the OpenMP calls create 4x4=16 thread. Is this correct or is there any optimization?

Thanks

Phil
flashpixx
 
Posts: 6
Joined: Tue Nov 15, 2011 10:18 am

Re: parallel call within thread

Postby ftinetti » Fri Nov 18, 2011 10:57 am

Well, this depends... check out the Spec regarding the so called "nesting of regions" and related functions and environment variables. I think that at least some implementation details are left to the compiler choice, so I think you should check your compiler too. Are you planning to oversubscribe your system?
ftinetti
 
Posts: 567
Joined: Wed Feb 10, 2010 2:44 pm

Re: parallel call within thread

Postby flashpixx » Fri Nov 18, 2011 11:21 am

Thanks, no I wouldn't oversubscribe my system. It should be a general question to understand the parallel processing. If I check my code, there is max. one call (like the example) with depend parallel call. I try to parallize on the algorithm structure only, not within the helper structurs. I'm looking within the spec, is this correct, that I can "solve this nested regions" (I have taken a shot look to the spec, but I can enable/disable it with omp_set_nested)?
flashpixx
 
Posts: 6
Joined: Tue Nov 15, 2011 10:18 am


Return to Using OpenMP

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests

cron