From ee6eaeb33ea9aeb8333480773466f859480bbc7a Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Fri, 20 Dec 2024 10:11:58 -0800 Subject: [PATCH] fix: Set HDF5 fle access to `readOnly` when posible Avoids problems with new (v1.14.5) HDF5 library locking. --- .../intergalactic_medium.filtering_mass.Gnedin2000.F90 | 10 +++++----- source/mass_distributions.Gaussian_ellipsoid.F90 | 2 +- ...mass_distributions.cylindrical.exponential_disk.F90 | 2 +- ...e_formation.virial_density_contrast.percolation.F90 | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/intergalactic_medium.filtering_mass.Gnedin2000.F90 b/source/intergalactic_medium.filtering_mass.Gnedin2000.F90 index 7fd1e2b28e..209bcc14d5 100644 --- a/source/intergalactic_medium.filtering_mass.Gnedin2000.F90 +++ b/source/intergalactic_medium.filtering_mass.Gnedin2000.F90 @@ -606,11 +606,11 @@ subroutine gnedin2000FileRead(self) if (.not.File_Exists(char(self%fileName))) return if (self%initialized) call self%table%destroy() !$ call hdf5Access%set() - call dataFile%openFile (char(self%fileName),overWrite=.false. ) - call dataFile%readDataset ('massFiltering' , massFiltering) - call dataFile%readAttribute('timeMinimum' , self%timeMinimum ) - call dataFile%readAttribute('timeMaximum' , self%timeMaximum ) - call dataFile%close ( ) + call dataFile%openFile (char(self%fileName),overWrite=.false. ,readOnly=.true.) + call dataFile%readDataset ('massFiltering' , massFiltering ) + call dataFile%readAttribute('timeMinimum' , self%timeMinimum ) + call dataFile%readAttribute('timeMaximum' , self%timeMaximum ) + call dataFile%close ( ) !$ call hdf5Access%unset() call self%table%create (self%timeMinimum,self%timeMaximum,size(massFiltering)) call self%table%populate( massFiltering ) diff --git a/source/mass_distributions.Gaussian_ellipsoid.F90 b/source/mass_distributions.Gaussian_ellipsoid.F90 index 876104215f..fa4e8ddae6 100644 --- a/source/mass_distributions.Gaussian_ellipsoid.F90 +++ b/source/mass_distributions.Gaussian_ellipsoid.F90 @@ -530,7 +530,7 @@ subroutine gaussianEllipsoidAccelerationTabulate(self) call File_Lock(char(fileName),fileLock,lockIsShared=.true.) if (File_Exists(fileName)) then !$ call hdf5Access%set() - call file%openFile (char(fileName ) ) + call file%openFile (char(fileName ),readOnly=.true. ) call file%readDataset( 'x' ,self%accelerationX ) call file%readDataset( 'scaleLength' ,self%accelerationScaleLength) call file%readDataset( 'acceleration' ,self%accelerationVector ) diff --git a/source/mass_distributions.cylindrical.exponential_disk.F90 b/source/mass_distributions.cylindrical.exponential_disk.F90 index 7faa662bf1..90bc1ed640 100644 --- a/source/mass_distributions.cylindrical.exponential_disk.F90 +++ b/source/mass_distributions.cylindrical.exponential_disk.F90 @@ -1095,7 +1095,7 @@ subroutine exponentialDiskAccelerationTabulate(self) call File_Lock(char(fileName),fileLock,lockIsShared=.true.) if (File_Exists(fileName)) then !$ call hdf5Access%set() - call file%openFile (char(fileName ) ) + call file%openFile (char(fileName ),readOnly=.true. ) call file%readDataset( 'radii' ,self%accelerationRadii ) call file%readDataset( 'heights' ,self%accelerationHeights ) call file%readDataset( 'accelerationRadial' ,self%accelerationRadial ) diff --git a/source/structure_formation.virial_density_contrast.percolation.F90 b/source/structure_formation.virial_density_contrast.percolation.F90 index f06352d0a1..45b4ffb283 100644 --- a/source/structure_formation.virial_density_contrast.percolation.F90 +++ b/source/structure_formation.virial_density_contrast.percolation.F90 @@ -591,7 +591,7 @@ subroutine percolationRestoreTable(self) ! Always obtain the file lock before the hdf5Access lock to avoid deadlocks between OpenMP threads. call File_Lock(char(self%fileName),fileLock,lockIsShared=.true.) !$ call hdf5Access%set() - call file%openFile (char(self%fileName )) + call file%openFile (char(self%fileName ) ,readOnly=.true. ) call file%readAttribute( 'timeMinimum' ,self%densityContrastTableTimeMinimum) call file%readAttribute( 'timeMaximum' ,self%densityContrastTableTimeMaximum) call file%readAttribute( 'massMinimum' ,self%densityContrastTableMassMinimum)