- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the following code (which I derived from the Reduction section in the documentation), does not compile:
Mirko
the following code (which I derived from the Reduction section in the documentation), does not compile:
[bash]parameter N=10 !$OMP PARALLEL DO DEFAULT(PRIVATE),SHARED(A,B),REDUCTION(+: A,B) DO I=1,N CALL WORK(ALOCAL,BLOCAL) A = A + ALOCAL B = B + BLOCAL END DO !$OMP END PARALLEL DO end [/bash]I tried to compile it with ifort -c -openmp doreduce.f90. The error message is
[bash]doreduce.f90(2): error #6761: An entity cannot appear explicitly in more than one clause per directive except that an entity can be specified in both a FIRSTPRIVATE and LASTPRIVATE clause. !$OMP PARALLEL DO DEFAULT(PRIVATE),SHARED(A,B),REDUCTION(+: A,B) ------------------------------------------------------------^ doreduce.f90(2): error #6761: An entity cannot appear explicitly in more than one clause per directive except that an entity can be specified in both a FIRSTPRIVATE and LASTPRIVATE clause. !$OMP PARALLEL DO DEFAULT(PRIV...Now off I go to read the documentation and try to make it work :-)
Mirko
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's embarrasing. A reduction variable is obviously shared, so the SHARED clause is redundant. Just remove SHARED(A,B) and the example should compile. I'll file a doc bug on this.
Patrick Kennedy
Intel Developer Support
Patrick Kennedy
Intel Developer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick,
A reduction variable is private within the parallel region .not. shared. When exiting the parallel region these private variables are combined into the same named variable outside the regionusing the reduction operator.
In the OP's example, using SHARED is in error when used with varibles listed within the REDUCE clause (those are implicitly PRIVATE).
Do not file a doc bug on this.
Jim Dempsey
A reduction variable is private within the parallel region .not. shared. When exiting the parallel region these private variables are combined into the same named variable outside the regionusing the reduction operator.
In the OP's example, using SHARED is in error when used with varibles listed within the REDUCE clause (those are implicitly PRIVATE).
Do not file a doc bug on this.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jim,
Thanks for the feedback. We do need to correct the documentation example, simply because it won't compile 'as is'. We're not trying to demonstate a coding error with the example.
It would be more accurate to say a reduction variable has a data scope unique from that of SHARED or PRIVATE, while having attributes of both.
It's a syntax error to mark reduction variables SHARED _or_ PRIVATE. Both of these produce compilation errors:
!$OMP PARALLEL DO DEFAULT(PRIVATE),SHARED(A,B),REDUCTION(+: A,B)
!$OMP PARALLEL DO DEFAULT(PRIVATE),PRIVATE(A,B),REDUCTION(+: A,B)
Regards,
Patrick
Thanks for the feedback. We do need to correct the documentation example, simply because it won't compile 'as is'. We're not trying to demonstate a coding error with the example.
It would be more accurate to say a reduction variable has a data scope unique from that of SHARED or PRIVATE, while having attributes of both.
It's a syntax error to mark reduction variables SHARED _or_ PRIVATE. Both of these produce compilation errors:
!$OMP PARALLEL DO DEFAULT(PRIVATE),SHARED(A,B),REDUCTION(+: A,B)
!$OMP PARALLEL DO DEFAULT(PRIVATE),PRIVATE(A,B),REDUCTION(+: A,B)
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick,
Yes, it is a syntax error (both ways).
The reduction variables have an additionalregion transition characteristic (going into region as well as comming out of region) but exist as private within the region (IOW held in threaddifferentiated locations/registers).IMHOPRIVATE should be permitted because:
PRIVATE means seperate same named variables per thead
PRIVATE permits COPYIN
REDUCTION is functionally equivilent to COPYIN with 0 then COPYOUT (using reduction operator).
Because PRIVATE can be augmented with COPYIN, it should be permitted orthoganality with an operation on the completion end of the parallel region(read: REDUCTION).
The OpenMP standards committee sees this differently.
Jim Dempsey
Yes, it is a syntax error (both ways).
The reduction variables have an additionalregion transition characteristic (going into region as well as comming out of region) but exist as private within the region (IOW held in threaddifferentiated locations/registers).IMHOPRIVATE should be permitted because:
PRIVATE means seperate same named variables per thead
PRIVATE permits COPYIN
REDUCTION is functionally equivilent to COPYIN with 0 then COPYOUT (using reduction operator).
Because PRIVATE can be augmented with COPYIN, it should be permitted orthoganality with an operation on the completion end of the parallel region(read: REDUCTION).
The OpenMP standards committee sees this differently.
Jim Dempsey
![](/skins/images/71A9511A625CE5D5D45FB59952A4AA71/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page