Improving the GFortran page on the Fortran Wiki

I think the page GFortran (current) on the Fortran Wiki could be updated (see last update: 17th March 2021) and improved:

Of course anyone can modify that Wiki page (without even creating an account), but it would be interesting to first define what the community think that page should ideally contain.

3 Likes

Ideally the gfortran page itself should contain as much of the information as possible, as this page shows how a secondary source can easily get out of date. The recent projects that provide simple methods for installing gfortran (and other) compilers on MacOS/Linux and MSWindows should be pointed to. The list of suggested changes seems like a good step in the right direction. Since the Discourse group and the comp.lang.fortran group do not supply a mechanism for easily transitioning the information there into organized references it is great to see someone updating the Wiki.

1 Like

If it can be useful, conda its a great tool for working seamlessly on Windows and Linux (almost like being in the same OS), and on linux, even if sudo is not enabled, conda install does the trick. Installing compilers can be managed quite easily by:

> conda config --add channels conda-forge
> conda install -c conda-forge make
> conda install -c conda-forge cmake
> conda install -c conda-forge cxx-compiler
> conda install fpm

ERRATA: the following are different between OSs
Linux:

> conda install -c conda-forge gcc
> conda install -c conda-forge gfortran
> conda install -c conda-forge gxx

Windows:

> conda install -c conda-forge m2w64-gcc
> conda install -c "conda-forge/label/cf202003" fortran-compiler

(m2w64-gcc will install gcc 5.3, and the “fortran-compiler” is flang not gfortran :s )

1 Like

On this kind of page, we should try either to avoid statements that could become easily outdated, or to date those statements. For example, if I write “In 2012, GFortran is implementing ??% of the Fortran 2008 standard”, the statement may be still online ten years later but the reader will understand that it is an outdated information (and it increases the probability that someone will decide to update it).

This is a draft for a plan:

1. Introduction: what is GFortran
2. Installing GFortran
3. Basic usage
4. Options
4.1. Diagnostic
4.2. Optimisation
4.3. Debugging
5. Parallel computing
5.1. OpenMP / SIMD
5.2 Accelerator devices: OpenACC
5.3. OpenCoarrays
5.4. OpenMPI
6. Contributing to GFortran
6.1. Bug reporting
6.2. Development
7. Useful links

Updated: 2023-02-25 13:40 UTC

In the parallel section shouldn’t some references to OpenMPI and OpenACC be also mentioned?
Then maybe make a sub-category:
5. Parallel computing
Add link to Flynn’s Taxonomy just for reference ?
5.1 Shared Memory
5.1.1 OpenMP / SIMD
5.1.2 Accelerator devices: OpenACC
5.2 Distributed Memory or Message Passing (SPMD)
5.2.1 OpenCoarrays
5.2.2 OpenMPI

… this can be misleading since MPI and Coarrays also enable doing shared-memory computing but given their main target is enabling distributed parallelization this could hold?

Thanks for feedback.
In a first step, I will add the four techniques in the draft. To avoid ambiguity, maybe it would be better to tell for each technique on what type of system it can be used?

I think that more than the type of system in which it can be used, is a matter of which aspect of current architectures they enable to exploit. From a very rough and shallow description:

  • OpenACC: enable multi-threading in a shared memory framework for GPUs and minimal latency in memory transfer from host (CPU) to device (GPU)

  • OpenMP/SIMD: SIMD for exploiting SSE/AVX/AVX2/AVX512 vectorization instructions in a single logical unit, OpenMP for multi-threading with all the logical units within a single NUMA core.

Normaly modern fortran compilers will exploit vectorization without the programmer needing to write “!$open simd” directives if the array operations are “clear and easy enough” for the compiler to see that it can vectorize.

The “do concurrent” construct should be mentioned as candidate to minimize boiler plate, and in some cases avoid the need for using the directives. For example Accelerating Fortran DO CONCURRENT with GPUs.

  • OpenCoarrays or OpenMPI : Enable message passing between logical units (if thought-off as not sharing memory) or between NUMA cores, clusters.
1 Like

I think the GFortran page should not give too much details about that, but rather just give the commands, options, environment variables the user will need to exploit these techniques. And redirect the user toward the related pages on the Wiki if he needs more information.

See those list of pages:
https://fortranwiki.org/fortran/search?query=parallel
https://fortranwiki.org/fortran/search?query=openmp

1 Like

Totally agree! I just put it there in case a brief wrap-up could be useful for directing the reader.

1 Like

I have heavily updated the GFortran page.

You can now help by:

  • improving the macOS and Windows installation sections (you can also add Conda or other systems),
  • writing the OpenACC and OpenMPI sections (I am not (yet) competent),
  • adding your preferred GCC/GFortran options,
  • etc.

Take note that the content is licensed under GNU Free Documentation License (like the GCC/GFortran official documentation).

P.s. I will ask @JerryD to review the page in a few days.

3 Likes

Added a couple of lines on OpenMP and OpenACC

2 Likes

Added content on vectorization and OpenMPI … if it is too verbose go ahead and edit, felt like some context was needed in the vectorization section.

2 Likes

Thanks, we begin to have a decent reference page about GFortran!

2 Likes

Concerning the compiler options, we should revisit some interesting discussions that occurred on that subject:
https://fortran-lang.discourse.group/search?q=compiler%20options

1 Like

This a big topic in it self! Depending on the needs of the project one might want:

  • The most aggressive optimizations: for speed or for memory
  • The most robust (e.g.: avoiding -ffast-math)
  • Being cross-compiler “equivalent” thus finding the right combinations

How do you see things here, a kind of Cook-book & best practices page/section?

btw: just realized that you had written some info on -march in the Optimization section, so the vectorization section duplicated this info. Do you think it is worth merging?

1 Like

I think the GFortran page should stay focused on giving simply the options of GFortran. And a new page could be created on optimisation strategies, with GFortran or other compilers.

Probably we coud compact a little that sentence:

Note: -march=native tells the compiler to optimize for current architecture, it will automatically detect if the current CPU has SSE/AVX/AVX2/AVX512 instruction sets available and go for it. You can also set a different target architecture (not recommended). More information in the GCC doc.

Done, let me know what you think about the new wording.

Agree!

1 Like

Great! thanks.
I think I will print the page tomorrow or Friday and fix the problems if needed, before asking Jerry Delisle (a GFortran developer) to review the whole page.

1 Like

Looking for gfortran in conda-forge repositories, I have found only:
https://github.com/conda-forge/gfortran_osx-64-feedstock
GitHub - conda-forge/gfortran_impl_osx-64-feedstock: A conda-smithy repository for gfortran_impl_osx-64.
GitHub - conda-forge/libgfortran-feedstock: A conda-smithy repository for libgfortran. Moved to https://github.com/conda-forge/gfortran_impl_osx-64-feedstock

But what does mean “impl” in gfortran_impl_osx-64-feedstock? What is the difference between gfortran_osx-64-feedstock and gfortran_impl_osx-64-feedstock?