Skip to content

Better synchronicity in middle-end flushing operations - #1862

Merged
franzpoeschel merged 39 commits into
openPMD:devfrom
franzpoeschel:fix-parallel-hdf5
Aug 31, 2026
Merged

Better synchronicity in middle-end flushing operations#1862
franzpoeschel merged 39 commits into
openPMD:devfrom
franzpoeschel:fix-parallel-hdf5

Conversation

@franzpoeschel

@franzpoeschel franzpoeschel commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

It seems that HDF5 has become quite a bit pickier about metadata definitions in parallel setups with versions 2.0 and 2.1, leading to hangups.
Earlier, it was enough to define them consistently across ranks, now we apparently have to keep the exact same order of operations.

This is bad for the Span API which runs internal flushes for structure setup.

Idea of this PR: Temporarily add this below block to RecordComponent::resetDataset():

    /*
     * For backwards-compatibility reasons, we do not actually run the below
     * flush. But the API should be written in such a way that the entire test
     * suite passes when enabling the below code block.
     */
#if 1
    auto cleanup = auxiliary::defer([&rc, this]() {
        if (rc.m_dataset.has_value() &&
            rc.m_dataset->dtype != Datatype::UNDEFINED &&
            IOHandler()->m_seriesStatus != internal::SeriesStatus::Parsing)
        {
            seriesFlush_impl</* flush_entire_series = */ false>(
                {FlushLevel::SkeletonOnly}, /* flush_io_handler = */ true);
        }
    });
#endif

Then check for hanging or failing tests and fix the flushing logic long enough until all tests pass again.

A follow-up PR should add a new API call to run this flush operation on any RecordComponent.

  • No longer flush inside the Span API, instead flush already at resetDataset()
  • Try if we can only enqueue operations and run them later, should be fine for the ordering
  • Ensure that only a select type of operation runs in structural setup flushes
  • Remove flushParticlesPath and flushMeshesPath functions, these unnecessarily leaked attribute flushes into the structure setup
  • Fix tests...
  • Manually go through tests and check if any of them silently swallows some errors, the chance is high
  • Guard setDirty calls
  • There are some commits deactivating a handful of tests, deal with them
  • Maybe document user-facing changes? probably none

Follow-Up ideas and possible design changes

Diff at https://github.com/franzpoeschel/openPMD-api/compare/defaults-upon-close...fix-parallel-hdf5?expand=1

Comment thread src/IO/AbstractIOHandlerImpl.cpp Fixed
Comment thread src/IO/AbstractIOHandlerImpl.cpp Fixed
Comment thread test/CoreTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/ParallelIOTest.cpp Fixed
Comment thread test/SerialIOTest.cpp Fixed
Comment thread test/SerialIOTest.cpp Fixed
@franzpoeschel
franzpoeschel force-pushed the fix-parallel-hdf5 branch 3 times, most recently from 48b4c2a to 07fb558 Compare March 27, 2026 10:19
Comment thread src/Iteration.cpp Fixed
}
} // namespace

std::future<void> AbstractIOHandlerImpl::flush(FlushLevel l)

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 430 lines.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread test/ParallelIOTest.cpp Outdated

Check notice

Code scanning / CodeQL

Unused static function Note test

Static function openPMD_parallel_bug_1655_bp5_writer_hangup is unreachable (
CATCH2_INTERNAL_TEST_24
must be removed at the same time)
Static function openPMD_parallel_bug_1655_bp5_writer_hangup is unreachable (
autoRegistrar25
must be removed at the same time)
Comment thread test/ParallelIOTest.cpp Outdated

Check notice

Code scanning / CodeQL

Unused static function Note test

Static function CATCH2_INTERNAL_TEST_24 is unreachable (
autoRegistrar25
must be removed at the same time)
@franzpoeschel franzpoeschel changed the title Parallel HDF5: Try fixing strict collective requirements of HDF5 >= 2.0 Better synchronicity in middle-end flushing operations Aug 27, 2026
@franzpoeschel
franzpoeschel enabled auto-merge (squash) August 27, 2026 13:53
@franzpoeschel
franzpoeschel merged commit d8c2651 into openPMD:dev Aug 31, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants