Re: question about efficiency of fortran in parallel environments
- From: Richard E Maine <nospam@xxxxxxxxxxxxx>
- Date: Fri, 27 May 2005 11:06:15 -0700
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
.
- References:
- question about efficiency of fortran in parallel environments
- From: Randall Mackie
- question about efficiency of fortran in parallel environments
- Prev by Date: Re: Troubles with some IMSL routines (eg EVLRG, and some other)
- Next by Date: Re: a.out file
- Previous by thread: question about efficiency of fortran in parallel environments
- Next by thread: Re: question about efficiency of fortran in parallel environments
- Index(es):
Relevant Pages
|