Skip to content

Commit

Permalink
Initial support for HDF5 subfiling
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 22, 2023
1 parent a3fe9b7 commit 5212931
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/5_write_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ using namespace openPMD;

int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);

int mpi_size;
int mpi_rank;
Expand Down
18 changes: 18 additions & 0 deletions src/IO/HDF5/ParallelHDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
#include "openPMD/IO/HDF5/ParallelHDF5IOHandler.hpp"
#include "openPMD/IO/HDF5/ParallelHDF5IOHandlerImpl.hpp"
#include "openPMD/auxiliary/Environment.hpp"
#include "openPMD/auxiliary/StringManip.hpp"

#ifdef H5_HAVE_SUBFILING_VFD
#include <H5FDsubfiling.h>
#endif

#if openPMD_HAVE_MPI
#include <mpi.h>
Expand Down Expand Up @@ -164,6 +169,19 @@ ParallelHDF5IOHandlerImpl::ParallelHDF5IOHandlerImpl(
VERIFY(
status >= 0,
"[HDF5] Internal error: Failed to set HDF5 file access property");

#ifdef H5_HAVE_SUBFILING_VFD
int thread_level = 0;
MPI_Query_thread(&thread_level);
if (thread_level >= MPI_THREAD_MULTIPLE)
{
H5FD_subfiling_config_t vfd_config;
// query default subfiling parameters
H5Pget_fapl_subfiling(m_fileAccessProperty, &vfd_config);
// ... and set them
H5Pset_fapl_subfiling(m_fileAccessProperty, &vfd_config);
}
#endif
}

ParallelHDF5IOHandlerImpl::~ParallelHDF5IOHandlerImpl()
Expand Down

0 comments on commit 5212931

Please sign in to comment.