This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] Predetermined loop iterators
On Wednesday 19 October 2005 10:49, Jakub Jelinek wrote:
> Where parallel construct here is just
> !$omp parallel
> or also
> !$omp parallel {do,sections,workshare}?
>
> What about nested !$omp parallels?
> integer :: i
> call omp_set_nested (.true.)
> !$omp parallel default (none)
> i = 1 ! is i predetermined here?
> !$omp parallel default (none)
> do i = 1, 10 ! here it is predetermined
> end do
> !$omp end parallel
> !$omp end parallel
>
> Are they privatized only on the parallel?
>
> integer :: i
> !$omp parallel default (none)
> i = 1 ! is i predetermined here?
> !$omp sections
> do i = 1, 10 ! or just private in sections?
> end do
> !$omp section
> do i = 4, 14
> end do
> !$omp end sections
> !$omp end parallel
>
> !$omp parallel default (none)
> i = 1 ! here I'm quite sure it is not predetermined
> !$omp do
> do i = 1, 10 ! because i should be private in !$omp do
> end do
> !$omp end parallel
>
IMO, in all these cases variable 'i' is implicitly private. The same rule
applies. The standard says that it is "... private in the parallel
construct.". I would probably have worded it as "... private in the
outermost parallel construct.".
Note that I'm usually not very good at reading standards, so you may want
to ask in the OpenMP list for confirmation. The Intel compiler implements
my interpretation, though.