Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1491,8 +1491,9 @@ scientifiques choisissent obligatoirement un `ParallelMode` typé :
d'un unique writer rang 0, `COLLECTIVE` pour les hyperslabs HDF5 MPIO exacts, ou `PER_RANK` pour des
artefacts locaux qualifiés par rang et un reçu agrégé. Le mode, le format, la sélection, la cible et
l'identité de chaque pièce native (`global_box_index`, `owner_rank`, `replicated`) sont authentifiés
entre rangs avant toute écriture. La route `COLLECTIVE` appelle le backend C++ HDF5 parallèle sur
`MPI_COMM_WORLD`; `h5py` reste uniquement un lecteur/écrivain série optionnel et n'est jamais un
entre rangs avant toute écriture. La route `COLLECTIVE` appelle le backend C++ HDF5 parallèle avec
la lane MPI dupliquée possédée par la session observateur ; le writer ne redécouvre ni n'emprunte
`MPI_COMM_WORLD`. `h5py` reste uniquement un lecteur/écrivain série optionnel et n'est jamais un
transport MPI. Une dépendance HDF5 parallèle native absente, un mode incompatible ou un backend
Kokkos GPU/device handle non supporté est refusé avant le
constructeur de `System`/`AmrSystem`; aucune route série implicite ne remplace une demande MPI.
Expand Down
9 changes: 5 additions & 4 deletions docs/design/exact-output-consumers.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ count, target suffix, or writer availability:
gather, but only rank 0 prepares, verifies and atomically publishes the single-file writer.
Preparation failures and the final receipt are broadcast to every participant.
- `COLLECTIVE` requires a distributed context, an authenticated collective resource plan and the
native C++ parallel-HDF5 provider. Each rank writes only its exact non-overlapping native
hyperslabs with exactly one MPIO collective transfer per dataset and rank (including a select-none
transfer for a rank with no patch). A replicated AMR coarse patch is assigned to rank 0 for this
mode so it cannot overlap.
native C++ parallel-HDF5 provider. The observer runtime owns a duplicated MPI lane for the complete
writer session; neither the Python writer nor the native HDF5 adapter borrows or rediscovers the
process world. Each rank writes only its exact non-overlapping native hyperslabs with exactly one
MPIO collective transfer per dataset and rank (including a select-none transfer for a rank with no
patch). A replicated AMR coarse patch is assigned to rank 0 for this mode so it cannot overlap.
- `PER_RANK` requires a distributed context and preserves each rank's exact local pieces, including
explicitly replicated coarse pieces. Targets are rank-qualified before any file is opened. The
transaction succeeds only after it aggregates one deterministic receipt per contiguous rank.
Expand Down
10 changes: 0 additions & 10 deletions include/pops/runtime/output/hdf5_collective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

#include <pops/parallel/comm.hpp>

namespace pops {
class WorldCommunicator;
}

namespace pops::runtime::output {

/// Non-owning, contiguous NumPy-compatible array view used by the native HDF5 adapter.
Expand Down Expand Up @@ -56,8 +52,6 @@ struct ParallelHdf5Capability {
/// rank is allowed to enter HDF5. An empty string means that local validation succeeded.
void collective_hdf5_input_consensus(const CommunicatorView& communicator,
const std::string& local_error);
void collective_hdf5_input_consensus(const WorldCommunicator& world,
const std::string& local_error);

/// Write one exact scientific-output artifact collectively on an explicit native communicator.
///
Expand All @@ -71,9 +65,5 @@ void write_collective_hdf5(const CommunicatorView& communicator, const std::stri
const std::string& manifest_json,
const std::vector<NamedArrayView>& root_arrays,
const std::vector<FieldView>& fields);
void write_collective_hdf5(const WorldCommunicator& world, const std::string& path,
const std::string& manifest_json,
const std::vector<NamedArrayView>& root_arrays,
const std::vector<FieldView>& fields);

} // namespace pops::runtime::output
22 changes: 6 additions & 16 deletions python/bindings/core/init/init_parallel_hdf5.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../bindings_detail.hpp"

#include <pops/parallel/execution_lane.hpp>
#include <pops/parallel/world_communicator.hpp>
#include <pops/runtime/output/hdf5_collective.hpp>

#include <algorithm>
Expand Down Expand Up @@ -97,21 +96,12 @@ void init_parallel_hdf5(py::module_& m) {
[](const py::object& communicator_value, const py::object& path_value,
const py::object& manifest_value, const py::object& root_arrays_value,
const py::object& field_rows_value) {
pops::CommunicatorView communicator;
if (py::isinstance<pops::WorldCommunicator>(communicator_value)) {
auto& world = communicator_value.cast<pops::WorldCommunicator&>();
if (&world != &pops::WorldCommunicator::world())
throw py::value_error("native HDF5 requires the exact process-world authority");
communicator = world.communicator();
} else if (py::isinstance<pops::ObserverMpiLane>(communicator_value)) {
auto& lane = communicator_value.cast<pops::ObserverMpiLane&>();
if (!lane.active())
throw py::value_error("native HDF5 observer lane is closed");
communicator = lane.communicator();
} else {
throw py::type_error(
"native HDF5 requires a PoPS world communicator or observer MPI lane");
}
if (!py::isinstance<pops::ObserverMpiLane>(communicator_value))
throw py::type_error("native HDF5 requires an exact duplicated observer MPI lane");
auto& lane = communicator_value.cast<pops::ObserverMpiLane&>();
if (!lane.active())
throw py::value_error("native HDF5 observer lane is closed");
const pops::CommunicatorView communicator = lane.communicator();
std::vector<py::array> owners;
std::vector<pops::runtime::output::NamedArrayView> arrays;
std::vector<pops::runtime::output::FieldView> fields;
Expand Down
2 changes: 1 addition & 1 deletion python/pops/output/_writers/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _parallel_snapshot_data(
if request.parallel_mode is not ParallelMode.COLLECTIVE:
raise ValueError(
"a resolved communicator is valid only for HDF5 COLLECTIVE output")
require_communicator(communicator)
require_communicator(communicator, allow_world=False)
if request.rank != rank(communicator):
raise ValueError("collective HDF5 request rank differs from its native communicator")
native, capability = _require_native_parallel_hdf5()
Expand Down
Loading
Loading