Hi everyone,
I have been following the LLVM flang project for a while. I’m a Fortran developer, working full-time on the commercial CFD-CAA (Computational Fluid Dynamics - Computational Aeroacoustics) code MGLET. This code is a typical HPC code, we crunch numbers on big, traditional clusters using Fortran and MPI.
I am now pleased to say, that as of now, flang-new
is able to build MGLET and run all of our basic testcases. I cannot say exactly from which date, commit or version of LLVM this became possible, but it is for sure quite recent. All of my testcases passed yesterday with a build of llvm-project from Github’s main branch.
This is impressive of the LLVM flang
community. Before flang-new
, the three compilers that were known to work with MGLET was GNU gfortran
, Intel ifx
and NAG nagfor
. Cray ftn
work partially, and Nvidia nvfortran
compile a binary but gives various runtime errors in every single testcase I have. The fact that flang-new
runs through all testcases without a single case failing on the first attempts is very impressive. I will follow up with more and bigger testcases and performance analysis at a later time.
If any of you are interested in MGLET, the core flow solver is freely available:
This codebase contains a very basic flow solver and immersed boundary implementation. On top of this we have lots of additional code in our commercial product, but my experience has shown that once the flow solver core compiles and runs, the rest of the code will do the same.
There are still a few rough edges in flang-new
, and I would use this opportunity to point out a few things that came to my mind when trying to compile and run MGLET (ordered by importance):
- We do not use assumed-rank arrays in MGLET at the moment, but we depend on
MPI_f08
. Assumed-rank arrays are required to build MPICHMPI_f08
, and it would be great to see that finished such that MPICH can build without any additional “secret flags”. There is already a Github issue on this. - This issue on Github related to generic interface name mangling was the only one where I had to adapt code in MGLET to workaround limitations in
flang-new
. It was quite annoying, as there were no clues in the error message on what name or symbol that caused problems, so I had to do some blind trial and errors based on guessing in order to rework the code. - GNU
gfortran
providesBACKTRACE()
and Intelifx
providesTRACEBACKQQ()
to print a stacktrace. This is really handy when debugging problems in MGLET. Usually, I avoid using compiler extensions, but this is too useful so it’s an exception to that rule. Maybeflang-new
could provide something similar? - The only intrinsics missing in
flang-new
that we use in MGLET seems to beIEEE_GET_UNDERFLOW_MODE
andIEEE_SET_UNDERFLOW_MODE
. They are not at all critical to MGLET and i just disabled them with a preprocessor macro (#ifndef __flang__
around their usage).
Thanks for the great effort, everyone, flang
is going to be a great compiler! If you have further questions, feel free to ask.