[Patch, Fortran] Support allocatable *scalar* coarrays
Daniel Carrera
dcarrera@gmail.com
Sat Jul 16 19:59:00 GMT 2011
On 07/16/2011 06:43 PM, Mikael Morin wrote:
>> Well, the current implementation supports effectively only a single
>> image - for -fcoarray=single on purpose and for -fcoarray=lib because it
>> has not yet been implemented.
>>
>> Later, one has to add some function call for "scalar[<image_numer>]"
>> while "scalar" itself is the local variable and can be handled as above.
> Ah, OK; that's where I was misunderstanding coarrays. I was thinking that a
> (possibly out of date) copy of remote images was available locally, like a
> normal array; and with any network exchanges happening during the SYNC* calls
> only.
> In fact network traffic happens anywhere there are square brackets, and SYNC*
> are mere iddle waits, right?
I am no expert, but I'll try to answer: Yes.
Yes, network traffic happens whenever there are square brackets and no
copies are stored locally. However, you have no guarantee of how far
ahead other images are. For example:
real :: foo[:]
foo = this_image()
if (this_image() == 1) then
foo = foo + foo[2]
end if
if (this_image() == 2) then
foo = foo + foo[1]
end if
This program could do all sorts of crazy things. As you said, the SYNC
is a idle wait, just to make processes wait for each other. The
following program is predictable:
real :: foo[:]
foo = this_image()
sync all
if (this_image() == 1) then
foo = foo + foo[2]
end if
sync all
if (this_image() == 2) then
foo = foo + foo[1]
end if
Cheers,
Daniel.
--
I'm not overweight, I'm undertall.
More information about the Gcc-patches
mailing list