Example 1: Parallel write
To view and/or download the first example code, click on this file name: parallel_write.c
In this example, each MPI process (up to 4 processes) writes a different dataset into an HDF5 file. If the number of processes is less than four, some datasets will be empty (zeros). The instructions are written to work properly on TACC Frontera, but with appropriate modifications, they ought to work on other systems as well.
To begin, load the PHDF5 module and view its "help" information, which offers guidance on compiling:
Compile the example code, parallel_write.c
:
Run the executable according to the following template (note that on TACC systems, ibrun
normally replaces mpirun
):
For example, to have two processes write two (nonzero) 4x4 datasets into the output file, run the following command:
Check the output using h5dump
:
Sample Output from h5dump:
Then try varying the number of processes:
Based on how the source code is written, do you understand the differences in the output from h5dump
?