Re: ELEMENTAL functions and performance
- From: Daniel Kraft <d@xxxxxxxx>
- Date: Wed, 30 Jul 2008 09:37:56 +0200
deltaquattro wrote:
Hi,
I would like to know if the attribute ELEMENTAL for a function/
subroutine can negatively affect performance or not.
I am going to code a lot of small functions, for things like Jacobi
polynomial evalution, Gauss point generation, etc. etc., to be used in
a "huge" code. I would like the functions to work for scalar as well
as for rank-1 array input/output. I'd prefer to write them as
ELEMENTAL, rather than forcing the user to read/write a scalar into a
rank-1 array of size 1 each time he has to use the subroutine for
scalars.
However, sometimes I heard that some "new" features of the language
may have an hit on performance, because they make optimization more
difficult for the compiler. I don't know if this is the case with
ELEMENTAL, however these functions will be called a lot of times, so
it's not a good idea if they are slow. The code will run on parallel
vectorial supercomputers. According to these informations, what would
you suggest me to do?
Thanks,
Hi,
I can't tell what your compiler does, but if you call the ELEMENTAL function on scalars I think it is quite probable that ELEMENTAL or not ELEMENTAL does not matter in this case (except that ELEMENTAL procedures have to be PURE for your point of view).
When called with an array argument, your ELEMENTAL procedure will be called for each element as opposed to when your procedure accepts the whole array for one call, and thus here's the possiblity that the performance changes; but I don't think you can really know in advance if it improves or degrades and how much; that probably depends on your code and how your compiler interprets it.
Yours,
Daniel
--
Done: Arc-Bar-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
Underway: Cav-Dwa-Law-Fem
To go: Cav-Hea-Kni-Mon-Pri-Ran-Rog-Tou
.
- Follow-Ups:
- Re: ELEMENTAL functions and performance
- From: Tobias Burnus
- Re: ELEMENTAL functions and performance
- Prev by Date: Re: ELEMENTAL functions and performance
- Next by Date: Issue from IVF 9.0 to IVF 10.1
- Previous by thread: Re: ELEMENTAL functions and performance
- Next by thread: Re: ELEMENTAL functions and performance
- Index(es):
Relevant Pages
|