On Wed, Oct 30, 2013 at 08:54:08AM -0400, Yosef Zlochower wrote:
I though that for C code, the (outermost) loop index was automatically private. Has this changed in the openmp standard?
I was under the same impression, and this may well be the case, but I found this statement about automatic private variables only within the Fortran section of the 'for' construct, not the C section.
Having said that, assume a construct like:
#pragma omp parallel for for (int i=0; i<N; i++) { }
Can you here actually specify private(i)? 'i' isn't even declared at the point of the pragma yet.
Further assuming that you use the same syntax (inline declaration) for inner loops, you should be fine:
#pragma omp parallel for for (int i=0; i<N; i++) for (int j=0; j<N; j++) { }
Frank