Is HDF5 multi-threaded?
No, HDF5 is not multi-threaded.
By default, you cannot build Parallel HDF5 with the thread-safe feature. You will receive a configure error if you try this combination.Checks were A check was added to the configure to disallow this, as it is not tested and may fail.
However, the --enable-unsupported configure option enable enables you to get around this check at your own risk. (You can actually view the configure file to see where the checks are check is made.) If the build completes properly and the tests pass, then the installation should be okay.
concurrent access concurrent access
Does HDF5 support concurrent access to one or more HDF5 file(s) from multiple threads in a single process?
There must also be some mechanism for the writing process to signal the reading process that the file is ready for reading and some way for the reading process to signal the writing process that the file may be written to again.
Keep in mind that thread-safety has nothing to do with particular file operations, but is about library operations. Regardless of read-only or not, all library operations are not thread-safe unless the thread-safe library is used.
Some things can still go wrong even if building HDF5 with thread-safety turned on:
- A thread-safe library was not actually built. Check the libhdf5.settings file to see if thread-safety was included.
- The application is actually linking to a non-thread-safe version of the library installed elsewhere on the system.
- The application is using the High Level, Fortran, Java, or C++ wrappers, none of which have been verified to be thread-safe.
- There is a non-HDF5 bug in the application.
Verify the following:
- A serial program works when linked to your library
- H5is_library_threadsafe() returns TRUE. See: https://support.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-IsLibraryThreadsafe
If that works and you are not using a wrapper, then the library should work.
If the issue cannot be resolved, please send us a minimum working example in C which shows the failure. Multi-threaded programming can be difficult and there may be an unseen issue in the code.