As mentioned before, HDF5 file operations are valid in PHDF5 as well, assuming that an appropriate parallel file access property list is given. In what follows, each code block illustrates a call to a different HDF5 file operation. The subsequent text describes how that call is used in the context of PHDF5. Note that functions in the HDF5 API related to file operations typically begin with H5F.

Create
hid_t H5Fcreate( const char *fname, unsigned flags,
                hid_t fcpl_id, hid_t fapl_id)

H5Fcreate() creates a new file. The fname parameter specifies the name of the new file. The flags parameter can be set to H5F_ACC_TRUNC to overwrite an existing file, or to H5F_ACC_EXCL to return an error code if the file already exists. By default, new files are created in read-write mode. The file creation and file access property lists, fcpl_id and fapl_id, are used to allow parallel access. Please refer to the next section on access property lists for more details. The function returns a file identifier for the created HDF5 file.

Open
hid_t H5Fopen( const char *fname, unsigned flags, hid_t fapl_id )

H5Fopen() opens a file with the name fname. The flags parameter can be set to H5F_ACC_RDWR (read-write mode) or H5F_ACC_RDONLY (read-only mode). The file access property list, fapl_id, is again used to enable parallel access. Please refer to the section on access property lists for more details. The function returns a file identifier for the opened HDF5 file.

Close
herr_t H5Fclose( hid_t fid )

H5Fclose() flushes all data to storage and closes access to the file referred by fid. If the file was opened using an MPI-IO collective call, then the close call will be a collective as well.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement