Skip to content

Commit

Permalink
Merge pull request #1768 from devitocodes/patch-mpi-neighborhood
Browse files Browse the repository at this point in the history
mpi: Patch neighborhood construction
  • Loading branch information
FabioLuporini authored Oct 5, 2021
2 parents 2ce93a5 + 136901c commit a7d3b38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions devito/mpi/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ def neighborhood(self):
# Set up diagonal neighbours
for i in product([LEFT, CENTER, RIGHT], repeat=self.ndim):
neighbor = [c + s.val for c, s in zip(self.mycoords, i)]
try:
ret[i] = self.comm.Get_cart_rank(neighbor)
except:
# Fallback for MPI ranks at the grid boundary

if any(c < 0 or c >= s for c, s in zip(neighbor, self.topology)):
ret[i] = MPI.PROC_NULL
else:
ret[i] = self.comm.Get_cart_rank(neighbor)

return ret

Expand Down

0 comments on commit a7d3b38

Please sign in to comment.