MOM6
mom_checksums::chksum Interface Reference

Detailed Description

This is an older interface for 1-, 2-, or 3-D checksums.

Definition at line 63 of file MOM_checksums.F90.

Private functions

subroutine chksum1d (array, mesg, start_i, end_i, compare_PEs)
 chksum1d does a checksum of a 1-dimensional array. More...
 
subroutine chksum2d (array, mesg)
 chksum2d does a checksum of all data in a 2-d array. More...
 
subroutine chksum3d (array, mesg)
 chksum3d does a checksum of all data in a 2-d array. More...
 

Functions and subroutines

◆ chksum1d()

subroutine mom_checksums::chksum::chksum1d ( real, dimension(:), intent(in)  array,
character(len=*), intent(in)  mesg,
integer, intent(in), optional  start_i,
integer, intent(in), optional  end_i,
logical, intent(in), optional  compare_PEs 
)
private

chksum1d does a checksum of a 1-dimensional array.

Parameters
[in]arrayThe array to be summed (index starts at 1).
[in]mesgAn identifying message.
[in]start_iThe starting index for the sum (default 1)
[in]end_iThe ending index for the sum (default all)
[in]compare_pesIf true, compare across PEs instead of summing and list the root_PE value (default true)

Definition at line 1551 of file MOM_checksums.F90.

1551  real, dimension(:), intent(in) :: array !< The array to be summed (index starts at 1).
1552  character(len=*), intent(in) :: mesg !< An identifying message.
1553  integer, optional, intent(in) :: start_i !< The starting index for the sum (default 1)
1554  integer, optional, intent(in) :: end_i !< The ending index for the sum (default all)
1555  logical, optional, intent(in) :: compare_PEs !< If true, compare across PEs instead of summing
1556  !! and list the root_PE value (default true)
1557 
1558  integer :: is, ie, i, bc, sum1, sum_bc
1559  real :: sum
1560  real, allocatable :: sum_here(:)
1561  logical :: compare
1562  integer :: pe_num ! pe number of the data
1563  integer :: nPEs ! Total number of processsors
1564 
1565  is = lbound(array,1) ; ie = ubound(array,1)
1566  if (present(start_i)) is = start_i
1567  if (present(end_i)) ie = end_i
1568  compare = .true. ; if (present(compare_pes)) compare = compare_pes
1569 
1570  sum = 0.0 ; sum_bc = 0
1571  do i=is,ie
1572  sum = sum + array(i)
1573  bc = bitcount(abs(array(i)))
1574  sum_bc = sum_bc + bc
1575  enddo
1576 
1577  pe_num = pe_here() + 1 - root_pe() ; npes = num_pes()
1578  allocate(sum_here(npes)) ; sum_here(:) = 0.0 ; sum_here(pe_num) = sum
1579  call sum_across_pes(sum_here,npes)
1580 
1581  sum1 = sum_bc
1582  call sum_across_pes(sum1)
1583 
1584  if (.not.compare) then
1585  sum = 0.0
1586  do i=1,npes ; sum = sum + sum_here(i) ; enddo
1587  sum_bc = sum1
1588  elseif (is_root_pe()) then
1589  if (sum1 /= npes*sum_bc) &
1590  write(0, '(A40," bitcounts do not match across PEs: ",I12,1X,I12)') &
1591  mesg, sum1, npes*sum_bc
1592  do i=1,npes ; if (sum /= sum_here(i)) then
1593  write(0, '(A40," PE ",i4," sum mismatches root_PE: ",3(ES22.13,1X))') &
1594  mesg, i, sum_here(i), sum, sum_here(i)-sum
1595  endif ; enddo
1596  endif
1597  deallocate(sum_here)
1598 
1599  if (is_root_pe()) &
1600  write(0,'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum_bc
1601 

◆ chksum2d()

subroutine mom_checksums::chksum::chksum2d ( real, dimension(:,:)  array,
character(len=*)  mesg 
)
private

chksum2d does a checksum of all data in a 2-d array.

Parameters
arrayThe array to be checksummed
mesgAn identifying message

Definition at line 1609 of file MOM_checksums.F90.

1609 
1610  real, dimension(:,:) :: array !< The array to be checksummed
1611  character(len=*) :: mesg !< An identifying message
1612 
1613  integer :: xs,xe,ys,ye,i,j,sum1,bc
1614  real :: sum
1615 
1616  xs = lbound(array,1) ; xe = ubound(array,1)
1617  ys = lbound(array,2) ; ye = ubound(array,2)
1618 
1619  sum = 0.0 ; sum1 = 0
1620  do i=xs,xe ; do j=ys,ye
1621  bc = bitcount(abs(array(i,j)))
1622  sum1 = sum1 + bc
1623  enddo ; enddo
1624  call sum_across_pes(sum1)
1625 
1626  sum = reproducing_sum(array(:,:))
1627 
1628  if (is_root_pe()) &
1629  write(0,'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum1
1630 ! write(0,'(A40,1X,Z16.16,1X,Z16.16,1X,ES25.16,1X,I12)') &
1631 ! mesg, sum, sum1, sum, sum1
1632 

◆ chksum3d()

subroutine mom_checksums::chksum::chksum3d ( real, dimension(:,:,:)  array,
character(len=*)  mesg 
)
private

chksum3d does a checksum of all data in a 2-d array.

Parameters
arrayThe array to be checksummed
mesgAn identifying message

Definition at line 1637 of file MOM_checksums.F90.

1637 
1638  real, dimension(:,:,:) :: array !< The array to be checksummed
1639  character(len=*) :: mesg !< An identifying message
1640 
1641  integer :: xs,xe,ys,ye,zs,ze,i,j,k, bc,sum1
1642  real :: sum
1643 
1644  xs = lbound(array,1) ; xe = ubound(array,1)
1645  ys = lbound(array,2) ; ye = ubound(array,2)
1646  zs = lbound(array,3) ; ze = ubound(array,3)
1647 
1648  sum = 0.0 ; sum1 = 0
1649  do i=xs,xe ; do j=ys,ye ; do k=zs,ze
1650  bc = bitcount(abs(array(i,j,k)))
1651  sum1 = sum1 + bc
1652  enddo ; enddo ; enddo
1653 
1654  call sum_across_pes(sum1)
1655  sum = reproducing_sum(array(:,:,:))
1656 
1657  if (is_root_pe()) &
1658  write(0,'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum1
1659 ! write(0,'(A40,1X,Z16.16,1X,Z16.16,1X,ES25.16,1X,I12)') &
1660 ! mesg, sum, sum1, sum, sum1
1661 

The documentation for this interface was generated from the following file: