Hello
I would like to discuss the opinion expressed here by Richard vs my opinion!
I attach two files called exp_01.f90 and use_exp_01.f90. The first file
contains four scalar copy routines for copy four scalar types.
The second file contains a program to use these four routines. I have added
counters to see how often the routines are called. (I did not bother to
initialize them, but the linker does that for me). The use of the interface
and elemental declaration IN THE USING program ensures that you can call
them as scalars or vectors or rank 2 ... . The using program tests a few
possibilities. The using program then dumps the counters and this shows
that the elemental declaration has had the effect that the compiler simply
calls the scalar routine as often as it has to. This confirms my assertion
"the pure elemental feature, it is just a short hand for - invoke this
function as many times as you need to".
As the pure elemental function has to work without changes to the standard
calling sequences between routines on most platforms, then I can only see
that this can be implemented by the compiler - ie as a programmer
convenience rather than as something which is part of the object code. I
have put the calling routine and the called routine into different files so
that both are not visible to the compiler at the same time, so that the
compiler cannot optimise this away. The klunky kounters also show that the
compiler has not fooled me.
Now, I have reworked the programs so that there are genuine multiple
dimensional routines, so that each routine is called only once. I was
surprised not to notice a big difference in run time. I expected that 16
million calls to a routine would slow things up quite a bit, but it was only
about 20% quicker with all of the calls eliminated. It appears to me that
the Intel is very quick at doing routines calls.
Perhaps I have not understood Richard; if so I apologise if the point he
was making was different from those which I am making here.
Any comments, observations etc will be appreciated.
Alistair
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of
Richard Maine
Sent: 03 April 2003 02:56
To: [log in to unmask]
Subject: Re: Compiler differences
Alistair Mills writes:
> think that trying to use both scalar and vectors with pure elemental >
functions is dangerous! As I understand the pure elemental feature, it is
> just a short hand for - invoke this function as many times as you need to
- > rather than a feature for dealing with multiple dimensions and ranks.
I haven't been able to look at the particular code in question. Too busy
this week, plus the modem connection from this hotel room keeps dropping out
far too often for my taste. But...
I cannot agree with the above characterization of ELEMENTAL. Handling
different ranks is *EXACTLY* one of the main purposes of ELEMENTAL. Whether
it fits the particular code at hand, I haven't tried to evaluate, but the
above description of what elemental is not for sounds to me like a pretty
good description of what it is for.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|