A modern Fortran scientific programming ecosystem
degenerateconic.com
degenerateconic.com
This resonates with me.
A lot of the code I wrote during my PhD was Python 2. It probably wouldn't run today without a lot of work. (The easiest approach might be to start a virtual machine using a disk image of the computer I used at the time.) I could have used Python 3, but at the time I didn't pay attention to what version I was using. I also used a lot of third-party packages when I should have minimized my dependencies.
I recently switched for Fortran for new scientific software largely because I expect Fortran code to last longer. I'm pretty paranoid about portability, too. I've used around 10 Fortran compilers now. I compile in standards compliance mode in most compilers. It's been interesting to see first-hand what's portable and what's not. I even got some code I've been working on recently to compile on Microsoft Fortran PowerStation 4.0 from 1995. Hopefully if it compiles on a compiler today and a compiler from 25 years ago, it'll still compile in 25 years?
Hm, a venv with interpreter is good enough and setup from nothing within 30 minutes still.. then if you have the right libs you are ready to go. Still doing that.
Most of my (admitted, simpler) scripts from 10 years ago usually run fine without any fuzz or even with later libs - good if one embraced py3 early and isn't stuck with py2 still after EOL ;) This sure depends on libs chosen and also implementor ( yeah I also know people who claim there code breaks ever few months... I don't know why).
I would claim that Fortran's stability only comes from the fact that ecosystem and libs were not really evolving anymore... you have that also in any compiled or also scripted language if you have these conditions or keep the stuff sround? In the end that's why numpy wraps Fortran libs! :D
I'm hoping that you're right as I'd like to eventually improve what I did during my PhD. The good news is that back then I asked someone to run my scripts on their computer as a check, and the main script apparently worked. So that indicates that my dependencies were fairly standard.
My master thesis is in Python 2 and uses several COM libraries. It has like 7 years old. It is impossible to rerun it.
So I'd say you're good for at least 23 years :)
Also the author of the post has worked on some really cool stuff. They work at NASA JSC and their Fortran code is being used for the Artemis I mission (https://twitter.com/DegenerateConic/status/15615313400670617...) which is gnarly.
Of course some old code bases with lot's of gotos cryptic variable names and fixed-form code layout look a bit atrocious, but the core is fairly solid.
Your examples are fun to follow and step out of the regular day-to-day distributed computing comfort zone.
I mentioned your book in my post on Fortran: https://gruchalski.com/posts/2022-08-28-i-enjoyed-modern-for....
How do you “maintain” a computational algorithm that was carefully designed and withstood the test of time over decades?
If anything, my understanding is that too many of the newer languages and runtimes are made with the idea that they must have the full tooling in the language and runtime. As opposed to in the past, where many of these subprograms would be written to be called from whatever software was being written for the machines.
- Hardware dies, logical or physical storage needs to be reloaded
- Algorithm is challenged as incorrect, needs to be tested
- Underlying hardware infrastructure adjusts to 64-bit hardware, and returns different values
- Intel decides to muck with the sine function near 0 (https://news.ycombinator.com/item?id=8434128, https://www.cs.earlham.edu/~dusko/cs63/fdiv.html, https://github.com/torvalds/linux/blob/v5.9/arch/x86/kernel/...)
and so on
That said, my assertion was that evidence is the algorithms in question are still valid. Usually, they are still champions in speed.
Certainly, folks have had to port and maintain the fortran compilers. Especially so to add targets.
But the very stability of fortran, the language, is a big boon to those implementations not having bit rot. And while I know they could be reimplemented, in what language? And to what real advantage?
The citations in the Julia source file are certainly newer - Abramowitz and Stegun was basically all I had.
I think the REDUCE functions were considered quite fast (for higher precision) at the time, but it was certainly true that they weren't tested as thoroughly as would be the norm now.
Fortran 90 and later are different enough to modern programming languages but Fortran 77 is an even bigger step back.
Some people seem to think these programs are ancient and unchanging. They're updated regularly. Otherwise they'd quickly be superseded by better implementations.
My problem with python are largely with calisthenics regarding getting all the libraries and virtual environments to play nice, and I have a particular hatred for pandas.
N.B. I'm looking at all of this from the standpoint of a scientific computations guy, not as a software engineer or a "data scientist," so Fortran is in my blood.
You don't need any fancy library to play with data.frames. And Rstudio makes very pleasant to work with.
As luck would have it, I'm presently auditioning for a gig that requires a foot in R and another in python. Rstudio is really wonderful!
How do you deal with resource management? Do you create a wrapper type for those that don't have automatic destructor? (I'm surprised that stdlib doesn't provide a wrapper for files)