Skip to content

Commit 0251315

Browse files
processor now takes into account the domain size when computing the number of IB force communications. This limits the number of transmits and prevents double-counting in periodic cases.
1 parent 51d0ab1 commit 0251315

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/common/m_global_parameters_common.fpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ module m_global_parameters_common
109109

110110
!> @name Processor coordinates and parallel-IO addressing (identical declaration across all three targets)
111111
!> @{
112-
integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM
113-
integer, allocatable, dimension(:) :: start_idx !< Starting cell-center index of local processor in global grid
112+
integer, allocatable, dimension(:) :: proc_coords !< Processor coordinates in MPI_CART_COMM
113+
integer, allocatable, dimension(:) :: start_idx !< Starting cell-center index of local processor in global grid
114+
integer :: num_procs_x = 1 !< Number of MPI ranks in x-direction
115+
integer :: num_procs_y = 1 !< Number of MPI ranks in y-direction
116+
integer :: num_procs_z = 1 !< Number of MPI ranks in z-direction
114117
!> @}
115118

116119
!> @name MPI info for parallel IO with Lustre file systems (identical across all three targets)

src/common/m_mpi_common.fpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ contains
10211021
subroutine s_mpi_decompose_computational_domain
10221022

10231023
#ifdef MFC_MPI
1024-
integer :: num_procs_x, num_procs_y, num_procs_z !< Optimal number of processors in the x-, y- and z-directions
10251024
!> Non-optimal number of processors in the x-, y- and z-directions
10261025
real(wp) :: tmp_num_procs_x, tmp_num_procs_y, tmp_num_procs_z
10271026
real(wp) :: fct_min !< Processor factorization (fct) minimization parameter

src/simulation/m_ibm.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ contains
12521252
recv_torques_snap = 0._wp
12531253
tag = 300
12541254
1255-
do k = 1, 2*ib_neighborhood_radius
1255+
do k = 1, min(2*ib_neighborhood_radius, num_procs_${X}$ - 1)
12561256
! send forces to +${X}$ neighbor; receive from -${X}$ neighbor. Add received values then
12571257
pack_pos = 0
12581258
$:GPU_PARALLEL_LOOP(private='[i]', copyin='[forces, torques]')
@@ -1300,7 +1300,7 @@ contains
13001300
send_neighbor = merge(bc_${X}$%beg, MPI_PROC_NULL, bc_${X}$%beg >= 0)
13011301
recv_neighbor = merge(bc_${X}$%end, MPI_PROC_NULL, bc_${X}$%end >= 0)
13021302
1303-
do k = 1, 2*ib_neighborhood_radius
1303+
do k = 1, min(2*ib_neighborhood_radius, num_procs_${X}$ - 1)
13041304
pack_pos = 0
13051305
$:GPU_PARALLEL_LOOP(private='[i]', copyin='[forces, torques]')
13061306
do i = 1, num_ibs

0 commit comments

Comments
 (0)