Skip to content

Commit

Permalink
(*)Corrected bug in field_chksum
Browse files Browse the repository at this point in the history
  When the field_chksum interfaces was added, it returned integers, but the set
of mpp_chksum routines from FMS it wraps return 64-bit integers, not 32-bit
integers. For small domain sizes (like in the TC tests) this is not a problem,
but for much larger problems (like tides_025), this results in a truncation of
the results and a change in the checksums, which in turn causes the model to
fail if it tries to read a depth-list file.  This commit restores the model
behavior prior to MOM6 PR#1299 (commit# 797b195..).  All answers are bitwise
identical in cases that worked with the previous version of the code, but some
depth-list files that were created with MOM6 code after that commit may have
incorrect verification checksums that lead to spurious fatal errors and should
be deleted.
  • Loading branch information
Hallberg-NOAA committed Jan 30, 2021
1 parent 14727e5 commit 199a453
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/framework/MOM_coms_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ end subroutine broadcast_real2D
!> Compute a checksum for a field distributed over a PE list. If no PE list is
!! provided, then the current active PE list is used.
function field_chksum_real_0d(field, pelist, mask_val) result(chksum)
real, intent(in) :: field !< Input scalar
real, intent(in) :: field !< Input scalar
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer :: chksum !< checksum of array
real, optional, intent(in) :: mask_val !< FMS mask value
integer(kind=int64) :: chksum !< checksum of array

chksum = mpp_chksum(field, pelist, mask_val)
end function field_chksum_real_0d
Expand All @@ -248,42 +248,42 @@ end function field_chksum_real_0d
!! provided, then the current active PE list is used.
function field_chksum_real_1d(field, pelist, mask_val) result(chksum)
real, dimension(:), intent(in) :: field !< Input array
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer :: chksum !< checksum of array
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer(kind=int64) :: chksum !< checksum of array

chksum = mpp_chksum(field, pelist, mask_val)
end function field_chksum_real_1d

!> Compute a checksum for a field distributed over a PE list. If no PE list is
!! provided, then the current active PE list is used.
function field_chksum_real_2d(field, pelist, mask_val) result(chksum)
real, dimension(:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer :: chksum !< checksum of array
real, dimension(:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer(kind=int64) :: chksum !< checksum of array

chksum = mpp_chksum(field, pelist, mask_val)
end function field_chksum_real_2d

!> Compute a checksum for a field distributed over a PE list. If no PE list is
!! provided, then the current active PE list is used.
function field_chksum_real_3d(field, pelist, mask_val) result(chksum)
real, dimension(:,:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer :: chksum !< checksum of array
real, dimension(:,:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer(kind=int64) :: chksum !< checksum of array

chksum = mpp_chksum(field, pelist, mask_val)
end function field_chksum_real_3d

!> Compute a checksum for a field distributed over a PE list. If no PE list is
!! provided, then the current active PE list is used.
function field_chksum_real_4d(field, pelist, mask_val) result(chksum)
real, dimension(:,:,:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer :: chksum !< checksum of array
real, dimension(:,:,:,:), intent(in) :: field !< Unrotated input field
integer, optional, intent(in) :: pelist(:) !< PE list of ranks to checksum
real, optional, intent(in) :: mask_val !< FMS mask value
integer(kind=int64) :: chksum !< checksum of array

chksum = mpp_chksum(field, pelist, mask_val)
end function field_chksum_real_4d
Expand Down

0 comments on commit 199a453

Please sign in to comment.