Skip to content

Commit

Permalink
comm: rename 'global_sums' to 'global_allreduce_sum'
Browse files Browse the repository at this point in the history
Make the purpose of the 'global_sums' interface, i.e. reducing a
distributed variable to a variable of the same shape (MPI_ALLREDUCE)
clearer by renaming it to 'global_allreduce_sum'.

This makes it clearer that in contrast to the 'global_sum' interface,
the resulting variable is of the same shape as the distributed variable.
  • Loading branch information
phil-blain committed Aug 24, 2020
1 parent e609c48 commit a29fdda
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module ice_dyn_vp
vvel_init, basal_stress_coeff, basalstress, Ktens, ice_HaloUpdate_vel
use ice_fileunits, only: nu_diag
use ice_flux, only: fm
use ice_global_reductions, only: global_sum, global_sums
use ice_global_reductions, only: global_sum, global_allreduce_sum
use ice_grid, only: dxt, dyt, dxhy, dyhx, cxp, cyp, cxm, cym, uarear
use ice_exit, only: abort_ice
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
Expand Down Expand Up @@ -3568,7 +3568,7 @@ subroutine orthogonalize(ortho_type , initer , &
dotprod_local(it) = sum(local_dot)
end do

hessenberg(1:initer, initer) = global_sums(dotprod_local(1:initer), distrb_info)
hessenberg(1:initer, initer) = global_allreduce_sum(dotprod_local(1:initer), distrb_info)

! Second loop of Gram-Schmidt (orthonormalize)
do it = 1, initer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ module ice_global_reductions
global_sum_scalar_int
end interface

interface global_sums
module procedure global_sums_dbl!, &
! module procedure global_sums_real, & ! not yet implemented
! module procedure global_sums_int ! not yet implemented
interface global_allreduce_sum
module procedure global_allreduce_sum_vector_dbl!, &
! module procedure global_allreduce_sum_vector_real, & ! not yet implemented
! module procedure global_allreduce_sum_vector_int ! not yet implemented
end interface

interface global_sum_prod
Expand Down Expand Up @@ -709,13 +709,13 @@ end function global_sum_scalar_int

!***********************************************************************

function global_sums_dbl(vector, dist) &
function global_allreduce_sum_vector_dbl(vector, dist) &
result(globalSums)

! Computes the global sums of sets of scalars (elements of 'vector')
! distributed across a parallel machine.
!
! This is actually the specific interface for the generic global_sums
! This is actually the specific interface for the generic global_allreduce_sum
! function corresponding to double precision vectors. The generic
! interface is identical but will handle real and integer vectors.

Expand Down Expand Up @@ -744,7 +744,7 @@ function global_sums_dbl(vector, dist) &
real (dbl_kind), dimension(:,:), allocatable :: &
work ! temporary local array

character(len=*), parameter :: subname = '(global_sums_dbl)'
character(len=*), parameter :: subname = '(global_allreduce_sum_vector_dbl)'

!-----------------------------------------------------------------------
!
Expand All @@ -768,7 +768,7 @@ function global_sums_dbl(vector, dist) &

!-----------------------------------------------------------------------

end function global_sums_dbl
end function global_allreduce_sum_vector_dbl

!***********************************************************************

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module ice_global_reductions
private

public :: global_sum, &
global_sums, &
global_allreduce_sum, &
global_sum_prod, &
global_maxval, &
global_minval
Expand All @@ -57,10 +57,10 @@ module ice_global_reductions
global_sum_scalar_int
end interface

interface global_sums
module procedure global_sums_dbl!, &
! module procedure global_sums_real, & ! not yet implemented
! module procedure global_sums_int ! not yet implemented
interface global_allreduce_sum
module procedure global_allreduce_sum_vector_dbl!, &
! module procedure global_allreduce_sum_vector_real, & ! not yet implemented
! module procedure global_allreduce_sum_vector_int ! not yet implemented
end interface

interface global_sum_prod
Expand Down Expand Up @@ -710,13 +710,13 @@ end function global_sum_scalar_int

!***********************************************************************

function global_sums_dbl(vector, dist) &
function global_allreduce_sum_vector_dbl(vector, dist) &
result(globalSums)

! Computes the global sums of sets of scalars (elements of 'vector')
! distributed across a parallel machine.
!
! This is actually the specific interface for the generic global_sums
! This is actually the specific interface for the generic global_allreduce_sum
! function corresponding to double precision vectors. The generic
! interface is identical but will handle real and integer vectors.

Expand Down Expand Up @@ -745,7 +745,7 @@ function global_sums_dbl(vector, dist) &
real (dbl_kind), dimension(:,:), allocatable :: &
work ! temporary local array

character(len=*), parameter :: subname = '(global_sums_dbl)'
character(len=*), parameter :: subname = '(global_allreduce_sum_vector_dbl)'

!-----------------------------------------------------------------------
!
Expand All @@ -769,7 +769,7 @@ function global_sums_dbl(vector, dist) &

!-----------------------------------------------------------------------

end function global_sums_dbl
end function global_allreduce_sum_vector_dbl

!***********************************************************************

Expand Down

0 comments on commit a29fdda

Please sign in to comment.