diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 42ecedd78a..3cff12901b 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -29,6 +29,8 @@ namespace LAMMPS_NS { template NPairKokkos::NPairKokkos(LAMMPS *lmp) : NPair(lmp) { + last_stencil_old = -1; + // use 1D view for scalars to reduce GPU memory operations d_scalars = typename AT::t_int_1d("neighbor:scalars",2); @@ -112,9 +114,11 @@ void NPairKokkos::copy_stencil_info() NPair::copy_stencil_info(); nstencil = ns->nstencil; - if (ns->last_stencil == update->ntimestep) { + if (ns->last_stencil != last_stencil_old) { // copy stencil to device as it may have changed + last_stencil_old = ns->last_stencil; + int maxstencil = ns->get_maxstencil(); if (maxstencil > (int)k_stencil.extent(0)) diff --git a/src/KOKKOS/npair_kokkos.h b/src/KOKKOS/npair_kokkos.h index 339d7e425d..cdac7538d7 100644 --- a/src/KOKKOS/npair_kokkos.h +++ b/src/KOKKOS/npair_kokkos.h @@ -138,7 +138,7 @@ class NPairKokkos : public NPair { // data from NStencil class - int nstencil; + int nstencil,last_stencil_old; DAT::tdual_int_1d k_stencil; // # of J neighs for each I DAT::tdual_int_1d_3 k_stencilxyz; };