5 ms·
My Math Teacher's Friend's Hurricane Simulation Story
I had a Math Class today for Calculus I, and my teacher was mentioning ways to use Newton's Method of Approximation to find close-enough zeros on a graph. Interesting stuff.
He then went on a tangent to the point that he began talking about his friend who had a basic hurricane simulation for a paritial PhD study. This is where things got interesting. His friend wrote the simulator said that everything had to stay in "good memory". My teacher asked him if he meant RAM or Hard Drives, which he denied and said that the "good memory" had something to do with on the actual CPU itself.
The second weird thing about this story is that this person, apparently for "performance reasons", wrote his hurricane simulator in FORTRAN. It still took days to complete each simulation, but why FORTRAN? Is it really that much better than C?
- gus_massa 8y agoFORTRAN is very popular in Physics. They have some private heavily optimized libraries written in 1980 and updated and improved each year and they are not going to rewrite them. You can find some code with the classic 5+1 spaces at the left, line numbers, no more than 72 characters. My recommendation is that if you are going to add new code, write nice code with proper nesting and using the "intersection" formatting http://fortranwiki.org/fortran/show/Continuation+lines http://fortranwiki.org/fortran/show/Continuation+lines . Preferably with modules, explicit types, and other modern stuff. On the other hand, the compilers are very good. Sometimes they are faster than C because you are not expected to do too much silly things with pointers, so the compiler can understand the code better. In The Computer Language Benchmarks Game, you can see that many times Fortran is faster than C. https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/fortran.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- igouy 8y ago> many times Fortran is faster than C Seems like those measurements show that most times the C programs were faster than the Fortran programs.
- TheRealKing 8y agoWouldn't it depend on how those benchmarks were written?
- igouy 8y agoAnd that is why all the program source code, and compiler options, and program output is shown on the benchmarks game website. (Any underlined text is a HTML link allowing you to drill-down to more detail).
- TheRealKing 8y agoI highly doubt if there would be any performance difference between carefully written Fortran, Ada, C, C++ codes. The much more relevant question is which one has the least development time for the given task.
- igouy 8y agogus_massa made a specific claim about what we could see on the benchmarks game website, and we can see that claim is really not true.
- ebcode 8y agoThe "good memory" referred to is the cpu cache. Search for "L1 cache", "L2 cache" online. Here's a starting point: https://www.quora.com/What-is-the-L1-L2-and-L3-cache-of-a-microprocessor-and-how-does-it-affect-the-performance-of-it-For-example-I-have-a-laptop-with-an-Intel-4700MQ-microprocessor-with-a-6MB-L3-cache-What-does-this-value-indicate?share=1 https://www.quora.com/What-is-the-L1-L2-and-L3-cache-of-a-mi...
- gjsman-1000 8y agoWhy did he need to stay within cache though? Was it actually necessary instead of RAM?
- TheRealKing 8y agoThere is really no performance difference between carefully-written Fortran and C codes for scientific research purposes. Really none. But in terms of learning and coding, Fortran is far easier to learn with a learning curve comparable to Python (but with the power of C language, again mostly for number crunching). Fortran has a wide variety of vectorization and native parallelization concepts that are extremely easy to use, something that almost no other compiled language has, at the moment.