Skip to content

Commit

Permalink
Merge pull request #760 from galacticusorg/fixHDF5ReadOnly
Browse files Browse the repository at this point in the history
Set HDF5 fle access to `readOnly` when posible
  • Loading branch information
abensonca authored Dec 21, 2024
2 parents 57caeb0 + ee6eaeb commit 2d169d0
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 2d169d0

Please sign in to comment.