Fortran OpenMP examples
OpenMP and OpenACC are open standards for parallel programming on CPU and GPU shared memory platforms. While OpenMP has wider compiler support, OpenACC also aims to be portable across compilers and computing architectures. OpenMP standard syntax for C, C++, Fortran, and CUDA can work seamlessly with non-OpenMP systems if code is properly written. While OpenMP is typically built in from the factory in contemporary compilers, the compilers may need flag(s) to enable OpenMP. Build systems like CMake and Meson can manage the OpenMP compiler flags.
OpenMP is well-supported in commercial computation performance-oriented Fortran compilers like:
OpenMP support in open-source Fortran compilers includes LLVM and GCC.
Open-source compilers such as LLVM Flang need to have the proper OpenMP-enabling flags set when building the compiler by the distribution maintainers. For example, Homebrew LLVM Flang was missing Fortran libomp.mod support due to misconfiguration in the Homebrew flang formula.
Examples of Fortran OpenMP code: