(j3.2006) Fw: (j3-members.2015) Question about DO CONCURRENT
Bill Long
longb
Mon Feb 9 17:58:23 EST 2015
On Feb 9, 2015, at 12:26 PM, Daniel C Chen <cdchen at ca.ibm.com> wrote:
> Malcolm said:
> "HOWEVER, in the similar but different
>
> DO CONCURRENT(...)
> IF (condition) THEN
> X = something
> code using X
> END IF
> code that doesn't use X
> END DO
>
> you cannot localise X, because if "condition" is true exactly once, the
> assignment affects the "outer" X. OTOH, if condition is true more than once,
> you cannot execute in parallel without localising X. Rather UGH."
>
> As for the solution, can we
A ?solution? should not have the effect of making a currently standard-conforming program suddenly not conforming. That would seem to disqualify option 2 below. Van raised the possibility that BLOCK could accomplish option 1.
Cheers,
Bill
>
> 1. Add syntax to DO CONCURRENT to allow users specify variables that need to be localised, which is similar to OMP's PRIVATE/FIRSTPRIVATE clause. Or,
>
> 2. Change the following restriction (similar changes should apply to Pointers, Allocatables)
> "A variable that is referenced in an iteration shall either be previously defined during that iteration, or shall not be defined or become undefined during any other iteration. A variable that is defined or becomes undefined by more than one iteration becomes undefined when the loop terminates. "
> To
> "A variable that is referenced in an iteration shall either be previously defined during that iteration, or shall not be defined or become undefined during any other iteration. A variable that is defined or becomes undefined by one or more iterations becomes undefined when the loop terminates. " -- This will allow compiler to localised x in the above example.
>
> Thanks,
>
> Daniel
>
> XL Fortran Development - IBM Toronto Software Lab
> Phone: 905-413-3056
> Tie: 969-3056
> Email: cdchen at ca.ibm.com
> http://www.ibm.com/software/awdtools/fortran/xlfortran
>
> <graycol.gif>"Malcolm Cohen" ---02/05/2015 19:35:24---Van writes: >That was my first reaction too. Then I realized that A is not changed
>
> From: "Malcolm Cohen" <malcolm at nag-j.co.jp>
> To: "fortran standards email list for J3" <j3 at j3-fortran.org>
> Date: 02/05/2015 19:35
> Subject: (j3.2006) Fw: (j3-members.2015) Question about DO CONCURRENT
> Sent by: j3-bounces at mailman.j3-fortran.org
>
>
>
> Van writes:
> >That was my first reaction too. Then I realized that A is not changed
> >during any iteration. Therefore, either B is assigned in every
> >iteration, or not assigned in any.
>
> Ah of course, thanks. (Very easy to misread that code!)
>
> Yes I realised some time ago that we didn't get the DO CONCURRENT specs "right"
> in the sense of being able to tell at compile time whether a variable was
> localised or global. In
>
> DO CONCURRENT(...)
> IF (condition) THEN
> X = something
> END IF
> code using X
> END DO
>
> when the loop has more than one iteration, you can make X local to the loop,
> since condition has to be loop-invariant for this to be legal, and after
> execution, the "outer" X either has its original value (if the condition was
> false) or is undefined (if the condition was true).
>
> HOWEVER, in the similar but different
>
> DO CONCURRENT(...)
> IF (condition) THEN
> X = something
> code using X
> END IF
> code that doesn't use X
> END DO
>
> you cannot localise X, because if "condition" is true exactly once, the
> assignment affects the "outer" X. OTOH, if condition is true more than once,
> you cannot execute in parallel without localising X. Rather UGH.
>
> Cheers,
> --
> ................................Malcolm Cohen, Nihon NAG, Tokyo.
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
Bill Long longb at cray.com
Fortran Technical Suport & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
More information about the J3
mailing list