C++ programming (was Newbie Alert: Beginning parallel program ming with Scyld)

Mark Hahn hahn at physics.mcmaster.ca
Thu Oct 17 21:24:55 PDT 2002

> Trying to be objective and not fan the flames ..


> 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

reasonably true for C vs Fortran, but clearly not for C++ vs Fortran.

> an expert C-programmer (read 'assembly programmer') may be able to tweak
> even more performance by hand-unrolling loops, using prefetch, etc.  

I'm afraid I don't see why C is somehow hostile to compiler-directed
unrolling and prefetch.  in fact, gcc demonstrates this.

> (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. )

gcc also demonstrates that C has had optimization-friendly aliasing
rules since C89.

More information about the Beowulf mailing list