MOM6
|
Interfaces to non-domain-oriented communication subroutines, including the MOM6 reproducing sums facility.
Data Types | |
interface | assignment(=) |
Copy the value of one extended-fixed-point number into another. More... | |
type | efp_type |
The Extended Fixed Point (EFP) type provides a public interface for doing sums and taking differences with this type. More... | |
interface | operator(+) |
Add two extended-fixed-point numbers. More... | |
interface | operator(-) |
Subtract one extended-fixed-point number from another. More... | |
interface | reproducing_sum |
Find an accurate and order-invariant sum of distributed 2d or 3d fields. More... | |
Functions/Subroutines | |
real function | reproducing_sum_2d (array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err) |
This subroutine uses a conversion to an integer representation of real numbers to give an order-invariant sum of distributed 2-D arrays that reproduces across domain decomposition. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007. More... | |
real function | reproducing_sum_3d (array, isr, ier, jsr, jer, sums, EFP_sum, err) |
This subroutine uses a conversion to an integer representation of real numbers to give an order-invariant sum of distributed 3-D arrays that reproduces across domain decomposition. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007. More... | |
integer(kind=8) function, dimension(ni) | real_to_ints (r, prec_error, overflow) |
Convert a real number into the array of integers constitute its extended-fixed-point representation. More... | |
real function | ints_to_real (ints) |
Convert the array of integers that constitute an extended-fixed-point representation into a real number. More... | |
subroutine | increment_ints (int_sum, int2, prec_error) |
Increment an array of integers that constitutes an extended-fixed-point representation with a another EFP number. More... | |
subroutine | increment_ints_faster (int_sum, r, max_mag_term) |
Increment an EFP number with a real number without doing any carrying of of overflows and using only minimal error checking. More... | |
subroutine | carry_overflow (int_sum, prec_error) |
This subroutine handles carrying of the overflow. More... | |
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. More... | |
logical function, public | query_efp_overflow_error () |
Returns the status of the module's error flag. | |
subroutine, public | reset_efp_overflow_error () |
Reset the module's error flag to false. | |
type(efp_type) function, public | efp_plus (EFP1, EFP2) |
Add two extended-fixed-point numbers. More... | |
type(efp_type) function, public | efp_minus (EFP1, EFP2) |
Subract one extended-fixed-point number from another. More... | |
subroutine | efp_assign (EFP1, EFP2) |
Copy one extended-fixed-point number into another. More... | |
real function, public | efp_to_real (EFP1) |
Return the real number that an extended-fixed-point number corresponds with. More... | |
real function, public | efp_real_diff (EFP1, EFP2) |
Take the difference between two extended-fixed-point numbers (EFP1 - EFP2) and return the result as a real number. More... | |
type(efp_type) function, public | real_to_efp (val, overflow) |
Return the extended-fixed-point number that a real number corresponds with. More... | |
subroutine, public | 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, public | mom_infra_end |
This subroutine carries out all of the calls required to close out the infrastructure cleanly. This should only be called in ocean-only runs, as the coupler takes care of this in coupled runs. | |
Variables | |
integer(kind=8), parameter | prec =2_8**46 |
The precision of each integer. | |
real, parameter | r_prec =2.0**46 |
A real version of prec. | |
real, parameter | i_prec =1.0/(2.0**46) |
The inverse of prec. | |
integer, parameter | max_count_prec =2**(63-46)-1 |
The number of values that can be added together with the current value of prec before there will be roundoff problems. | |
integer, parameter | ni =6 |
The number of long integers to use to represent a real number. | |
real, dimension(ni), parameter | pr = (/ r_prec**2, r_prec, 1.0, 1.0/r_prec, 1.0/r_prec**2, 1.0/r_prec**3 /) |
An array of the real precision of each of the integers. | |
real, dimension(ni), parameter | i_pr = (/ 1.0/r_prec**2, 1.0/r_prec, 1.0, r_prec, r_prec**2, r_prec**3 /) |
An array of the inverse of the real precision of each of the integers. | |
real, parameter | max_efp_float = pr(1) * (2.**63 - 1.) |
The largest float with an EFP representation. NOTE: Only the first bin can exceed precision, but is bounded by the largest signed integer. | |
logical | overflow_error = .false. |
This becomes true if an overflow is encountered. | |
logical | nan_error = .false. |
This becomes true if a NaN is encountered. | |
logical | debug = .false. |
Making this true enables debugging output. | |
|
private |
This subroutine handles carrying of the overflow.
[in,out] | int_sum | The array of EFP integers being modified by carries, but without changing value. |
[in] | prec_error | The PE-count dependent precision of the integers that is safe from overflows during global sums. This will be larger than the compile-time precision parameter, and is used to detect overflows. |
Definition at line 538 of file MOM_coms.F90.
|
private |
Copy one extended-fixed-point number into another.
[out] | efp1 | The recipient extended fixed point number |
[in] | efp2 | The source extended fixed point number |
Definition at line 638 of file MOM_coms.F90.
subroutine, public mom_coms::efp_list_sum_across_pes | ( | type(efp_type), dimension(:), intent(inout) | EFPs, |
integer, intent(in) | nval, | ||
logical, dimension(:), intent(out), optional | errors | ||
) |
This subroutine does a sum across PEs of a list of EFP variables, returning the sums in place, with all overflows carried.
[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 698 of file MOM_coms.F90.
type(efp_type) function, public mom_coms::efp_minus | ( | type(efp_type), intent(in) | EFP1, |
type(efp_type), intent(in) | EFP2 | ||
) |
Subract one extended-fixed-point number from another.
[in] | efp1 | The first extended fixed point number |
[in] | efp2 | The extended fixed point number being subtracted from the first extended fixed point number |
Definition at line 625 of file MOM_coms.F90.
type(efp_type) function, public mom_coms::efp_plus | ( | type(efp_type), intent(in) | EFP1, |
type(efp_type), intent(in) | EFP2 | ||
) |
Add two extended-fixed-point numbers.
[in] | efp1 | The first extended fixed point number |
[in] | efp2 | The second extended fixed point number |
Definition at line 614 of file MOM_coms.F90.
real function, public mom_coms::efp_real_diff | ( | type(efp_type), intent(in) | EFP1, |
type(efp_type), intent(in) | EFP2 | ||
) |
Take the difference between two extended-fixed-point numbers (EFP1 - EFP2) and return the result as a real number.
[in] | efp1 | The first extended fixed point number |
[in] | efp2 | The extended fixed point number being subtracted from the first extended fixed point number |
Definition at line 660 of file MOM_coms.F90.
real function, public mom_coms::efp_to_real | ( | type(efp_type), intent(inout) | EFP1 | ) |
Return the real number that an extended-fixed-point number corresponds with.
[in,out] | efp1 | The extended fixed point number being converted |
Definition at line 650 of file MOM_coms.F90.
|
private |
Increment an array of integers that constitutes an extended-fixed-point representation with a another EFP number.
[in,out] | int_sum | The array of EFP integers being incremented |
[in] | int2 | The array of EFP integers being added |
[in] | prec_error | The PE-count dependent precision of the integers that is safe from overflows during global sums. This will be larger than the compile-time precision parameter, and is used to detect overflows. |
Definition at line 472 of file MOM_coms.F90.
|
private |
Increment an EFP number with a real number without doing any carrying of of overflows and using only minimal error checking.
[in,out] | int_sum | The array of EFP integers being incremented |
[in] | r | The real number being added. |
[in,out] | max_mag_term | A running maximum magnitude of the r's. |
Definition at line 506 of file MOM_coms.F90.
|
private |
Convert the array of integers that constitute an extended-fixed-point representation into a real number.
[in] | ints | The array of EFP integers |
Definition at line 459 of file MOM_coms.F90.
type(efp_type) function, public mom_coms::real_to_efp | ( | real, intent(in) | val, |
logical, intent(inout), optional | overflow | ||
) |
Return the extended-fixed-point number that a real number corresponds with.
[in] | val | The real number being converted |
[in,out] | overflow | Returns true if the conversion is being done on a value that is too large to be represented |
Definition at line 674 of file MOM_coms.F90.
|
private |
Convert a real number into the array of integers constitute its extended-fixed-point representation.
[in] | r | The real number being converted |
[in] | prec_error | The PE-count dependent precision of the integers that is safe from overflows during global sums. This will be larger than the compile-time precision parameter, and is used to detect overflows. |
[in,out] | overflow | Returns true if the conversion is being done on a value that is too large to be represented |
Definition at line 417 of file MOM_coms.F90.
|
private |
This subroutine carries the overflow, and then makes sure that all integers are of the same sign as the overall value.
[in,out] | int_sum | The array of integers being modified to take a |
Definition at line 562 of file MOM_coms.F90.
|
private |
This subroutine uses a conversion to an integer representation of real numbers to give an order-invariant sum of distributed 2-D arrays that reproduces across domain decomposition. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007.
[in] | array | The array to be summed |
[in] | isr | The starting i-index of the sum, noting that the array indices starts at 1 |
[in] | ier | The ending i-index of the sum, noting that the array indices starts at 1 |
[in] | jsr | The starting j-index of the sum, noting that the array indices starts at 1 |
[in] | jer | The ending j-index of the sum, noting that the array indices starts at 1 |
[out] | efp_sum | The result in extended fixed point format |
[in] | reproducing | If present and false, do the sum using the naive non-reproducing approach |
[in] | overflow_check | If present and false, disable checking for overflows in incremental results. This can speed up calculations if the number of values being summed is small enough |
[out] | err | If present, return an error code instead of triggering any fatal errors directly from this routine. |
Definition at line 83 of file MOM_coms.F90.
|
private |
This subroutine uses a conversion to an integer representation of real numbers to give an order-invariant sum of distributed 3-D arrays that reproduces across domain decomposition. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007.
[in] | array | The array to be summed |
[in] | isr | The starting i-index of the sum, noting that the array indices starts at 1 |
[in] | ier | The ending i-index of the sum, noting that the array indices starts at 1 |
[in] | jsr | The starting j-index of the sum, noting that the array indices starts at 1 |
[in] | jer | The ending j-index of the sum, noting that the array indices starts at 1 |
[out] | sums | The sums by vertical layer |
[out] | efp_sum | The result in extended fixed point format |
[out] | err | If present, return an error code instead of triggering any fatal errors directly from this routine. |
Definition at line 245 of file MOM_coms.F90.