[Omp] C++ class data member privatization

Shah, Sanjiv sanjiv.shah at intel.com
Thu Dec 1 12:00:48 PST 2005


I'm afraid there's no good way.  You basically have to split the class
into 2, once containing the private parts and the rest.


Sanjiv

 

-- 
Sanjiv, 217-403-4244 

________________________________

From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf
Of Lei Huang
Sent: Thursday, December 01, 2005 1:50 PM
To: Omp at openmp.org
Subject: [Omp] C++ class data member privatization

 

Dear OpenMP experts,

 

  I have a question regarding how to privatize a class data member in
C++. Since the member variable is in the class scope, I was wondering
how a compiler handles the case. I tried to use the private clause, but
the compiler does not allow me. My code looks like the following:

 

class a

{

   Int m_i;

 

   Void process() 

   { 

         #pragma omp parallel private(m_i)

          ......

   }

}

 

 Should I use threadprivate in this case? 

 

Thanks for your suggestions!

 

Best Regards,

 

Sincerely

Lei Huang

 

University of Houston

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openmp.org/pipermail/omp/attachments/20051201/5bf745a2/attachment.html


More information about the Omp mailing list