Dynamically change the File Access Property List


I’m wondering if it is possible to dynamically change the File Access Property List after a file has been opened.

My ultimate goal is to enable changes in the H5Pget_alignment/set_property property after a file has been created.

I would like to make sure my data is aligned at specific boundaries (1024 bytes, or 4096 bytes), but it would be preferrable, for legacy reasons, to not change the original open subroutine of the existing code-base.

Thank you!


xref: https://github.com/Unidata/netcdf-c/pull/2178
xref: https://github.com/Unidata/netcdf-c/issues/2177


I don’t see how that would work: by definition the file is opened according the state of this property list, implying cause and effect. On the posted forum you already have a solution with the relevant source code section a copy is made of the FAPL before using it.


Because you don’t have that information when you open/create the file? What’s your use case and what kind of gains do you expect?



Thank you both for replying so quickly.

Generally speaking, aligned reads and writes can be faster for data that works with PCIe connected hardware (GPU, NVMe).

For the usecase I have, extending this property to netcdf, the question came up when we were trying to find a way to expose this API to the netcdf4 library.

The current state of the netcdf4 library does not have additional parameters it can send to the hdf5 library at creation time. Adding them may introduce backward incompatibility. Maintainers and developers of the library asked me to triple check that with HDF5, the alignment had to be set at open time. Thank you for confirming.

Personally, it seems like a strange constraint to not be able to change it dynamically, but I understand sometimes it is easier to assume certain things don’t change.

Thank you again!