[Omp] data scope clause

Jose Luis Gordillo Ruiz jlgr at super.unam.mx
Wed Apr 27 11:02:07 PDT 2005


Patricia Bittencourt Sampaio escribió lo siguiente:

> 
>   Hi,
> 
>     I'm a lit bit confused about the properties of
> data scope clauses. If I have something like this:
> 
> #pragma omp parallel private(x, y, z)
> {
>     int id;
>     
>     id = omp_get_thread_num();
>     x = 2+id;
>      
>     k_routine(x, y, z);
> }
> 
>     In this example, will the variables(x, y and z)
> become shared at k_routine() or the clause make them
> persist as private even inside k_routine?
> 

  You are just passing on copies of the values of the vars x,y,z. Inside 
  k_routine, the 1st, 2nd and 3rd parameters (whatever they are called) 
  are local vars, and private vars in consecuence.

  The question is what happens when one uses something like

  k_routine(&x,&y,&z)
 

  José Luis Gordillo
  Supercómputo - UNAM






More information about the Omp mailing list