compdyn / partmc

Particle-resolved stochastic atmospheric aerosol model
http://lagrange.mechse.illinois.edu/partmc/
GNU General Public License v2.0
27 stars 15 forks source link

Cannot do parallel builds #196

Open pbosler opened 5 months ago

pbosler commented 5 months ago

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.

slayoo commented 5 months ago

Thanks for reporting it.

This seems to be a known CMake issue:

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).