7 comments

[ 0.23 ms ] story [ 17.0 ms ] thread
It always boggles my mind that these core math libraries are still written in Fortran (same goes for some famous core matrix math libraries that still kick around). I have always presumed that it was because nobody knows Fortran well enough anymore to successfully translate them to something more modern.

Are we at the point yet where we might be able to replace some of these legacy Fortran libs with more modern, legible, performant Rust or C/C++?

Nope. FORTRAN code is still very performant in this area with modern compilers, which is why it is still used.

It's an example of Chesterton's Fence.

What's a concrete example of how FORTRAN compilers are inherently better at this type of task than modern C/C++ or Rust compilers?
It's not really about the compilers ever since C99's restrict (you can almost always equal fortran performance now), it's how much more you have to think and validate about how to write the C/C++ plus the compiler and linker options to use.

Also with C99 you get many of the convenient aspects of fortran (<tgmath.h> and vardim array function args) and with C11 you also get <complex.h> now.

But you are still missing fortran's * operator and it's more than just syntactic sugar, it accepts more types.

For DDSCAT there is the C analogue ADDA which is faster under most typical current uses. There's also IFDDA (basically fortran with a C++ convenience wrapper) offering the best performance with NVIDIA.
WTF is wrong with Fortran? And writing _legacy_ in front of something doesn't make it legacy. Who still uses the <legacy> wheel? I assume you are just kicking a hornet's nest for fun on hn.
ahem... https://github.com/ilayn/semicolon-lapack

It is mostly out of habit. These days there are no differences between languages. Very often they compile to the same machine code. Fortran array syntax is light years ahead of what C++ offers (yes including std::linalg and that's why numpy, julia, matlab picked it up) but lacks everything else as a language including often claimed portability.