Fortran to be featured at Exercism in July

From comp.lang.fortran:

Fortran to be featured at Exercism in July, but …

As many are aware, Exercism.org is featuring various languages thematically this year as part of their 12in23 program (see The Official #12in23 Calendar! - YouTube ).

Fortran is being featured in July under the heading “Jurassic July”. I have been contacted by Erik Schierboom of Exercism about the Fortran content. He has written as below, and if you’re interested in contributing, please contact him via the forum https://forum.exercism.org/u/ErikSchierboom. (I do have an email address for him which, if you write to me directly, I’ll supply.)

‘Next month is Jurassic July, which will feature Fortran. I probably won’t have time to do an introduction video beforehand, but we will do the monthly introduction video. For that, I usually do write up a script for the actual introduction video and then use its contents. This time though, I’m severely limited in my time, so I was wondering if perhaps you could give me a starting point? Of course, you don’t need to write the actual contents and I can probably fairly quickly write up the “history” part of it, but the “Why it’s great” and “Standout features” sections are harder for me.’

2 Likes

For “Why it’s great”, I think the answer is

  • availability of highly-optimizing compilers
  • amount of critical legacy code (e.g. weather models and nuclear simulations)
  • number crunching on supercomputers (for instance, you can quote the NERSC statistics mentioning the percentage of node-hours that ran Fortran code)

For “standout features”, I would mention:

  • native support for N-dimensional arrays (Python needs NumPy, C++ only got mdspan in 2023 standard, etc.)
  • the array indexing syntax (esp. slicing and striding)
  • whole array operations, e.g. A(:) = B(:) + C(:), ANY() intrinsic function, or WHERE construct
  • the COMPLEX data type
  • native parallelism with co-arrays (although this last one really needs some traction from both programmers and compiler devs).

Also, the fact that the language keeps evolving (such as object-oriented Fortran since the 2003 standard) might blow some people’s minds.

2 Likes

For “Why it’s great”: great support for mpi parallel computing.

(It seems that only C can compete with Fortran in this regard since MPI only supports C and Fortran).

As a result, Fortran programs are using most of the resources of the largest supercomputers in the world. I think MPI parallel computing will remain being the dominant parallel paradigm in the next decade for large-scale scientific simulations.

this isn’t true. mpi works with Julia as well and has been used on some pretty big supcomputers (including fugaku, see GitHub - giordano/julia-on-fugaku for details)

MPI is just a library and a transport layer and is not specific to the programming language. There are bindings to many languages like Java or Python, and other can be created if needed.

Major MPI implimentations, OpenMPI, mpich and Intel MPI, only provide compiler wrappers for Fortran and C/C++.
Others might be considered as being unofficial and hacks.

In that sense every Fortran call of a C library through C-Fortran interop would be a hack.

No, MPI is really just a library and a communication infrastructure behind, the compiler wrappers specifically are not necessary (there is just one sentence mentioning them in the MPI standard), just for convenience. The official language bindings are for C and Fortran (not C++ anymore) but the library is designed with portability in mind.

In fact many programmers, including me, will write their own wrappers to those official C and Fortran MPI procedures, to simplify the calls where the same arguments are often repeated or can be inferred. Thst is just what other language binding designers do when calling the MPI C functiins through the C interoperability layers of the respective languages.

2 Likes

@VladimirF is correct, the C++ bindings are officially deprecated.

If you dig deep enough, the Julia wrappers actually rely on the C interface. See the numerous ccall in this file, for instance:

Anyway, back on the topic, you can see the completed post here at the Exercism website: