Particularly for HPC users, what are the latest standards of Fortran, MPI, OpenMP and OpenACC that you can readily compile using the pre-installed compilers and libraries in your environment? - I am wondering what is a realistic combination of standards to target for on-the-fly machine generated code, taking into account the fact that tangled dependencies can sometimes keep installed compilers and libraries below the latest releases.
I’m a stubborn idiot that installs their own everything from scratch, and now with spack it’s easy to build things from scratch.
Otherwise, usually things are a couple versions behind and mostly it’s GNU, Intel, and the Nvidia ones.
Thanks. A couple of versions behind restricts things quite a bit though - probably to F2003, MPI 3.0, OpenMP 4.5 and OpenACC 2.6 - though perhaps this is too pessimistic (or even optimistic?)
The question would be, which OS does your HPC infrastructure runs on and which package manager do you have access as an user. RedHat ? some old CentOS ? Debian ?
This seems a bit too pesimistic. MPI 4 through OpenMPI4.x has already been available for quite some time. GNU and Intel compilers have been F2008 compliant also for many years.
Also if it is a Cray, I haven’t had many issues with OS but damn has Cray been a pain in my neck
Thanks. My one concern with F2008 (which I would prefer to adopt) is how many people have a system based on nvfortran - particularly for GPU support.
In that case the problem is very specific to nvfortran; which is mainly F2003 compliant with a very limited subset of F2008 features. Nvfortran undergoes very basic maintainance as it will be replaced by flang.
You can also combine GNU compilers with offloading capabilities and/or linking with nvidia stack, there might be some useful information and links in this thread GPU offloading in Fortran - #16 by hkvzjal
The way I’ve approached things is to pick the least capable compiler in terms of standard (in this case nvfortran) and make sure my code (which is GPU accelerated) builds with it. If you can build on nvfortran it will surely build with the rest of the lot.
I am very defensive with what I use - since I care about performance on the GPU it is mostly declarative, do concurrent, little to no polymorphism, etc. i.e. what people would call decorated F90 haha
I have been very conservative with my use of OpenMP, limiting my use to mostly OpenMP 4.5.
I had been interested in memory management and thread management, but it was difficult to identify what new OpenMP directives were reliably supported by which version of Gfortran (my main compiler for OpenMP).
Better documentation of what OpenMP is reliably supported in Gfortran is needed.
The many recent changes in GPU memory need a better standard as most appear to be supported by one compiler extension, which is a poor outcome for portability.
I also find that DO CONCURRENT appears to be a niche solution, as I have few computations that can comply with the pure limitations and benefit from threading, while !$OMP PARALLEL DO provides a more reliable solution with it’s clause labelling. Most DO_C examples do not exceed the thread initiation overheads.
To me, a better development path would be to incorporate OpenMP into Fortran, rather than reinvent via pure DO CONCURRENT.
Thanks - that does suggest sticking with F2003 plus a few nvfortran recognised F2008 features.
TL/DR: Regarding Fortran standards, I recommend using whatever features of the latest standard (currently Fortran 2023) that the compiler(s) of interest support.
Any other approach is fraught with several subtle pitfalls, ambiguities, and complications. Just to give one example of many, standards have mistakes. Settling on a standard means settling on a set of mistakes. Some mistakes get fixed in a subsequent corrigendum. Others get fixed in the next standard. If I recall correctly, Fortran 2008 had three published corrigenda and one unpublished one because ISO capped corrigenda at three. I suspect this is the reason that previous standards are officially withdrawn each time a new standard gets published. So officially, there is only ever one standard at a time.