Files
hdf5/HDF5Examples/C/H5PAR/C_sourcefiles.cmake
Scot Breitenfeld 9b77f784f7 Add parallel example for HDF5 on an MPI_Comm_split sub-communicator (#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.
2026-09-01 15:13:31 -05:00

18 lines
501 B
CMake

#-----------------------------------------------------------------------------
# Define Sources, one file per application
#-----------------------------------------------------------------------------
set (examples
ph5_filtered_writes
ph5_filtered_writes_no_sel
ph5_dataset
ph5_file_create
ph5_hyperslab_by_row
ph5_hyperslab_by_col
ph5_hyperslab_by_pattern
ph5_hyperslab_by_chunk
ph5_comm_split
)
if (${HDF5_PROVIDES_SUBFILING_VFD})
list (APPEND examples ph5_subfiling)
endif ()