On 08/13/2014 01:41 PM, Tobias Burnus wrote: > 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? These contexts are used to prevent situations like that. See gfortran.dg/goacc/omp.f95 for examples. Also, Thomas mentioned that we shouldn't need a separate oacc_context, so I've added an is_openmp field to omp_context to indicate if omp_current_context represents an openmp context (true) or openacc (false). >> 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 2.14.3.3, 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? I'm not sure. I sent an email to the openacc technical mailing list, but I haven't heard back from them. > Additionally, I wonder whether you shouldn't also add a test case for > the reduction with private. I added one, see private-3.f95. Beware, part of that test is commented out because our support for the private clause is incomplete. Thomas is working on the private and firstprivate clauses, so he can uncomment that portion of the test once the private clause is fully working. Is this patch ok for gomp-4_0-branch? Cesar