Skip to content

Commit 410a82a

Browse files
committed
Don't forward empty Span operations to backend
1 parent af5ebe9 commit 410a82a

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
@@ -366,6 +366,15 @@ RecordComponent::storeChunk(Offset o, Extent e, F &&createBuffer)
366366
dCreate.name = rc.m_name;
367367
IOHandler()->enqueue(IOTask(this, dCreate));
368368
}
369+
370+
if (size == 0)
371+
{
372+
// Don't forward this operation to the backend as it might create ugly
373+
// zero-blocks in ADIOS2
374+
setDirtyRecursive(true);
375+
return DynamicMemoryView<T>();
376+
}
377+
369378
Parameter<Operation::GET_BUFFER_VIEW> getBufferView;
370379
getBufferView.offset = o;
371380
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)