Live data from Hacker News

Why are most climate models in Fortran?

partee.io

101–110 of 136 posts

Re: Why are most climate models in Fortran?

#101

The actual title is, "Why are Climate models written in programming languages from 1950?". I think the assumption that "old is bad" is the cause of many, many, many foolish decisions. Useless code rewrites, company reorganizations that are not significant improvements, and many other bad ideas hinge on this Worship Of The New. Why are we using an alphabetic system originally developed c. 1800BC? It's old, we should s…

And it's just a misunderstanding. I think it was Perlis who said, "We don't know what the programming language of the future will look like, but we know it will be called FORTRAN."

Hoare said "I don’t know what the language of the year 2000 will look like, but I know it will be called Fortran". He also said "ALGOL 60 is alive and well and living in Fortran 90", which is a decent compliment from him.

Re: Why are most climate models in Fortran?

#102
post #100

Earlier quoted context omitted.

Ahem ;-) Somehow your mention of cowboys entering the field feels irritating, considering Kazushige Goto and his contributions to BLAS while being in Austin, TX. Banzai!

While Goto typically gets the plaudits (and obviously did good work there), you should credit van de Geijn in that area long term.

Oops.

Haven't even been aware of that.

Anyways, irritation over 'cowboys entering into the field' still stands, because it happened in Austin, TX.

Yeehaw!

;-)

Re: Why are most climate models in Fortran?

#103

Earlier quoted context omitted.

My understanding is that they're mostly fortran programs linked together with unix scripts which are run on HPCs - could the models run in a more distributed way like high quality grid computing setup? Lastly, what's the best way to find and learn more about the models?

Yes, they run in the cloud, see e.g. https://cloudrun.co (disclaimer: my side-business), but others have done it as well, for a few years now. On dedicated, shared-memory nodes, it's no different from HPC performance-wise. It can be even better because cloud instances tend to have later generation CPUs, whereas large HPC systems are typically updated every ~5 years or so. But for distributed-memory parallel runs (mul…

Indeed, basically, though you may lose from lack of direct access to the hardware. But it's typically expensive. Do AWS and GCP actually have RDMA fabrics now? The AWS "low latency" one of a year or so ago had a similar latency to what I got with 1GbE at one time.

Re: Why are most climate models in Fortran?

#104
post #94

BLAS uses Fortran I think, and Lapack. Good luck calling that slow. Another clueless JS hipster, maybe.

The reference BLAS in Fortran is indeed slow. I'm not aware of any tuned version in Fortran. It might be possible to re-write the BLIS structure in Fortran and get reasonable performance on, say, Haswell, but not on SKX, if we talk x86.

Re: Why are most climate models in Fortran?

#105

Earlier quoted context omitted.

That is a great question, and while I don’t know for sure, I think a relevant anecdotal observation that stands out to me is that many languages which do have first-class multidimensional arrays also have one-based indexing. And I would speculate this in turn is because most people who wanted matrices badly enough to make them a language feature wanted to do linear algebra with them, where you generally also want one…

I don't get why a language can't have both 0 and 1 based indexing, just set it as a compiler flag or something. They are a homomorphism, it's not hard to add or subtract one.

Why can't each array have its own indexing?

You could declare the array as array[0..100] of something resp. array[1..100] of something for 0/1 based, and just as well do array[2..100] of something, or array[-1..100] of something, for -1/2 based.

Or with letters array['a'..'z'] of something,

Or with enums. TEnum = (red, blue, green), and then an array array[red..green] of something

Actually, that is just Pascal

Re: Why are most climate models in Fortran?

#106
post #5

Not only "climate models"... a large chunk of scipy is just a thin Python layer over decades-old Fortran code. That many physicists chose to use the real thing instead of the fisher-price interface speaks in favor of them.

It is sad indeed that so few new languages have a stable ABI like Fortran and C.

Re: Why are most climate models in Fortran?

#107

C and C++ are definitely the competitors to Fortran; not Chapel or Python. In the life sciences, large amounts of Fortran code has been rewritten in C/C++. But they have orders of magnitude more funding than climate science and teams of professional programmers to maintain the code. Fortran is a domain-specific language for scientists, and excels at array arithmetic (for graph-based problems though, maybe look elsewh…

There's a saying among physicists that you can write Fortran in any language.

Re: Why are most climate models in Fortran?

#108

Earlier quoted context omitted.

I don't get why a language can't have both 0 and 1 based indexing, just set it as a compiler flag or something. They are a homomorphism, it's not hard to add or subtract one.

Why can't each array have its own indexing? You could declare the array as array[0..100] of something resp. array[1..100] of something for 0/1 based, and just as well do array[2..100] of something, or array[-1..100] of something, for -1/2 based. Or with letters array['a'..'z'] of something, Or with enums. TEnum = (red, blue, green), and then an array array[red..green] of something Actually, that is just Pascal

This would all be fine until you start passing and returning these arrays and indexes between independently implemented functions and modules. Then you'd have to start declaring an index type tied to a specific array or a way to look up the index base for a passed in array.

Re: Why are most climate models in Fortran?

#109

Earlier quoted context omitted.

That is a great question, and while I don’t know for sure, I think a relevant anecdotal observation that stands out to me is that many languages which do have first-class multidimensional arrays also have one-based indexing. And I would speculate this in turn is because most people who wanted matrices badly enough to make them a language feature wanted to do linear algebra with them, where you generally also want one…

I don't get why a language can't have both 0 and 1 based indexing, just set it as a compiler flag or something. They are a homomorphism, it's not hard to add or subtract one.

Ada lets you use any integer subtype as an array range. The first index can start anywhere you wish. It's string library defaults to 1-based but you can easily interoperate with strings using a different subtype. Code can be written that is base agnostic by using the attribute mechanism or by aliasing arrays to use a known range.

Re: Why are most climate models in Fortran?

#110
post #17

Hint for commenters: Since Fortran 90, it's spelled Fortran, not FORTRAN. By using the latter you signal that your experience on the topic is from 30 years ago. https://en.wikipedia.org/wiki/Fortran#Fortran_90

Right. Sometimes old habits die hard and I use FORTRAN when I mean Fortran but I don't do it intentionally nor do I do it out of ignorance. (I note that as I type this into Firefox, its speller still wants to capitalize the word! As I've discovered so do many other editors and word-processors.)

In recent years I've adopted the following nomenclature and you'll note I've done so here in my earlier posts. That is to treat the name of each specific version as a proper name. As FORTRAN IV was originally called that including the Romanized numerals for the version number I use that out of respect for those who originally named it in the same way I'd always use say John and not john. Nowadays, when I refer to Fortran in its generic sense I use its new default name rather than its old acronym form.

Post reply on HN