Private variables

Private clause can be used to make thread- private versions of such variables:

#pragma omp parallel private(id)
{
 int id = omp_get_thread_num();
 cout << "My thread num" << id << endl; 
}
  • What is their value on entry? Exit?
  • OpenMP provides ways to control that
  • Can use default(none) to require the sharing of each variable to be described