Bin 1 is NOT bounded by efp_carry (only bins 2..6 are – see the
module docstring), so the double-precision transport needs its
own guard: after summing nranks local values, the partial sum
in bin 1 must stay <= 2**53 / nranks for the MPI_SUM-on-doubles
combine to remain exact (the analogue of MOM6’s
prec_error = huge(1_int64) / num_PEs, but for the int64-as-
double transport rather than int64 transport). .false. ⇒ the
caller must error stop, never silently proceed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(efp_t), | intent(in) | :: | a | |||
| integer, | intent(in) | :: | nranks |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int64), | private | :: | bound |
pure function efp_bin1_within_transport_bound(a, nranks) result(ok) !! Bin 1 is NOT bounded by `efp_carry` (only bins 2..6 are -- see the !! module docstring), so the double-precision transport needs its !! own guard: after summing `nranks` local values, the partial sum !! in bin 1 must stay `<= 2**53 / nranks` for the MPI_SUM-on-doubles !! combine to remain exact (the analogue of MOM6's !! `prec_error = huge(1_int64) / num_PEs`, but for the int64-as- !! double transport rather than int64 transport). `.false.` ⇒ the !! caller must `error stop`, never silently proceed. type(efp_t), intent(in) :: a integer, intent(in) :: nranks logical :: ok integer(int64) :: bound if (nranks <= 0) then ok = .true. return end if bound = (2_int64**53)/int(nranks, int64) ok = abs(a%v(1)) <= bound end function efp_bin1_within_transport_bound