Repository navigation
fix(io)!: name local_save files by rank on a single process too - #786
Merged
Merged
Conversation
Under MPI, local_save wrote <filename>_rank<rank>.h5 and .xdmf on several processes but <filename>.h5 and .xdmf on one, because the rank suffix came from the size check that save applies to a single-process communicator. Post-processing scripts had to special-case runs on one process, and test_local_save failed at -n 1, which CTest never ran. local_save now always appends the rank under MPI. save keeps its naming. Builds without MPI are unchanged. test_local_save and test_save_options also run on 1 process. BREAKING CHANGE: an MPI build running on one process now writes local_save output as <filename>_rank0.h5 and <filename>_rank0.xdmf instead of <filename>.h5 and <filename>.xdmf.
gouarin
force-pushed
the
fix/local-save-single-rank
branch
from
October 28, 2026 07:02
e16badc to
49670f9
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #786 +/- ##
=======================================
Coverage 82.70% 82.70%
=======================================
Files 161 161
Lines 10200 10200
Branches 3926 3926
=======================================
Hits 8436 8436
Misses 1150 1150
Partials 614 614
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.



Description
In an MPI build,
local_savenames its files<filename>_rank<rank>.h5and.xdmf, but only when more than one process runs. On one process it wrote<filename>.h5and.xdmf. The suffix came from the check thatsaveapplies to a single-process communicator (comm.size() == 1 && world.size() > 1), andlocal_savewent throughsave(..., MPI_COMM_SELF, ...). Onmain,mpiexec -n 1 ./test_local_savefails all 8 cases. CTest only ran it on 2 to 4 processes, so CI never saw it.local_savenow always appends the rank in an MPI build, so scripts that read the output need no special case for one process.save, with or without a communicator, keeps its naming. Builds without MPI are unchanged:local_savewrites<filename>.h5, assavedoes.howto/save.mdandapi/io.mdnow say this.Breaking changes
In an MPI build running on one process,
local_save("out", mesh, u)now writesout_rank0.h5andout_rank0.xdmfinstead ofout.h5andout.xdmf. Scripts that open these files from a one-process run must add_rank0.Related issue
Follow-up to #775, which added
test_local_save.How has this been tested?
add_mpi_gtesttakes a newSINGLE_PROCESSflag, which also registers the test on 1 process.test_local_saveandtest_save_optionsuse it.maintest_local_saveat-n 1test_local_save,test_save_optionsat-n 1to4test_save_optionsno longer special-cases one process.