(j3.2006) Questions about relationship between BLOCK and DO CONCURRENT

Bill Long longb
Thu Jul 17 19:14:09 EDT 2008



Van Snyder wrote:
> If an object is declared within a BLOCK within a DO CONCURRENT
> construct, is there a different one for each iteration?  

Sure. Why would the rules be different from an ordinary DO loop?   You 
might take a performance hit for doing this, but it looks legal.

> It seems
> especially important in the cases of automatic or allocatable or pointer
> or polymorphic variables that they be different:
>
> do concurrent ( i=... )
>   block
>     real :: A(i)
>     ...
>   end block
> end do
>
>   

One advantage for the case below is that you get the required deallocate 
automatically.

> do concurrent ( i=... )
>   block
>     real, allocatable :: A(:)
>     ...
>     allocate ( A(i) )
>     ...
>   end block
> end do
>   

Allocation of a polymorphic object to have a parameterized derived 
type!  You can't possibly have any toes left at this point.
> do concurrent ( i=... )
>   block
>     class(C), allocatable :: A
>     ...
>     allocate ( type(C_extension(i)) :: A )
>     ...
>   end block
> end do
>
>   
Cheers,
Bill


-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list