7 ms·
I'm really interested in Fortran because I love super down-to-the-metal optimisation stuff, but I have no meaningful use-case for it. Where would you recommend
by nonsince 9y ago
I'm really interested in Fortran because I love super down-to-the-metal optimisation stuff, but I have no meaningful use-case for it. Where would you recommend someone start if they wanted to get into modern Fortran?
- jabl 9y agoMost Fortran programmers are scientists or engineers. So you could become a computational scientist. Materials science (density-functional theory, computational chemistry), climate/weather modeling, computational mechanics, fluid dynamics, etc. are all fields where Fortran usage is strong. If you're not interested in science, I guess you could contribute to GCC or LLVM and try to make Fortran benchmarks run faster.
- leephillips 9y agoAny time you want to do a big numerical computation fast. I suggest that, instead of looking at old fortran code, you make sure you are learning to use array fortran, which is supported by gfortran. You can do operations on arrays directly (makes the code concise), and get multi-processor parallelism with very little effort.
- sampo 9y ago> array fortran You mean Coarray Fortran, which can be a substitute for OpenMP, but simpler. https://en.wikipedia.org/wiki/Coarray_Fortran https://en.wikipedia.org/wiki/Coarray_Fortran
- leephillips 9y agoYes, that's the term I should have used. Thank you.
- federchen13 9y agoDue to it's simplicity, due to it's support for atomics, and due to some traditional Fortran features (modules, F9x object-based, build-in array support), Coarray Fortran does already allow to break it's own limits for development of more sophisticated parallel logic codes: https://github.com/MichaelSiehl/Atomic_Subroutines--How_the_Parallel_Codes_may_look_like--Part_2 https://github.com/MichaelSiehl/Atomic_Subroutines--How_the_...
- Athas 9y agoFortran isn't really used much for down-to-the-metal optimisation. It's not at all built for the low-level tricks common in C, but rather expects you to program at a higher level (notably with first-class arrays), after which the compiler will (hopefully) do its magic. Although in practice, most Fortran code is not particularly optimised (or optimised for long-dead machines), and could be much much faster. So, if you want to do down-to-the-metal optimisation for Fortran, you want to write a Fortran compiler, not a Fortran program.
- alfalfasprout 9y agoTo add to some of the answers, Fortran's strength is that a scientist can write an algorithm for some numerical routine fairly easily and the output code will be highly optimized. This is possible because you don't have to deal with all the weird edge cases you have in C/C++ like aliasing. The language is fairly simple so it can be optimized to death and it's easy to add things like automatic vectorization, etc.
- prestonbriggs 9y agoI'm sure you meant to include scare quotes, as in "easy" :-)
- orbifold 9y agoCompared to C++ / C even old fortran is suprisingly pleasant to use, when you want to implement simple numerical algorithms, it feels a bit like a barebones matlab
- j_s 9y agoTie in machine learning somehow and Fortran can come back in style.