To demonstrate how HDF5 backend is working in Damaris, a few examples have been developed. These examples can be found under the examples/storage folder. They will be installed with Damaris if HDF5 support is enabled and ENABLE_EXAMPLES=ON is set on the CMake command line.
cmake <other options> -DENABLE_HDF5=ON -DHDF5_ROOT=/path/to/hdf5/installation/folder -DENABLE_EXAMPLES=ONBelow, you can find a brief description of each example code.
vector: In this example, a one-dimensional array is stored to the HDF5 format using some processes. The example has been developed in such a way to support domains, i.e. each process may write multiple times during an iteration.
2dmesh: Like the vector example, but in a 2D grid. This example is the most complete sample among HDF5 samples. The use of ghost zones and also domains has been demonstrated in this example as well.
2dmesh_select: Another 2D grid example that uses the selection capability of the Damaris implementation (v1.8.0+) to specify a reordered dataset by using a variable XML attribute named “select-mem” to specify indices of where to place data.
2dmesh_select_subset: A more complex 2D grid example that again uses the selection capability of the Damaris HDF5 output, however, specifies a dataset of different size to the input data variable. It requires 3 variables specified in the XML attributes, named “select-mem”, “select-subset” and “select-file” to specify indices of where to select data from memory, the shape of the dataset being created and the order in which to place data in the resized dataset, respectively.
3dmesh: This example demonstrates how a 3D mesh could be saved in the HDF5 format.
blocks-hdf5: This example shows how the VisIt blocks sample could be instrumented to save the simulation results to HDF5 format.
mandelbulb-hdf5: Like the previous VisIt example, mandelbulb-hdf5 shows how the mandelbulb example of VisIt could store its dataset in HDF5 format.
Running Samples
To run an example, first make sure that all parameters and values of XML file of the example (number of dedicated cores, size, domains, etc.) are set properly.
# Ensure the path to the Damaris library is in LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
# Run an example ( using: <dedicated cores="2" nodes="0">):
mpirun -np 6 --oversubscribe ./2dmesh "2dmesh.xml"
# Output
h5dump 2dmesh_It0_Pr0.h5
HDF5 "2dmesh_It0_Pr0.h5" {
GROUP "/" {
GROUP "space" {
DATASET "P0" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 4, 16 ) / ( 4, 16 ) }
DATA {
(0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
(1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
(2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
(3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
}
DATASET "P1" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 4, 16 ) / ( 4, 16 ) }
DATA {
(0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
(1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
(2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
(3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}
}
}
}
}
As a rule of thumb, if you change the number of dedicated cores or the number of client processes (size) in the XML file, make sure that the related value in bash file (the value after -np switch of mpirun) is updated as well. The number of processes that is passed to mpirun should be the sum of dedicated cores and the number of clients (size).
To go to the documentation for the HDF5 backend please follow this link