forked from lijiext/lammps
Fix a few issues with Kokkos class2 files
This commit is contained in:
parent
69a8e19dc5
commit
c6c1852b3b
|
@ -35,6 +35,7 @@ class AngleClass2Kokkos : public AngleClass2 {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef DeviceType device_type;
|
typedef DeviceType device_type;
|
||||||
|
typedef ArrayTypes<DeviceType> AT;
|
||||||
typedef EV_FLOAT value_type;
|
typedef EV_FLOAT value_type;
|
||||||
|
|
||||||
AngleClass2Kokkos(class LAMMPS *);
|
AngleClass2Kokkos(class LAMMPS *);
|
||||||
|
@ -61,29 +62,29 @@ class AngleClass2Kokkos : public AngleClass2 {
|
||||||
|
|
||||||
class NeighborKokkos *neighborKK;
|
class NeighborKokkos *neighborKK;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
typename AT::t_x_array_randomread x;
|
||||||
typename ArrayTypes<DeviceType>::t_f_array f;
|
typename AT::t_f_array f;
|
||||||
typename ArrayTypes<DeviceType>::t_int_2d anglelist;
|
typename AT::t_int_2d anglelist;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::tdual_efloat_1d k_eatom;
|
typename AT::tdual_efloat_1d k_eatom;
|
||||||
typename ArrayTypes<DeviceType>::tdual_virial_array k_vatom;
|
typename AT::tdual_virial_array k_vatom;
|
||||||
typename ArrayTypes<DeviceType>::t_efloat_1d d_eatom;
|
typename AT::t_efloat_1d d_eatom;
|
||||||
typename ArrayTypes<DeviceType>::t_virial_array d_vatom;
|
typename AT::t_virial_array d_vatom;
|
||||||
|
|
||||||
int nlocal,newton_bond;
|
int nlocal,newton_bond;
|
||||||
int eflag,vflag;
|
int eflag,vflag;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_theta0;
|
typename AT::tdual_ffloat_1d k_theta0;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_k2, k_k3, k_k4;
|
typename AT::tdual_ffloat_1d k_k2, k_k3, k_k4;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_bb_k, k_bb_r1, k_bb_r2;
|
typename AT::tdual_ffloat_1d k_bb_k, k_bb_r1, k_bb_r2;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_ba_k1, k_ba_k2, k_ba_r1, k_ba_r2;
|
typename AT::tdual_ffloat_1d k_ba_k1, k_ba_k2, k_ba_r1, k_ba_r2;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_setflag, k_setflag_a, k_setflag_bb, k_setflag_ba;
|
typename AT::tdual_ffloat_1d k_setflag, k_setflag_a, k_setflag_bb, k_setflag_ba;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_theta0;
|
typename AT::t_ffloat_1d d_theta0;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_k2, d_k3, d_k4;
|
typename AT::t_ffloat_1d d_k2, d_k3, d_k4;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_bb_k, d_bb_r1, d_bb_r2;
|
typename AT::t_ffloat_1d d_bb_k, d_bb_r1, d_bb_r2;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_ba_k1, d_ba_k2, d_ba_r1, d_ba_r2;
|
typename AT::t_ffloat_1d d_ba_k1, d_ba_k2, d_ba_r1, d_ba_r2;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_setflag, d_setflag_a, d_setflag_bb, d_setflag_ba;
|
typename AT::t_ffloat_1d d_setflag, d_setflag_a, d_setflag_bb, d_setflag_ba;
|
||||||
|
|
||||||
virtual void allocate();
|
virtual void allocate();
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,18 +66,18 @@ void BondClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||||
// reallocate per-atom arrays if necessary
|
// reallocate per-atom arrays if necessary
|
||||||
|
|
||||||
if (eflag_atom) {
|
if (eflag_atom) {
|
||||||
if(k_eatom.dimension_0()<maxeatom) {
|
//if(k_eatom.dimension_0()<maxeatom) { // won't work without adding zero functor
|
||||||
memory->destroy_kokkos(k_eatom,eatom);
|
memory->destroy_kokkos(k_eatom,eatom);
|
||||||
memory->create_kokkos(k_eatom,eatom,maxeatom,"improper:eatom");
|
memory->create_kokkos(k_eatom,eatom,maxeatom,"improper:eatom");
|
||||||
d_eatom = k_eatom.d_view;
|
d_eatom = k_eatom.template view<DeviceType>();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
if (vflag_atom) {
|
if (vflag_atom) {
|
||||||
if(k_vatom.dimension_0()<maxvatom) {
|
//if(k_vatom.dimension_0()<maxvatom) { // won't work without adding zero functor
|
||||||
memory->destroy_kokkos(k_vatom,vatom);
|
memory->destroy_kokkos(k_vatom,vatom);
|
||||||
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"improper:vatom");
|
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"improper:vatom");
|
||||||
d_vatom = k_vatom.d_view;
|
d_vatom = k_vatom.template view<DeviceType>();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
// if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
||||||
|
|
|
@ -35,6 +35,7 @@ class BondClass2Kokkos : public BondClass2 {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef DeviceType device_type;
|
typedef DeviceType device_type;
|
||||||
|
typedef ArrayTypes<DeviceType> AT;
|
||||||
typedef EV_FLOAT value_type;
|
typedef EV_FLOAT value_type;
|
||||||
|
|
||||||
BondClass2Kokkos(class LAMMPS *);
|
BondClass2Kokkos(class LAMMPS *);
|
||||||
|
@ -60,7 +61,6 @@ class BondClass2Kokkos : public BondClass2 {
|
||||||
|
|
||||||
class NeighborKokkos *neighborKK;
|
class NeighborKokkos *neighborKK;
|
||||||
|
|
||||||
typedef ArrayTypes<DeviceType> AT;
|
|
||||||
typename AT::t_x_array_randomread x;
|
typename AT::t_x_array_randomread x;
|
||||||
typename Kokkos::View<double*[3],typename AT::t_f_array::array_layout,DeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > f;
|
typename Kokkos::View<double*[3],typename AT::t_f_array::array_layout,DeviceType,Kokkos::MemoryTraits<Kokkos::Atomic> > f;
|
||||||
typename AT::t_int_2d bondlist;
|
typename AT::t_int_2d bondlist;
|
||||||
|
|
|
@ -77,15 +77,15 @@ void DihedralClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||||
if (eflag_atom) {
|
if (eflag_atom) {
|
||||||
memory->destroy_kokkos(k_eatom,eatom);
|
memory->destroy_kokkos(k_eatom,eatom);
|
||||||
memory->create_kokkos(k_eatom,eatom,maxeatom,"dihedral:eatom");
|
memory->create_kokkos(k_eatom,eatom,maxeatom,"dihedral:eatom");
|
||||||
d_eatom = k_eatom.d_view;
|
d_eatom = k_eatom.template view<DeviceType>();
|
||||||
}
|
}
|
||||||
if (vflag_atom) {
|
if (vflag_atom) {
|
||||||
memory->destroy_kokkos(k_vatom,vatom);
|
memory->destroy_kokkos(k_vatom,vatom);
|
||||||
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"dihedral:vatom");
|
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"dihedral:vatom");
|
||||||
d_vatom = k_vatom.d_view;
|
d_vatom = k_vatom.template view<DeviceType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
atomKK->sync(execution_space,datamask_read);
|
//atomKK->sync(execution_space,datamask_read);
|
||||||
k_k1.template sync<DeviceType>();
|
k_k1.template sync<DeviceType>();
|
||||||
k_k2.template sync<DeviceType>();
|
k_k2.template sync<DeviceType>();
|
||||||
k_k3.template sync<DeviceType>();
|
k_k3.template sync<DeviceType>();
|
||||||
|
@ -125,8 +125,8 @@ void DihedralClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||||
k_setflag_aat.template sync<DeviceType>();
|
k_setflag_aat.template sync<DeviceType>();
|
||||||
k_setflag_bb13t.template sync<DeviceType>();
|
k_setflag_bb13t.template sync<DeviceType>();
|
||||||
|
|
||||||
if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
//if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
||||||
else atomKK->modified(execution_space,F_MASK);
|
//else atomKK->modified(execution_space,F_MASK);
|
||||||
|
|
||||||
x = atomKK->k_x.view<DeviceType>();
|
x = atomKK->k_x.view<DeviceType>();
|
||||||
f = atomKK->k_f.view<DeviceType>();
|
f = atomKK->k_f.view<DeviceType>();
|
||||||
|
|
|
@ -68,8 +68,8 @@ class DihedralClass2Kokkos : public DihedralClass2 {
|
||||||
|
|
||||||
DAT::tdual_efloat_1d k_eatom;
|
DAT::tdual_efloat_1d k_eatom;
|
||||||
DAT::tdual_virial_array k_vatom;
|
DAT::tdual_virial_array k_vatom;
|
||||||
DAT::t_efloat_1d d_eatom;
|
typename AT::t_efloat_1d d_eatom;
|
||||||
DAT::t_virial_array d_vatom;
|
typename AT::t_virial_array d_vatom;
|
||||||
|
|
||||||
int nlocal,newton_bond;
|
int nlocal,newton_bond;
|
||||||
int eflag,vflag;
|
int eflag,vflag;
|
||||||
|
@ -78,29 +78,29 @@ class DihedralClass2Kokkos : public DihedralClass2 {
|
||||||
typename AT::t_int_scalar d_warning_flag;
|
typename AT::t_int_scalar d_warning_flag;
|
||||||
HAT::t_int_scalar h_warning_flag;
|
HAT::t_int_scalar h_warning_flag;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_k2, k_k3, k_k1;
|
typename AT::tdual_ffloat_1d k_k2, k_k3, k_k1;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_phi1, k_phi2, k_phi3;
|
typename AT::tdual_ffloat_1d k_phi1, k_phi2, k_phi3;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_mbt_f1, k_mbt_f2, k_mbt_f3, k_mbt_r0;
|
typename AT::tdual_ffloat_1d k_mbt_f1, k_mbt_f2, k_mbt_f3, k_mbt_r0;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_ebt_f1_1, k_ebt_f2_1, k_ebt_f3_1, k_ebt_r0_1;
|
typename AT::tdual_ffloat_1d k_ebt_f1_1, k_ebt_f2_1, k_ebt_f3_1, k_ebt_r0_1;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_ebt_f1_2, k_ebt_f2_2, k_ebt_f3_2, k_ebt_r0_2;
|
typename AT::tdual_ffloat_1d k_ebt_f1_2, k_ebt_f2_2, k_ebt_f3_2, k_ebt_r0_2;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_at_f1_1, k_at_f2_1, k_at_f3_1, k_at_theta0_1;
|
typename AT::tdual_ffloat_1d k_at_f1_1, k_at_f2_1, k_at_f3_1, k_at_theta0_1;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_at_f1_2, k_at_f2_2, k_at_f3_2, k_at_theta0_2;
|
typename AT::tdual_ffloat_1d k_at_f1_2, k_at_f2_2, k_at_f3_2, k_at_theta0_2;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_aat_k, k_aat_theta0_1, k_aat_theta0_2;
|
typename AT::tdual_ffloat_1d k_aat_k, k_aat_theta0_1, k_aat_theta0_2;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_bb13t_k, k_bb13t_r10, k_bb13t_r30;
|
typename AT::tdual_ffloat_1d k_bb13t_k, k_bb13t_r10, k_bb13t_r30;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_setflag_d, k_setflag_mbt, k_setflag_ebt;
|
typename AT::tdual_ffloat_1d k_setflag_d, k_setflag_mbt, k_setflag_ebt;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_setflag_at, k_setflag_aat, k_setflag_bb13t;
|
typename AT::tdual_ffloat_1d k_setflag_at, k_setflag_aat, k_setflag_bb13t;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_k2, d_k3, d_k1;
|
typename AT::t_ffloat_1d d_k2, d_k3, d_k1;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_phi1, d_phi2, d_phi3;
|
typename AT::t_ffloat_1d d_phi1, d_phi2, d_phi3;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_mbt_f1, d_mbt_f2, d_mbt_f3, d_mbt_r0;
|
typename AT::t_ffloat_1d d_mbt_f1, d_mbt_f2, d_mbt_f3, d_mbt_r0;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_ebt_f1_1, d_ebt_f2_1, d_ebt_f3_1, d_ebt_r0_1;
|
typename AT::t_ffloat_1d d_ebt_f1_1, d_ebt_f2_1, d_ebt_f3_1, d_ebt_r0_1;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_ebt_f1_2, d_ebt_f2_2, d_ebt_f3_2, d_ebt_r0_2;
|
typename AT::t_ffloat_1d d_ebt_f1_2, d_ebt_f2_2, d_ebt_f3_2, d_ebt_r0_2;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_at_f1_1, d_at_f2_1, d_at_f3_1, d_at_theta0_1;
|
typename AT::t_ffloat_1d d_at_f1_1, d_at_f2_1, d_at_f3_1, d_at_theta0_1;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_at_f1_2, d_at_f2_2, d_at_f3_2, d_at_theta0_2;
|
typename AT::t_ffloat_1d d_at_f1_2, d_at_f2_2, d_at_f3_2, d_at_theta0_2;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_aat_k, d_aat_theta0_1, d_aat_theta0_2;
|
typename AT::t_ffloat_1d d_aat_k, d_aat_theta0_1, d_aat_theta0_2;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_bb13t_k, d_bb13t_r10, d_bb13t_r30;
|
typename AT::t_ffloat_1d d_bb13t_k, d_bb13t_r10, d_bb13t_r30;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_setflag_d, d_setflag_mbt, d_setflag_ebt;
|
typename AT::t_ffloat_1d d_setflag_d, d_setflag_mbt, d_setflag_ebt;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_setflag_at, d_setflag_aat, d_setflag_bb13t;
|
typename AT::t_ffloat_1d d_setflag_at, d_setflag_aat, d_setflag_bb13t;
|
||||||
|
|
||||||
virtual void allocate();
|
virtual void allocate();
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,21 +77,21 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||||
// reallocate per-atom arrays if necessary
|
// reallocate per-atom arrays if necessary
|
||||||
|
|
||||||
if (eflag_atom) {
|
if (eflag_atom) {
|
||||||
if(k_eatom.dimension_0()<maxeatom) {
|
//if(k_eatom.dimension_0()<maxeatom) { // won't work without adding zero functor
|
||||||
memory->destroy_kokkos(k_eatom,eatom);
|
memory->destroy_kokkos(k_eatom,eatom);
|
||||||
memory->create_kokkos(k_eatom,eatom,maxeatom,"improper:eatom");
|
memory->create_kokkos(k_eatom,eatom,maxeatom,"improper:eatom");
|
||||||
d_eatom = k_eatom.d_view;
|
d_eatom = k_eatom.template view<DeviceType>();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
if (vflag_atom) {
|
if (vflag_atom) {
|
||||||
if(k_vatom.dimension_0()<maxvatom) {
|
//if(k_vatom.dimension_0()<maxvatom) { // won't work without adding zero functor
|
||||||
memory->destroy_kokkos(k_vatom,vatom);
|
memory->destroy_kokkos(k_vatom,vatom);
|
||||||
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"improper:vatom");
|
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"improper:vatom");
|
||||||
d_vatom = k_vatom.d_view;
|
d_vatom = k_vatom.template view<DeviceType>();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
atomKK->sync(execution_space,datamask_read);
|
//atomKK->sync(execution_space,datamask_read);
|
||||||
k_k0.template sync<DeviceType>();
|
k_k0.template sync<DeviceType>();
|
||||||
k_chi0.template sync<DeviceType>();
|
k_chi0.template sync<DeviceType>();
|
||||||
k_aa_k1.template sync<DeviceType>();
|
k_aa_k1.template sync<DeviceType>();
|
||||||
|
@ -104,8 +104,8 @@ void ImproperClass2Kokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||||
k_setflag_i.template sync<DeviceType>();
|
k_setflag_i.template sync<DeviceType>();
|
||||||
k_setflag_aa.template sync<DeviceType>();
|
k_setflag_aa.template sync<DeviceType>();
|
||||||
|
|
||||||
if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
//if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
||||||
else atomKK->modified(execution_space,F_MASK);
|
//else atomKK->modified(execution_space,F_MASK);
|
||||||
|
|
||||||
x = atomKK->k_x.view<DeviceType>();
|
x = atomKK->k_x.view<DeviceType>();
|
||||||
f = atomKK->k_f.view<DeviceType>();
|
f = atomKK->k_f.view<DeviceType>();
|
||||||
|
|
|
@ -79,8 +79,8 @@ class ImproperClass2Kokkos : public ImproperClass2 {
|
||||||
|
|
||||||
DAT::tdual_efloat_1d k_eatom;
|
DAT::tdual_efloat_1d k_eatom;
|
||||||
DAT::tdual_virial_array k_vatom;
|
DAT::tdual_virial_array k_vatom;
|
||||||
DAT::t_efloat_1d d_eatom;
|
typename AT::t_efloat_1d d_eatom;
|
||||||
DAT::t_virial_array d_vatom;
|
typename AT::t_virial_array d_vatom;
|
||||||
|
|
||||||
int nlocal,newton_bond;
|
int nlocal,newton_bond;
|
||||||
int eflag,vflag;
|
int eflag,vflag;
|
||||||
|
@ -89,13 +89,13 @@ class ImproperClass2Kokkos : public ImproperClass2 {
|
||||||
typename AT::t_int_scalar d_warning_flag;
|
typename AT::t_int_scalar d_warning_flag;
|
||||||
HAT::t_int_scalar h_warning_flag;
|
HAT::t_int_scalar h_warning_flag;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_k0,k_chi0;
|
typename AT::tdual_ffloat_1d k_k0,k_chi0;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_aa_k1,k_aa_k2,k_aa_k3,k_aa_theta0_1,k_aa_theta0_2,k_aa_theta0_3;
|
typename AT::tdual_ffloat_1d k_aa_k1,k_aa_k2,k_aa_k3,k_aa_theta0_1,k_aa_theta0_2,k_aa_theta0_3;
|
||||||
typename ArrayTypes<DeviceType>::tdual_ffloat_1d k_setflag_i,k_setflag_aa,k_setflag;
|
typename AT::tdual_ffloat_1d k_setflag_i,k_setflag_aa,k_setflag;
|
||||||
|
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_k0,d_chi0;
|
typename AT::t_ffloat_1d d_k0,d_chi0;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_aa_k1,d_aa_k2,d_aa_k3,d_aa_theta0_1,d_aa_theta0_2,d_aa_theta0_3;
|
typename AT::t_ffloat_1d d_aa_k1,d_aa_k2,d_aa_k3,d_aa_theta0_1,d_aa_theta0_2,d_aa_theta0_3;
|
||||||
typename ArrayTypes<DeviceType>::t_ffloat_1d d_setflag_i,d_setflag_aa,d_setflag;
|
typename AT::t_ffloat_1d d_setflag_i,d_setflag_aa,d_setflag;
|
||||||
|
|
||||||
virtual void allocate();
|
virtual void allocate();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue