Reference documentation for deal.II version 9.2.0
|
#include <deal.II/base/hdf5.h>
Public Member Functions | |
template<typename Container > | |
Container | read () |
template<typename Container > | |
Container | read_selection (const std::vector< hsize_t > &coordinates) |
template<typename Container > | |
Container | read_hyperslab (const std::vector< hsize_t > &offset, const std::vector< hsize_t > &count) |
template<typename Container > | |
Container | read_hyperslab (const std::vector< hsize_t > &data_dimensions, const std::vector< hsize_t > &offset, const std::vector< hsize_t > &stride, const std::vector< hsize_t > &count, const std::vector< hsize_t > &block) |
template<typename number > | |
void | read_none () |
template<typename Container > | |
void | write (const Container &data) |
template<typename Container > | |
void | write_selection (const Container &data, const std::vector< hsize_t > &coordinates) |
template<typename Container > | |
void | write_hyperslab (const Container &data, const std::vector< hsize_t > &offset, const std::vector< hsize_t > &count) |
template<typename Container > | |
void | write_hyperslab (const Container &data, const std::vector< hsize_t > &data_dimensions, const std::vector< hsize_t > &offset, const std::vector< hsize_t > &stride, const std::vector< hsize_t > &count, const std::vector< hsize_t > &block) |
template<typename number > | |
void | write_none () |
bool | get_query_io_mode () const |
void | set_query_io_mode (const bool new_query_io_mode) |
std::string | get_io_mode () |
H5D_mpio_actual_io_mode_t | get_io_mode_as_hdf5_type () |
std::string | get_local_no_collective_cause () |
uint32_t | get_local_no_collective_cause_as_hdf5_type () |
std::string | get_global_no_collective_cause () |
uint32_t | get_global_no_collective_cause_as_hdf5_type () |
std::vector< hsize_t > | get_dimensions () const |
unsigned int | get_size () const |
unsigned int | get_rank () const |
Public Member Functions inherited from HDF5::HDF5Object | |
template<typename T > | |
T | get_attribute (const std::string &attr_name) const |
template<typename T > | |
void | set_attribute (const std::string &attr_name, const T value) |
std::string | get_name () const |
template<> | |
bool | get_attribute (const std::string &attr_name) const |
template<> | |
void | set_attribute (const std::string &attr_name, const std::string value) |
Protected Member Functions | |
DataSet (const std::string &name, const hid_t &parent_group_id, bool mpi) | |
DataSet (const std::string &name, const hid_t &parent_group_id, const std::vector< hsize_t > &dimensions, const std::shared_ptr< hid_t > &t_type, const bool mpi) | |
Protected Member Functions inherited from HDF5::HDF5Object | |
HDF5Object (const std::string &name, const bool mpi) | |
Private Attributes | |
unsigned int | rank |
std::vector< hsize_t > | dimensions |
std::shared_ptr< hid_t > | dataspace |
unsigned int | size |
bool | query_io_mode |
H5D_mpio_actual_io_mode_t | io_mode |
uint32_t | local_no_collective_cause |
uint32_t | global_no_collective_cause |
Friends | |
class | Group |
Additional Inherited Members | |
Protected Attributes inherited from HDF5::HDF5Object | |
const std::string | name |
std::shared_ptr< hid_t > | hdf5_reference |
const bool | mpi |
|
protected |
Open dataset. This is an internal constructor. The function Group::open_dataset() should be used to open a dataset.
|
protected |
Create dataset. This is an internal constructor. The function Group::create_dataset() should be used to create a dataset.
Container HDF5::DataSet::read |
Reads all the data of the dataset.
Datatype conversion takes place at the time of the read operation and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container
can be std::vector<float>
, std::vector<double>
, std::vector<std::complex<float>>
, std::vector<std::complex<double>>
, std::vector<int>
, std::vector<unsigned int>
, Vector<float>
, Vector<double>
, Vector<std::complex<float>>
, Vector<std::complex<double>>
, FullMatrix<float>
, FullMatrix<double>
, FullMatrix<std::complex<float>>
or FullMatrix<std::complex<double>>
.
Container HDF5::DataSet::read_selection | ( | const std::vector< hsize_t > & | coordinates | ) |
Reads data of a subset of the dataset.
Datatype conversion takes place at the time of the read operation and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
The selected elements can be scattered and take any shape in the dataset. For example, in the case of a dataset with rank 4 a selection of 3 points will be described by a 3-by-4 array. Note the indexing is zero-based. To select the points (1,1,1,1), (14,6,12,18), and (8,22,30,22), the point selection array would be as follows:
Parallel HDF5 supports collective I/O on point selections.
Datatype conversion takes place at the time of the read operation and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container HDF5::DataSet::read_hyperslab | ( | const std::vector< hsize_t > & | offset, |
const std::vector< hsize_t > & | count | ||
) |
Reads a hyperslab from the dataset. The parameters are summarized below:
offset:
The starting location for the hyperslab.count:
The number of elements to select along each dimension.When reading a hyperslab, HDF5 also allows to provide "stride" and "block" parameters (see the HDF5 documentation). These are not used by the current function and set to nullptr
. However these parameters can be used with the function read_hyperslab(const std::vector<hsize_t> &, const std::vector<hsize_t> &, const std::vector<hsize_t> &, const std::vector<hsize_t> &, const std::vector<hsize_t> &)
See the Dataspaces and Data Transfer section in the HDF5 User's Guide. See as well the H5Sselect_hyperslab definition.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container
can be std::vector<float>
, std::vector<double>
, std::vector<std::complex<float>>
, std::vector<std::complex<double>>
, std::vector<int>
, std::vector<unsigned int>
, Vector<float>
, Vector<double>
, Vector<std::complex<float>>
, Vector<std::complex<double>>
, FullMatrix<float>
, FullMatrix<double>
, FullMatrix<std::complex<float>>
or FullMatrix<std::complex<double>>
.
Container HDF5::DataSet::read_hyperslab | ( | const std::vector< hsize_t > & | data_dimensions, |
const std::vector< hsize_t > & | offset, | ||
const std::vector< hsize_t > & | stride, | ||
const std::vector< hsize_t > & | count, | ||
const std::vector< hsize_t > & | block | ||
) |
Writes a data hyperslab to the dataset. The parameters are summarized below:
dataset_dimensions:
the dimensions of the data memory block.offset:
The starting location for the hyperslab.stride:
The number of elements to separate each element or block to be selected.count:
The number of elements or blocks to select along each dimension.block:
The size of the block selected from the dataspace.See the Dataspaces and Data Transfer section in the HDF5 User's Guide. See as well the H5Sselect_hyperslab definition.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container
can be std::vector<float>
, std::vector<double>
, std::vector<std::complex<float>>
, std::vector<std::complex<double>>
, std::vector<int>
, std::vector<unsigned int>
, Vector<float>
, Vector<double>
, Vector<std::complex<float>>
, Vector<std::complex<double>>
, FullMatrix<float>
, FullMatrix<double>
, FullMatrix<std::complex<float>>
or FullMatrix<std::complex<double>>
.
void HDF5::DataSet::read_none |
This function does not read any data, but it can contribute to a collective read call. number
can be float
, double
, std::complex<float>
, std::complex<double>
, int
or unsigned int
.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
void HDF5::DataSet::write | ( | const Container & | data | ) |
Writes data in the dataset. number
can be float
, double
, std::complex<float>
, std::complex<double>
, int
or unsigned int
.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container
can be std::vector<float>
, std::vector<double>
, std::vector<std::complex<float>>
, std::vector<std::complex<double>>
, std::vector<int>
, std::vector<unsigned int>
, Vector<float>
, Vector<double>
, Vector<std::complex<float>>
, Vector<std::complex<double>>
, FullMatrix<float>
, FullMatrix<double>
, FullMatrix<std::complex<float>>
or FullMatrix<std::complex<double>>
.
void HDF5::DataSet::write_selection | ( | const Container & | data, |
const std::vector< hsize_t > & | coordinates | ||
) |
Writes data to a subset of the dataset. number
can be float
, double
, std::complex<float>
, std::complex<double>
, int
or unsigned int
.
The selected elements can be scattered and take any shape in the dataset. For example, in the case of a dataset with rank 4 a selection of 3 points will be described by a 3-by-4 array. Note the indexing is zero-based. To select the points (1,1,1,1), (14,6,12,18), and (8,22,30,22), the point selection array would be as follows:
Parallel HDF5 supports collective I/O on point selections.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
void HDF5::DataSet::write_hyperslab | ( | const Container & | data, |
const std::vector< hsize_t > & | offset, | ||
const std::vector< hsize_t > & | count | ||
) |
Writes a data hyperslab to the dataset. The parameters are summarized below:
offset:
The starting location for the hyperslab.count:
The number of elements to select along each dimension.When writing a hyperslab, HDF5 also allows to provide "stride" and "block" parameters (see the HDF5 documentation). These are not used by the current function and set to nullptr
. However these parameters can be used with the function write_hyperslab(const Container &data, const std::vector<hsize_t> &data_dimensions, const std::vector<hsize_t> &offset, const std::vector<hsize_t> &stride, const std::vector<hsize_t> &count, const std::vector<hsize_t> &block).
See the Dataspaces and Data Transfer section in the HDF5 User's Guide. See as well the H5Sselect_hyperslab definition.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
void HDF5::DataSet::write_hyperslab | ( | const Container & | data, |
const std::vector< hsize_t > & | data_dimensions, | ||
const std::vector< hsize_t > & | offset, | ||
const std::vector< hsize_t > & | stride, | ||
const std::vector< hsize_t > & | count, | ||
const std::vector< hsize_t > & | block | ||
) |
Writes a data hyperslab to the dataset. The parameters are summarized below:
dataset_dimensions:
the dimensions of the data memory block.offset:
The starting location for the hyperslab.stride:
The number of elements to separate each element or block to be selected.count:
The number of elements or blocks to select along each dimension.block:
The size of the block selected from the dataspace.See the Dataspaces and Data Transfer section in the HDF5 User's Guide. See as well the H5Sselect_hyperslab definition.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
Container
can be std::vector<float>
, std::vector<double>
, std::vector<std::complex<float>>
, std::vector<std::complex<double>>
, std::vector<int>
, std::vector<unsigned int>
, Vector<float>
, Vector<double>
, Vector<std::complex<float>>
, Vector<std::complex<double>>
, FullMatrix<float>
, FullMatrix<double>
, FullMatrix<std::complex<float>>
or FullMatrix<std::complex<double>>
.
void HDF5::DataSet::write_none |
This function does not write any data, but it can contribute to a collective write call. In the context of a collective MPI write call, if a process does not write any data at all, the process should call this function because the operation is collective and all the MPI processes have to contribute to the call, even if they don't have data to write. number
can be float
, double
, std::complex<float>
, std::complex<double>
, int
or unsigned int
.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Transfer: Datatype Conversion and Selection section in the HDF5 User's Guide.
An example of how to use this function can be found in step-62.
bool HDF5::DataSet::get_query_io_mode | ( | ) | const |
This function returns the boolean query_io_mode.
In cases where maximum performance has to be achieved, it is important to make sure that all MPI read/write operations are collective. The HDF5 library provides API routines that can be used after the read/write I/O operations to query the I/O mode. If query_io_mode is set to true, then after every read/write operation the deal.II's HDF5 interface calls the routines H5Pget_mpio_actual_io_mode() and H5Pget_mpio_no_collective_cause(). The results are stored in io_mode, local_no_collective_cause and global_no_collective_cause. We suggest to query the I/O mode only in Debug mode because it requires calling additional HDF5 routines.
void HDF5::DataSet::set_query_io_mode | ( | const bool | new_query_io_mode | ) |
std::string HDF5::DataSet::get_io_mode | ( | ) |
This function returns the I/O mode that was used on the last parallel I/O call. See H5Pget_mpio_actual_io_mode.
The return value is a std::string
and can be
Value | Meaning |
---|---|
H5D_MPIO_NO_COLLECTIVE | No collective I/O was performed. Collective I/O was not requested or collective I/O isn't possible on this dataset. |
H5D_MPIO_CHUNK_INDEPENDENT | HDF5 performed chunk collective optimization schemes and each chunk was accessed independently. |
H5D_MPIO_CHUNK_COLLECTIVE | HDF5 performed chunk collective optimization and each chunk was accessed collectively. |
H5D_MPIO_CHUNK_MIXED | HDF5 performed chunk collective optimization and some chunks were accessed independently, some collectively. |
H5D_MPIO_CONTIGUOUS_COLLECTIVE | Collective I/O was performed on a contiguous dataset. |
H5D_mpio_actual_io_mode_t HDF5::DataSet::get_io_mode_as_hdf5_type | ( | ) |
This function returns the I/O mode that was used on the last parallel I/O call. See H5Pget_mpio_actual_io_mode. The return type is H5D_mpio_actual_io_mode_t
which corresponds to the value returned by H5Pget_mpio_actual_io_mode.
The return value can be
Value | Meaning |
---|---|
H5D_MPIO_NO_COLLECTIVE | No collective I/O was performed. Collective I/O was not requested or collective I/O isn't possible on this dataset. |
H5D_MPIO_CHUNK_INDEPENDENT | HDF5 performed chunk collective optimization and each chunk was accessed independently. |
H5D_MPIO_CHUNK_COLLECTIVE | HDF5 performed chunk collective optimization and each chunk was accessed collectively. |
H5D_MPIO_CHUNK_MIXED | HDF5 performed chunk collective optimization and some chunks were accessed independently, some collectively. |
H5D_MPIO_CONTIGUOUS_COLLECTIVE | Collective I/O was performed on a contiguous dataset. |
std::string HDF5::DataSet::get_local_no_collective_cause | ( | ) |
This function returns the local causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause.
The return value is a string and can be
Value | Meaning |
---|---|
H5D_MPIO_COLLECTIVE | Collective I/O was performed successfully. |
H5D_MPIO_SET_INDEPENDENT | Collective I/O was not performed because independent I/O was requested. |
H5D_MPIO_DATATYPE_CONVERSION | Collective I/O was not performed because datatype conversions were required. |
H5D_MPIO_DATA_TRANSFORMS | Collective I/O was not performed because data transforms needed to be applied. |
H5D_MPIO_SET_MPIPOSIX | Collective I/O was not performed because the selected file driver was MPI-POSIX. |
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES | Collective I/O was not performed because one of the dataspaces was neither simple nor scalar. |
H5D_MPIO_POINT_SELECTIONS | Collective I/O was not performed because there were point selections in one of the dataspaces. |
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET | Collective I/O was not performed because the dataset was neither contiguous nor chunked. |
H5D_MPIO_FILTERS | Collective I/O was not performed because filters needed to be applied. |
uint32_t HDF5::DataSet::get_local_no_collective_cause_as_hdf5_type | ( | ) |
This function returns the local causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause. The return type is uint32_t
and corresponds to the value returned by H5Pget_mpio_no_collective_cause.
The return value can be
Value | Meaning |
---|---|
H5D_MPIO_COLLECTIVE | Collective I/O was performed successfully. |
H5D_MPIO_SET_INDEPENDENT | Collective I/O was not performed because independent I/O was requested. |
H5D_MPIO_DATATYPE_CONVERSION | Collective I/O was not performed because datatype conversions were required. |
H5D_MPIO_DATA_TRANSFORMS | Collective I/O was not performed because data transforms needed to be applied. |
H5D_MPIO_SET_MPIPOSIX | Collective I/O was not performed because the selected file driver was MPI-POSIX. |
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES | Collective I/O was not performed because one of the dataspaces was neither simple nor scalar. |
H5D_MPIO_POINT_SELECTIONS | Collective I/O was not performed because there were point selections in one of the dataspaces. |
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET | Collective I/O was not performed because the dataset was neither contiguous nor chunked. |
H5D_MPIO_FILTERS | Collective I/O was not performed because filters needed to be applied. |
std::string HDF5::DataSet::get_global_no_collective_cause | ( | ) |
This function retrieves the global causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause.
The return value is a std::string and can be
Value | Meaning |
---|---|
H5D_MPIO_COLLECTIVE | Collective I/O was performed successfully. |
H5D_MPIO_SET_INDEPENDENT | Collective I/O was not performed because independent I/O was requested. |
H5D_MPIO_DATATYPE_CONVERSION | Collective I/O was not performed because datatype conversions were required. |
H5D_MPIO_DATA_TRANSFORMS | Collective I/O was not performed because data transforms needed to be applied. |
H5D_MPIO_SET_MPIPOSIX | Collective I/O was not performed because the selected file driver was MPI-POSIX. |
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES | Collective I/O was not performed because one of the dataspaces was neither simple nor scalar. |
H5D_MPIO_POINT_SELECTIONS | Collective I/O was not performed because there were point selections in one of the dataspaces. |
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET | Collective I/O was not performed because the dataset was neither contiguous nor chunked. |
H5D_MPIO_FILTERS | Collective I/O was not performed because filters needed to be applied. |
uint32_t HDF5::DataSet::get_global_no_collective_cause_as_hdf5_type | ( | ) |
This function returns the global causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause. The return type is uint32_t
and corresponds to the value returned by H5Pget_mpio_no_collective_cause.
The return value can be
Value | Meaning |
---|---|
H5D_MPIO_COLLECTIVE | Collective I/O was performed successfully. |
H5D_MPIO_SET_INDEPENDENT | Collective I/O was not performed because independent I/O was requested. |
H5D_MPIO_DATATYPE_CONVERSION | Collective I/O was not performed because datatype conversions were required. |
H5D_MPIO_DATA_TRANSFORMS | Collective I/O was not performed because data transforms needed to be applied. |
H5D_MPIO_SET_MPIPOSIX | Collective I/O was not performed because the selected file driver was MPI-POSIX. |
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES | Collective I/O was not performed because one of the dataspaces was neither simple nor scalar. |
H5D_MPIO_POINT_SELECTIONS | Collective I/O was not performed because there were point selections in one of the dataspaces. |
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET | Collective I/O was not performed because the dataset was neither contiguous nor chunked. |
H5D_MPIO_FILTERS | Collective I/O was not performed because filters needed to be applied. |
std::vector< hsize_t > HDF5::DataSet::get_dimensions | ( | ) | const |
unsigned int HDF5::DataSet::get_size | ( | ) | const |
unsigned int HDF5::DataSet::get_rank | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
If query_io_mode is set to true, then after every read/write operation the deal.II's HDF5 interface calls the routines H5Pget_mpio_actual_io_mode() and H5Pget_mpio_no_collective_cause(). The results are stored in io_mode, local_no_collective_cause and global_no_collective_cause.
|
private |
|
private |
Local causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause.
|
private |
Global causes that broke collective I/O on the last parallel I/O call. See H5Pget_mpio_no_collective_cause.