Oasis3-MCT
Functions/Subroutines | Variables
mod_oasis_reprosum Module Reference

OASIS reproducible sum method from P. Worley. More...

Functions/Subroutines

subroutine, public oasis_reprosum_setopts (repro_sum_use_ddpdd_in, repro_sum_rel_diff_max_in, repro_sum_recompute_in, repro_sum_master, repro_sum_logunit)
 Set runtime options. More...
 
subroutine, public oasis_reprosum_calc (arr, arr_gsum, nsummands, dsummands, nflds, ddpdd_sum, arr_gbl_max, arr_gbl_max_out, arr_max_levels, arr_max_levels_out, gbl_max_nsummands, gbl_max_nsummands_out, gbl_count, repro_sum_validate, repro_sum_stats, rel_diff, commid)
 Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on a fixed point algorithm. An alternative is to use an "almost always reproducible" floating point algorithm. More...
 
subroutine oasis_reprosum_int (arr, arr_gsum, nsummands, dsummands, nflds, arr_max_shift, arr_gmax_exp, max_levels, max_level, validate, recompute, omp_nthreads, mpi_comm)
 Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on a fixed point algorithm. The accuracy of the fixed point algorithm is controlled by the number of "levels" of integer expansion, the maximum value of which is specified by max_level. More...
 
logical function, public oasis_reprosum_tolexceeded (name, nflds, master, logunit, rel_diff)
 Test whether distributed sum exceeds tolerance and print out a warning message. More...
 
subroutine oasis_reprosum_ddpdd (arr, arr_gsum, nsummands, dsummands, nflds, mpi_comm)
 Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on He and Ding's implementation of the double-double algorithm. More...
 
subroutine, private ddpdd (dda, ddb, len, itype)
 
subroutine, private split_indices (total, num_pieces, ibeg, iend)
 

Variables

logical, public oasis_reprosum_recompute = .false.
 
real(r8), public oasis_reprosum_reldiffmax = -1.0_r8
 
logical repro_sum_use_ddpdd = .false.
 
logical detailed_timing = .false.
 

Detailed Description

OASIS reproducible sum method from P. Worley.

Function/Subroutine Documentation

◆ ddpdd()

subroutine, private mod_oasis_reprosum::ddpdd ( complex(r8), dimension(len), intent(in)  dda,
complex(r8), dimension(len), intent(inout)  ddb,
integer, intent(in)  len,
integer, intent(in)  itype 
)
private

Definition at line 1354 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_calc()

subroutine, public mod_oasis_reprosum::oasis_reprosum_calc ( real(r8), dimension(dsummands,nflds), intent(in)  arr,
real(r8), dimension(nflds), intent(out)  arr_gsum,
integer, intent(in)  nsummands,
integer, intent(in)  dsummands,
integer, intent(in)  nflds,
logical, intent(in), optional  ddpdd_sum,
real(r8), dimension(nflds), intent(in), optional  arr_gbl_max,
real(r8), dimension(nflds), intent(out), optional  arr_gbl_max_out,
integer, dimension(nflds), intent(in), optional  arr_max_levels,
integer, dimension(nflds), intent(out), optional  arr_max_levels_out,
integer, intent(in), optional  gbl_max_nsummands,
integer, intent(out), optional  gbl_max_nsummands_out,
integer, intent(in), optional  gbl_count,
logical, intent(in), optional  repro_sum_validate,
integer, dimension(5), intent(inout), optional  repro_sum_stats,
real(r8), dimension(2,nflds), intent(out), optional  rel_diff,
integer, intent(in), optional  commid 
)

Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on a fixed point algorithm. An alternative is to use an "almost always reproducible" floating point algorithm.

Parameters
[in]nsummandsnumber of local summands
[in]dsummandsdeclared first dimension
[in]nfldsnumber of fields
[in]arrinput array
[out]arr_gsumglobal means
[in]ddpdd_sumuse ddpdd algorithm instead of fixed precision algorithm
[in]arr_gbl_maxupper bound on max(abs(arr))
[out]arr_gbl_max_outcalculated upper bound on max(abs(arr))
[in]arr_max_levelsmaximum number of levels of integer expansion to use
[out]arr_max_levels_outoutput of number of levels of integer expansion to used
[in]gbl_max_nsummandsmaximum of nsummand over all processes
[out]gbl_max_nsummands_outcalculated maximum nsummands over all processes
[in]gbl_countwas total number of summands; now is ignored; use gbl_max_nsummands instead
[in]repro_sum_validateflag enabling/disabling testing that gmax and max_levels are accurate/sufficient. Default is enabled.
[in,out]repro_sum_statsincrement running totals for (1) one-reduction repro_sum (2) two-reduction repro_sum (3) both types in one call (4) nonrepro_sum (5) global max nsummands reduction
[out]rel_diffrelative and absolute differences between fixed and floating point sums
[in]commidMPI communicator

Definition at line 267 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_ddpdd()

