Should Iteration::close(flush=true) write files?
- Dominant language
- C++
- Stars
- 161
- Forks
- 59
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 7
Description
**What do you want to achieve, please describe.**
I want to use openPMD to output data in the Einstein Toolkit. We are using AMReX and it's mesh refinement. I am currently experimenting with a first prototype of an openPMD-based I/O module for the Einstein Toolkit.
I looked at the examples and the API. I am puzzled by one thing: Files are created, but they remain empty (0 bytes) until the `Series` object is destroyed.
The code is approximately:
```C++
series = make_unique("file.bp", openPMD::Access::CREATE, MPI_COMM_WORLD);
write_iters = make_unique(series->writeIterations());
openPMD::Iteration iter = (*write_iters)[cctk_iteration];
{
openPMD::Mesh mesh = iter.meshes[groupname];
openPMD::Mesh mesh = iter.meshes[groupname];
components.at(vi).resetDataset(dataset);
components.at(vi).storeChunk(openPMD::shareRaw(ptr), offset, extent);
}
iter.close();
write_iters.reset();
series->flush();
```
I need to call `series.reset()` to have the data written to file. It is my impression that closing the iteration should already write all data to the file.
It is also my impression that it is more efficient to keep the `Series` object around. (I think this is implied from the ADIOS2 documentation.)
I installed `openPMD-api` via Spack a few days ago. I am using macOS. I am using ADIOS2 as back end.
Contributor guide
Assessment
This issue has not been assessed yet.