update variables, templates, kk types

This commit is contained in:
Megan J. McCarthy
2024-06-27 22:56:12 -06:00
parent d7da58752b
commit 6a8e7b4d70
16 changed files with 245 additions and 237 deletions

View File

@ -38,6 +38,7 @@ static constexpr double SMALL = 0.001;
template<class DeviceType>
AngleCharmmKokkos<DeviceType>::AngleCharmmKokkos(LAMMPS *lmp) : AngleCharmm(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -125,12 +126,12 @@ void AngleCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -284,10 +285,10 @@ void AngleCharmmKokkos<DeviceType>::coeff(int narg, char **arg)
k_r_ub.h_view[i] = r_ub[i];
}
k_k.template modify<LMPHostType>();
k_theta0.template modify<LMPHostType>();
k_k_ub.template modify<LMPHostType>();
k_r_ub.template modify<LMPHostType>();
k_k.modify_host();
k_theta0.modify_host();
k_k_ub.modify_host();
k_r_ub.modify_host();
k_k.template sync<DeviceType>();
k_theta0.template sync<DeviceType>();
@ -322,10 +323,10 @@ void AngleCharmmKokkos<DeviceType>::read_restart(FILE *fp)
k_r_ub.h_view[i] = r_ub[i];
}
k_k.template modify<LMPHostType>();
k_theta0.template modify<LMPHostType>();
k_k_ub.template modify<LMPHostType>();
k_r_ub.template modify<LMPHostType>();
k_k.modify_host();
k_theta0.modify_host();
k_k_ub.modify_host();
k_r_ub.modify_host();
k_k.template sync<DeviceType>();
k_theta0.template sync<DeviceType>();

View File

