This is the mail archive of the
mailing list for the GCC project.
Re: [patch,gomp4] make fortran loop variables implicitly private in openacc
- From: Tobias Burnus <burnus at net-b dot de>
- To: Cesar Philippidis <cesar at codesourcery dot com>, fortran at gcc dot gnu dot org, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 Aug 2014 22:41:47 +0200
- Subject: Re: [patch,gomp4] make fortran loop variables implicitly private in openacc
- Authentication-results: sourceware.org; auth=none
- References: <53E957F0 dot 3090908 at codesourcery dot com>
Cesar Philippidis wrote:
According to section 2.6.1 in the openacc spec, fortran loop variables
should be implicitly private like in openmp. This patch does just so.
Makes sense. Looking at the patch, I wonder whether the context is
properly handled when mixing OpenMP and OpenACC. I have the feeling that
one then might end up using the OpenACC context when one should use the
OpenMP context. However, I have not fully followed the program flow. For
instance, would something like
!$omp simd private(i) reduction(+:c)
do i = 1, n
be properly handled?
Also, while working on this patch, I noticed that I made the check for
variables appearing in multiple openacc clauses too strict. A private
variable may also appear inside a reduction clause. I've also included a
fix for this in this patch.
In OpenMP, one has (OMP 4.0, 2.14.3): "A list item that specifies a
given variable may not appear in more than one clause on the same
directive, except that a variable may be specified in both firstprivate
and lastprivate clauses."
And in 184.108.40.206, OpenMP has: "List items that appear in a private,
firstprivate, or reduction clause in a parallel construct may also
appear in a private clause in an enclosed parallel,task, or worksharing,
or simd construct.
I tried to find it in something similar in OpenACC - but I failed. I
found in (OpenACC 2.0a, 2.7.11) a reference to reduction with private,
which implies that a reduction variable my be private, but I didn't find
much more. In particular, it is not clear to me whether it would permit
only those which are private implicitly or in an oacc parallel region or
also in an explicit private clause in the same directive. Can you point
me to the spec?
Additionally, I wonder whether you shouldn't also add a test case for
the reduction with private.