The new features of Fortran 2018 [pdf]
isotc.iso.org
isotc.iso.org
For a while I was translating my Matlab codes to FORTRAN; it was surprisingly easy. But I was being too naive with array resizings in Matlab and most of the speed gain (which was like 2-3 orders of magnitude) could be achieved in Matlab itself by preallocating memory.
To this day I have the nervous tick of initializing arrays with zeros even in numpy.
I dunno - I wouldn’t call that a nervous tick. If you know or have a good idea of how much memory you need, then it only seems polite to let the runtime/OS know ahead of time.
I think of it like RSVP’ing to a dinner party. Host is very appreciative when they know how many people they’re serving.
The typical way to create arrays in Numpy is with `np.zeros(size)`. What is it that you're doing?
https://www.manning.com/books/modern-fortran
Most other ‘modern fortran’ books assume you have knowledge of older fortran versions.
Table of Contents and samples on the author's site:
Here's author's recent series of articles "Analyzing stock price time series with modern Fortran":
https://milancurcic.com/2018/11/06/analyzing-stock-price-tim...
Still have my copy of "FORTRAN 77 For Engineers and Scientists" just in case.
It was very easy to pick up for someone who had only used AppleII or TRS-80 BASIC.
Don't know if it's still the case, but in FORTRAN IV you don't need spaces between keywords and variable names. So when the compiler sees "FORI=2" it has to look still further ahead to decide if this is a for-loop (FORI=2TO9DO) or an assignment to a variable named FORI. Decidedly not a context-free grammar; you can't even figure out the tokens without the ad-hoc parser getting involved.
WAs told in my first week after a hours quick instruction on our 11/40 - to get the book on Fortran from the company library and learn it.
Another notable capability is that procedures default to recursive and there is a way to state they are non_recursive.
IF ( N ) 6020, 6030, 6999
Basically GOTO 3 different labels, depending whether if N is -ve 0 or +ve
I have used my first jobs standard for statement labeling - which was fairly common, 6000's for goto's 7000 and 8000 for FORMAT statements
Things like metacommands [0] will need to be converted to something standard (or removed) to work with modern compilers.
https://github.com/CodethinkLabs/fortrantools/blob/master/RE...
Most of the patches are upstreamed, but their gcc repo contains the patched versions on top of the latest gcc releases.
For an example of use in production, my business [0] is built around running ~1M lines of parallel Fortran (public domain code) in the cloud. There are many many other uses but tend to be less visible -- under the hood of other software, banking systems, many DOE and DOD projects etc.
In addition to being fast, I find it considerably easier to read than C++ as it isn't as low level and doesn't have as much noise (at least the later versions like Fortran 90).
It also makes writing numerical code easy as it was truly built for high performance scientific computing.
A lot of older scientific projects run on Fortran and although I know some projects that were migrated to C++, it wasn't due to any defect from the language besides it not being taught very often in colleges now outside of some astrophysics classes where it was once a mainstay in engineering and science curriculums.
There are several compilers available, but a lot of them are commercial and some are expensive. There are free versions as well of course.
Numpy, R, Matlab, etc. are good scripting languages for a lot of Fortran, but if you ever need to peek under the hood...
https://scicomp.stackexchange.com/questions/304/c-vs-fortran...
"Sorry for digging up an old thread but it seems that even in 2015, Fortran is being used a lot.
I just came across this (alternate link) list which basically is a list of 13 codes approved by DOE's OCLF facility to run on the 300-petaFLOPS Summit machine which will be made available to researchers in 2018. I tried to find the main language used for the code (based on a quick google search) and here is what I found:
XGC Fortran
SPECFEM Fortran
ACME Fortran (Bunch of climate codes)
DIRAC Fortran (Mostly)
FLASH Fortran
GTC Fortran
HACC C/C++
LS-DALTON Fortran (some C)
NAMD C/C++
NUCCOR Fortran
NWCHEM Fortran
QMCPACK C++
RAPTOR Fortran"
Note: QMCPACK is written in C++ but depends on LAPACK which is again Fortran.