3 ms·
> [Fortran] is great for technical and numerical codes that need to run fast and are intended to be used for decades. The libraries listed above will not stop w
by btrettel 4y ago
> [Fortran] is great for technical and numerical codes that need to run fast and are intended to be used for decades. The libraries listed above will not stop working in a few years. An extremely complicated Fortran application can be recompiled with just a Fortran compiler. You cannot say the same for anything written in the Python scientific ecosystem, which is a Frankenstein hybrid of a scripting language hacked together with a pile of C/C++/Fortran libraries compiled by somebody else. Good luck trying to run Python you write now 20 years from now (or trying to run something written 20 years ago). Fortran is a simple and stable foundation upon which to build our scientific software, Python is not.
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?
- throw827474737 4y ago> (The easiest approach might be to start a virtual machine using a disk image of the computer I used at the time. 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
- btrettel 4y ago> 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. 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.
- erremerre 4y agoI did a program (12 years ago) for a course at University in Fortran. When I encountered few years ago, I manage to compile in Microsoft Fortran PowerStation changing the arrays from '[ ]' (something g95 used) to (/ /) (which I think is the real Fortran90 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.
- toddm 4y agoI wrote https://github.com/toddjm/projects/blob/master/science/dqmc.f https://github.com/toddjm/projects/blob/master/science/dqmc.... in 1999, and it compiles and runs just fine with gfortran on my Mac. So I'd say you're good for at least 23 years :)