Re: Language efficiency of C versus FORTRAN et al

From: Gregory Toomey (nospam_at_bigpond.com)
Date: 12/27/04


Date: Mon, 27 Dec 2004 13:23:54 +1000

travisperkins03@hotmail.com wrote:

> Hi,
>
> I have read somewhere that C code sometimes cannot be compiled to be as
> efficient as FORTRAN, eg for matrix multiplication, because a C
> compiler cannot make the assumptions about arrays that a FORTRAN
> compiler can. But I don't understand the example, not least because I
> don't understand FORTRAN. I also don't understand why it is more
> efficient in this case for a compiler to choose the order of evaluation
> (or whatever it is that it does for matrix multiplication to make it
> faster).
>
> Can anyone explain all this, please? And how much speed-up might one
> get from using FORTRAN over C for such things? What sort of compilers
> offer the best performance for issues like this? Is there any general
> advice about how to achieve efficient code for such linear algebra?
>
> This is a fairly live issue, because matrix mulitplication (and other
> things, like evaluating a dot product) often take an extremely long
> time for large matrices and vectors.
>
> I am also wondering how other languages like Pascal might compare to C
> and Fortran in this regard; does Pascal have enough array structure to
> allow compilers to take advantage of such optimisations?
>
> Any more general docs on issues like this would also be interesting
> reading.
>
> Thanks

Fortran compilers have been optimised for SIMD architectures eg Cray
supercomputers. They improve the speed of vector/matrix calculations.

I presume the same is now true for C matrix libraries on SIMD machines.

See http://en.wikipedia.org/wiki/SIMD

gtoomey



Relevant Pages

  • Re: Language efficiency of C versus FORTRAN et al
    ... > efficient as FORTRAN, eg for matrix multiplication, because a C ... > compiler cannot make the assumptions about arrays that a FORTRAN ... choose an algorithm which is more awkward in one language than the other. ...
    (comp.lang.c)
  • Re: A question on Newtons Method
    ... >> I can't believe you'd advise a noob to use a compiler which is still ... > production codes and codes from textbooks. ... > The Fortran standard generally does not specify the required behavior ... >> another important class of hassle which most numerical programmers ...
    (sci.math.num-analysis)
  • Fortran Resources (July 2004)
    ... and the standard for the Fortran language and its derivatives. ... WHERE CAN I OBTAIN A FORTRAN 95 COMPILER? ... Absoft Fortran compilers, debuggers, and development tools for Windows, ... are available for Linux systems. ...
    (comp.lang.fortran)
  • Fortran Resources (August 2004)
    ... and the standard for the Fortran language and its derivatives. ... Absoft Fortran compilers, debuggers, and development tools for Windows, ... and Linux include source-compatible Fortran 95 compiler suites ... are available for Linux systems. ...
    (comp.lang.fortran)
  • Fortran Resources (Last Issue)
    ... the, then, new Fortran 90. ... and the standard for the Fortran language and its derivatives. ... WHERE CAN I OBTAIN A FORTRAN 95 COMPILER? ... The Fortran Company offers F, the subset language, for Unix and Windows, ...
    (comp.lang.fortran)

Loading