From 03d457b18499d1c08b13aebcb1bee9c97823c57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 30 Jun 2025 17:37:18 +0200 Subject: [PATCH 1/3] Little fix for parallel flushing --- .../plugins/openPMD/writer/ParticleAttribute.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp index 01b6a7aff7e..ff0c2ed497f 100644 --- a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp +++ b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp @@ -158,6 +158,18 @@ namespace picongpu if(elements == 0) { // accumulateWrittenBytes += 0; + + // Since Span-based storeChunk needs to interact with the openPMD backend (potentially opening it), + // this cannot be skipped in parallel setups + for(uint32_t d = 0; d < components; d++) + { + ::openPMD::RecordComponent recordComponent + = components > 1 ? record[name_lookup[d]] : record[::openPMD::MeshRecordComponent::SCALAR]; + + recordComponent.storeChunk( + ::openPMD::Offset{globalOffset}, + ::openPMD::Extent{elements}); + } return; } From ba536827ecfac39942202a171eda9cf942a1f863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 17 Oct 2025 18:15:52 +0200 Subject: [PATCH 2/3] Workaround for https://github.com/openPMD/openPMD-api/pull/1794 --- .../picongpu/plugins/openPMD/writer/ParticleAttribute.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp index ff0c2ed497f..922d555de1f 100644 --- a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp +++ b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp @@ -159,8 +159,10 @@ namespace picongpu { // accumulateWrittenBytes += 0; - // Since Span-based storeChunk needs to interact with the openPMD backend (potentially opening it), - // this cannot be skipped in parallel setups +# if !OPENPMDAPI_VERSION_GE(0, 17, 0) + // Workaround for this bug: https://github.com/openPMD/openPMD-api/pull/1794 + // In the affected versions of the openPMD-api, Span-based storeChunk must be + // treated as an MPI-collective call. for(uint32_t d = 0; d < components; d++) { ::openPMD::RecordComponent recordComponent @@ -170,6 +172,7 @@ namespace picongpu ::openPMD::Offset{globalOffset}, ::openPMD::Extent{elements}); } +# endif return; } From 250408dd72a581785081a6abf8664f8cae8600cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 13 Mar 2026 14:59:00 +0100 Subject: [PATCH 3/3] Add the workaround also for recent releases --- include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp index 922d555de1f..6435b6e8626 100644 --- a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp +++ b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp @@ -159,8 +159,8 @@ namespace picongpu { // accumulateWrittenBytes += 0; -# if !OPENPMDAPI_VERSION_GE(0, 17, 0) // Workaround for this bug: https://github.com/openPMD/openPMD-api/pull/1794 + // and also this one for good measure https://github.com/openPMD/openPMD-api/pull/1862 // In the affected versions of the openPMD-api, Span-based storeChunk must be // treated as an MPI-collective call. for(uint32_t d = 0; d < components; d++) @@ -172,7 +172,6 @@ namespace picongpu ::openPMD::Offset{globalOffset}, ::openPMD::Extent{elements}); } -# endif return; }