This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,gomp4] make fortran loop variables implicitly private in openacc

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

!$oacc parallel
!$omp simd private(i) reduction(+:c)
do i = 1, n
end do

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, 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]