Prevent file locking for HDF5 files#1688
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1688 +/- ##
==========================================
+ Coverage 41.66% 41.66% +<.01%
==========================================
Files 176 176
Lines 30215 30216 +1
Branches 6256 6256
==========================================
+ Hits 12588 12589 +1
Misses 16703 16703
Partials 924 924
Continue to review full report at Codecov.
|
|
I previously had similar issues with the HDF5 files for the machine learning thermo model, except that it couldn't open them due to no locks being available. At the time, I addressed it by downgrading HDF5 from 1.10 to 1.8 which solved the issue. I'm wondering what changed about file locking between 1.10 and 1.8, whether it's actually related to NFS, and if there are any downsides to disabling file locks. |
|
Potentially relevant: The last link mentions that HDF5 1.10.0 (the next release after 1.8.16) includes As for if there are any downsides of not using file locking, I believe this is not an issue because our code for this is not in a parallelized section where more than one thread could be trying to write to the file. I could be wrong though. |
|
As discussed offline, this change and adding h5py explicitly as a dependency have been incorporated into #1686. Therefore, this PR is now closed. |
Motivation or Problem
There appears to be an issue with saving HDF5 files, which we now use to save the filter tensors (thanks to @mjohnson541 for discovering this). On remote servers, it is possible to get the following error on current master:
I found this issue on the h5py Github, which suggests that this is a problem with the code trying to lock the file when writing, which causes problems for NFS mounted file systems (i.e. most network mounted drives on servers). The only suggested fix is to export and environment variable with
export HDF5_USE_FILE_LOCKING=FALSE, though this fix does not appear to work for everyone.Description of Changes
Use
os.environto set this environment variable wheneverrmgpy.rmg.mainis imported, which contains the code that saves the filter tensors as HDF5 files. This way, we do not have to tell people to add this on to their job submission scripts.Testing
@mjohnson541 has confirmed that this fix removed this issue for him