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

Simone Atzeni simone.at at gmail.com
Mon Sep 29 10:06:52 PDT 2014


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



More information about the Openmp-dev mailing list