Add parallel example for HDF5 on an MPI_Comm_split sub-communicator - #6646
Merged
Merged
Conversation
Adds HDF5Examples/C/H5PAR/ph5_comm_split.c, showing parallel HDF5 use on a communicator produced by MPI_Comm_split rather than on MPI_COMM_WORLD. The example splits MPI_COMM_WORLD by rank parity. The even ranks form a writer group that collectively creates a dataset with one row per writer rank, then reopens the file read-only on the same sub-communicator and verifies what it wrote. The odd ranks stand in for a group with other responsibilities and make no HDF5 calls at all. The comments cover the two rules this pattern depends on: MPI_Comm_split is collective over the parent communicator, so every rank must call it even if it never opens the file; and once a file is opened with a FAPL carrying a sub-communicator, every collective HDF5 call on that file is collective over that sub-communicator alone. The example runs with any number of MPI ranks.
brtnfld
requested review from
glennsong09,
jhendersonHDF,
lrknox,
mattjala and
vchoi-hdfgroup
as code owners
August 27, 2026 19:27
github-actions
Bot
removed request for
glennsong09,
lrknox,
mattjala and
vchoi-hdfgroup
August 27, 2026 19:33
Contributor
Review ChecklistThis PR touches the following areas. Each needs a sign-off
|
| * communicator must match the set of ranks that will make the | ||
| * collective calls on the reopened file. | ||
| */ | ||
| fapl_id = make_fapl(sub_comm); |
Collaborator
There was a problem hiding this comment.
Strictly speaking this shouldn't ever be necessary, but it's also not a terrible idea.
jhendersonHDF
approved these changes
Sep 1, 2026
brtnfld
added a commit
that referenced
this pull request
Sep 12, 2026
…6646) Adds HDF5Examples/C/H5PAR/ph5_comm_split.c, showing parallel HDF5 use on a communicator produced by MPI_Comm_split rather than on MPI_COMM_WORLD. The example splits MPI_COMM_WORLD by rank parity. The even ranks form a writer group that collectively creates a dataset with one row per writer rank, then reopens the file read-only on the same sub-communicator and verifies what it wrote. The odd ranks stand in for a group with other responsibilities and make no HDF5 calls at all. The comments cover the two rules this pattern depends on: MPI_Comm_split is collective over the parent communicator, so every rank must call it even if it never opens the file; and once a file is opened with a FAPL carrying a sub-communicator, every collective HDF5 call on that file is collective over that sub-communicator alone. The example runs with any number of MPI ranks.
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.
Adds
HDF5Examples/C/H5PAR/ph5_comm_split.c, an example of using parallelHDF5 on a communicator produced by
MPI_Comm_splitrather than onMPI_COMM_WORLD.Applications often divide
MPI_COMM_WORLDinto groups that do differentwork, where only some of those groups touch the HDF5 file. None of the
existing H5PAR examples show that arrangement; they all open the file on
MPI_COMM_WORLD.