Skip to content

Commit

Permalink
Bugfix: cpu clock sync error
Browse files Browse the repository at this point in the history
This patch fixes an error in the `sync` flag of the cpu clocks.

Previously, we would set the sync bit of a flag based on the presence of
sync, rather than testing if the value was true.  This would cause
potential hangs in any clock that set `sync`, including `.false.`.

This patch correctly replaces the single `ibset` call with an if-block
to either `ibset` or `ibclr`.
  • Loading branch information
marshallward committed Dec 4, 2021
1 parent 585cc70 commit 36d4f7f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions config_src/infra/FMS1/MOM_cpu_clock_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ integer function cpu_clock_id(name, sync, grain)
integer :: clock_flags

clock_flags = clock_flag_default
if (present(sync)) &
clock_flags = ibset(clock_flags, 0)
if (present(sync)) then
if (sync) then
clock_flags = ibset(clock_flags, 0)
else
clock_flags = ibclr(clock_flags, 0)
endif
endif

cpu_clock_id = mpp_clock_id(name, flags=clock_flags, grain=grain)
end function cpu_clock_id
Expand Down
9 changes: 7 additions & 2 deletions config_src/infra/FMS2/MOM_cpu_clock_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ integer function cpu_clock_id(name, sync, grain)
integer :: clock_flags

clock_flags = clock_flag_default
if (present(sync)) &
clock_flags = ibset(clock_flags, 0)
if (present(sync)) then
if (sync) then
clock_flags = ibset(clock_flags, 0)
else
clock_flags = ibclr(clock_flags, 0)
endif
endif

cpu_clock_id = mpp_clock_id(name, flags=clock_flags, grain=grain)
end function cpu_clock_id
Expand Down

0 comments on commit 36d4f7f

Please sign in to comment.