Skip to content

Commit 6537212

Browse files
committed
Don't forward empty Span operations to backend
1 parent 684eb9b commit 6537212

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/openPMD/RecordComponent.tpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ RecordComponent::storeChunk(Offset o, Extent e, F &&createBuffer)
114114
dCreate.name = rc.m_name;
115115
IOHandler()->enqueue(IOTask(this, dCreate));
116116
}
117+
118+
if (size == 0)
119+
{
120+
// Don't forward this operation to the backend as it might create ugly
121+
// zero-blocks in ADIOS2
122+
setDirtyRecursive(true);
123+
return DynamicMemoryView<T>();
124+
}
125+
117126
Parameter<Operation::GET_BUFFER_VIEW> getBufferView;
118127
getBufferView.offset = o;
119128
getBufferView.extent = e;

include/openPMD/Span.hpp

Lines changed: 4 additions & 1 deletion
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)