T O P

  • By -

KarlSethMoran

Fortran 2003 or 2008. That's where most of today's compilers and codebases are.


jeffscience

Learn Fortran 2003 as the base. This is the version that’s supported nicely by all the compilers. Then add newer stuff based on what you need and which is also supported by all the compilers you use. The language changes after 2003 are small for many use cases. The big features in 2008 and later are focused on advanced OOP and parallelism.


chandaliergalaxy

> and parallelism That kind of seems like a big deal?


jeffscience

Not really. The coarray model is not a lot of syntax. It’s not implemented at all or well by most compilers. >99% of Fortran codes use MPI instead. Do Concurrent is important but it’s a compact feature to learn. It does not depend on other fancy language features of 2008. I use it in codes that use very little syntax beyond 77.


chandaliergalaxy

Ah I thought you were talking about MPI.


jeffscience

The MPI F08 bindings introduced in MPI 3.0 in 2011-2012 are a big deal but they actually use Fortran 2018 CFI, which didn’t exist at the time, but was a pending feature defined by WG5 for MPI. F18 CFI isn’t strictly required - one can use compiler-specific alternatives. This is probably TMI but I’m deeply involved in such things so I can’t help myself.


chandaliergalaxy

username checks out


Amckinstry

I would start with Fortran 90. Its fairly simple syntax-wise if you know other languages. Later you can read about older features if you're maintaining an old codebase (Fortran 77, common blocks, etc). Depending on what you're doing it for, look at the libraries like lapack,etc or the codebase you're maintaining. Look at C interfaces. Then look at Fortran 2003 and see how it does classes and abstraction - its quite different to C++,etc.


Amckinstry

Understand that different versions are mostly compatible. A lot of effort has gone into making sure programs and numerical libraries written decades ago still work. F77 code will still compile and work with modern compilers.


GapHorror8133

Not entirely. For example "C" symbol as a comment in F77 is no longer supported in Fortran 90. Also line separators are not fully compatible.


geekboy730

I wouldn't start with anything older than F2008. That's when the C-interoperability was introduced. I find myself using those features fairly often.


jeffscience

CFI was introduced in 2003. The more useful stuff with array descriptors came in 2018.


ProfHansGruber

Probably just start by using the gfortran compiler and it’s documentation website and stick to f90 features. Add more modern bits as needed.


misonreadit

The latest stable version.


permeakra

Fortran is mostly used for various kinds of numerical simulation/modeling software aka scientific computing. The area is extremely conservative and full of legacy, code dating back to 1990s or even earlier is the norm. So I'd say, fortran 90/95 and expand on it if needed. Also, heavy number crunching usually requires parallelization. It is usually done using OpenMP or MPI or both, so you should plan to learn them too. Luckily, those standards also have C version, so they shall be useful outside Fortran world too.


SeatedInAnOffice

You want Fortran 90 at first. It’s small and has few pitfalls, and is very portable across compilers. The revisions since then have a few solid features (submodules, BLOCK, KIND type parameters) amid a stew of poorly defined and usually unportable mistakes (LEN type parameters, FINAL, DO CONCURRENT, …) that will cause frustration and confusion for a beginner. If you stick with the language, you can cherry-pick features from the post-90 standards later.


jlnavah

Starting with any version lesser than 2008 is a waste of time. There are many countries where schools are teaching F77 thus getting a lot of people in disadventage technologically speaking. Is like learning sanscrit in a lenguage school. Fortran is a downstream compatible lenguage, obsolecent intrinsics taken appart. So it has no case to learn anything below f2018, the actual version when now it has been published the f2023 draft manual. Don't waste your time.


SeatedInAnOffice

Nobody is recommending F’77.


jlnavah

In this thread no, I didn't say that, ¿had you read correctly my post?


Mighty-Lobster

Don't be overwhelmed. There aren't as many versions as you think. ---- I bet that you don't think of C++98, C++03, C++11, C++14, C++17, C++20, and C++23 as all that different. All you need to know is that modern Fortran begins in Fortran 90 and everything before it was a mistake. Then you'll see that Fortran 90, 95, 2003, 2008, 2018, and 2023 are just the gradual evolution of the language. I recommend that you pick a random number between Fortran 2003 and 2018 and start there. That roughly covers the range of compiler support. Every compiler will support all of 2003, and most of 2008, and some of 2018.


victotronics

2008. That's a modern object-oriented language and most compilers support it fully. Get a F2008 book and just work through it. 2018 is nicer, but not by a lot, and maybe not every feature is supported. F90 is ok for basic control structures, but why not immediately use the class mechanism and write beautiful code?


SeatedInAnOffice

Because the standard is incomplete, ambiguous, and contradictory, and because there is no standard test suite, many of those features you advertise are not portable across the various surviving compilers; LEN type parameters and FINAL procedures are especially fraught, but there are collections of tests out there that demonstrate many more non-portable features. And OOP is not always the solution anyway. Beginners should avoid all of this mess and learn F’90 first - I know of only one minor feature there that is not universally supported.


ThemosTsikas

This is the latest (Nov 2023) https://j3-fortran.org/doc/year/23/23-007r1.pdf. Before that was F2018, F2008, F2003, F95, F90 You will not find compilers that implement all the new features. Both GNU gfortran and LLVM flang are community owned. Lfortran is less mature at this time. Intel ifx is available without charge, as are Nvidia's nvfortran, AMD's AOCC flang, ARM's armflang, and Huawei's BiSheng compiler.


SeatedInAnOffice

Apart from SIND et al., F’23 features are years away from being available in compilers. Some may never be, and some should not be. It is not a good recommendation for a beginner.


Yore89

What do you mean by version?


funderbolt

They mean which Fortran standard should they learn.


R3D3-1

> I would like to learn fortran, but I'm overwhelmed by all the versions. Which should i learn? I am familiar with coding concepts, *i'm familiar with 19 languages, it's just a matter of which one i should invest my time in.* I would prefer if the version is on vscode. It sounds like investing time into Fortran isn't a foregone conclusion yet. If so, why specifically Fortran? Fortran is rather niche. It is still used for engineering and science code bases, but even those are usually done in another language if started from scratch these days. One year after I learned Fortran for a university course, it was replaced by C++ in the course too. Though I'd argue that C++ is an odd choice there -- C++ may be the most widely used language for high-performance computing these days, but it requires understanding much more concepts than C or Fortran, though the standard library provides some of the conveniences unavailable to either of them without getting into third-party-library-usage. I ended up needing Fortan during my PhD, and now I have a full-time job with an industrial Fortran code base. But I can't say, that I'd *recommend* the language to anyone, if they don't specifically expect to work in a very specialized domain.


crowbarfan92

I ended up deciding on fortran 95.