
My Math Teacher's Friend's Hurricane Simulation Story - gjsman-1000
I had a Math Class today for Calculus I, and my teacher was mentioning ways to use Newton&#x27;s Method of Approximation to find close-enough zeros on a graph. Interesting stuff.<p>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 &quot;good memory&quot;. My teacher asked him if he meant RAM or Hard Drives, which he denied and said that the &quot;good memory&quot; had something to do with on the actual CPU itself.<p>The second weird thing about this story is that this person, apparently for &quot;performance reasons&quot;, 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
FORTRAN 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/...](https://benchmarksgame-
team.pages.debian.net/benchmarksgame/faster/fortran.html)

~~~
igouy
> 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
I 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
gus_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.

------
TheRealKing
There 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.

------
ebcode
The "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-mi...](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)

~~~
gjsman-1000
Why did he need to stay within cache though? Was it actually necessary instead
of RAM?

