Fortran submodule file naming
A Fortran submodule may be defined in the same file or a different file than the Fortran module that uses the submodule. Meta-build systems such as CMake and Meson are aware that each Fortran compiler has distinct Fortran submodule naming conventions. Fortran module and submodule interface files are like generated header files.
| Compiler | module files | submodule files |
|---|---|---|
GCC gfortran |
demo.mod demo.smod | demo@hi.smod |
LLVM flang |
demo.mod | demo-hi.mod |
Nvidia HPC nvfortran |
demo.mod | demo-hi.mod |
Intel ifx |
demo.mod | demo@hi.smod |
IBM xlf |
demo.mod | demo_hi.smod |
Cray ftn < 19.0 |
DEMO.mod | HI.mod |
Cray ftn ≥ 19.0 |
DEMO.mod | DEMO.HI.mod |
- GCC Gfortran module and submodule naming convention is defined in module.cc by definintions “MODULE_EXTENSION” and “SUBMODULE_EXTENSION”.
- LLVM Flang module and submodule naming convention is defined in Semantics.
The table above can be derived from an
example project
or by the values of CMake variables CMAKE_Fortran_SUBMODULE_EXT and CMAKE_Fortran_SUBMODULE_SEP located in
<compilerName>-Fortran.cmake.
Related:
- Fortran submodule reference
- Fortran module file format