Skip to content

Commit

Permalink
Fix the segmentation fault in selecting actual neighbor particles. (A…
Browse files Browse the repository at this point in the history
  • Loading branch information
hengjiew committed Jul 18, 2022
1 parent 40b3d21 commit 73dbf2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_NeighborParticlesGPUImpl.H
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ buildNeighborCopyOp (bool use_boundary_neighbor)
{
BL_PROFILE("NeighborParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::buildNeighborCopyOp()");

AMREX_ASSERT(hasNeighbors() == false);
AMREX_ASSERT(!hasNeighbors() || use_boundary_neighbor);

const int lev = 0;
const auto& geom = this->Geom(lev);
Expand Down
8 changes: 4 additions & 4 deletions Src/Particle/AMReX_NeighborParticlesI.H
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,8 @@ selectActualNeighbors (CheckPair&& check_pair, int num_cells)
auto pperm = bins.permutationPtr();
auto poffset = bins.offsetsPtr();

unsigned int np_boundary = 0;
unsigned int* p_np_boundary = &np_boundary;
Gpu::Buffer<unsigned int> np_boundary({0});
unsigned int* p_np_boundary = np_boundary.data();
constexpr unsigned int max_unsigned_int = std::numeric_limits<unsigned int>::max();

AMREX_FOR_1D ( np_real, i,
Expand Down Expand Up @@ -899,9 +899,9 @@ selectActualNeighbors (CheckPair&& check_pair, int num_cells)
}
}
});// end amrex_for_1d
Gpu::streamSynchronize();

m_boundary_particle_ids[lev][index].resize(np_boundary);
unsigned int* p_np_boundary_h = np_boundary.copyToHost();
m_boundary_particle_ids[lev][index].resize(*p_np_boundary_h);

}// end mypariter
}// end lev
Expand Down

0 comments on commit 73dbf2f

Please sign in to comment.