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. More... | |
subroutine, public | reset_efp_overflow_error () |
Reset the module's error flag to false. More... | |
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. More... | |
Variables | |
integer(kind=8), parameter | prec =2_8**46 |
The precision of each integer. More... | |
real, parameter | r_prec =2.0**46 |
A real version of prec. More... | |
real, parameter | i_prec =1.0/(2.0**46) |
The inverse of prec. More... | |
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. More... | |
integer, parameter | ni =6 |
The number of long integers to use to represent a real number. More... | |
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. More... | |
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. More... | |
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. More... | |
logical | overflow_error = .false. |
This becomes true if an overflow is encountered. More... | |
logical | nan_error = .false. |
This becomes true if a NaN is encountered. More... | |
logical | debug = .false. |
Making this true enables debugging output. More... | |
|
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.
References i_prec, ni, overflow_error, and prec.
Referenced by efp_list_sum_across_pes(), reproducing_sum_2d(), and reproducing_sum_3d().
|
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.
References ni.
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.
References carry_overflow(), efp_to_real(), max_count_prec, mom_error_handler::mom_error(), ni, and overflow_error.
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.
References increment_ints(), and ni.
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.
References increment_ints().
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.
References efp_to_real().
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.
References ints_to_real(), and regularize_ints().
Referenced by efp_list_sum_across_pes(), and efp_real_diff().
|
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.
References ni, overflow_error, and prec.
Referenced by efp_minus(), efp_plus(), reproducing_sum_2d(), and reproducing_sum_3d().
|
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.
References i_pr, max_efp_float, nan_error, ni, overflow_error, and pr.
Referenced by reproducing_sum_2d(), and reproducing_sum_3d().
|
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.
Referenced by efp_to_real(), reproducing_sum_2d(), and reproducing_sum_3d().
subroutine, public mom_coms::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.
Definition at line 748 of file MOM_coms.F90.
logical function, public mom_coms::query_efp_overflow_error | ( | ) |
Returns the status of the module's error flag.
Definition at line 603 of file MOM_coms.F90.
References overflow_error.
Referenced by mom_spatial_means::global_i_mean(), and mom_spatial_means::global_j_mean().
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.
References mom_error_handler::mom_error(), and real_to_ints().
|
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.
References i_pr, mom_error_handler::mom_error(), nan_error, ni, pr, and prec.
Referenced by real_to_efp(), reproducing_sum_2d(), and reproducing_sum_3d().
|
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.
References i_prec, ni, and prec.
Referenced by efp_to_real(), reproducing_sum_2d(), and reproducing_sum_3d().
|
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.
References carry_overflow(), debug, i_pr, increment_ints(), increment_ints_faster(), ints_to_real(), max_count_prec, mom_error_handler::mom_error(), mom_error_handler::mom_mesg(), nan_error, ni, overflow_error, pr, real_to_ints(), and regularize_ints().
|
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.
References carry_overflow(), debug, increment_ints(), increment_ints_faster(), ints_to_real(), max_count_prec, mom_error_handler::mom_error(), mom_error_handler::mom_mesg(), nan_error, ni, overflow_error, pr, real_to_ints(), and regularize_ints().
subroutine, public mom_coms::reset_efp_overflow_error | ( | ) |
Reset the module's error flag to false.
Definition at line 609 of file MOM_coms.F90.
References overflow_error.
Referenced by mom_spatial_means::global_i_mean(), and mom_spatial_means::global_j_mean().
|
private |
Making this true enables debugging output.
Definition at line 51 of file MOM_coms.F90.
Referenced by reproducing_sum_2d(), and reproducing_sum_3d().
|
private |
An array of the inverse of the real precision of each of the integers.
Definition at line 41 of file MOM_coms.F90.
Referenced by increment_ints_faster(), real_to_ints(), and reproducing_sum_2d().
|
private |
The inverse of prec.
Definition at line 30 of file MOM_coms.F90.
Referenced by carry_overflow(), and regularize_ints().
|
private |
The number of values that can be added together with the current value of prec before there will be roundoff problems.
Definition at line 31 of file MOM_coms.F90.
Referenced by efp_list_sum_across_pes(), reproducing_sum_2d(), and reproducing_sum_3d().
|
private |
The largest float with an EFP representation. NOTE: Only the first bin can exceed precision, but is bounded by the largest signed integer.
Definition at line 44 of file MOM_coms.F90.
Referenced by increment_ints_faster().
|
private |
This becomes true if a NaN is encountered.
Definition at line 50 of file MOM_coms.F90.
Referenced by increment_ints_faster(), real_to_ints(), reproducing_sum_2d(), and reproducing_sum_3d().
|
private |
The number of long integers to use to represent a real number.
Definition at line 36 of file MOM_coms.F90.
Referenced by carry_overflow(), efp_assign(), efp_list_sum_across_pes(), efp_minus(), increment_ints(), increment_ints_faster(), ints_to_real(), real_to_ints(), regularize_ints(), reproducing_sum_2d(), and reproducing_sum_3d().
|
private |
This becomes true if an overflow is encountered.
Definition at line 49 of file MOM_coms.F90.
Referenced by carry_overflow(), efp_list_sum_across_pes(), increment_ints(), increment_ints_faster(), query_efp_overflow_error(), reproducing_sum_2d(), reproducing_sum_3d(), and reset_efp_overflow_error().
|
private |
An array of the real precision of each of the integers.
Definition at line 38 of file MOM_coms.F90.
Referenced by increment_ints_faster(), ints_to_real(), real_to_ints(), reproducing_sum_2d(), and reproducing_sum_3d().
|
private |
The precision of each integer.
Definition at line 28 of file MOM_coms.F90.
Referenced by carry_overflow(), increment_ints(), real_to_ints(), and regularize_ints().
|
private |
A real version of prec.
Definition at line 29 of file MOM_coms.F90.