subroutine mod_oasis_reprosum::oasis_reprosum_ddpdd ( real(r8), dimension(dsummands,nflds), intent(in)  arr,
real(r8), dimension(nflds), intent(out)  arr_gsum,
integer, intent(in)  nsummands,
integer, intent(in)  dsummands,
integer, intent(in)  nflds,
integer, intent(in)  mpi_comm 
)
private

Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on He and Ding's implementation of the double-double algorithm.

Parameters
[in]nsummandsnumber of local summands
[in]dsummandsdeclared first dimension
[in]nfldsnumber of fields
[in]arrinput array
[in]mpi_commMPI subcommunicator
[out]arr_gsumglobal sums

Definition at line 1281 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_int()

subroutine mod_oasis_reprosum::oasis_reprosum_int ( real(r8), dimension(dsummands,nflds), intent(in)  arr,
real(r8), dimension(nflds), intent(out)  arr_gsum,
integer, intent(in)  nsummands,
integer, intent(in)  dsummands,
integer, intent(in)  nflds,
integer, intent(in)  arr_max_shift,
integer, dimension(nflds), intent(in)  arr_gmax_exp,
integer, dimension(nflds), intent(in)  max_levels,
integer, intent(in)  max_level,
logical, intent(in)  validate,
logical, intent(out)  recompute,
integer, intent(in)  omp_nthreads,
integer, intent(in)  mpi_comm 
)
private

Compute the global sum of each field in "arr" using the indicated communicator with a reproducible yet scalable implementation based on a fixed point algorithm. The accuracy of the fixed point algorithm is controlled by the number of "levels" of integer expansion, the maximum value of which is specified by max_level.

Parameters
[in]nsummandsnumber of local summands
[in]dsummandsdeclared first dimension
[in]nfldsnumber of fields
[in]arr_max_shiftmaximum safe exponent for value < 1 (so that sum does not overflow)
[in]arr_gmax_expexponents of global maxima
[in]max_levelsmaximum number of levels of integer expansion
[in]max_levelmaximum value in max_levels
[in]omp_nthreadsnumber of OpenMP threads
[in]mpi_commMPI subcommunicator
[in]arrinput array
[in]validateflag indicating that accuracy of solution generated from arr_gmax_exp and max_levels should be tested
[out]recomputeflag indicating that either the upper bounds are inaccurate, or max_levels and arr_gmax_exp do not generate accurate enough sums
[out]arr_gsumglobal means

Definition at line 751 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_setopts()

subroutine, public mod_oasis_reprosum::oasis_reprosum_setopts ( logical, intent(in), optional  repro_sum_use_ddpdd_in,
real(r8), intent(in), optional  repro_sum_rel_diff_max_in,
logical, intent(in), optional  repro_sum_recompute_in,
logical, intent(in), optional  repro_sum_master,
integer, intent(in), optional  repro_sum_logunit 
)

Set runtime options.

Parameters
[in]repro_sum_use_ddpdd_inUse DDPDD algorithm instead of fixed precision algorithm
[in]repro_sum_rel_diff_max_inmaximum permissible difference between reproducible and nonreproducible sums
[in]repro_sum_recompute_inrecompute using different algorithm when difference between reproducible and nonreproducible sums is too great
[in]repro_sum_masterflag indicating whether this process should output log messages
[in]repro_sum_logunitunit number for log messages

Definition at line 105 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_tolexceeded()

logical function, public mod_oasis_reprosum::oasis_reprosum_tolexceeded ( character(len=*), intent(in)  name,
integer, intent(in)  nflds,
logical, intent(in)  master,
integer, intent(in), optional  logunit,
real(r8), dimension(2,nflds), intent(in)  rel_diff 
)

Test whether distributed sum exceeds tolerance and print out a warning message.

Parameters
[in]namedistributed sum identifier
[in]nfldsnumber of fields
[in]masterprocess that will write warning messages?
[in]logunitunit warning messages written to
[in]rel_diffrelative and absolute differences between fixed and floating point sums

Definition at line 1195 of file mod_oasis_reprosum.F90.

◆ split_indices()

subroutine, private mod_oasis_reprosum::split_indices ( integer, intent(in)  total,
integer, intent(in)  num_pieces,
integer, dimension(num_pieces), intent(out)  ibeg,
integer, dimension(num_pieces), intent(out)  iend 
)
private

Definition at line 1394 of file mod_oasis_reprosum.F90.

Variable Documentation

◆ detailed_timing

logical mod_oasis_reprosum::detailed_timing = .false.
private

Definition at line 89 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_recompute

logical, public mod_oasis_reprosum::oasis_reprosum_recompute = .false.

Definition at line 73 of file mod_oasis_reprosum.F90.

◆ oasis_reprosum_reldiffmax

real(r8), public mod_oasis_reprosum::oasis_reprosum_reldiffmax = -1.0_r8

Definition at line 75 of file mod_oasis_reprosum.F90.

◆ repro_sum_use_ddpdd

logical mod_oasis_reprosum::repro_sum_use_ddpdd = .false.
private

Definition at line 88 of file mod_oasis_reprosum.F90.