Re: question about efficiency of fortran in parallel environments



In article <esKdnfign_8rygrfRVn-1g@xxxxxxxxxxx>,
Randall Mackie <rlmackie862@xxxxxxxxx> wrote:

> One of the programmers in my company, who programs mainly in c,
> has said that my program could be made more efficient if it
> were converted from Fortran to C.

Does he actually give any justification, or just a "my way is better"?
You can find people who will tell you almost anything, particularly if
they don't need to provide supporting evidence.

> Other people (the PETSc programmers) have said it doesn't make any difference
> whether I use C or Fortran.

Hmm. Which input sounds like an unbiased one to you? I think I hear in
your posting that you already know the answer to that.

Frankly, I would not trust the advice of anyone who tells you that using
any particular language (including Fortran) is the secret to efficiency.
That is far too simplistic a viewpoint to have much connection to
reality.

By *FAR* the most important issue in terms of efficiency is the choice
of good algorithms. Algorithm selection can and does make many orders of
magnitude difference in some cases; yes I meant that "many" and I know
what an order of magnitude means. I've personally seen such cases. For a
start, since you mention parallelism, it can be a fairly major issue to
select algorithms that parallelize well.

Even when one gets down to the relatively minor issues of language
selection, it is quite possible to write horribly slow code in either C
or Fortran (or other languages), and it is also possible to write very
efficient code in either language. Plentiful examples of all cases
exist. If you know Fortran well, and know how to make Fortran code
efficient, but you don't know much about C, then you'll likely do better
in Fortran than C. The converse is also true. If your first-mentioned
programmer acquaintance knows C much better than Fortran, then perhaps
*HIS* C code is more efficient than his Fortran code; that doesn't have
much to do with the languages in general, and it doesn't have much to do
with your code. (On the other hand, if he thinks that switching
languages is the secret to making code efficient, I might suspect that
he doesn't know how to really code efficiently in any language -
narrowness of viewpoint isn't a good start.)

There is no "magic" language that automatically makes things better. It
still takes a programmer.

You will also hear from plenty of people (possibly some on this
newsgroup) about how Fortran is more efficient than C. Certainly many
people who are highly concerned about efficiency work in Fortran; it is
generally considered one of Fortran's strengths. But when phrased as
broadly as "Fortran is more efficient than C", I personally think that
is about as silly an argument as the one that C is more efficient than
Fortran. So I won't go into the technical details.

There is abundant direct evidence that skilled Fortran programmers can
write highly efficient code in Fortran. That much is safe to say. Anyone
who disputes that is probably saying more about their own biases than
about anything else. But there is also evidence that skilled C
programmers can write highly efficient code in C.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.



Relevant Pages

  • Re: A petition to J3 apropos FORTRANs future
    ... Fortran folded like an accordion and gave ... The vast majority of programmers are not doing "scientific ... In theory, programmers would just "use the best language for the job", ... But there are reasons, both real and silly, why one ...
    (comp.lang.fortran)
  • Re: Interested about number crunching in Ada
    ... The idea that any language such as Ada is better than ... FORTRAN will not go over very well. ... simply boring for most programmers. ...
    (comp.lang.ada)
  • Re: one-liner for characater replacement
    ... Same error possible with pre-1970's Fortran. ... So does any language. ... (the programmers themselves) ... I never heard anyone praise either for quality in those days. ...
    (comp.lang.fortran)
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... I don't think that currently available versions of Fortran have the OO stuff implemented yet. ... Do the programmers have any OOP experience for when the 2003 features become available? ... Also, I've met quite a few Fortran programmers, but I know very few who really knew the language very well, and 77, for example, is not a very complicated language. ... COBOL shops are trying to go OOP with languages such as C++ and Java ...
    (comp.lang.pl1)
  • Re: Help from fellow Fortran Users
    ... >> department head winced and commented that Fortran is no longer being ... Portability, for programs written in any language, depends on four ... A compiler that generates code for an AXP platform is not ... Some programmers are just so impressed with their own knowledge of the ...
    (comp.lang.fortran)