[Openmp-commits] [PATCH] LLVM OpenMP CMake Overhaul

Jim Cownie james.h.cownie at intel.com
Fri Jun 26 01:47:58 PDT 2015

In http://reviews.llvm.org/D10656#194353, @chandlerc wrote:

> Oh my, I didn't realize that the runtime actually compiled Fortran code.

> I think this is pretty bad. It means the particular API exported by the runtime depends on what set of frontends are available. Which in turn means we need folks to acquire a fortran frontend when prepping a build of the runtime to give to others.

> I'm not actually a fortran expert, so this may be a naive question, but I thought there was better compatibility between fortran and C and it was possible to define a fortran interface from C... That would certainly be helpful here.

> Assuming that's not how it works, and we need to build a fortran component, would it make sense to have it be a separate library name so that it is clear that the C openmp runtime only requires a C compiler to build, and the Fortran bits live in a runtime stacked on top of it and require a Fortran frontend to build?

Chandler, the issue here is with providing a Fortran module that contains the OpenMP interfaces. Unfortunately, Fortran module files are a binary format file which has no standard specification. therefore to produce a module file for a specific compiler you have to compile the module with that compiler. 
The OpenMP standard wants it to be possible for Fortran users to "use omp_lib", that requires that an appropriate Fortran module file exists.

So, the issue is not with the Fortran interface to C functions (the implementation of the Fortran module can use those interfaces if it wants to), but with the fact that Fortran compilers store modules in compiler dependent binary formats. Therefore you need the appropriate Fortran compiler to build the module file.

If a distributor is building the runtime they need to either build the module file on the user's machine at install time (when they can see which Fortran compilers the user has to hand), to maintain a (small) Fortran compiler zoo to build appropriate modules, or explain to the user how to build the module when they install (almost the same as my first solution, but less automatic).




More information about the Openmp-commits mailing list