C++ programming (was Newbie Alert: Beginning parallel program ming with Scyld)
Daniel Kidger
Daniel.Kidger at quadrics.com
Wed Oct 16 07:12:22 PDT 2002
Trying to be objective and not fan the flames ..
graham.mullier at syngenta.com wrote:
>compiler writers can no doubt correct me but I'm reasonably convinced that
>in many cases Fortran (77 rather than 90 or later) is sufficiently limited
>in the language constructs possible that the compiler is better able to
>optimise the code.
In Fortran you write what you want to do, in C you write how to actualy do
that operation.
Hence a compiler can always optimise Fortran code more than C code becuase
the programmer has expressed the operation at a higher level (eg. a
matrix-multiply rather than a nested set of for-loops). However ultimately
an expert C-programmer (read 'assembly programmer') may be able to tweak
even more performance by hand-unrolling loops, using prefetch, etc.
The trouble is that the latter approach is much more costly in terms of
programmer time, is architecture specific (some optimisations are
pathalogical if the cache-size/ number of registers is different from that
expected), and sometime gives the wrong answer.
(Also Mark Hahn suggested that Fortran was not inherently parallel - I would
argue that it is since Fortran source code exposes available concurrency of
operations : vector notation, loop trip counts are known a-priori, no
aliasing of pointers, etc. )
Yours,
Daniel.
--------------------------------------------------------------
Dr. Dan Kidger, Quadrics Ltd. daniel.kidger at quadrics.com
One Bridewell St., Bristol, BS1 2AA, UK 0117 915 5505
----------------------- www.quadrics.com --------------------
More information about the Beowulf
mailing list