Repository navigation
Fix make -j race on Fortran .mod files - #238
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #238 +/- ##
=======================================
Coverage 78.49% 78.49%
=======================================
Files 56 56
Lines 9802 9802
=======================================
Hits 7694 7694
Misses 2108 2108 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mwest1066
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
make -jrace on Fortran.modfilesSeveral targets compiled the same sources. All
.modfiles go to the build root, so parallel builds could race in the building and copying steps. This was noted in #196. Several targets compiled the same sources, and all.modfiles go to the build root, so undermake -jtwo compilers could write the same module at once. That is theCannot rename module file 'pmc_util.mod0'error. Previously we've just run everything including CI with serialmaketo avoid this.Changes (
CMakeLists.txtonly)partmc_getoptSTATIC library forsrc/getopt.F90. The 11 programs thatuse getopt_mnow link it instead of each compilinggetopt.F90themselves.test_nucleate_ode,test_poisson_sampleandtest_binomial_samplenow linkpartmclibinstead of recompiling its sources (util,constants,sys,rand,mpi, GSL, C_SORT). This avoids another race condition.make -j$(nproc), so CI exercises the parallel build. However they don't guarantee that parallel builds work (only ninja would address this)Every source is now compiled by exactly one target, avoiding race conditions and failure.
Testing
cmake -G Ninja+ninja: 223/223 (master fails immediately due to race condition)make -j 32)Fixes #196.