openPMD/openPMD-api

Segfault in Flush of Particle Record Component

Open

#490 opened on Feb 22, 2019

 (7 comments) (0 reactions) (3 assignees)C++ (57 forks)auto 404
MPIaffects latest releasebackend: HDF5bughelp wanted

Repository metrics

Stars
 (160 stars)
PR merge metrics
 (PR metrics pending)

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 after the first storeChunk().

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<uint64_t>(mpi_s);
    uint64_t mpi_rank = static_cast<uint64_t>(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