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:
series = make_unique<openPMD::Series>("file.bp", openPMD::Access::CREATE, MPI_COMM_WORLD);
write_iters = make_unique<openPMD::WriteIterations>(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.