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