Sum a value or 1-d array of values across processors, returning the sums in place.
Definition at line 64 of file MOM_coms.F90.
|
| subroutine | efp_list_sum_across_pes (EFPs, nval, errors) |
| | This subroutine does a sum across PEs of a list of EFP variables, returning the sums in place, with all overflows carried. More...
|
| |
| subroutine | efp_val_sum_across_pes (EFP, error) |
| | This subroutine does a sum across PEs of an EFP variable, returning the sums in place, with all overflows carried. More...
|
| |
Sum a value or 1-d array of values across processors, returning the sums in place.
Definition at line 64 of file MOM_coms.F90.
◆ efp_list_sum_across_pes()
| subroutine mom_coms::efp_sum_across_pes::efp_list_sum_across_pes |
( |
type(efp_type), dimension(:), intent(inout) |
EFPs, |
|
|
integer, intent(in) |
nval, |
|
|
logical, dimension(:), intent(out), optional |
errors |
|
) |
| |
|
private |
This subroutine does a sum across PEs of a list of EFP variables, returning the sums in place, with all overflows carried.
- Parameters
-
| [in,out] | efps | The list of extended fixed point numbers |
| [in] | nval | The number of values being summed. |
| [out] | errors | A list of error flags for each sum |
Definition at line 789 of file MOM_coms.F90.
789 type(EFP_type),
dimension(:), &
790 intent(inout) :: EFPs
792 integer,
intent(in) :: nval
793 logical,
dimension(:), &
794 optional,
intent(out) :: errors
799 integer(kind=8),
dimension(ni,nval) :: ints
800 integer(kind=8) :: prec_error
801 logical :: error_found
802 character(len=256) :: mesg
805 if (num_pes() > max_count_prec)
call mom_error(fatal, &
806 "reproducing_sum: Too many processors are being used for the value of "//&
807 "prec. Reduce prec to (2^63-1)/num_PEs.")
809 prec_error = (2_8**62 + (2_8**62 - 1)) / num_pes()
811 overflow_error = .false. ; error_found = .false.
813 do i=1,nval ;
do n=1,ni ; ints(n,i) = efps(i)%v(n) ;
enddo ;
enddo
815 call sum_across_pes(ints(:,:), ni*nval)
817 if (
present(errors)) errors(:) = .false.
819 overflow_error = .false.
820 call carry_overflow(ints(:,i), prec_error)
821 do n=1,ni ; efps(i)%v(n) = ints(n,i) ;
enddo
822 if (
present(errors)) errors(i) = overflow_error
823 if (overflow_error)
then
824 write (mesg,
'("EFP_list_sum_across_PEs error at ",i6," val was ",ES12.6, ", prec_error = ",ES12.6)') &
825 i, efp_to_real(efps(i)), real(prec_error)
826 call mom_error(warning, mesg)
828 error_found = error_found .or. overflow_error
830 if (error_found .and. .not.(
present(errors)))
then
831 call mom_error(fatal,
"Overflow in EFP_list_sum_across_PEs.")
◆ efp_val_sum_across_pes()
| subroutine mom_coms::efp_sum_across_pes::efp_val_sum_across_pes |
( |
type(efp_type), intent(inout) |
EFP, |
|
|
logical, intent(out), optional |
error |
|
) |
| |
|
private |
This subroutine does a sum across PEs of an EFP variable, returning the sums in place, with all overflows carried.
- Parameters
-
| [in,out] | efp | The extended fixed point numbers being summed across PEs. |
| [out] | error | An error flag for this sum |
Definition at line 839 of file MOM_coms.F90.
839 type(EFP_type),
intent(inout) :: EFP
841 logical,
optional,
intent(out) :: error
846 integer(kind=8),
dimension(ni) :: ints
847 integer(kind=8) :: prec_error
848 logical :: error_found
849 character(len=256) :: mesg
852 if (num_pes() > max_count_prec)
call mom_error(fatal, &
853 "reproducing_sum: Too many processors are being used for the value of "//&
854 "prec. Reduce prec to (2^63-1)/num_PEs.")
856 prec_error = (2_8**62 + (2_8**62 - 1)) / num_pes()
858 overflow_error = .false. ; error_found = .false.
860 do n=1,ni ; ints(n) = efp%v(n) ;
enddo
862 call sum_across_pes(ints(:), ni)
864 if (
present(error)) error = .false.
866 overflow_error = .false.
867 call carry_overflow(ints(:), prec_error)
868 do n=1,ni ; efp%v(n) = ints(n) ;
enddo
869 if (
present(error)) error = overflow_error
870 if (overflow_error)
then
871 write (mesg,
'("EFP_val_sum_across_PEs error val was ",ES12.6, ", prec_error = ",ES12.6)') &
872 efp_to_real(efp), real(prec_error)
873 call mom_error(warning, mesg)
875 error_found = error_found .or. overflow_error
877 if (error_found .and. .not.(
present(error)))
then
878 call mom_error(fatal,
"Overflow in EFP_val_sum_across_PEs.")
The documentation for this interface was generated from the following file: