[Omp] Threadprivate variables and nested parallelism

Marina Kraeva kraeva at iastate.edu
Tue Dec 12 14:53:53 PST 2006


Dieter and Lawrence,

Thank you for the clarification.

Lawrence, I feel your pain :)

Marina.

Meadows, Lawrence F wrote:

>  
> Dieter, I'm sure that your interpretation is correct. Every
> thread gets its own copy.
> 
> So if it is "unfortunate" then you would want to be able to
> make a threadprivate variable shared in an inner team (using
> an explicit shared clause on the parallel directive, I
> assume). I have no idea how hard this would be to implement
> and I don't like it.
> 
> I wish we could just drop nested parallelism... and threads...
> 
> -----Original Message-----
> From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
> Of Dieter an Mey
> Sent: Tuesday, December 12, 2006 9:31 AM
> To: Marina Kraeva
> Cc: omp at openmp.org
> Subject: Re: [Omp] Threadprivate variables and nested parallelism
> 
> My understanding is that all threads will get there own copy - even 
> threads of the inner team (unfortunately).
> 
> Dieter
> 
> Marina Kraeva schrieb:
> 
>>Hello,
>>
>>I could not find in API 2.5 what will happen if a threadprivate
> 
> variable 
> 
>>is referenced within a nested parallel region, other than this:
>>
>>The values of data in the threadprivate objects of threads other than 
>>the initial thread are guaranteed to persist between two consecutive 
>>active parallel regions only if all the following conditions hold:
>>* Neither parallel region is nested inside another parallel region.
>>
>>
>>I would think that each thread of the initial team (created for the 
>>nesting parallel region) will create a new team, and the threadprivate
> 
> 
>>copy of this thread will become shared among threads in the new team
> 
> in 
> 
>>the nested parallel region (so there will be NT shared variables,
> 
> where 
> 
>>NT is the number of threads in the nesting parallel region).
>>
>>Am I correct assuming this? Can I count on this behavior or it's
> 
> undefined?
> 
>>Thank you,
>>Marina Kraeva.
>>_______________________________________________
>>Omp mailing list
>>Omp at openmp.org
>>http://openmp.org/mailman/listinfo/omp
>>
> 
> 


More information about the Omp mailing list