Hi Harald,
<snipp>
> > Did that help?
>
> Actually this discussion is quite helpful to me, so I (and maybe
> others) understand more of the underlying stuff.
>
> I now spent some time looking thru portions of the F2023 standard,
> and I think that it answers many questions in that respect:
>
> - 10.2 Assignment, esp. 10.2.1.3 Interpretation of intrinsic
> assignments
>
> - 11.1.3 ASSOCIATE construct
>
> - Transformational intrinsics: this_image, team_number, ...
>
> It seems to be clear in most cases on which image something is
> evaluated, and which order.
>
> > I mean, we are way off of the original question, which was if it
> > is ok to always compute a function result on the image initiating a
> > communication instead of in the caf_accessor.
>
> I am still confused what you mean by "initiating a communication".
When you use OpenCoarrays and a Coindex gets executed a communication
is triggered.
> The function you are talking about takes an argument, interpreted
> in the way defined by the standard, and each image evalutes its
> portion.
That is what I confused. I had the dumb idea to evaluate certain
functions not on the calling image, but on the remote one. (Again,
OpenCoarrays triggers a communication, when the coindex points to an
image different from this_image()). My last patch remedies this.
Function calls in an expression having a coindex are now always
evaluated on the calling image.
> In code such as
>
> > if (this_image() == 1) caf(:, team_number(row_team))[1, team_number
> > = -1] = row
>
> team_number is a transformational function, which I expect to get
> evaluated on each image where the condition is fulfilled. I don't
> see any communication involved.
Well, the expression caf(...)[1, team_number=-1] when this_image() /= 1
triggers a communication. The program is writing into "remote" memory
here. I.e. memory that belongs to image 1 in the initial team. When
this code is executed by image 1 of the row_team, which maps to image 4
in the initial team (just for simplicity; it may map to a different one,
but let's assume it is mapped linear here), then a portion of the caf
array in the initial team of image 1 is updated. When using
OpenCoarrays, this means that a message is composed, send to the remote
image's communication thread, executed there and a result is returned
indicating completion. This is where the communication is involved.
GFortran creates an accessor routine for writing data into `caf(:,
add_data%team_number_row_team) = data`. This routine is executed by the
communication thread on the remote image. My latest patch now corrects,
that `add_data%team_number_row_team` is correctly used instead of
`current_team(add_data%row_team)`. The latter can not be executed in
the communication thread, because `row_team` is a pointer into memory
of the calling image.
Yes, I know. All of this confusing and it also took me a longer time to
understand all of this and figure a way to do this fast and efficient.
> Then there is the assignment, which is difficult. I haven't thought
> long enough about the consistency between the condition which refers
> to the current team, and coindex 1 of the initial team.
> (This is why I asked about communicators and alike, as this assignment
> might be correct only under very special conditions, or I just don't
> understand it.)
To my understanding that assignment is allowed by the standard. Any
concerns?
> So can you clarify that your code evaluates in the standard-defined
> way?
I hope the above did it.
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de