Skip to content

About Flang

Gary Klimowicz edited this page Jul 21, 2020 · 7 revisions

Goals

Flang is a Fortran front-end designed for integration with LLVM, with open source licensing consistent with Clang C++ and LLVM, and suitable for deployment and interoperability with Clang/LLVM across a wide variety of systems.

The goals of Flang are:

  • Ensure Flang becomes a self-sustaining open source project
  • Attract additional developers from the (broad) community to create a critical mass of contributors
  • Deliver single-core CPU performance comparable or better than that of gfortran
  • Enable multicore CPU and GPU programming with a robust and performant implementation of OpenMP
  • Create a source base that can be readily re-hosted and re-targeted to future systems as easily as Clang and LLVM
  • Create a source base in which researchers and developers can ramp up and be productive quickly
  • Create a source base that is componentized to a degree that enables re-use of elements of Flang in tools projects

The first four of these goals have been largely addressed by the current Flang compiler.

The Flang project team determined that the last three goals could not be achieved in a reasonable time with the current code base. A new project (originally called F18) was announced at EuroLLVM April 17, 2018, to address these issues.

This project has been adopted by LLVM as the project's official Fortran front-end. In March, 2020, this F18 was upstreamed into the LLVM monorepo in the flang directory.

History of Flang

This public GitHub repository for Flang was created May 11, 2017 for the original Flang. In the first year, over 500 commits and 900 tests have been added to the repository. Over 1600 commits have been added to the repository since its inception.

CMake Version 3.10 added support for Flang.

Spack supports building and using Flang.

A Windows port has been initiated by the broader Flang community.

ARM Ltd. introduced a commercially supported Fortran compiler for ARM/HPC November 13, 2017.

Fortran 2008 Features

Flang is a fairly complete Fortran 2003 compiler. Work has been done to implement features of Fortran 2008 and Fortran 2018.

The following Fortran 2008 features have been implemented:

  • Pointers to internal procedures
  • DO CONCURRENT
  • ERROR STOP
  • CONTIGUOUS attribute
  • G0 edit descriptor
  • BACK optional argument on MAXLOC/MINLOC
  • BLOCK construct
  • Allocation of polymorphic variables
  • EXECUTE_COMMAND_LINE
  • Vector NORM2
  • Multiple sourced allocations in a single statement

The full status of the Fortran 2008 features can be found on the Fortran 2008 Features page.

OpenMP 4.5 TARGET offload to GPUs and multi-core CPUs

Flang already implements most of OpenMP 4.5 for multi-core CPUs. This functionality is enabled by default with -fopenmp. It is implemented on top of the existing pre-4.5 OpenMP runtime API (kmpc).

NVIDIA is following the Clang 7.0 model to add offload support to Flang. This support can be enabled by building Flang with -DFLANG_OPENMP_GPU_NVIDIA=ON.

What's New (20.July.2020)

We've implemented a new process for managing pull requests into this GitHub repository. With the relicensing of Flang to the Apache 2.0 license with LLVM exceptions, these pull requests no longer require a contributor license agreement.

See the Community page for details on the new pull request process.

Bug fixes

We have fixed many Flang issues, and provided other bug fixes:

  • Fixes from the PGI Fortran compiler
  • Bugs related to structure constructors
  • Bugs related to finalizers
  • Fixes for OpenMP

See the GitHub Issues list for the current status on issues.