[Omp] allocatable objects with OpenMP

Shah, Sanjiv sanjiv.shah at intel.com
Sun Dec 12 21:20:37 PST 2004


See below.
Sanjiv 


--
Sanjiv, 217-403-4244

-----Original Message-----
From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf
Of yunhe
Sent: Tuesday, November 30, 2004 3:46 PM
To: omp at openmp.org
Subject: [Omp] allocatable objects with OpenMP

We use allocatable objects in F90 code.  Do we have to declare "!$OMP
threadprivate" for these variables?  In our simple test code, the answer
is yes.  It is declared in the module that declares the allocatable
array.  For example:

module foo
   real, pointer:: work(:)
   !$OMP threadprivate (work)
end module foo

Do we need to add "save work" before "!$OMP threadprivate?"

>> As I recall, for common blocks, the threadprivate directive implies
SAVE.
>> I don't remember if that applies to modules also.  It wouldn't hurt
to
>> include the SAVE.

Now, suppose we have the following:
module foo
   type new
      real, pointer :: work(:)
   end type new
   type(new) new_type
end module

How do we declare threadprivate now?  We tried:
$!OMP threadprivate (new_type%work)
and it won't work.  Does OpenMP support this kind of feature in F90?

>> What is wrong with threadprivate( new_type ), and the allocate 
>> new_type%work in each thread?

Thanks for your reply.

Helen





_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp_openmp.org




More information about the Omp mailing list