@ -58,19 +58,18 @@ class AngleCharmmKokkos : public AngleCharmm {
const F_FLOAT &delx1, const F_FLOAT &dely1, const F_FLOAT &delz1,
const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const;
using KKDeviceType = typename KKDevice<DeviceType>::value;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
protected:
class NeighborKokkos *neighborKK;
typedef ArrayTypes<DeviceType> AT;
typename AT::t_x_array_randomread x;
using KKDeviceType = typename KKDevice<DeviceType>::value;
typename Kokkos::View<double*[3],typename AT::t_f_array::array_layout,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > f;
typename AT::t_int_2d anglelist;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
Kokkos::View<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic>> d_eatom;
Kokkos::View<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic>> d_vatom;

View File

@ -38,6 +38,7 @@ static constexpr double SMALL = 0.001;
template<class DeviceType>
AngleClass2Kokkos<DeviceType>::AngleClass2Kokkos(LAMMPS *lmp) : AngleClass2(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -141,12 +142,12 @@ void AngleClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -386,21 +387,21 @@ void AngleClass2Kokkos<DeviceType>::coeff(int narg, char **arg)
k_theta0.h_view[i] = theta0[i];
}
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_k4.template modify<LMPHostType>();
k_bb_k.template modify<LMPHostType>();
k_bb_r1.template modify<LMPHostType>();
k_bb_r2.template modify<LMPHostType>();
k_ba_k1.template modify<LMPHostType>();
k_ba_k2.template modify<LMPHostType>();
k_ba_r1.template modify<LMPHostType>();
k_ba_r2.template modify<LMPHostType>();
k_setflag.template modify<LMPHostType>();
k_setflag_a.template modify<LMPHostType>();
k_setflag_bb.template modify<LMPHostType>();
k_setflag_ba.template modify<LMPHostType>();
k_theta0.template modify<LMPHostType>();
k_k2.modify_host();
k_k3.modify_host();
k_k4.modify_host();
k_bb_k.modify_host();
k_bb_r1.modify_host();
k_bb_r2.modify_host();
k_ba_k1.modify_host();
k_ba_k2.modify_host();
k_ba_r1.modify_host();
k_ba_r2.modify_host();
k_setflag.modify_host();
k_setflag_a.modify_host();
k_setflag_bb.modify_host();
k_setflag_ba.modify_host();
k_theta0.modify_host();
}
/* ----------------------------------------------------------------------
@ -465,21 +466,21 @@ void AngleClass2Kokkos<DeviceType>::read_restart(FILE *fp)
k_theta0.h_view[i] = theta0[i];
}
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_k4.template modify<LMPHostType>();
k_bb_k.template modify<LMPHostType>();
k_bb_r1.template modify<LMPHostType>();
k_bb_r2.template modify<LMPHostType>();
k_ba_k1.template modify<LMPHostType>();
k_ba_k2.template modify<LMPHostType>();
k_ba_r1.template modify<LMPHostType>();
k_ba_r2.template modify<LMPHostType>();
k_setflag.template modify<LMPHostType>();
k_setflag_a.template modify<LMPHostType>();
k_setflag_bb.template modify<LMPHostType>();
k_setflag_ba.template modify<LMPHostType>();
k_theta0.template modify<LMPHostType>();
k_k2.modify_host();
k_k3.modify_host();
k_k4.modify_host();
k_bb_k.modify_host();
k_bb_r1.modify_host();
k_bb_r2.modify_host();
k_ba_k1.modify_host();
k_ba_k2.modify_host();
k_ba_r1.modify_host();
k_ba_r2.modify_host();
k_setflag.modify_host();
k_setflag_a.modify_host();
k_setflag_bb.modify_host();
k_setflag_ba.modify_host();
k_theta0.modify_host();
}
/* ----------------------------------------------------------------------

View File

@ -36,8 +36,8 @@ class AngleClass2Kokkos : public AngleClass2 {
public:
typedef DeviceType device_type;
typedef ArrayTypes<DeviceType> AT;
typedef EV_FLOAT value_type;
typedef ArrayTypes<DeviceType> AT;
AngleClass2Kokkos(class LAMMPS *);
~AngleClass2Kokkos() override;
@ -60,6 +60,9 @@ class AngleClass2Kokkos : public AngleClass2 {
const F_FLOAT &delx1, const F_FLOAT &dely1, const F_FLOAT &delz1,
const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const;
typename AT::tdual_efloat_1d k_eatom;
typename AT::tdual_virial_array k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -67,9 +70,6 @@ class AngleClass2Kokkos : public AngleClass2 {
typename AT::t_x_array_randomread x;
typename AT::t_f_array f;
typename AT::t_int_2d anglelist;
typename AT::tdual_efloat_1d k_eatom;
typename AT::tdual_virial_array k_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;

View File

@ -36,6 +36,7 @@ using namespace MathConst;
template<class DeviceType>
AngleCosineKokkos<DeviceType>::AngleCosineKokkos(LAMMPS *lmp) : AngleCosine(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -124,12 +125,12 @@ void AngleCosineKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -254,7 +255,7 @@ void AngleCosineKokkos<DeviceType>::coeff(int narg, char **arg)
for (int i = 1; i <= n; i++)
k_k.h_view[i] = k[i];
k_k.template modify<LMPHostType>();
k_k.modify_host();
}
/* ----------------------------------------------------------------------
@ -270,7 +271,7 @@ void AngleCosineKokkos<DeviceType>::read_restart(FILE *fp)
for (int i = 1; i <= n; i++)
k_k.h_view[i] = k[i];
k_k.template modify<LMPHostType>();
k_k.modify_host();
}
/* ----------------------------------------------------------------------

View File

@ -37,6 +37,7 @@ class AngleCosineKokkos : public AngleCosine {
public:
typedef DeviceType device_type;
typedef EV_FLOAT value_type;
typedef ArrayTypes<DeviceType> AT;
AngleCosineKokkos(class LAMMPS *);
~AngleCosineKokkos() override;
@ -59,6 +60,9 @@ class AngleCosineKokkos : public AngleCosine {
const F_FLOAT &delx1, const F_FLOAT &dely1, const F_FLOAT &delz1,
const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const;
typename AT::tdual_efloat_1d k_eatom;
typename AT::tdual_virial_array k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -66,9 +70,6 @@ class AngleCosineKokkos : public AngleCosine {
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
typename ArrayTypes<DeviceType>::t_f_array f;
typename ArrayTypes<DeviceType>::t_int_2d anglelist;
typename ArrayTypes<DeviceType>::tdual_efloat_1d k_eatom;
typename ArrayTypes<DeviceType>::tdual_virial_array k_vatom;
typename ArrayTypes<DeviceType>::t_efloat_1d d_eatom;
typename ArrayTypes<DeviceType>::t_virial_array d_vatom;

View File

@ -40,6 +40,7 @@ static constexpr double TOLERANCE = 0.05;
template<class DeviceType>
DihedralCharmmKokkos<DeviceType>::DihedralCharmmKokkos(LAMMPS *lmp) : DihedralCharmm(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -115,7 +116,7 @@ void DihedralCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
qqrd2e = force->qqrd2e;
h_warning_flag() = 0;
k_warning_flag.template modify<LMPHostType>();
k_warning_flag.modify_host();
k_warning_flag.template sync<DeviceType>();
copymode = 1;
@ -141,7 +142,7 @@ void DihedralCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
// error check
k_warning_flag.template modify<DeviceType>();
k_warning_flag.template sync<LMPHostType>();
k_warning_flag.sync_host();
if (h_warning_flag())
error->warning(FLERR,"Dihedral problem");
@ -174,20 +175,20 @@ void DihedralCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
k_eatom_pair.template modify<DeviceType>();
k_eatom_pair.template sync<LMPHostType>();
k_eatom_pair.sync_host();
for (int i = 0; i < n; i++)
force->pair->eatom[i] += k_eatom_pair.h_view(i);
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
k_vatom_pair.template modify<DeviceType>();
k_vatom_pair.template sync<LMPHostType>();
k_vatom_pair.sync_host();
for (int i = 0; i < n; i++) {
force->pair->vatom[i][0] += k_vatom_pair.h_view(i,0);
force->pair->vatom[i][1] += k_vatom_pair.h_view(i,1);
@ -454,12 +455,12 @@ void DihedralCharmmKokkos<DeviceType>::coeff(int narg, char **arg)
k_weight.h_view[i] = weight[i];
}
k_k.template modify<LMPHostType>();
k_multiplicity.template modify<LMPHostType>();
k_shift.template modify<LMPHostType>();
k_cos_shift.template modify<LMPHostType>();
k_sin_shift.template modify<LMPHostType>();
k_weight.template modify<LMPHostType>();
k_k.modify_host();
k_multiplicity.modify_host();
k_shift.modify_host();
k_cos_shift.modify_host();
k_sin_shift.modify_host();
k_weight.modify_host();
k_k.template sync<DeviceType>();
k_multiplicity.template sync<DeviceType>();
@ -502,10 +503,10 @@ void DihedralCharmmKokkos<DeviceType>::init_style()
}
}
k_lj14_1.template modify<LMPHostType>();
k_lj14_2.template modify<LMPHostType>();
k_lj14_3.template modify<LMPHostType>();
k_lj14_4.template modify<LMPHostType>();
k_lj14_1.modify_host();
k_lj14_2.modify_host();
k_lj14_3.modify_host();
k_lj14_4.modify_host();
k_lj14_1.template sync<DeviceType>();
k_lj14_2.template sync<DeviceType>();
@ -547,12 +548,12 @@ void DihedralCharmmKokkos<DeviceType>::read_restart(FILE *fp)
k_weight.h_view[i] = weight[i];
}
k_k.template modify<LMPHostType>();
k_multiplicity.template modify<LMPHostType>();
k_shift.template modify<LMPHostType>();
k_cos_shift.template modify<LMPHostType>();
k_sin_shift.template modify<LMPHostType>();
k_weight.template modify<LMPHostType>();
k_k.modify_host();
k_multiplicity.modify_host();
k_shift.modify_host();
k_cos_shift.modify_host();
k_sin_shift.modify_host();
k_weight.modify_host();
k_k.template sync<DeviceType>();
k_multiplicity.template sync<DeviceType>();

View File

@ -104,6 +104,10 @@ class DihedralCharmmKokkos : public DihedralCharmm {
const F_FLOAT &evdwl, const F_FLOAT &ecoul, const F_FLOAT &fpair, const F_FLOAT &delx,
const F_FLOAT &dely, const F_FLOAT &delz) const;
typedef typename KKDevice<DeviceType>::value KKDeviceType;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -114,9 +118,6 @@ class DihedralCharmmKokkos : public DihedralCharmm {
typename AT::t_f_array f;
typename AT::t_int_2d dihedrallist;
typedef typename KKDevice<DeviceType>::value KKDeviceType;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
Kokkos::View<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_eatom;
Kokkos::View<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_vatom;

View File

@ -47,6 +47,7 @@ static constexpr double TOLERANCE = 0.05;
template<class DeviceType>
DihedralCharmmfswKokkos<DeviceType>::DihedralCharmmfswKokkos(LAMMPS *lmp) : DihedralCharmmfsw(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -122,7 +123,7 @@ void DihedralCharmmfswKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
qqrd2e = force->qqrd2e;
h_warning_flag() = 0;
k_warning_flag.template modify<LMPHostType>();
k_warning_flag.modify_host();
k_warning_flag.template sync<DeviceType>();
copymode = 1;
@ -148,7 +149,7 @@ void DihedralCharmmfswKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
// error check
k_warning_flag.template modify<DeviceType>();
k_warning_flag.template sync<LMPHostType>();
k_warning_flag.sync_host();
if (h_warning_flag())
error->warning(FLERR,"Dihedral problem");
@ -181,20 +182,20 @@ void DihedralCharmmfswKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
k_eatom_pair.template modify<DeviceType>();
k_eatom_pair.template sync<LMPHostType>();
k_eatom_pair.sync_host();
for (int i = 0; i < n; i++)
force->pair->eatom[i] += k_eatom_pair.h_view(i);
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
k_vatom_pair.template modify<DeviceType>();
k_vatom_pair.template sync<LMPHostType>();
k_vatom_pair.sync_host();
for (int i = 0; i < n; i++) {
force->pair->vatom[i][0] += k_vatom_pair.h_view(i,0);
force->pair->vatom[i][1] += k_vatom_pair.h_view(i,1);
@ -471,12 +472,12 @@ void DihedralCharmmfswKokkos<DeviceType>::coeff(int narg, char **arg)
k_weight.h_view[i] = weight[i];
}
k_k.template modify<LMPHostType>();
k_multiplicity.template modify<LMPHostType>();
k_shift.template modify<LMPHostType>();
k_cos_shift.template modify<LMPHostType>();
k_sin_shift.template modify<LMPHostType>();
k_weight.template modify<LMPHostType>();
k_k.modify_host();
k_multiplicity.modify_host();
k_shift.modify_host();
k_cos_shift.modify_host();
k_sin_shift.modify_host();
k_weight.modify_host();
k_k.template sync<DeviceType>();
k_multiplicity.template sync<DeviceType>();
@ -519,10 +520,10 @@ void DihedralCharmmfswKokkos<DeviceType>::init_style()
}
}
k_lj14_1.template modify<LMPHostType>();
k_lj14_2.template modify<LMPHostType>();
k_lj14_3.template modify<LMPHostType>();
k_lj14_4.template modify<LMPHostType>();
k_lj14_1.modify_host();
k_lj14_2.modify_host();
k_lj14_3.modify_host();
k_lj14_4.modify_host();
k_lj14_1.template sync<DeviceType>();
k_lj14_2.template sync<DeviceType>();
@ -564,12 +565,12 @@ void DihedralCharmmfswKokkos<DeviceType>::read_restart(FILE *fp)
k_weight.h_view[i] = weight[i];
}
k_k.template modify<LMPHostType>();
k_multiplicity.template modify<LMPHostType>();
k_shift.template modify<LMPHostType>();
k_cos_shift.template modify<LMPHostType>();
k_sin_shift.template modify<LMPHostType>();
k_weight.template modify<LMPHostType>();
k_k.modify_host();
k_multiplicity.modify_host();
k_shift.modify_host();
k_cos_shift.modify_host();
k_sin_shift.modify_host();
k_weight.modify_host();
k_k.template sync<DeviceType>();
k_multiplicity.template sync<DeviceType>();

View File

@ -67,6 +67,10 @@ class DihedralCharmmfswKokkos : public DihedralCharmmfsw {
const F_FLOAT &evdwl, const F_FLOAT &ecoul, const F_FLOAT &fpair, const F_FLOAT &delx,
const F_FLOAT &dely, const F_FLOAT &delz) const;
typedef typename KKDevice<DeviceType>::value KKDeviceType;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -76,10 +80,6 @@ class DihedralCharmmfswKokkos : public DihedralCharmmfsw {
typename AT::t_ffloat_1d_randomread q;
typename AT::t_f_array f;
typename AT::t_int_2d dihedrallist;
typedef typename KKDevice<DeviceType>::value KKDeviceType;
Kokkos::DualView<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType> k_eatom;
Kokkos::DualView<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType> k_vatom;
Kokkos::View<E_FLOAT*,Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_eatom;
Kokkos::View<F_FLOAT*[6],Kokkos::LayoutRight,KKDeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > d_vatom;

View File

@ -38,6 +38,7 @@ static constexpr double SMALL = 0.001;
template<class DeviceType>
DihedralClass2Kokkos<DeviceType>::DihedralClass2Kokkos(LAMMPS *lmp) : DihedralClass2(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -137,7 +138,7 @@ void DihedralClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
newton_bond = force->newton_bond;
h_warning_flag() = 0;
k_warning_flag.template modify<LMPHostType>();
k_warning_flag.modify_host();
k_warning_flag.template sync<DeviceType>();
copymode = 1;
@ -163,7 +164,7 @@ void DihedralClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
// error check
k_warning_flag.template modify<DeviceType>();
k_warning_flag.template sync<LMPHostType>();
k_warning_flag.sync_host();
if (h_warning_flag())
error->warning(FLERR,"Dihedral problem");
@ -179,12 +180,12 @@ void DihedralClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -786,44 +787,44 @@ void DihedralClass2Kokkos<DeviceType>::coeff(int narg, char **arg)
k_setflag_bb13t.h_view[i] = setflag_bb13t[i];
}
k_k1.template modify<LMPHostType>();
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_phi1.template modify<LMPHostType>();
k_phi2.template modify<LMPHostType>();
k_phi3.template modify<LMPHostType>();
k_mbt_f1.template modify<LMPHostType>();
k_mbt_f2.template modify<LMPHostType>();
k_mbt_f3.template modify<LMPHostType>();
k_mbt_r0.template modify<LMPHostType>();
k_ebt_f1_1.template modify<LMPHostType>();
k_ebt_f2_1.template modify<LMPHostType>();
k_ebt_f3_1.template modify<LMPHostType>();
k_ebt_r0_1.template modify<LMPHostType>();
k_ebt_f1_2.template modify<LMPHostType>();
k_ebt_f2_2.template modify<LMPHostType>();
k_ebt_f3_2.template modify<LMPHostType>();
k_ebt_r0_2.template modify<LMPHostType>();
k_at_f1_1.template modify<LMPHostType>();
k_at_f2_1.template modify<LMPHostType>();
k_at_f3_1.template modify<LMPHostType>();
k_at_f1_2.template modify<LMPHostType>();
k_at_f2_2.template modify<LMPHostType>();
k_at_f3_2.template modify<LMPHostType>();
k_at_theta0_1.template modify<LMPHostType>();
k_at_theta0_2.template modify<LMPHostType>();
k_aat_k.template modify<LMPHostType>();
k_aat_theta0_1.template modify<LMPHostType>();
k_aat_theta0_2.template modify<LMPHostType>();
k_bb13t_k.template modify<LMPHostType>();
k_bb13t_r10.template modify<LMPHostType>();
k_bb13t_r30.template modify<LMPHostType>();
k_setflag_d.template modify<LMPHostType>();
k_setflag_mbt.template modify<LMPHostType>();
k_setflag_ebt.template modify<LMPHostType>();
k_setflag_at.template modify<LMPHostType>();
k_setflag_aat.template modify<LMPHostType>();
k_setflag_bb13t.template modify<LMPHostType>();
k_k1.modify_host();
k_k2.modify_host();
k_k3.modify_host();
k_phi1.modify_host();
k_phi2.modify_host();
k_phi3.modify_host();
k_mbt_f1.modify_host();
k_mbt_f2.modify_host();
k_mbt_f3.modify_host();
k_mbt_r0.modify_host();
k_ebt_f1_1.modify_host();
k_ebt_f2_1.modify_host();
k_ebt_f3_1.modify_host();
k_ebt_r0_1.modify_host();
k_ebt_f1_2.modify_host();
k_ebt_f2_2.modify_host();
k_ebt_f3_2.modify_host();
k_ebt_r0_2.modify_host();
k_at_f1_1.modify_host();
k_at_f2_1.modify_host();
k_at_f3_1.modify_host();
k_at_f1_2.modify_host();
k_at_f2_2.modify_host();
k_at_f3_2.modify_host();
k_at_theta0_1.modify_host();
k_at_theta0_2.modify_host();
k_aat_k.modify_host();
k_aat_theta0_1.modify_host();
k_aat_theta0_2.modify_host();
k_bb13t_k.modify_host();
k_bb13t_r10.modify_host();
k_bb13t_r30.modify_host();
k_setflag_d.modify_host();
k_setflag_mbt.modify_host();
k_setflag_ebt.modify_host();
k_setflag_at.modify_host();
k_setflag_aat.modify_host();
k_setflag_bb13t.modify_host();
}
@ -956,44 +957,44 @@ void DihedralClass2Kokkos<DeviceType>::read_restart(FILE *fp)
k_setflag_bb13t.h_view[i] = setflag_bb13t[i];
}
k_k1.template modify<LMPHostType>();
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_phi1.template modify<LMPHostType>();
k_phi2.template modify<LMPHostType>();
k_phi3.template modify<LMPHostType>();
k_mbt_f1.template modify<LMPHostType>();
k_mbt_f2.template modify<LMPHostType>();
k_mbt_f3.template modify<LMPHostType>();
k_mbt_r0.template modify<LMPHostType>();
k_ebt_f1_1.template modify<LMPHostType>();
k_ebt_f2_1.template modify<LMPHostType>();
k_ebt_f3_1.template modify<LMPHostType>();
k_ebt_r0_1.template modify<LMPHostType>();
k_ebt_f1_2.template modify<LMPHostType>();
k_ebt_f2_2.template modify<LMPHostType>();
k_ebt_f3_2.template modify<LMPHostType>();
k_ebt_r0_2.template modify<LMPHostType>();
k_at_f1_1.template modify<LMPHostType>();
k_at_f2_1.template modify<LMPHostType>();
k_at_f3_1.template modify<LMPHostType>();
k_at_f1_2.template modify<LMPHostType>();
k_at_f2_2.template modify<LMPHostType>();
k_at_f3_2.template modify<LMPHostType>();
k_at_theta0_1.template modify<LMPHostType>();
k_at_theta0_2.template modify<LMPHostType>();
k_aat_k.template modify<LMPHostType>();
k_aat_theta0_1.template modify<LMPHostType>();
k_aat_theta0_2.template modify<LMPHostType>();
k_bb13t_k.template modify<LMPHostType>();
k_bb13t_r10.template modify<LMPHostType>();
k_bb13t_r30.template modify<LMPHostType>();
k_setflag_d.template modify<LMPHostType>();
k_setflag_mbt.template modify<LMPHostType>();
k_setflag_ebt.template modify<LMPHostType>();
k_setflag_at.template modify<LMPHostType>();
k_setflag_aat.template modify<LMPHostType>();
k_setflag_bb13t.template modify<LMPHostType>();
k_k1.modify_host();
k_k2.modify_host();
k_k3.modify_host();
k_phi1.modify_host();
k_phi2.modify_host();
k_phi3.modify_host();
k_mbt_f1.modify_host();
k_mbt_f2.modify_host();
k_mbt_f3.modify_host();
k_mbt_r0.modify_host();
k_ebt_f1_1.modify_host();
k_ebt_f2_1.modify_host();
k_ebt_f3_1.modify_host();
k_ebt_r0_1.modify_host();
k_ebt_f1_2.modify_host();
k_ebt_f2_2.modify_host();
k_ebt_f3_2.modify_host();
k_ebt_r0_2.modify_host();
k_at_f1_1.modify_host();
k_at_f2_1.modify_host();
k_at_f3_1.modify_host();
k_at_f1_2.modify_host();
k_at_f2_2.modify_host();
k_at_f3_2.modify_host();
k_at_theta0_1.modify_host();
k_at_theta0_2.modify_host();
k_aat_k.modify_host();
k_aat_theta0_1.modify_host();
k_aat_theta0_2.modify_host();
k_bb13t_k.modify_host();
k_bb13t_r10.modify_host();
k_bb13t_r30.modify_host();
k_setflag_d.modify_host();
k_setflag_mbt.modify_host();
k_setflag_ebt.modify_host();
k_setflag_at.modify_host();
k_setflag_aat.modify_host();
k_setflag_bb13t.modify_host();
}
/* ----------------------------------------------------------------------

View File

@ -60,6 +60,9 @@ class DihedralClass2Kokkos : public DihedralClass2 {
const F_FLOAT &vb2x, const F_FLOAT &vb2y, const F_FLOAT &vb2z,
const F_FLOAT &vb3x, const F_FLOAT &vb3y, const F_FLOAT &vb3z) const;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -67,9 +70,6 @@ class DihedralClass2Kokkos : public DihedralClass2 {
typename AT::t_x_array_randomread x;
typename AT::t_f_array f;
typename AT::t_int_2d dihedrallist;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;

View File

@ -39,6 +39,7 @@ static constexpr double SMALLER = 0.00001;
template<class DeviceType>
DihedralOPLSKokkos<DeviceType>::DihedralOPLSKokkos(LAMMPS *lmp) : DihedralOPLS(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -100,7 +101,7 @@ void DihedralOPLSKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
newton_bond = force->newton_bond;
h_warning_flag() = 0;
k_warning_flag.template modify<LMPHostType>();
k_warning_flag.modify_host();
k_warning_flag.template sync<DeviceType>();
copymode = 1;
@ -126,7 +127,7 @@ void DihedralOPLSKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
// error check
k_warning_flag.template modify<DeviceType>();
k_warning_flag.template sync<LMPHostType>();
k_warning_flag.sync_host();
if (h_warning_flag())
error->warning(FLERR,"Dihedral problem");
@ -142,12 +143,12 @@ void DihedralOPLSKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -372,10 +373,10 @@ void DihedralOPLSKokkos<DeviceType>::coeff(int narg, char **arg)
k_k4.h_view[i] = k4[i];
}
k_k1.template modify<LMPHostType>();
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_k4.template modify<LMPHostType>();
k_k1.modify_host();
k_k2.modify_host();
k_k3.modify_host();
k_k4.modify_host();
}
/* ----------------------------------------------------------------------
@ -395,10 +396,10 @@ void DihedralOPLSKokkos<DeviceType>::read_restart(FILE *fp)
k_k4.h_view[i] = k4[i];
}
k_k1.template modify<LMPHostType>();
k_k2.template modify<LMPHostType>();
k_k3.template modify<LMPHostType>();
k_k4.template modify<LMPHostType>();
k_k1.modify_host();
k_k2.modify_host();
k_k3.modify_host();
k_k4.modify_host();
}
/* ----------------------------------------------------------------------

View File

@ -60,16 +60,15 @@ class DihedralOPLSKokkos : public DihedralOPLS {
const F_FLOAT &vb2x, const F_FLOAT &vb2y, const F_FLOAT &vb2z,
const F_FLOAT &vb3x, const F_FLOAT &vb3y, const F_FLOAT &vb3z) const;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
protected:
class NeighborKokkos *neighborKK;
typename AT::t_x_array_randomread x;
typename AT::t_f_array f;
typename AT::t_int_2d dihedrallist;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
typename ArrayTypes<DeviceType>::t_efloat_1d d_eatom;
typename ArrayTypes<DeviceType>::t_virial_array d_vatom;

View File

@ -34,6 +34,7 @@ static constexpr double SMALL = 0.001;
template<class DeviceType>
ImproperClass2Kokkos<DeviceType>::ImproperClass2Kokkos(LAMMPS *lmp) : ImproperClass2(lmp)
{
kokkosable = 1;
atomKK = (AtomKokkos *) atom;
neighborKK = (NeighborKokkos *) neighbor;
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
@ -110,7 +111,7 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
newton_bond = force->newton_bond;
h_warning_flag() = 0;
k_warning_flag.template modify<LMPHostType>();
k_warning_flag.modify_host();
k_warning_flag.template sync<DeviceType>();
copymode = 1;
@ -139,7 +140,7 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
// error check
k_warning_flag.template modify<DeviceType>();
k_warning_flag.template sync<LMPHostType>();
k_warning_flag.sync_host();
if (h_warning_flag())
error->warning(FLERR,"Improper problem");
@ -171,12 +172,12 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
k_eatom.template modify<DeviceType>();
k_eatom.template sync<LMPHostType>();
k_eatom.sync_host();
}
if (vflag_atom) {
k_vatom.template modify<DeviceType>();
k_vatom.template sync<LMPHostType>();
k_vatom.sync_host();
}
copymode = 0;
@ -918,17 +919,17 @@ void ImproperClass2Kokkos<DeviceType>::coeff(int narg, char **arg)
k_setflag_aa.h_view[i] = setflag_aa[i];
}
k_k0.template modify<LMPHostType>();
k_chi0.template modify<LMPHostType>();
k_aa_k1.template modify<LMPHostType>();
k_aa_k2.template modify<LMPHostType>();
k_aa_k3.template modify<LMPHostType>();
k_aa_theta0_1.template modify<LMPHostType>();
k_aa_theta0_2.template modify<LMPHostType>();
k_aa_theta0_3 .template modify<LMPHostType>();
k_setflag.template modify<LMPHostType>();
k_setflag_i.template modify<LMPHostType>();
k_setflag_aa.template modify<LMPHostType>();
k_k0.modify_host();
k_chi0.modify_host();
k_aa_k1.modify_host();
k_aa_k2.modify_host();
k_aa_k3.modify_host();
k_aa_theta0_1.modify_host();
k_aa_theta0_2.modify_host();
k_aa_theta0_3 .modify_host();
k_setflag.modify_host();
k_setflag_i.modify_host();
k_setflag_aa.modify_host();
}
/* ----------------------------------------------------------------------
@ -979,17 +980,17 @@ void ImproperClass2Kokkos<DeviceType>::read_restart(FILE *fp)
k_setflag_aa.h_view[i] = setflag_aa[i];
}
k_k0.template modify<LMPHostType>();
k_chi0.template modify<LMPHostType>();
k_aa_k1.template modify<LMPHostType>();
k_aa_k2.template modify<LMPHostType>();
k_aa_k3.template modify<LMPHostType>();
k_aa_theta0_1.template modify<LMPHostType>();
k_aa_theta0_2.template modify<LMPHostType>();
k_aa_theta0_3 .template modify<LMPHostType>();
k_setflag.template modify<LMPHostType>();
k_setflag_i.template modify<LMPHostType>();
k_setflag_aa.template modify<LMPHostType>();
k_k0.modify_host();
k_chi0.modify_host();
k_aa_k1.modify_host();
k_aa_k2.modify_host();
k_aa_k3.modify_host();
k_aa_theta0_1.modify_host();
k_aa_theta0_2.modify_host();
k_aa_theta0_3 .modify_host();
k_setflag.modify_host();
k_setflag_i.modify_host();
k_setflag_aa.modify_host();
}
/* ----------------------------------------------------------------------

View File

@ -71,6 +71,9 @@ class ImproperClass2Kokkos : public ImproperClass2 {
const F_FLOAT &vb2x, const F_FLOAT &vb2y, const F_FLOAT &vb2z,
const F_FLOAT &vb3x, const F_FLOAT &vb3y, const F_FLOAT &vb3z) const;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
protected:
class NeighborKokkos *neighborKK;
@ -78,9 +81,6 @@ class ImproperClass2Kokkos : public ImproperClass2 {
typename AT::t_x_array_randomread x;
typename Kokkos::View<double*[3],typename AT::t_f_array::array_layout,typename KKDevice<DeviceType>::value,Kokkos::MemoryTraits<Kokkos::Atomic> > f;
typename AT::t_int_2d improperlist;
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;