Skip to content

Commit

Permalink
fix: Set HDF5 fle access to readOnly when posible
Browse files Browse the repository at this point in the history
Avoids problems with new (v1.14.5) HDF5 library locking.
  • Loading branch information
abensonca committed Dec 20, 2024
1 parent 2581c3f commit ee6eaeb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions source/intergalactic_medium.filtering_mass.Gnedin2000.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion source/mass_distributions.Gaussian_ellipsoid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion source/mass_distributions.cylindrical.exponential_disk.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ee6eaeb

Please sign in to comment.