FMS  2024.03
Flexible Modeling System
mpp_efp_mod

This module provides interfaces to the non-domain-oriented communication subroutines. More...

Data Types

interface  assignment(=)
 Assignment override interface for mpp_efp_type. More...
 
type  mpp_efp_type
 The Extended Fixed Point (mpp_efp) type provides a public interface for doing sums and taking differences with this type. More...
 
interface  mpp_reproducing_sum
 This interface uses a conversion to an integer representation of real numbers to give order-invariant sums that will reproduce across PE count. More...
 
interface  operator(+)
 Operator override interface for mpp_efp_type. More...
 
interface  operator(-)
 Operator override interface for mpp_efp_type. More...
 

Functions/Subroutines

subroutine carry_overflow (int_sum, prec_error)
 This subroutine handles carrying of the overflow.
 
subroutine increment_ints (int_sum, int2, prec_error)
 This subroutine increments a number with another, both using the integer representation in real_to_ints.
 
subroutine increment_ints_faster (int_sum, r, max_mag_term)
 This subroutine increments a number with another, both using the integer representation in real_to_ints, but without doing any carrying of overflow. The entire operation is embedded in a single call for greater speed.
 
real(r8_kind) function ints_to_real (ints)
 This function reverses the conversion in real_to_ints.
 
subroutine mpp_efp_assign (EFP1, EFP2)
 This subroutine assigns all components of the extended fixed point type variable on the RHS (EFP2) to the components of the variable on the LHS (EFP1).
 
subroutine, public mpp_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.
 
type(mpp_efp_type) function, public mpp_efp_minus (EFP1, EFP2)
 
type(mpp_efp_type) function, public mpp_efp_plus (EFP1, EFP2)
 
real(r8_kind) function, public mpp_efp_real_diff (EFP1, EFP2)
 
real(r8_kind) function, public mpp_efp_to_real (EFP1)
 
logical function, public mpp_query_efp_overflow_error ()
 
type(mpp_efp_type) function, public mpp_real_to_efp (val, overflow)
 
real(r4_kind) function mpp_reproducing_sum_r4_2d (array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err)
 
real(r8_kind) function mpp_reproducing_sum_r8_2d (array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err)
 Calculates a reproducing sum for a 2D, 8-byte real array. More...
 
real(r8_kind) function mpp_reproducing_sum_r8_3d (array, isr, ier, jsr, jer, sums, EFP_sum, err)
 Reproducing sum for 3d arrays of 8-bit reals. More...
 
subroutine, public mpp_reset_efp_overflow_error ()
 
integer(i8_kind) function, dimension(numint) real_to_ints (r, prec_error, overflow)
 This function converts a real number to an equivalent representation using several long integers.
 
subroutine regularize_ints (int_sum)
 This subroutine carries the overflow, and then makes sure that all integers are of the same sign as the overall value.
 

Variables

logical debug = .false.
 Making this true enables debugging output.
 
real(r8_kind), dimension(numint), parameter i_pr = (/ 1.0_8/r_prec**2, 1.0_8/r_prec, 1.0_8, r_prec, r_prec**2, r_prec**3 /)
 
real(r8_kind), parameter i_prec =1.0_8/(2.0_8**NUMBIT)
 The inverse of prec.
 
integer, parameter max_count_prec =2**(63-NUMBIT)-1
 The number of values that can be added together with the current value of prec before there will be roundoff problems.
 
logical nan_error = .false.
 
integer, parameter numint = 6
 The number of long integers to use to represent a real number.
 
logical overflow_error = .false.
 
real(r8_kind), dimension(numint), parameter pr = (/ r_prec**2, r_prec, 1.0_8, 1.0_8/r_prec, 1.0_8/r_prec**2, 1.0_8/r_prec**3 /)
 
integer(i8_kind), parameter prec =2_8**NUMBIT
 The precision of each integer.
 
real(r8_kind), parameter r_prec =2.0_8**NUMBIT
 A real version of prec.
 

Detailed Description

This module provides interfaces to the non-domain-oriented communication subroutines.

Mainly includes interfaces and type definitions for reproducing operations with extended fixed point data.


Data Type Documentation

◆ mpp_efp_mod::assignment(=)

interface mpp_efp_mod::assignment(=)

Assignment override interface for mpp_efp_type.

Definition at line 94 of file mpp_efp.F90.

Private Member Functions

subroutine mpp_efp_assign (EFP1, EFP2)
 This subroutine assigns all components of the extended fixed point type variable on the RHS (EFP2) to the components of the variable on the LHS (EFP1).
 

◆ mpp_efp_mod::mpp_efp_type

type mpp_efp_mod::mpp_efp_type

The Extended Fixed Point (mpp_efp) type provides a public interface for doing sums and taking differences with this type.

Definition at line 80 of file mpp_efp.F90.

Collaboration diagram for mpp_efp_type:
[legend]

Public Attributes

