My supervisor tells me that Fortran is faster at number crunching than C.
From the various benchmarks i've see on the web he appears to be right, however the tests i've found were done several years ago, so anyone know whether it's still the case?
My supervisor tells me that Fortran is faster at number crunching than C.
From the various benchmarks i've see on the web he appears to be right, however the tests i've found were done several years ago, so anyone know whether it's still the case?
Do they still make new fortran compilers? If they don't, I'd guess that the latest optimized C/C++ compiler would produce faster code than an ancient fortan compiler.
Away.
That is what Fortran is designed for. C is more general purpose. Well written C can compare roughly equally to Fortran (though for the purpose, the Fortran code will likely be more readable).
Object-oriented C++ can compare to Fortran (though it usually doesn't because of implementation issues). This is through C++ templates. Here's a link ( http://www.oonumerics.org/blitz/ ). You might find the benchmarks fairly interesting as well.
Cheers
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
Fortran literally means Formula Translator. It was made for engineers to do number crunching, so it's no wonder that it beats a language like C.
FAQ
"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.
"If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.
All of the above is correct.
Also, to add on: C was originally made for programmers to develop compilers and operating systems.
Fortran 77 can do better optimizations when dealing with arrays. They are all fixed length. There is no dynamically allocated memory, and no pointers. This makes it possible for the fortran compiler to assume things that a C compiler cannot assume. These optimizations are where the speed comes from. Fortran is faster when solving big linear systems and when doing other things that require array manipulation. It is not faster in any other aspects of number crunching that I know of, nevertheless this is a real real big chunk of the numbering crunching business.
Last edited by grady; 10-28-2003 at 11:17 PM.
>>> Do they still make new fortran compilers?
Yes, of course they do. The Fortran standard is also a continually evolving beast. Most Fortran compilers sold these days will adhere to one of the newer Fortran 9x standards but have a 77 backward compatibility.
For some weeks last year, the new version of Compaqs, (lets be honest DEC's), Fortran compiler topped the best sellers list at GreyMatter.
You certainly can create pointers in Fortran, it is just done differently than C/C++.
Many scientists , engineers and mathematicians use Fortran as their tool of choice. For that reason, there are a lot of very large mathematical libraries available for Fortran.
I used Fortran 77 for plant automation and process control systems until quite recently.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
I was hoping the answer would be "No, C is much faster now" so i could happily ignore Fortran...... guess not. Oh well its seems fairly similar to C, though somehow to my eyes it looks messier. (I suppose that's just because i'm less familiar with it)
Anyway thanks for all the input.
Can Visual C++ do Fortran, or was that my imagination being fuelled by alcohol and a few other bad things (Again)?
Surprisingly, no. And for some strange reason many other C compilers also can't compile Fortran code.Originally posted by SMurf
Can Visual C++ do Fortran, or was that my imagination being fuelled by alcohol and a few other bad things (Again)?
Gosh, you might have to use a Fortran compiler!
Hmm.. I never really see Fortran used much. Mostly C/Perl/PHP/Java/ASP. Maybe I don't look in the right places.
>Oh well its seems fairly similar to C, though somehow to my eyes it looks messier.
It is actually closer to BASIC than C. In fact, according to what I have read (correct me if I am wrong), BASIC is a child of Fortran.
I see, well i have only ever learned C (and C++ syntax), so perhaps its nothing like C bar the fact that its a programming language and they all have some base similarities. (I was suprised at how easy it was to read, i guess the old saying that learning to program is much harder than learning a new language is true )It is actually closer to BASIC than C
My friend who is a mechanical engineering major is taking a fortran class...He asked me for help a few times, and based on my still fairly small knowledge of C++ I picked up basic fortran very quick! I don't like it much thought, and I'm surprised that my school requires engineering majors other than CS to take that class. IMO all engineers should take a basic c++ class.
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka
>>> though somehow to my eyes it looks messier.
If you come the other way, i.e. are a Fortran programmer learning C, (like I did), you'd think exactly the same thing. All those semi colons and curly brackets??? What a mess! Reserved words??? What on Earth do you need reserved words for??? It goes no...
It is as easy to write good Fortran code as it is good C/C++. Equally, it is as easy to write messy Fortran code as it is messy C/C++ code.
If you know C, learning Fortran will take you a very short time.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.