Cannot do parallel builds
pbosler opened this issue · 1 comments
Running make -j
so that PartMC is built in parallel decreases compilation times, but is currently unavailable. Errors like
f951: Fatal Error: Cannot rename module file ‘pmc_util.mod0’ to ‘pmc_util.mod’: No such file or directory
compilation terminated.
imply that a module that depends on pmc_util.mod
is being built before pmc_util.mod
has been compiled. Several errors like this (but with different specific filenames) suggest that CMake is having a hard time resolving dependencies between different PartMC modules.
Serial builds (with just make
) work fine.
Thanks for reporting it.
This seems to be a known CMake issue:
- https://gitlab.kitware.com/cmake/cmake/-/issues/17044
- https://gitlab.kitware.com/cmake/cmake/-/issues/22898
- https://stackoverflow.com/questions/29728867/cmake-parallel-build-for-fortran-90-with-modules
It seems that CMake does not support "-j" for Fortran code without refactoring the CMake instructions to be concurrency-safe. PartMC has a lot of module-providing sources, so IIUC, we would need to refactor CMakeLists.txt in a way that essentially each .F90 file has its own target with Fortran_MODULE_DIRECTORY
and target_include_directories
set accordingly to a "private" module directory (i.e., 50+ new targets).