Skip to content

Commit

Permalink
fix: Re-use tabulated excursion set solutions
Browse files Browse the repository at this point in the history
The final check on whether the tabulated and stored-to-file excursion set solution is sufficient was made only if the table was not already initialized. This was inefficient as if a retabulation was required the stored-to-file solution would never be checked, resulting in duplication of effort between parallel threads. This patch causes the check of the stored-to-file solution to be made even if the table has already been initialized.
  • Loading branch information
abensonca committed Aug 11, 2021
1 parent 4dfca95 commit 57d73d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ double precision function farahiProbability(self,variance,time,node)
if (makeTable) then
!$omp critical(farahiProbabilityTabulate)
! Attempt to read the file again now that we are within the critical section. If another thread made the file while we were waiting we may be able to skip building the table.
if (self%useFile.and..not.self%tableInitialized) then
if (self%useFile) then
call self%fileNameInitialize()
call File_Lock(char(self%fileName),fileLock,lockIsShared=.true.)
call self%fileRead()
Expand Down Expand Up @@ -760,7 +760,7 @@ subroutine farahiRateTabulate(self,varianceProgenitor,time,node)
if (makeTable) then
!$omp critical(farahiRateTabulate)
! Attempt to read the file again now that we are within the critical section. If another thread made the file while we were waiting we may be able to skip building the table.
if (self%useFile.and.self%tableInitializedRate) then
if (self%useFile) then
call File_Lock(char(self%fileName),fileLock,lockIsShared=.true.)
call self%fileRead()
call File_Unlock(fileLock)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ double precision function farahiMidpointProbability(self,variance,time,node)
if (makeTable) then
!$omp critical(farahiMidpointProbabilityTabulate)
! Attempt to read the file again now that we are within the critical section. If another thread made the file while we were waiting we may be able to skip building the table.
if (self%useFile.and..not.self%tableInitialized) then
if (self%useFile) then
call File_Lock(char(self%fileName),fileLock,lockIsShared=.true.)
call self%fileRead()
call File_Unlock(fileLock)
Expand Down Expand Up @@ -436,7 +436,7 @@ subroutine farahiMidpointRateTabulate(self,varianceProgenitor,time,node)
if (makeTable) then
!$omp critical(farahiMidpointRateTabulate)
! Attempt to read the file again now that we are within the critical section. If another thread made the file while we were waiting we may be able to skip building the table.
if (self%useFile.and..not.self%tableInitialized) then
if (self%useFile) then
call File_Lock(char(self%fileName),fileLock,lockIsShared=.true.)
call self%fileRead()
call File_Unlock(fileLock)
Expand Down

0 comments on commit 57d73d0

Please sign in to comment.