Every time I've heard about a present-day Fortran code base it's because 1) Fortran is really good at those sorts of problems, and 2) lock-in because it's too hard to rewrite to another language, with little career benefit when you could be adding new features.
My experience is that usually it's only 2), for example in large code bases written in MUMPS.
With Fortran it's 1) and 2).
As I understand it, Fortran outperforms other languages for problems like matrix math, especially if you care about issues like portability and memory use.
Not only is Fortran designed for those problems, but the there's been a lot of thought, time, effort, and money used to make the generated code go fast.
Yes, in a language like C++, which has been frequently used to substitute Fortran, the native support for arrays is very bad.
You can eventually obtain the same performance in C++ like in Fortran, by defining your custom array types, with a complete set of operators and functions for them, possibly using inline assembly or SIMD intrinsics for implementing trickier operations. The same may be true for other programming languages that are extensible enough.
But just replacing Fortran with another currently popular programming language is not sufficient, without some extensive support libraries.
Because modern Fortran has all the goodies as other languages, first class support for CUDA, and a performance Python will never achieve, all coupled with 70 years of production code.
Also lets not forget that the beloved C is only about 10 years younger.
The preliminary Fortran specification was written in 1954, while the first version of C is from 1974.
The first Fortran implementation is from 1956, but that was not yet a complete high-level programming language, because any complicated functions and subroutines had to be written in assembly language.
In 1958, "Fortran II" added the features required to write any functions and subroutines also in Fortran, so that can be considered the first complete implementation.
Even when considering the first complete implementation, not the first written specification, C would be 16 years younger.
Even if modern Fortran compilers can still compile old Fortran programs, when writing a new Fortran program that would resemble very little with the original Fortran.
The oil and gas industry still runs on Fortran code written many decades ago. The mathematicians and physicists got things right way back then in Fortran, no need to rewrite it.
I feel this, my field (orbital dynamics) has a lot of heritage fortran that at this point I think will never go away. Much of it has a proven history, but there are large swaths of it that the original authors have long since died and no one knows the innards anymore.
I know, if it aint broke... but it feels like something has been lost if we are using code that no one alive knows what it is doing. I suppose that is the AI future.
Fortran isn't some extinct language that hasn't changed. The latest standard is only three years old.
We're not talking a language trapped on obsolete hardware. We're talking something that is still in regular use for any numeric tower, because that is what it is good at.
If you touch floating point, ever, there is a good chance the library used for processing it is a maintained, probably fairly modern, Fortran codebase.
Fortran is a beautiful language for scientific computation. The only problem is a) dogshit older code and b) the lack of ergonomic high level abstractions. The first is excusable since Fortran predates logical IF statements, and the latter is trivial with python, FFI and an LLM.
None of the programming languages that are popular today is a good replacement for Fortran, because by default they have very poor support for arrays and for many features of the floating-point computations.
The languages that are extensible, like C++, allow the definition of custom data types and of operators for them, with which the defects from the language specification can be compensated.
But that means that it is not enough to choose a programming language to replace Fortran, but also a set of libraries that would provide facilities at least as good as those provided by default in Fortran.
Such libraries introduce additional dependencies, so the choice is not simple.
Julia is one of the very few programming languages that has been intended for the same domain of applications as Fortran, but Julia has made some controversial design choices and it is doubtful that there are many cases where substituting Fortran with Julia would be a definite improvement in comparison with using the latest Fortran standard.
Good. The current state is a start, but I look forward to proper support.
I'm a computational physicist. Why can't we let this poor old language rest in peace already?
Every time I've heard about a present-day Fortran code base it's because 1) Fortran is really good at those sorts of problems, and 2) lock-in because it's too hard to rewrite to another language, with little career benefit when you could be adding new features.
It applies to all programming languages.
The whole "I rewrote X in Y" is mostly about career building, gathering Y portfolio, to jump ecosystems.
Now it doesn't matter any longer, it is one natural language paragraph away, what the output language should be.
My experience is that usually it's only 2), for example in large code bases written in MUMPS.
With Fortran it's 1) and 2).
As I understand it, Fortran outperforms other languages for problems like matrix math, especially if you care about issues like portability and memory use.
Not only is Fortran designed for those problems, but the there's been a lot of thought, time, effort, and money used to make the generated code go fast.
Yes, in a language like C++, which has been frequently used to substitute Fortran, the native support for arrays is very bad.
You can eventually obtain the same performance in C++ like in Fortran, by defining your custom array types, with a complete set of operators and functions for them, possibly using inline assembly or SIMD intrinsics for implementing trickier operations. The same may be true for other programming languages that are extensible enough.
But just replacing Fortran with another currently popular programming language is not sufficient, without some extensive support libraries.
Because modern Fortran has all the goodies as other languages, first class support for CUDA, and a performance Python will never achieve, all coupled with 70 years of production code.
Also lets not forget that the beloved C is only about 10 years younger.
And now proper debugger support it would seem...
gdb works with fortran, no?
That has been available for decades as well, this is only about lldb.
GDB and Visual Studio debugger were supported.
C is actually 20 years younger.
The preliminary Fortran specification was written in 1954, while the first version of C is from 1974.
The first Fortran implementation is from 1956, but that was not yet a complete high-level programming language, because any complicated functions and subroutines had to be written in assembly language.
In 1958, "Fortran II" added the features required to write any functions and subroutines also in Fortran, so that can be considered the first complete implementation.
Even when considering the first complete implementation, not the first written specification, C would be 16 years younger.
Even if modern Fortran compilers can still compile old Fortran programs, when writing a new Fortran program that would resemble very little with the original Fortran.
The oil and gas industry still runs on Fortran code written many decades ago. The mathematicians and physicists got things right way back then in Fortran, no need to rewrite it.
I feel this, my field (orbital dynamics) has a lot of heritage fortran that at this point I think will never go away. Much of it has a proven history, but there are large swaths of it that the original authors have long since died and no one knows the innards anymore.
I know, if it aint broke... but it feels like something has been lost if we are using code that no one alive knows what it is doing. I suppose that is the AI future.
I’m a computational Physicist. Sometimes, it’s the right tool for the job.
Fortran isn't some extinct language that hasn't changed. The latest standard is only three years old.
We're not talking a language trapped on obsolete hardware. We're talking something that is still in regular use for any numeric tower, because that is what it is good at.
If you touch floating point, ever, there is a good chance the library used for processing it is a maintained, probably fairly modern, Fortran codebase.
Fortran is a beautiful language for scientific computation. The only problem is a) dogshit older code and b) the lack of ergonomic high level abstractions. The first is excusable since Fortran predates logical IF statements, and the latter is trivial with python, FFI and an LLM.
Typed Unions and Visitors give you sum types and the like.
What kind of high level abstraction do you feel is too unergonomic to use?
B has been solved for a while, we are on Fortran 2023 nowadays.
You get as much ergonomics as a language like Zig, that gets praises all over the place.
One thing that could be nice is having an ergonomic language that transpiles to Fortran.
None of the programming languages that are popular today is a good replacement for Fortran, because by default they have very poor support for arrays and for many features of the floating-point computations.
The languages that are extensible, like C++, allow the definition of custom data types and of operators for them, with which the defects from the language specification can be compensated.
But that means that it is not enough to choose a programming language to replace Fortran, but also a set of libraries that would provide facilities at least as good as those provided by default in Fortran.
Such libraries introduce additional dependencies, so the choice is not simple.
Julia is one of the very few programming languages that has been intended for the same domain of applications as Fortran, but Julia has made some controversial design choices and it is doubtful that there are many cases where substituting Fortran with Julia would be a definite improvement in comparison with using the latest Fortran standard.
intels fortran compiler can often beat c. there is also absolutely nothing wrong w modern fortran
had to maintain simulations which hot loop was written in fortran. i learned the hard way why they are in fortran..