Setting up the access property list

Unlike functions for file operations, which start with H5F, HDF5 functions for creating or manipulating property lists start with H5P. The HDF5 API includes functions that allow you to query and modify most kinds of property lists, including those for file creation, file access, dataset creation, dataset access and transfer, plus a few generic ones. As our focus here is on PHDF5, we only describe the aspects of property lists that affect parallel operations.

Create
hid_t H5Pcreate( hid_t id )

H5Pcreate() creates a new property list as an instance of the class identified by the id parameter. For example, the H5P_FILE_CREATE and H5P_FILE_ACCESS identifiers can be specified to instantiate a new file-creation and new file-access property list, respectively. Similarly, the H5P_DATASET_XFER identifier can be given to instantiate a new data-transfer property list. The function returns a handle to the new list.

Get / Set Parallel File Access
herr_t H5Pset_fapl_mpio( hid_t id, MPI_Comm comm, MPI_Info info )
herr_t H5Pget_fapl_mpio( hid_t id, MPI_Comm *comm, MPI_Info *info )

H5Pset_fapl_mpio() is used to store certain MPI-IO information, namely the MPI communicator and an MPI_info object, that will pertain to opening an HDF5 file (using MPI_File_open(), internally). The purpose of the info object is to supply MPI-IO with hints about timeouts and buffer sizes that will apply to the file after it is opened; if no hints are required, its value can be MPI_INFO_NULL. The corresponding "getter" function, H5Pget_fapl_mpio(), is used to retrieve MPI-related file access information through the comm and info pointers. In particular, the filename that is associated with id can be retrieved (but not set) through info.

Metadata Access
herr_t H5Pset_all_coll_metadata_ops( hid_t id, hbool_t is_collective )

Various HDF5 operations will potentially lead to metadata reads. To manage this metadata I/O, H5Pset_all_coll_metadata_ops() can be used to set the metadata reads to be either collective (is_collective == 1) or independent (0, default).

Data Transfer
herr_t H5Pset_dxpl_mpio( hid_t id, H5FD_mpio_xfer_t xmode )

H5Pset_dxpl_mpio() is used to control the MPI-IO transfer mode during data I/O operations. id identifies the data transfer property list to be modified, and xmode is the transfer mode. xmode can be set to H5FD_MPIO_INDEPENDENT (default) or H5FD_MPIO_COLLECTIVE, for independent and collective I/O access respectively.

There are some additional H5P functions in the API, which can be used to optimize I/O with chunking. Refer to the PHDF5 documentation for more details on these functions:

  • H5Pset_dxpl_mpio_chunk_opt()
  • H5Pset_dxpl_mpio_chunk_opt_ratio()
  • H5Pset_dxpl_mpio_chunk_opt_num()
 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement