5858 return nothing
5959end
6060
61- function fill_halo_regions! (c:: OffsetArray , bcs, indices, loc, grid:: DistributedTripolarGridOfSomeKind , buffers, args... ;
62- only_local_halos= false , fill_open_bcs= true , kwargs... )
63-
64- north_bc = bcs. north
65-
61+ function fill_halo_regions! (c:: OffsetArray , bcs, indices, loc, grid:: DistributedTripolarGridOfSomeKind , buffers, args... ; kwargs... )
62+
6663 arch = architecture (grid)
6764 kernels!, ordered_bcs = get_boundary_kernels (bcs, c, grid, loc, indices)
6865
@@ -73,7 +70,7 @@ function fill_halo_regions!(c::OffsetArray, bcs, indices, loc, grid::Distributed
7370 @inbounds fill_halo_event! (c, kernels![task], ordered_bcs[task], loc, grid, buffers, args... ; kwargs... )
7471 end
7572
76- fill_corners! (c, arch. connectivity, indices, loc, arch, grid, buffers, args... ; only_local_halos, kwargs... )
73+ fill_corners! (c, arch. connectivity, indices, loc, arch, grid, buffers, args... ; kwargs... )
7774
7875 # We increment the request counter only if we have actually initiated the MPI communication.
7976 # This is the case only if at least one of the boundary conditions is a distributed communication
@@ -82,8 +79,11 @@ function fill_halo_regions!(c::OffsetArray, bcs, indices, loc, grid::Distributed
8279 arch. mpi_tag[] += 1
8380 end
8481
85- switch_north_halos! (c, north_bc, grid, loc)
86-
82+ if arch. mpi_tag[] == 0 # The communication has been reset, switch the north halos!
83+ north_bc = bcs. north
84+ switch_north_halos! (c, north_bc, grid, loc)
85+ end
86+
8787 return nothing
8888end
8989
0 commit comments