[Openmp-dev] Private clause behavior outside and inside a function

Millad Ghane millad.mg at gmail.com
Mon Sep 29 10:24:49 PDT 2014


Hi

I checked this out (you could have too).

It is the latter situation that you mentioned. By using private, the value
of C will remain intact. So after for-loop, value of C is the same as its
value before the loop.


Bests,
Millad

On Monday, September 29, 2014, Simone Atzeni <simone.at at gmail.com> wrote:

> Hi all,
>
> I have a OpenMP code like the following:
>
>
> --------------------------------------------------------------------------------
> “c" is global
>
> #pragma omp parallel for default(shared) private(c,eps)
>   for (i=0; i<N; i++) {
>     for (j=0; j<N; j++) {
>       cr = -2.0+2.5*(double)(i)/(double)(N)+eps;
>       c.i = 1.125*(double)(j)/(double)(NPOINTS)+eps;
>       test();
>     }
>   }
>
> and “test" is a function that read the values in “c”.
>
>
> --------------------------------------------------------------------------------
>
> The “c” inside the for loop and inside the function are the same?
> Or that one in the for loop is local (because of the private clause) and
> that one within the function is global?
>
> Thanks.
> Best,
> Simone
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at dcs-maillist2.engr.illinois.edu <javascript:;>
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev
>


-- 
Sent from my iPhone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20140929/1ada7734/attachment.html>


More information about the Openmp-dev mailing list