17#ifdef DEAL_II_WITH_HDF5
31 namespace HDF5ObjectImplementation
40# ifdef DEAL_II_WITH_MPI
41 if (std::uncaught_exceptions() > 0)
44 <<
"---------------------------------------------------------\n"
45 <<
"HDF5 " + type +
" objects call " + name +
47 <<
"them and release any resources they acquired. This call\n"
48 <<
"requires MPI synchronization. Since an exception is\n"
49 <<
"currently uncaught, this synchronization would likely\n"
50 <<
"deadlock because only the current process is trying to\n"
51 <<
"destroy the object. As a consequence, the program will be\n"
52 <<
"aborted and the HDF5 might be corrupted.\n"
53 <<
"---------------------------------------------------------"
56 MPI_Abort(MPI_COMM_WORLD, 1);
84 const hid_t &parent_group_id,
87 , query_io_mode(false)
88 , io_mode(H5D_MPIO_NO_COLLECTIVE)
89 , local_no_collective_cause(H5D_MPIO_SET_INDEPENDENT)
90 , global_no_collective_cause(H5D_MPIO_SET_INDEPENDENT)
92 hdf5_reference = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
96 const herr_t ret = H5Dclose(*pointer);
101 dataspace = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
105 const herr_t ret = H5Sclose(*pointer);
121 rank_ret = H5Sget_simple_extent_ndims(*
dataspace);
139 const hid_t &parent_group_id,
140 const std::vector<hsize_t> &dimensions,
141 const std::shared_ptr<hid_t> &t_type,
144 , rank(dimensions.
size())
145 , dimensions(dimensions)
146 , query_io_mode(false)
147 , io_mode(H5D_MPIO_NO_COLLECTIVE)
148 , local_no_collective_cause(H5D_MPIO_SET_INDEPENDENT)
149 , global_no_collective_cause(H5D_MPIO_SET_INDEPENDENT)
151 hdf5_reference = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
155 const herr_t ret = H5Dclose(*pointer);
160 dataspace = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
164 const herr_t ret = H5Sclose(*pointer);
211 ExcMessage(
"query_io_mode should be true in order to use io_mode"));
214 case (H5D_MPIO_NO_COLLECTIVE):
215 return "H5D_MPIO_NO_COLLECTIVE";
217 case (H5D_MPIO_CHUNK_INDEPENDENT):
218 return "H5D_MPIO_CHUNK_INDEPENDENT";
220 case (H5D_MPIO_CHUNK_COLLECTIVE):
221 return "H5D_MPIO_CHUNK_COLLECTIVE";
223 case (H5D_MPIO_CHUNK_MIXED):
224 return "H5D_MPIO_CHUNK_MIXED";
226 case (H5D_MPIO_CONTIGUOUS_COLLECTIVE):
227 return "H5D_MPIO_CONTIGUOUS_COLLECTIVE";
231 return "Internal error";
236 return "Internal error";
241 H5D_mpio_actual_io_mode_t
246 "query_io_mode should be true in order to use get_io_mode"));
258 "query_io_mode should be true in order to use get_local_no_collective_cause()"));
270 "query_io_mode should be true in order to use get_local_no_collective_cause()"));
282 "query_io_mode should be true in order to use get_global_no_collective_cause()"));
294 "query_io_mode should be true in order to use get_global_no_collective_cause()"));
324 const Group &parentGroup,
329 hdf5_reference = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
332 const herr_t ret = H5Gclose(*pointer);
394# ifdef DEAL_II_WITH_MPI
407 :
File(name, mode, true, mpi_communicator)
418 hdf5_reference = std::shared_ptr<hid_t>(
new hid_t, [](hid_t *pointer) {
421 const herr_t err = H5Fclose(*pointer);
432# ifdef DEAL_II_WITH_MPI
433# ifdef H5_HAVE_PARALLEL
434 const MPI_Info info = MPI_INFO_NULL;
436 plist = H5Pcreate(H5P_FILE_ACCESS);
438 ret = H5Pset_fapl_mpio(plist, mpi_communicator, info);
460 H5Fcreate(
name.data(), H5F_ACC_TRUNC, H5P_DEFAULT, plist);
471 ret = H5Pclose(plist);
476 (void)mpi_communicator;
unsigned int get_rank() const
std::vector< hsize_t > get_dimensions() const
std::vector< hsize_t > dimensions
std::uint32_t get_local_no_collective_cause_as_hdf5_type()
unsigned int get_size() const
std::shared_ptr< hid_t > dataspace
DataSet(const std::string &name, const hid_t &parent_group_id, bool mpi)
std::string get_local_no_collective_cause()
std::string get_io_mode()
std::uint32_t local_no_collective_cause
std::string get_global_no_collective_cause()
bool get_query_io_mode() const
std::uint32_t global_no_collective_cause
std::uint32_t get_global_no_collective_cause_as_hdf5_type()
H5D_mpio_actual_io_mode_t get_io_mode_as_hdf5_type()
void set_query_io_mode(const bool new_query_io_mode)
H5D_mpio_actual_io_mode_t io_mode
File(const std::string &name, const FileAccessMode mode)
DataSet open_dataset(const std::string &name) const
Group open_group(const std::string &name) const
Group(const std::string &name, const Group &parent_group, const bool mpi, const GroupAccessMode mode)
Group create_group(const std::string &name) const
std::shared_ptr< hid_t > hdf5_reference
std::string get_name() const
HDF5Object(const std::string &name, const bool mpi)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertNothrow(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
#define DEAL_II_ASSERT_UNREACHABLE()
void check_exception(const std::string &type, const std::string &name)
std::string no_collective_cause_to_string(const std::uint32_t no_collective_cause)