[Users] Fortran OpenMP parallel do

Frank Loeffler knarf at cct.lsu.edu
Wed Oct 30 09:09:45 CDT 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20131030/4f37f38f/attachment.bin 


More information about the Users mailing list