MOM_coms module reference
Interfaces to non-domain-oriented communication subroutines, including the MOM6 reproducing sums facility
Data Types
The Extended Fixed Point (EFP) type provides a public interface for doing sums and taking differences with this type. |
Generic Interfaces
Making this true enables debugging output. |
|
Find an accurate and order-invariant sum of a distributed 2d field, returning the result in the form of an extended fixed point value that can be converted back with EFP_to_real. |
|
Sum a value or 1-d array of values across processors, returning the sums in place |
|
Add two extended-fixed-point numbers |
|
Subtract one extended-fixed-point number from another |
|
Copy the value of one extended-fixed-point number into another |
Functions/Subroutines
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, with the result returned as an extended fixed point type that can be converted back to a real number using EFP_to_real. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007. |
|
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. |
|
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. |
|
Convert a real number into the array of integers constitute its extended-fixed-point representation |
|
Convert the array of integers that constitute an extended-fixed-point representation into a real number |
|
Increment an array of integers that constitutes an extended-fixed-point representation with a another EFP number |
|
Sum the elements of an array in EFP form and append the result to an existing EFP array. |
|
Decompose one real into its 6 signed EFP bin contributions. NaNs and overflows are reported by flags, rather than the module-level error logicals, so that the routine is free of side effects. |
|
This subroutine handles carrying of the overflow. |
|
This subroutine carries the overflow, and then makes sure that all integers are of the same sign as the overall value. |
|
Returns the status of the module's error flag |
|
Reset the module's error flag to false |
|
Add two extended-fixed-point numbers |
|
Subract one extended-fixed-point number from another |
|
Copy one extended-fixed-point number into another |
|
Return the real number that an extended-fixed-point number corresponds with |
|
Take the difference between two extended-fixed-point numbers (EFP1 - EFP2) and return the result as a real number |
|
Return the extended-fixed-point number that a real number corresponds with |
|
This subroutine does a sum across PEs of a list of EFP variables, returning the sums in place, with all overflows carried. |
|
This subroutine does a sum across PEs of an EFP variable, returning the sums in place, with all overflows carried. |
Type Documentation
- type, public :: EFP_type
The Extended Fixed Point (EFP) type provides a public interface for doing sums and taking differences with this type.
The use of this type is documented in Hallberg, R. & A. Adcroft, 2014: An Order-invariant Real-to-Integer Conversion Sum. Parallel Computing, 40(5-6), doi:10.1016/j.parco.2014.04.007.
- Parameters
v
The value in this type
Generic Interface Documentation
- interface reproducing_sum
Making this true enables debugging output.
Find an accurate and order-invariant sum of a distributed 2d or 3d field, in some cases after undoing the scaling of the input array and restoring that scaling in the returned value
Callers call graph
Text view
mom_checksum_packages::mom_state_stats → mom_coms::interface::reproducing_sum
mom_checksums::chksum2d → mom_coms::interface::reproducing_sum
mom_checksums::chksum3d → mom_coms::interface::reproducing_sum
mom_checksums::chksum_b_2d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_b_3d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_h_2d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_h_3d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_u_2d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_u_3d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_v_2d::substats → mom_coms::interface::reproducing_sum
mom_checksums::chksum_v_3d::substats → mom_coms::interface::reproducing_sum
mom_debugging::totalstuff → mom_coms::interface::reproducing_sum
mom_debugging::totaltands → mom_coms::interface::reproducing_sum
mom_diagnostics::calculate_diagnostic_fields → mom_coms::interface::reproducing_sum
mom_horizontal_regridding::homogenize_field → mom_coms::interface::reproducing_sum
mom_ice_shelf::integrate_over_ice_sheet_area → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::ice_shelf_solve_inner_cg → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::ice_shelf_solve_inner_cr → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::ice_shelf_solve_inner_minres → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::ice_shelf_solve_outer → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::volume_above_floatation → mom_coms::interface::reproducing_sum
mom_ice_shelf_dynamics::write_ice_shelf_energy → mom_coms::interface::reproducing_sum
mom_offline_main::offline_advection_layer → mom_coms::interface::reproducing_sum
mom_offline_main::remaining_transport_sum → mom_coms::interface::reproducing_sum
mom_shared_initialization::compute_global_grid_integrals → mom_coms::interface::reproducing_sum
mom_spatial_means::global_area_integral → mom_coms::interface::reproducing_sum
mom_spatial_means::global_area_mean → mom_coms::interface::reproducing_sum
mom_spatial_means::global_area_mean_u → mom_coms::interface::reproducing_sum
mom_spatial_means::global_area_mean_v → mom_coms::interface::reproducing_sum
mom_spatial_means::global_layer_mean → mom_coms::interface::reproducing_sum
mom_spatial_means::global_mass_integral → mom_coms::interface::reproducing_sum
mom_spatial_means::global_volume_mean → mom_coms::interface::reproducing_sum
mom_spherical_harmonics::spherical_harmonics_forward → mom_coms::interface::reproducing_sum
mom_sum_output::write_energy → mom_coms::interface::reproducing_sum
mom_tracer_registry::tracer_array_chkinv → mom_coms::interface::reproducing_sum
mom_tracer_registry::tracer_reg_chkinv → mom_coms::interface::reproducing_sum
tidal_bay_initialization::tidal_bay_set_obc_data → mom_coms::interface::reproducing_sum
- interface reproducing_sum_EFP
Find an accurate and order-invariant sum of a distributed 2d field, returning the result in the form of an extended fixed point value that can be converted back with EFP_to_real.
Callers call graph
Text view
mom_diag_remap::horizontally_average_field → mom_coms::interface::reproducing_sum_efp
mom_spatial_means::adjust_area_mean_to_zero → mom_coms::interface::reproducing_sum_efp
mom_spatial_means::global_mass_int_efp → mom_coms::interface::reproducing_sum_efp
mom_sum_output::accumulate_net_input → mom_coms::interface::reproducing_sum_efp
mom_sum_output::write_energy → mom_coms::interface::reproducing_sum_efp
- interface EFP_sum_across_PEs
Sum a value or 1-d array of values across processors, returning the sums in place
- Implementations
Callers call graph
Text view
mom_diag_remap::horizontally_average_field → mom_coms::interface::efp_sum_across_pes
mom_energetic_pbl::energetic_pbl_end → mom_coms::interface::efp_sum_across_pes
mom_spatial_means::adjust_area_mean_to_zero → mom_coms::interface::efp_sum_across_pes
mom_spatial_means::global_i_mean → mom_coms::interface::efp_sum_across_pes
mom_spatial_means::global_j_mean → mom_coms::interface::efp_sum_across_pes
mom_spatial_means::global_layer_mean → mom_coms::interface::efp_sum_across_pes
mom_sum_output::write_energy → mom_coms::interface::efp_sum_across_pes
mom_tracer_flow_control::call_tracer_stocks → mom_coms::interface::efp_sum_across_pes
- interface operator(+)
Add two extended-fixed-point numbers
- Implementations
- interface operator(-)
Subtract one extended-fixed-point number from another
- Implementations
- interface assignment(=)
Copy the value of one extended-fixed-point number into another
Functions/Subroutine Documentation
- function reproducing_EFP_sum_2d(array, isr, ier, jsr, jer, overflow_check, err, only_on_PE, unscale) result(EFP_sum)
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, with the result returned as an extended fixed point type that can be converted back to a real number using EFP_to_real. This technique is described in Hallberg & Adcroft, 2014, Parallel Computing, doi:10.1016/j.parco.2014.04.007.
- Parameters
array [in]
The array to be summed in arbitrary units [a], or in arbitrary scaled units [A ~> a] if unscale is present
isr [in]
The starting i-index of the sum, noting that the array indices starts at 1
ier [in]
The ending i-index of the sum, noting that the array indices starts at 1
jsr [in]
The starting j-index of the sum, noting that the array indices starts at 1
jer [in]
The ending j-index of the sum, noting that the array indices starts at 1
overflow_check [in]
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
err [out]
If present, return an error code instead of triggering any fatal errors directly from this routine.
only_on_PE [in]
If present and true, do not do the sum across processors, only reporting the local sum
unscale [in]
A factor that is used to undo scaling of array before it is summed, often to compensate for the scaling in [a A-1 ~> 1]
EFP_sum
The result in extended fixed point format
- function reproducing_sum_2d(array, isr, ier, jsr, jer, EFP_sum, reproducing, overflow_check, err, only_on_PE, unscale) result(sum)
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.
- Parameters
array [in]
The array to be summed in arbitrary units [a], or in arbitrary scaled units [A ~> a] if unscale is present
isr [in]
The starting i-index of the sum, noting that the array indices starts at 1
ier [in]
The ending i-index of the sum, noting that the array indices starts at 1
jsr [in]
The starting j-index of the sum, noting that the array indices starts at 1
jer [in]
The ending j-index of the sum, noting that the array indices starts at 1
EFP_sum [out]
The result in extended fixed point format
reproducing [in]
If present and false, do the sum using the naive non-reproducing approach
overflow_check [in]
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
err [out]
If present, return an error code instead of triggering any fatal errors directly from this routine.
only_on_PE [in]
If present and true, do not do the sum across processors, only reporting the local sum
unscale [in]
A factor that is used to undo scaling of array before it is summed, often to compensate for the scaling in [a A-1 ~> 1]
sum
The sum of the values in array in the same arbitrary units as array [a] or [A ~> a]
Callees call graph
- function reproducing_sum_3d(array, isr, ier, jsr, jer, sums, EFP_sum, EFP_lay_sums, err, only_on_PE, unscale) result(sum)
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.
- Parameters
array [in]
The array to be summed in arbitrary units [a], or in arbitrary scaled units [A ~> a] if unscale is present
isr [in]
The starting i-index of the sum, noting that the array indices starts at 1
ier [in]
The ending i-index of the sum, noting that the array indices starts at 1
jsr [in]
The starting j-index of the sum, noting that the array indices starts at 1
jer [in]
The ending j-index of the sum, noting that the array indices starts at 1
sums [out]
The sums by vertical layer in the same arbitrary units as array [a] or [A ~> a]
EFP_sum [out]
The result in extended fixed point format
EFP_lay_sums [out]
The sums by vertical layer in EFP format
err [out]
If present, return an error code instead of triggering any fatal errors directly from this routine.
only_on_PE [in]
If present and true, do not do the sum across processors, only reporting the local sum
unscale [in]
A factor that is used to undo scaling of array before it is summed, often to compensate for the scaling in [a A-1 ~> 1]
sum
The sum of the values in array in the same arbitrary units as array [a] or [A ~> a]
Callees call graph
- function real_to_ints(r, prec_error, overflow) result(ints)
Convert a real number into the array of integers constitute its extended-fixed-point representation
- Parameters
r [in]
The real number being converted in arbitrary units [a]
prec_error [in]
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.
overflow [inout]
Returns true if the conversion is being done on a value that is too large to be represented
Callers call graph
- function ints_to_real(ints) result(r)
Convert the array of integers that constitute an extended-fixed-point representation into a real number
- Parameters
ints [in]
The array of EFP integers
Callers call graph
- 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
- Parameters
int_sum [inout]
The array of EFP integers being incremented
int2 [in]
The array of EFP integers being added
prec_error [in]
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.
Callers call graph
- subroutine increment_block_ints(array, is, ie, js, je, descale, ints_sum, max_mag_term, prec_error)
Sum the elements of an array in EFP form and append the result to an existing EFP array.
- Parameters
array [in]
The field being added, in arbitrary units [A ~> a]
is [in]
Start i-index of the summed domain
ie [in]
End i-index of the summed domain
js [in]
Start j-index of the summed domain
je [in]
End j-index of the summed domain
descale [in]
Factor to descale array to physical value [a A-1 ~> 1]
ints_sum [inout]
The array of EFP integers being incremented
max_mag_term [inout]
A running maximum magnitude of the r's, in arbitrary units [a]
prec_error [in]
The maximum resolvable value for a given number of PEs
Callees call graph
Callers call graph
- pure subroutine efp_decompose(r, e, rmag, is_nan, is_ovf)
Decompose one real into its 6 signed EFP bin contributions. NaNs and overflows are reported by flags, rather than the module-level error logicals, so that the routine is free of side effects.
- Parameters
r [in]
The real number being decomposed [a]
e [out]
Signed contribution to EFP bins
rmag [out]
Equals abs(r), or 0 if r is NaN/Inf [a]
is_nan [out]
Equals 1 if r is a NaN or Inf, else 0
is_ovf [out]
Equals 1 if abs(r) has no EFP representation, else 0
- subroutine carry_overflow(int_sum, prec_error)
This subroutine handles carrying of the overflow.
- Parameters
int_sum [inout]
The array of EFP integers being modified by carries, but without changing value.
prec_error [in]
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.
- 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.
- Parameters
int_sum [inout]
The array of integers being modified to take a regular form with all integers of the same sign, but without changing value.
Callers call graph
- function query_EFP_overflow_error()
Returns the status of the module's error flag
Callers call graph
- subroutine reset_EFP_overflow_error()
Reset the module's error flag to false
Callers call graph
- function EFP_plus(EFP1, EFP2)
Add two extended-fixed-point numbers
- Parameters
EFP_plus
The result in extended fixed point format
EFP1 [in]
The first extended fixed point number
EFP2 [in]
The second extended fixed point number
- function EFP_minus(EFP1, EFP2)
Subract one extended-fixed-point number from another
- Parameters
EFP_minus
The result in extended fixed point format
EFP1 [in]
The first extended fixed point number
EFP2 [in]
The extended fixed point number being subtracted from the first extended fixed point number
- subroutine EFP_assign(EFP1, EFP2)
Copy one extended-fixed-point number into another
- Parameters
EFP1 [out]
The recipient extended fixed point number
EFP2 [in]
The source extended fixed point number
- function EFP_to_real(EFP1)
Return the real number that an extended-fixed-point number corresponds with
- Parameters
EFP1 [inout]
The extended fixed point number being converted
EFP_to_real
The real version of the number in arbitrary units [a]
Callees call graph
Callers call graph
Text view
mom_diag_remap::horizontally_average_field → mom_coms::efp_to_real
mom_energetic_pbl::energetic_pbl_end → mom_coms::efp_to_real
mom_spatial_means::adjust_area_mean_to_zero → mom_coms::efp_to_real
mom_spatial_means::global_layer_mean → mom_coms::efp_to_real
mom_tracer_flow_control::call_tracer_stocks → mom_coms::efp_to_real
- function EFP_real_diff(EFP1, EFP2)
Take the difference between two extended-fixed-point numbers (EFP1 - EFP2) and return the result as a real number
- Parameters
EFP1 [in]
The first extended fixed point number
EFP2 [in]
The extended fixed point number being subtracted from the first extended fixed point number
EFP_real_diff
The real result in arbitrary units [a]
- function real_to_EFP(val, overflow)
Return the extended-fixed-point number that a real number corresponds with
- Parameters
val [in]
The real number being converted in arbitrary units [a]
overflow [inout]
Returns true if the conversion is being done on a value that is too large to be represented
Callees call graph
Callers call graph
- 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.
- Parameters
EFPs [inout]
The list of extended fixed point numbers being summed across PEs.
nval [in]
The number of values being summed.
errors [out]
A list of error flags for each sum
- 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.
- Parameters
EFP [inout]
The extended fixed point numbers being summed across PEs.
error [out]
An error flag for this sum