Skip to content

Commit b62f3fd

Browse files
committed
Don't forward empty Span operations to backend
1 parent b0dfe64 commit b62f3fd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/openPMD/RecordComponent.tpp

+9
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,15 @@ RecordComponent::storeChunk(Offset o, Extent e, F &&createBuffer)
370370
dCreate.options = rc.m_dataset.value().options;
371371
IOHandler()->enqueue(IOTask(this, dCreate));
372372
}
373+
374+
if (size == 0)
375+
{
376+
// Don't forward this operation to the backend as it might create ugly
377+
// zero-blocks in ADIOS2
378+
setDirtyRecursive(true);
379+
return DynamicMemoryView<T>();
380+
}
381+
373382
Parameter<Operation::GET_BUFFER_VIEW> getBufferView;
374383
getBufferView.offset = o;
375384
getBufferView.extent = e;

include/openPMD/Span.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ class DynamicMemoryView
113113
}
114114

115115
public:
116-
explicit DynamicMemoryView() = default;
116+
explicit DynamicMemoryView()
117+
{
118+
m_param.out->backendManagedBuffer = false;
119+
};
117120

118121
/**
119122
* @brief Acquire the underlying buffer at its current position in memory.

0 commit comments

Comments
 (0)