Skip to content

Commit 0f79876

Browse files
author
Daniel Vickers
committed
Fixed neighbor instantiation for larger-than 8-rank cases
1 parent 401d243 commit 0f79876

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

src/simulation/m_start_up.fpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ contains
12221222
end if
12231223
end do
12241224

1225-
patch_ib_gbl(:) = patch_ib(:)
1225+
patch_ib_gbl(1:num_ibs) = patch_ib(1:num_ibs)
12261226
call get_neighbor_bounds() ! make sure the bounds of the neighbors are correctly set up
12271227
call s_compute_ib_neighbor_ranks() ! build lookup of all neighbor MPI ranks
12281228

@@ -1280,7 +1280,7 @@ contains
12801280

12811281
#ifdef MFC_MPI
12821282
integer :: ierr
1283-
integer, dimension(4) :: buf4
1283+
integer, dimension(4) :: buf4, rbuf4
12841284
integer, dimension(2) :: buf2, rbuf2
12851285

12861286
ax = ib_neighborhood_radius
@@ -1307,24 +1307,22 @@ contains
13071307
buf4 = [bc_y%beg, bc_y%end, bc_z%beg, bc_z%end]
13081308

13091309
! Send to -x, receive from +x -> edges (+1,+/-1,0) and (+1,0,+/-1)
1310-
call MPI_SENDRECV(buf4, 4, MPI_INTEGER, merge(bc_x%beg, MPI_PROC_NULL, bc_x%beg >= 0), 310, buf4, 4, MPI_INTEGER, &
1310+
call MPI_SENDRECV(buf4, 4, MPI_INTEGER, merge(bc_x%beg, MPI_PROC_NULL, bc_x%beg >= 0), 310, rbuf4, 4, MPI_INTEGER, &
13111311
& merge(bc_x%end, MPI_PROC_NULL, bc_x%end >= 0), 310, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)
13121312
if (bc_x%end >= 0) then
1313-
ib_neighbor_ranks(+1, -1, 0) = buf4(1)
1314-
ib_neighbor_ranks(+1, +1, 0) = buf4(2)
1315-
ib_neighbor_ranks(+1, 0, -1) = buf4(3)
1316-
ib_neighbor_ranks(+1, 0, +1) = buf4(4)
1313+
ib_neighbor_ranks(+1, -1, 0) = rbuf4(1)
1314+
ib_neighbor_ranks(+1, +1, 0) = rbuf4(2)
1315+
ib_neighbor_ranks(+1, 0, -1) = rbuf4(3)
1316+
ib_neighbor_ranks(+1, 0, +1) = rbuf4(4)
13171317
end if
13181318

1319-
! Restore buf4, then send to +x, receive from -x -> edges (-1,+/-1,0) and (-1,0,+/-1)
1320-
buf4 = [bc_y%beg, bc_y%end, bc_z%beg, bc_z%end]
1321-
call MPI_SENDRECV(buf4, 4, MPI_INTEGER, merge(bc_x%end, MPI_PROC_NULL, bc_x%end >= 0), 311, buf4, 4, MPI_INTEGER, &
1319+
call MPI_SENDRECV(buf4, 4, MPI_INTEGER, merge(bc_x%end, MPI_PROC_NULL, bc_x%end >= 0), 311, rbuf4, 4, MPI_INTEGER, &
13221320
& merge(bc_x%beg, MPI_PROC_NULL, bc_x%beg >= 0), 311, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)
13231321
if (bc_x%beg >= 0) then
1324-
ib_neighbor_ranks(-1, -1, 0) = buf4(1)
1325-
ib_neighbor_ranks(-1, +1, 0) = buf4(2)
1326-
ib_neighbor_ranks(-1, 0, -1) = buf4(3)
1327-
ib_neighbor_ranks(-1, 0, +1) = buf4(4)
1322+
ib_neighbor_ranks(-1, -1, 0) = rbuf4(1)
1323+
ib_neighbor_ranks(-1, +1, 0) = rbuf4(2)
1324+
ib_neighbor_ranks(-1, 0, -1) = rbuf4(3)
1325+
ib_neighbor_ranks(-1, 0, +1) = rbuf4(4)
13281326
end if
13291327
end if
13301328

0 commit comments

Comments
 (0)