From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Sat, 11 Aug 2007 23:06:34 -0800 |
Organization: | Compilers Central |
References: | 07-08-01607-08-021 07-08-024 |
Keywords: | optimize, parallel, Fortran |
Posted-Date: | 12 Aug 2007 08:58:27 EDT |
wclodius@lanl.gov wrote:
(snip)
>>I lost track of Fortran before 90 was standarised, but the array
>>notation of 8X was seriously broken: while theoretically letting
>>programmers express themselves at a high level, it forced serial
>>semantics whether the programmer intended that or no; thus the
>>notation could not be vectorised or parallelised any easier than if
>>explicit do loops had been used.
PL/I has the serial semantics, where, for example,
A=A+A(5);
the new value of A(5) is used in additions for elements past A(5).
Fortran instead requires the opposite, that the effect is as if the
whole right side was evaluated before any change is made to the left
side. If the compiler can't verify no side effects, a temporary is
needed.
(snip)
> FWIW Fortran 95 and 2003 have the FORALL assignment statement that
> provides the semantics you desire, however it has not been popular in
> the modern codebase for a variety of reasons.
I don't believe that FORALL does what you say, though I think it
should have done that. From Fortran 2003:
"Execution of a forall-assignment-stmt that is an assignment-stmt
causes the evaluation of expr and all 15 expressions within
variable for all active combinations of index-name values.
These evaluations may be 16 done in any order. After all these
evaluations have been performed, each expr value is assigned to
the 17 corresponding variable. The assignments may occur in any
order."
The right side can be evaluated in any order, and the values assigned
in any order, but all evaluations are, in theory, done before any
assignments. Again, temporaries may be required.
(snip)
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.