diff --git a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp index 01b6a7aff7..922d555de1 100644 --- a/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp +++ b/include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp @@ -158,6 +158,21 @@ namespace picongpu if(elements == 0) { // accumulateWrittenBytes += 0; + +# 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 + = components > 1 ? record[name_lookup[d]] : record[::openPMD::MeshRecordComponent::SCALAR]; + + recordComponent.storeChunk( + ::openPMD::Offset{globalOffset}, + ::openPMD::Extent{elements}); + } +# endif return; }