From 09b2e2fc58f08645a0006230da7171f02f1c7171 Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Fri, 14 Aug 2020 12:41:20 -0400 Subject: [PATCH] comm: rename 'global_sums' to 'global_allreduce_sum' 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. --- cicecore/cicedynB/dynamics/ice_dyn_vp.F90 | 4 ++-- .../comm/mpi/ice_global_reductions.F90 | 18 +++++++++--------- .../comm/serial/ice_global_reductions.F90 | 18 +++++++++--------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 index 416e3beac..a448eb6e3 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_vp.F90 @@ -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 @@ -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 diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 index cb926f8dd..1d724fb39 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 @@ -36,7 +36,7 @@ module ice_global_reductions private public :: global_sum, & - global_sums, & + global_allreduce_sum, & global_sum_prod, & global_maxval, & global_minval @@ -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 @@ -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. @@ -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)' !----------------------------------------------------------------------- ! @@ -768,7 +768,7 @@ function global_sums_dbl(vector, dist) & !----------------------------------------------------------------------- - end function global_sums_dbl + end function global_allreduce_sum_vector_dbl !*********************************************************************** diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 index 3b37b50d5..4d53e873e 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 @@ -37,7 +37,7 @@ module ice_global_reductions private public :: global_sum, & - global_sums, & + global_allreduce_sum, & global_sum_prod, & global_maxval, & global_minval @@ -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 @@ -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. @@ -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)' !----------------------------------------------------------------------- ! @@ -769,7 +769,7 @@ function global_sums_dbl(vector, dist) & !----------------------------------------------------------------------- - end function global_sums_dbl + end function global_allreduce_sum_vector_dbl !***********************************************************************