(j3.2006) (SC22WG5.5700) [ukfortran] AW: coarray dummy arguments
Bill Long
longb
Wed Apr 13 18:27:04 EDT 2016
I modified Reinhold?s example to be executable:
> cat test.f90
module modu
contains
SUBROUTINE S1(A, IL)
INTEGER :: A[*]
INTEGER :: IL
SYNC IMAGES ( [1,2] )
IL = A ! (A)
END SUBROUTINE
SUBROUTINE S2(A, IL)
INTEGER :: A
INTEGER :: IL
SYNC IMAGES ( [1,2] )
IL = A
END SUBROUTINE
end module modu
program test
use modu
implicit none
INTEGER :: I[*] = 0
integer :: mype, IL = 0
mype = this_image()
if (mype == 1) then
I[2] = I[2] + 1
SYNC IMAGES( [1,2] )
else if (mype == 2) then
CALL S1(I, IL)
end if
print *, "image ", mype, "gets IL = ", IL
end program test
It seems to do what I would expect:
> ftn test.f90
> srun -n2 ./a.out
image 1 gets IL = 0
image 2 gets IL = 1
Cheers,
Bill
On Apr 6, 2016, at 6:47 AM, Bader, Reinhold <Reinhold.Bader at lrz.de> wrote:
> Hi Anton,
>
>> -----Urspr?ngliche Nachricht-----
>> Von: owner-sc22wg5 at open-std.org [mailto:owner-sc22wg5 at open-std.org] Im
>> Auftrag von Anton Shterenlikht
>> Gesendet: Mittwoch, 6. April 2016 05:37
>> An: j3 at mailman.j3-fortran.org; Bader, Reinhold <Reinhold.Bader at lrz.de>
>> Cc: sc22wg5 at open-std.org
>> Betreff: (SC22WG5.5700) [ukfortran] AW: (j3.2006) coarray dummy arguments
>>
>> Hi Reinhold
>>
>> Your example makes your point much clearer.
>> Still...
>>
>>> Image 1:
>>>
>>> INTEGER :: I[*] = 0
>>>
>>> I[2] = I[2] + 1
>>> SYNC IMAGES( [1,2] )
>>>
>>> Image 2:
>>>
>>> INTEGER :: IL
>>>
>>> CALL S1(I, IL)
>>>
>>> The current text in the standard causes the above to be non-conforming
>>> for two reasons:
>>>
>>> (1) the dummy argument A of procedure S1 is modified by a different
>>> image, in violation of 12.5.2.13 para 3+4. Since the ability to do
>>> such modifications is part of the coarray design, further
>>> exceptions need to be added to the above paragraphs. The
>>> exceptions
>>
>> I think this code violates [195:3-4].
>> Variable I is defined on image 1 and used on image 2 in the same segment,
>> which is prohibited.
>
> The text in [195:3-4] does not say "used". It says "it shall not be referenced, defined, or become undefined
> 4 in a segment on another image unless the segments are ordered". The suggested modifications ensure
> that passing it in as a dummy argument does not trigger any item in that list.
>
> (Note that even if you shift the code executed on image 1 to within S1, the procedure might be invoked on
> image 2 after the update has been performed, but before the SYNC has been completed, on image 1.)
>
> Cheers
> Reinhold
>
>> "I" is used on image 2 as actual argument when calling subroutine S1. I believe
>> that to conform, SYNC IMAGES( [1,2] ) must appear before CALL S1(I, IL).
>>
>> This seems to be related to the dummy variable issue you are addressing. When
>> you say that the ability to modify a dummy argument by a different image is part
>> of the coarray design, I'm not sure.
>>
>> Anton
> _______________________________________________
> 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