integer(i8_kind), dimension(numint) v
 

◆ mpp_efp_mod::mpp_reproducing_sum

interface mpp_efp_mod::mpp_reproducing_sum

This interface uses a conversion to an integer representation of real numbers to give order-invariant sums that will reproduce across PE count.

This idea comes from R. Hallberg and A. Adcroft.

Definition at line 71 of file mpp_efp.F90.

Private Member Functions

real(r4_kind) function mpp_reproducing_sum_r4_2d (array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err)
 
real(r8_kind) function mpp_reproducing_sum_r8_2d (array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err)
 Calculates a reproducing sum for a 2D, 8-byte real array. More...
 
real(r8_kind) function mpp_reproducing_sum_r8_3d (array, isr, ier, jsr, jer, sums, EFP_sum, err)
 Reproducing sum for 3d arrays of 8-bit reals. More...
 

Member Function/Subroutine Documentation

◆ mpp_reproducing_sum_r4_2d()

real(r4_kind) function mpp_reproducing_sum_r4_2d ( real(r4_kind), dimension(:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
type(mpp_efp_type), intent(out), optional  EFP_sum,
logical, intent(in), optional  reproducing,
logical, intent(in), optional  overflow_check,
integer, intent(out), optional  err 
)
private
Returns
Result

Definition at line 243 of file mpp_efp.F90.

◆ mpp_reproducing_sum_r8_2d()

real(r8_kind) function mpp_reproducing_sum_r8_2d ( real(r8_kind), dimension(:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
type(mpp_efp_type), intent(out), optional  EFP_sum,
logical, intent(in), optional  reproducing,
logical, intent(in), optional  overflow_check,
integer, intent(out), optional  err 
)
private

Calculates a reproducing sum for a 2D, 8-byte real array.

Returns
Result

Definition at line 102 of file mpp_efp.F90.

◆ mpp_reproducing_sum_r8_3d()

real(r8_kind) function mpp_reproducing_sum_r8_3d ( real(r8_kind), dimension(:,:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
real(r8_kind), dimension(:), intent(out), optional  sums,
type(mpp_efp_type), intent(out), optional  EFP_sum,
integer, intent(out), optional  err 
)
private

Reproducing sum for 3d arrays of 8-bit reals.

This function uses a conversion to an integer representation of real numbers to give order-invariant sums that will reproduce across PE count. This idea comes from R. Hallberg and A. Adcroft.

Returns
Result

Definition at line 269 of file mpp_efp.F90.

◆ mpp_efp_mod::operator(+)

interface mpp_efp_mod::operator(+)

Operator override interface for mpp_efp_type.

Definition at line 88 of file mpp_efp.F90.

Private Member Functions

type(mpp_efp_type) function mpp_efp_plus (EFP1, EFP2)
 

◆ mpp_efp_mod::operator(-)

interface mpp_efp_mod::operator(-)

Operator override interface for mpp_efp_type.

Definition at line 91 of file mpp_efp.F90.

Private Member Functions

type(mpp_efp_type) function mpp_efp_minus (EFP1, EFP2)
 

Function/Subroutine Documentation

◆ mpp_reproducing_sum_r4_2d()

real(r4_kind) function mpp_efp_mod::mpp_reproducing_sum_r4_2d ( real(r4_kind), dimension(:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
type(mpp_efp_type), intent(out), optional  EFP_sum,
logical, intent(in), optional  reproducing,
logical, intent(in), optional  overflow_check,
integer, intent(out), optional  err 
)
private
Returns
Result

Definition at line 243 of file mpp_efp.F90.

◆ mpp_reproducing_sum_r8_2d()

real(r8_kind) function mpp_efp_mod::mpp_reproducing_sum_r8_2d ( real(r8_kind), dimension(:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
type(mpp_efp_type), intent(out), optional  EFP_sum,
logical, intent(in), optional  reproducing,
logical, intent(in), optional  overflow_check,
integer, intent(out), optional  err 
)
private

Calculates a reproducing sum for a 2D, 8-byte real array.

Returns
Result

Definition at line 102 of file mpp_efp.F90.

◆ mpp_reproducing_sum_r8_3d()

real(r8_kind) function mpp_efp_mod::mpp_reproducing_sum_r8_3d ( real(r8_kind), dimension(:,:,:), intent(in)  array,
integer, intent(in), optional  isr,
integer, intent(in), optional  ier,
integer, intent(in), optional  jsr,
integer, intent(in), optional  jer,
real(r8_kind), dimension(:), intent(out), optional  sums,
type(mpp_efp_type), intent(out), optional  EFP_sum,
integer, intent(out), optional  err 
)
private

Reproducing sum for 3d arrays of 8-bit reals.

This function uses a conversion to an integer representation of real numbers to give order-invariant sums that will reproduce across PE count. This idea comes from R. Hallberg and A. Adcroft.

Returns
Result

Definition at line 269 of file mpp_efp.F90.