openPMD / openPMD/openPMD-api

Segfault in Flush of Particle Record Component

Open
#490 7 comments 0 reactions 3 assignees Claimed by @franzpoeschel View on GitHub
affects latest release backend: HDF5 bug help wanted MPI
Dominant language
C++
Stars
161
Forks
59
Avg merge
2d 22h
Merged PRs (30d)
7

Description

**Describe the bug**
An early flush during parallel `CREATE` causes a segfault.

**To Reproduce**

Taken from `ParallelIOTest` section `hdf5_write_test` `[parallel][hdf5]` with an added `o.flush()` [here](https://github.com/openPMD/openPMD-api/blob/e3d816a615caba711c8ef85d82791a09387d72bd/test/ParallelIOTest.cpp#L101) after the first `storeChunk()`.

```C++
TEST_CASE( "hdf5_write_test", "[parallel][hdf5]" )
{
int mpi_s{-1};
int mpi_r{-1};
MPI_Comm_size(MPI_COMM_WORLD, &mpi_s);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_r);
uint64_t mpi_size = static_cast(mpi_s);
uint64_t mpi_rank = static_cast(mpi_r);
Series o = Series("../samples/parallel_write.h5", AccessType::CREATE, MPI_COMM_WORLD);

o.setAuthor("Parallel HDF5");
ParticleSpecies& e = o.iterations[1].particles["e"];

std::vector< double > position_global(mpi_size);
double pos{0.};
std::generate(position_global.begin(), position_global.end(), [&pos]{ return pos++; });
std::shared_ptr< double > position_local(new double);
*position_local = position_global[mpi_rank];

e["position"]["x"].resetDataset(Dataset(determineDatatype(position_local), {mpi_size}));
e["position"]["x"].storeChunk(position_local, {mpi_rank}, {1});

o.flush(); //! @todo why does this flush cause a segfault?
}
```
**Expected behavior**
Should not segfault :-)

**Software Environment:**
- version of openPMD-api: 0.8.0-dev (as of e3d816a615caba711c8ef85d82791a09387d72bd)
- installed openPMD-api via: from source
- operating system: Debian 9.7
- machine: local laptop
- name and version of Python implementation: N/A
- version of HDF5: 1.10.0-patch1
- version of ADIOS1: N/A
- name and version of MPI: OpenMPI 2.0.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.