Commit 7cff3436 authored by Dan Ibanez's avatar Dan Ibanez
Browse files

fix allocation regressions in PairTableKokkos

parent a1ac8610
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ PairTableKokkos<DeviceType>::~PairTableKokkos()
{
  delete h_table;
  delete d_table;
  copymode = true; //prevents base class destructor from running
}

/* ---------------------------------------------------------------------- */
@@ -345,10 +346,18 @@ void PairTableKokkos<DeviceType>::create_kokkos_tables()
template<class DeviceType>
void PairTableKokkos<DeviceType>::allocate()
{
  PairTable::allocate();
  allocated = 1;
  const int nt = atom->ntypes + 1;

  memory->create(setflag,nt,nt,"pair:setflag");
  memory->create_kokkos(d_table->cutsq,h_table->cutsq,cutsq,nt,nt,"pair:cutsq");
  memory->create_kokkos(d_table->tabindex,h_table->tabindex,tabindex,nt,nt,"pair:tabindex");

  d_table_const.cutsq = d_table->cutsq;
  d_table_const.tabindex = d_table->tabindex;
  memset(&setflag[0][0],0,nt*nt*sizeof(int));
  memset(&cutsq[0][0],0,nt*nt*sizeof(double));
  memset(&tabindex[0][0],0,nt*nt*sizeof(int));
}

/* ----------------------------------------------------------------------
+0 −9
Original line number Diff line number Diff line
@@ -93,15 +93,6 @@ class PairTableKokkos : public PairTable {
    typename ArrayTypes<LMPHostType>::t_ffloat_2d rsq,drsq,e,de,f,df,e2,f2;
  };

  struct Table {
    int ninput,rflag,fpflag,match,ntablebits;
    int nshiftbits,nmask;
    double rlo,rhi,fplo,fphi,cut;
    double *rfile,*efile,*ffile;
    double *e2file,*f2file;
    double innersq,delta,invdelta,deltasq6;
    double *rsq,*drsq,*e,*de,*f,*df,*e2,*f2;
  };
  TableDeviceConst d_table_const;
  TableDevice* d_table;
  TableHost* h_table;