Announcement

Collapse
No announcement yet.

GCC Prepares For Fortran 2018 Support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    There's definitely a lot more to it than mere legacy. Modern Fortran (2003, 2008, and now 2018) has some quite powerful features pertaining to object orientation, and native parallelism (via the "coarrays" model). This is on top of a large variety of intrinsic mathematical functions, IEEE arithmetic and C interoperability, along with (since Fortran 90/95) very powerful array syntax (since multidimensional arrays are and always will be an intrinsic language feature). Furthermore there is an increasing number of libraries written to the newer standards, even for things like JSON.

    On the other hand, it is of course true that Fortran is by its very nature conservative. Features are deprecated and obsoleted only when there is a clear reason to, and are implemented only when there is clear utility and a clear way to define the syntax in a minimally-obtrusive way. This has led to some interesting syntax quirks over the years, and also an admittedly still very much crippled (or at least restrictive) IO system - while catastrophic for "systems" languages, for primarily numerical work this is mainly just an inconvenience.

    I would advise those dismissing the idea of writing new code in Modern Fortran to actually look into what features are now present, and what sort of code you can write. Most of Fortran's status as "whipping-boy" is primarily contingent on plain ignorance.

    I've written a (simple) bandstructure code in Modern Fortran (roughly F2003 dialect), and am writing simulation code for illumination optics (to be released at a later date, most likely GPL3) which makes use of F2008 and F2018 functionality. Keeping up to date on newer GCC versions is essential, many of the more interesting features of F2003/2008 have been completed since I started using the language in 2014.

    Bandstructure code: https://github.com/aphirst/BandFTN (project currently stalled)
    Examples from "Modern Fortran in Practice": http://flibs.sourceforge.net/example...n_fortran.html
    ... and there are many more examples which can be found just by searching the web

    Comment


    • #12
      I think the ability to build off of other's work is a boon to productivity -- and science is built on the idea of standing on the shoulders of giants.

      As a statistics student, I found the basics of Fortran and it's pass by reference default really easy to get the hang of and just start writing.
      But then, for such an old language, developer tools in the form of libraries that provide the building blocks we need are conspicuously absent.

      Meaning even though C++ looks like a giant headache, the fact I can just rela on the STL to provide basics like a rich library of special and statistical functions, make life a lot easier, and actually does a better job getting out of the way to let me focus on the math and algorithms while still getting fast code.

      I​​​​​​ actually once had to download R's math libraries (written in C), wrap the functions I needed, and compile 20 something files into a shared library just to gain access to the basics that other languages provide either built in/through the STL or well supported and maintained libraries. Writing high performance, or even reasonably better than naive, implementations of these algorithms is not trivial.

      As far as easy to use numerical languages that produce fast code go, the only advantage I see for Fortran over Julia is for static compilation into binaries or shared libraries okay, that's big, but then C++ covers that space). Granted, Julia is linked to LAPACK (OpenBLAS's by default, written in Fortran), but other than this, Julia seems like it has a much better developed package ecosystem, letting me easily build on other's work (while also having a great type system and multiple dispatch, allowing for things like great automatic differentiation support).

      So my impression is that Fortran, despite it's age, does not feel like a mature language. The ecosystem of tools just seems to be missing. Otherwise, I think I'd actually enjoy Fortran as more than a curiosity for simple performance tests, but as an actual option for a project.
      Or maybe I'm not accustomed to some old way of doing things, where people build up a collection of shared libraries to link as they build their projects?

      Comment

      Working...
      X