Page tree


How to write and NOT to write compound datasets using F90 in Parallel HDF5

Here are two examples of writing compound datatypes using F90 in Parallel HDF5:

Both examples write a one dimensional array of size 16 using 4 processes. Elements of the array are structures:

      char*2
      integer
      double precision
      float

The compound_p.f90 program tries to write the dataset by each process writing one field:

  process 0 writes character field (16 elements)
  process 1 writes integer field (16 elements)
  process 2 writes double field (16 elements)
  process 3 writes real field (16 elements)

However, this is NOT currently supported by the HDF5 library (it fails by writing the wrong value). It will take a lot of work to implement this, but it could be done.

The compound_pall.f90 program writes a dataset by each process writing all 4 fields and its own portion of the data array:

  process 0 writes character, integer, double and real fields for elements 1 through 4
  process 1 writes character, integer, double and real fields for elements 5 through 8
  process 2 writes character, integer, double and real fields for elements 9 through 12
  process 3 writes character, integer, double and real fields for elements 13 through 16

This works for both independent and collective writes, and unfortunately is the only way now for Fortran to write a compound dataset in parallel.