Commit b8897765 authored by Stan Moore's avatar Stan Moore
Browse files

Fixing memory leak in Kokkos neighborlist

parent 1370385c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -218,8 +218,6 @@ void FixQEqReaxKokkos<DeviceType>::pre_force(int vflag)
  d_ilist = k_list->d_ilist;
  inum = list->inum;

  k_list->clean_copy();
  //cleanup_copy();
  copymode = 1;

  int teamsize = TEAMSIZE;
+6 −13
Original line number Diff line number Diff line
@@ -22,21 +22,14 @@ enum{NSQ,BIN,MULTI};
/* ---------------------------------------------------------------------- */

template<class Device>
void NeighListKokkos<Device>::clean_copy()
NeighListKokkos<Device>::NeighListKokkos(class LAMMPS *lmp):NeighList(lmp)
{
  ilist = NULL;
  numneigh = NULL;
  firstneigh = NULL;
  firstdouble = NULL;
  dnum = 0;
  iskip = NULL;
  ijskip = NULL;

  ipage = NULL;
  dpage = NULL;

  _stride = 1;
  maxneighs = 16;
  kokkos = 1;
  maxatoms = 0;
}
  execution_space = ExecutionSpaceFromDevice<Device>::space;
};

/* ---------------------------------------------------------------------- */

+1 −6
Original line number Diff line number Diff line
@@ -68,18 +68,13 @@ class NeighListKokkos: public NeighList {
public:
  int maxneighs;

  void clean_copy();
  void grow(int nmax);
  typename ArrayTypes<Device>::t_neighbors_2d d_neighbors;
  typename DAT::tdual_int_1d k_ilist;   // local indices of I atoms
  typename ArrayTypes<Device>::t_int_1d d_ilist;
  typename ArrayTypes<Device>::t_int_1d d_numneigh; // # of J neighs for each I

  NeighListKokkos(class LAMMPS *lmp):
  NeighList(lmp) {_stride = 1; maxneighs = 16; kokkos = 1; maxatoms = 0;
                  execution_space = ExecutionSpaceFromDevice<Device>::space;
  };
  ~NeighListKokkos() {numneigh = NULL; ilist = NULL;};
  NeighListKokkos(class LAMMPS *lmp);

  KOKKOS_INLINE_FUNCTION
  AtomNeighbors get_neighbors(const int &i) const {
+1 −1
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ class NeighborKokkosExecute
    h_new_maxneighs() = neigh_list.maxneighs;
  };

  ~NeighborKokkosExecute() {neigh_list.clean_copy();};
  ~NeighborKokkosExecute() {neigh_list.copymode = 1;};

  template<int HalfNeigh, int Newton, int Tri>
  KOKKOS_FUNCTION
+0 −3
Original line number Diff line number Diff line
@@ -120,9 +120,6 @@ void PairCoulDSFKokkos<DeviceType>::compute(int eflag_in, int vflag_in)

  int inum = list->inum;

  // Call cleanup_copy which sets allocations NULL which are destructed by the PairStyle

  k_list->clean_copy();
  copymode = 1;

  // loop over neighbors of my atoms
Loading