Yet Another Opportunity to Optimize by the Front End.
Toon Moene
toon@moene.indiv.nluug.nl
Sat Oct 28 15:34:00 GMT 2006
L.S.,
Last week, when on holiday and really having time to think (as opposed
to spend my brain cells on office politics), I changed some of our
Numerical Weather Prediction software (http://hirlam.org) to use a
linked list of (a derived type consisting of) arrays.
One of the peculiarities of this set up is that the "correct" entry in
the linked list is found by performing the following test:
SUBROUTINE AAP(M,N,...,WIM,....)
...
REAL WIM(M,N)
...
IF ( ALL(CURRENT % WIM == WIM) ) THEN
...
IOW, the check for matching is ALL("The stored array equals the array
passed as an argument").
Now this idiom would be greatly sped up if the front end didn't compile
this the obvious way:
allocate (temp (m,n))
loop over n
loop over m
temp (...) = x(...) == y(...)
loop over n
loop over m
all = all .and. temp(...)
and evaluated the reduction operator "all" directly into a register.
Is this already considered by some on their to-do list ?
[ The same goes for "any", "sum", etc. ]
Thanks in advance,
--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran: http://gcc.gnu.org/fortran/
Who's working on GNU Fortran:
http://gcc.gnu.org/ml/gcc/2006-01/msg00000.html
More information about the Fortran
mailing list