The LFortran team writes about their LLVM-based interactive Fortran compiler and its progress compiling codebases such as LAPACK, SciPy, and minpack.
HN commenters call the work absurdly impressive, and praise Fortran with a notebook-style workflow as Python-like use with high performance.
High performance scientific computing is very much still a FORTRAN, C, and C++ game. And of those, FORTRAN has some compelling advantages in terms of first-class built-in support for multidimensional arrays, and quite excellent compilers. And, as others have noted, until the `restrict` keyword in C99, there were optimizations in FORTRAN that were not even possible in C.
I mostly used C for my (small-scale) HPC work in grad school because it’s what I knew best, but at several points I wished I had learned Fortran instead.
Probably one of the only “higher level” languages that’s ever been used for serious petascale scientific computing is Julia (first with Celeste on the astro side, possibly soon with CliMA for climate modeling), which not coincidentally follows similar array indexing conventions as FORTRAN. And while that’s what I mostly use now, I don’t see Fortran going away any time soon.
If anything, with cool new projects like LFortran [1] making it possible to use Fortran more interactively, it’s probably quite a good time to learn modern Fortran!
[1] https://lfortran.org/
A couple big things: Fortran natively performs operations on arrays directly like Matlab or Numpy in Python (Matlab was originally a REPL-style front-end to Fortan), and Fortran compilers tend to yield quite fast code (though specific cases will have another language outperform Fortran).
You can read more about the language and its high-level features here: https://fortran-lang.org
That website/community was created in part by the original author of the Python Sympy library, Ondřej Čertík. He is also working on his own Fortran compiler that you can use via webassembly to play around with Fortran; find links if you want to play here: https://lfortran.org
I've only dabbled a little, but I like the general idea, and I appreciate a F/OSS Fortran compiler being developed like this alongside actively seeking to grow the Fortran community & push the language & its libraries forward.
I expect more widespread adoption of Fortran to be quite a ways out, but what Ondřej is doing for Fortran is necessary (not sufficient) for such adoption to be the case.
as a mechanical engineer i wrote lots of FEM codes in FORTRAN, i still do and honestly enjoy programming in it. the lack of graduates who know Fortran is a correct estimate. As far as I know, it is usually replaced by MATLAB and Python in our departments. Unfortunately, C++ is taught less.
i don't know much about future CPU technology or why it is likely that Fortran codes don't perform properly on GPU. but i know that NVIDIA takes too much time to provide CUDA-FORTRAN for windows. nothing happened after 4 years.
But it seems to me that the isolated Fortran programmers have recently become well connected. Look at the website [1], Package Manager or LFortran [2].
[1] https://fortran-lang.org/en/
[2] https://lfortran.org/
Hopefully, the SciPy community can stay open-minded about modern Fortran libraries.
Modern Fortran is quite different from Fortran 77, while being as powerful, if not more.
In addition, there has been a significant community effort on improving and modernising the legacy packages, the ecosystem, and the language itself.
With projects like LFortran (https://lfortran.org/), fpm (https://github.com/fortran-lang/fpm), and stdlib (https://github.com/fortran-lang/stdlib), I believe that Fortran will enjoy prosperity again.
Fortran used to get lots of hate from the C-like crowd. Maybe it still does.
This said, it is a modern, very high performance computing language. It is easy to, as the article notes, adapt the language to fit the algorithm, rather than doing the reverse which C/C++/etc. demand. The only other language that I am aware of like that is Julia.
Julia has a REPL built in, and you need to use PackageCompiler.jl to compile AOT code. Then again fortran has a nascent REPL[1].
[1] https://lfortran.org/
"Ondřej [Certik] is the original author of SymPy, SymEngine and LFortran".
https://www.sympy.org/en/index.html
https://symengine.org/
https://lfortran.org/ << "Modern interactive LLVM-based Fortran compiler"
~
Raise your hand if you first encountered Fortran in (eng) school and wrote your first Fortain programs on punch cards. (MTS for bonus).