(j3.2006) DO CONCURRENT question

Bill Long longb
Wed Nov 21 15:53:48 EST 2012



On 11/21/12 1:13 PM, Lionel, Steve wrote:
> I am puzzled by some wording in the standard regarding DO CONCURRENT and
> hope one or more of you can shed some light on it.
>
> 8.1.6.7, page 178, lines 5-7 say:
>
> 5 A variable that is referenced in an iteration shall either be
> previously defined during that iteration, or
>
> 6 shall not be defined or become undefined during any other iteration. A
> variable that is defined or becomes
>
> 7 undefined by more than one iteration becomes undefined when the loop
> terminates.
>
> It then goes on to show in note 8.11:
>
> A variable that is effectively local to each iteration of a DO
> CONCURRENT construct can be declared in
>
> a BLOCK construct within it. For example:
>
> DO CONCURRENT (I = 1:N)
>
> BLOCK
>
> REAL :: T
>
> T = A(I) + B(I)
>
> C(I) = T + SQRT(T)
>
> END BLOCK
>
> END DO
>
> If the BLOCK were removed, so that T was a procedure scope variable, why
> wouldn?t ?previously defined during that iteration? be sufficient to
> effectively make T local to each iteration, negating the need here for
> BLOCK?  Or am I misreading this?

No. You are right that the BLOCK is not technically needed here.  What 
it does is remove any issue concerning T "becomes undefined when the 
loop terminates" since (this) T does not even exist at the end of the 
loop.

Cheers,
Bill


>
> Steve Lionel
>
> Intel Developer Support
>
> Merrimack, NH
>
>
>
> _______________________________________________
> 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 Support    &                 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