[Omp] Threadprivate variables and nested parallelism
Federico Massaioli
federico.massaioli at caspur.it
Wed Dec 13 10:16:46 PST 2006
I'm confused too.
Shared and private attributes are local to a parallel region. Thus, a
variable which is private on a parallel region can be made shared on a
nested one.
OTOH, "threadprivateness" is a global attribute. How could a threadprivate
variable made shared if is globally known to be threadprivate?
Federico
On Wed, 13 Dec 2006, James Beyer wrote:
> Ok, I am confused. If you want all of the threads to share the same data why
> is it in the threadprivate list? Or are you talking about nested parallelism
> where the outer parallel region has the data in threadprivate and the inner
> parallel region has the data shared? If this is the case I don't see why
> there would be a problem with this. Of course I may change my opinion as I
> begin bringing full support for nested parallelism on line in our compiler.
>
> james
>
> Dieter an Mey wrote:
>> Well, you now, Larry, that we are happily profiting from nested
>> parallelism, where tasks would not be the right solution.
>>
>> And providing copies of large chunks of data for all threads of the inner
>> teams can be a waste of memory...
>>
>> But I understand that implementing the feature to share threadprivate data
>> may be painful - but I am just a stupid user ...
>>
>> Dieter
>>
>>
>> Marina Kraeva schrieb:
>>> 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
>>>>>
>>>>
>>>>
>>>
>>
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp
>
-----------------------------------------------------------------------
"Even if you don't always actually 'need' the highest precision, you
can still delight in the joy of fully understanding what's going on."
Paul Horowitz & Winfield Hill - The Art of Electronics
-----------------------------------------------------------------------
Federico Massaioli CASPUR
email: federico.massaioli at caspur.it V. dei Tizii 6/b
Ph.: +39-06-44486710 I-00185 Roma Italy
Fax: +39-06-4957083 www.caspur.it
More information about the Omp
mailing list