Since 2015, NVIDIA has supported Flang: a Fortran compiler frontend to LLVM. The first Flang was based on the PGI compiler, with proprietary optimizations removed. However, the C-based decade-plus of cruft led Flang developers and management to a ground-up rewrite in C++17. This new Flang f18 targets modern Fortran 2008 / 2018 syntax and is implemented in C++17 internally. Flang became part of LLVM 11.
NOTE: Flang is growing in features and may not be sufficiently feature-complete for modern Fortran until later LLVM 11.x releases.
Build system support
Flang is supported by Cmake ≥ 3.10, although CMake ≥ 3.14 is recommended in general to support more Fortran 2008 features.
Select Flang in the build system as usual by environment variable:
If you it necessary to build Flang, follow the
LLVM build procedure
Building the LLVM Flang Fortran compiler from source is a resource-intensive process.
- A moderately powerful PC is needed to compile Flang with > 100 GB of free space on the drive you build Flang on. While the Flang install is small, the Flang build process requires a lot of drive space.
- Don’t use too much RAM with the
makefor building Flang. It maxed out RAM on a PC with 32 GB of RAM with
make -j. Try just plain