On Thu, 25 Jun 1998, Magne Rudshaug wrote:
> Hi list members!
>
> I'm about to start to convert our inhouse f77 FEM library code to f90. To
> make it as efficient as possible I would like to have some more background
> on efficient implementation in f90. Does anyone out there know a book or
> paper that adress this issue in particular. Thanks in advance for any reply!
Kaere Magne,
As far as I know there is no book published on efficient Fortran 90/95.
A good read is still Metcalf's book "Effective Fortran 77" (Oxford 1985)
and translating some of the advice to Fortran 90/95.
There are a couple of articles etc (see e.g. this mailbase) on certain
new features of Fortran 90/95 but that is often dependent on the maturity
of the used compiler. I remember some two articles over the last years
(96-98) in Computer Physics Communications on some aspects of Fortran 90.
The single most detrimental item to efficiency are probably arrays with
pointer attributes. Otherwise most advice about efficient array use applies
unchanged though some compilers may not yet be able to translate Fortran
90's array syntax into efficient code (but it should be easy to convert
to do-loops if necessary). MATMUL and DOT_PRODUCT could be inefficiently
implemented, so it is probably better to use a library (BLAS/LAPACK/..).
But next to efficiency you would want to consider questions of maintenance,
modularity, clarity, portability. I would suggest to stick to a subset of
Fortran, i.e. Essential Lahey or F, or their common subset.
Since in most codes the usual 10-90 rule applies (10 percent of code consume 90
percent of runtime) optimisation is really needed only for a small part of the
code and should be done towards the end of the recoding. A profiled run of the
F77 version should tell you where this time-consuming part is (which is probably
quite efficient already) and just incorporate it after some cosmetics.
>From my own experience of recoding I would say the greatest improvements have been:
-better user interface
taking care of initialisations, removing many hand-set parameters
esp array dimensions through allocation of memory
-clarity
often by designing useful user-defined types
reduced argument lists (through types and modules)
shorter code (or more versatile)
-safety
explicit interfaces via modules, no common blocks
private variables
-efficiency
little or no penalty
Cheers,
Werner
-----------------------------------------------------------------------
| Werner W Schulz |
| Dept of Chemistry email: [log in to unmask] |
| University of Cambridge Phone: (+44) (0)1223 336 502 |
| Lensfield Road Secretary: 1223 336 338 |
| Cambridge CB2 1EW Fax: 1223 336 536 |
| United Kingdom WWW: |
-----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|