Fix execution space issues

This commit is contained in:
Stan Moore 2017-08-23 16:08:01 -06:00
parent a641289d5b
commit a062944de9
10 changed files with 55 additions and 51 deletions

View File

@ -14,6 +14,8 @@
#ifdef ATOM_CLASS
AtomStyle(dpd/kk,AtomVecDPDKokkos)
AtomStyle(dpd/kk/device,AtomVecDPDKokkos)
AtomStyle(dpd/kk/host,AtomVecDPDKokkos)
#else

View File

@ -197,7 +197,7 @@ void FixEOStableRXKokkos<DeviceType>::operator()(TagFixEOStableRXInit, const int
double tmp;
if (mask[i] & groupbit) {
if(dpdTheta[i] <= 0.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
energy_lookup(i,dpdTheta[i],tmp);
uCond[i] = 0.0;
uMech[i] = tmp;
@ -239,7 +239,7 @@ void FixEOStableRXKokkos<DeviceType>::operator()(TagFixEOStableRXTemperatureLook
if (mask[i] & groupbit){
temperature_lookup(i,uCond[i]+uMech[i]+uChem[i],dpdTheta[i]);
if (dpdTheta[i] <= 0.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
}
}
@ -387,11 +387,11 @@ void FixEOStableRXKokkos<DeviceType>::temperature_lookup(int id, double ui, doub
// Apply the Secant Method
for(it=0; it<maxit; it++){
if(fabs(f2-f1) < MY_EPSILON){
if(isnan(f1) || isnan(f2)) k_error_flag.d_view() = 2;
if(isnan(f1) || isnan(f2)) k_error_flag.template view<DeviceType>()() = 2;
temp = t1;
temp = MAX(temp,lo);
temp = MIN(temp,hi);
k_warning_flag.d_view() = 1;
k_warning_flag.template view<DeviceType>()() = 1;
break;
}
temp = t2 - f2*(t2-t1)/(f2-f1);
@ -404,9 +404,9 @@ void FixEOStableRXKokkos<DeviceType>::temperature_lookup(int id, double ui, doub
}
if(it==maxit){
if(isnan(f1) || isnan(f2) || isnan(ui) || isnan(thetai) || isnan(t1) || isnan(t2))
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
else
k_error_flag.d_view() = 3;
k_error_flag.template view<DeviceType>()() = 3;
}
thetai = temp;
}

View File

@ -1403,7 +1403,7 @@ void FixRxKokkos<DeviceType>::operator()(Tag_FixRxKokkos_solveSystems<ZERO_RATES
if (y[ispecies] < -1.0e-10)
{
//error->one(FLERR,"Computed concentration in RK solver is < -1.0e-10");
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
// This should be an atomic update.
}
else if (y[ispecies] < MY_EPSILON)
@ -1444,10 +1444,10 @@ void FixRxKokkos<DeviceType>::solve_reactions(const int vflag, const bool isPreF
{
const int count = nlocal + (newton_pair ? nghost : 0);
if (count > k_dpdThetaLocal.d_view.dimension_0()) {
if (count > k_dpdThetaLocal.template view<DeviceType>().dimension_0()) {
memory->destroy_kokkos (k_dpdThetaLocal, dpdThetaLocal);
memory->create_kokkos (k_dpdThetaLocal, dpdThetaLocal, count, "FixRxKokkos::dpdThetaLocal");
this->d_dpdThetaLocal = k_dpdThetaLocal.d_view;
this->d_dpdThetaLocal = k_dpdThetaLocal.template view<DeviceType>();
this->h_dpdThetaLocal = k_dpdThetaLocal.h_view;
}
@ -1514,8 +1514,8 @@ void FixRxKokkos<DeviceType>::solve_reactions(const int vflag, const bool isPreF
memory->create_kokkos (k_diagnosticCounterPerODEnSteps, diagnosticCounterPerODEnSteps, nlocal, "FixRxKokkos::diagnosticCounterPerODEnSteps");
memory->create_kokkos (k_diagnosticCounterPerODEnFuncs, diagnosticCounterPerODEnFuncs, nlocal, "FixRxKokkos::diagnosticCounterPerODEnFuncs");
d_diagnosticCounterPerODEnSteps = k_diagnosticCounterPerODEnSteps.d_view;
d_diagnosticCounterPerODEnFuncs = k_diagnosticCounterPerODEnFuncs.d_view;
d_diagnosticCounterPerODEnSteps = k_diagnosticCounterPerODEnSteps.template view<DeviceType>();
d_diagnosticCounterPerODEnFuncs = k_diagnosticCounterPerODEnFuncs.template view<DeviceType>();
Kokkos::parallel_for ( Kokkos::RangePolicy<DeviceType, Tag_FixRxKokkos_zeroCounterViews>(0,nlocal), *this);
//Kokkos::parallel_for ( nlocal,
@ -1619,7 +1619,7 @@ void FixRxKokkos<DeviceType>::solve_reactions(const int vflag, const bool isPreF
if (y[ispecies] < -1.0e-10)
{
//error->one(FLERR,"Computed concentration in RK solver is < -1.0e-10");
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
// This should be an atomic update.
}
else if (y[ispecies] < MY_EPSILON)
@ -1907,7 +1907,7 @@ void FixRxKokkos<DeviceType>::operator()(Tag_FixRxKokkos_firstPairOperator<WT_FL
{
// Create an atomic view of sumWeights and dpdThetaLocal. Only needed
// for Half/thread scenarios.
typedef Kokkos::View< E_FLOAT*, typename DAT::t_efloat_1d::array_layout, typename DAT::t_efloat_1d::device_type, Kokkos::MemoryTraits< AtomicF< NEIGHFLAG >::value> > AtomicViewType;
typedef Kokkos::View< E_FLOAT*, typename DAT::t_efloat_1d::array_layout, DeviceType, Kokkos::MemoryTraits< AtomicF< NEIGHFLAG >::value> > AtomicViewType;
AtomicViewType a_dpdThetaLocal = d_dpdThetaLocal;
AtomicViewType a_sumWeights = d_sumWeights;
@ -2044,10 +2044,10 @@ void FixRxKokkos<DeviceType>::computeLocalTemperature()
int sumWeightsCt = nlocal + (NEWTON_PAIR ? nghost : 0);
//memory->create_kokkos (k_sumWeights, sumWeights, sumWeightsCt, "FixRxKokkos::sumWeights");
if (sumWeightsCt > k_sumWeights.d_view.dimension_0()) {
if (sumWeightsCt > k_sumWeights.template view<DeviceType>().dimension_0()) {
memory->destroy_kokkos(k_sumWeights, sumWeights);
memory->create_kokkos (k_sumWeights, sumWeightsCt, "FixRxKokkos::sumWeights");
d_sumWeights = k_sumWeights.d_view;
d_sumWeights = k_sumWeights.template view<DeviceType>();
h_sumWeights = k_sumWeights.h_view;
}
@ -2083,7 +2083,7 @@ void FixRxKokkos<DeviceType>::computeLocalTemperature()
// Create an atomic view of sumWeights and dpdThetaLocal. Only needed
// for Half/thread scenarios.
//typedef Kokkos::View< E_FLOAT*, typename DAT::t_efloat_1d::array_layout, DeviceType, Kokkos::MemoryTraits< AtomicF< NEIGHFLAG >::value> > AtomicViewType;
typedef Kokkos::View< E_FLOAT*, typename DAT::t_efloat_1d::array_layout, typename DAT::t_efloat_1d::device_type, Kokkos::MemoryTraits< AtomicF< NEIGHFLAG >::value> > AtomicViewType;
typedef Kokkos::View< E_FLOAT*, typename DAT::t_efloat_1d::array_layout, DeviceType, Kokkos::MemoryTraits< AtomicF< NEIGHFLAG >::value> > AtomicViewType;
AtomicViewType a_dpdThetaLocal = d_dpdThetaLocal;
AtomicViewType a_sumWeights = d_sumWeights;

View File

@ -74,6 +74,8 @@ typedef struct s_CounterType CounterType;
template <typename DeviceType>
class FixRxKokkos : public FixRX {
public:
typedef ArrayTypes<DeviceType> AT;
FixRxKokkos(class LAMMPS *, int, char **);
virtual ~FixRxKokkos();
virtual void init();
@ -202,10 +204,10 @@ class FixRxKokkos : public FixRX {
DAT::tdual_int_1d k_diagnosticCounterPerODEnFuncs;
//typename ArrayTypes<DeviceType>::t_int_1d d_diagnosticCounterPerODEnSteps;
//typename ArrayTypes<DeviceType>::t_int_1d d_diagnosticCounterPerODEnFuncs;
typename DAT::t_int_1d d_diagnosticCounterPerODEnSteps;
typename DAT::t_int_1d d_diagnosticCounterPerODEnFuncs;
typename HAT::t_int_1d h_diagnosticCounterPerODEnSteps;
typename HAT::t_int_1d h_diagnosticCounterPerODEnFuncs;
typename AT::t_int_1d d_diagnosticCounterPerODEnSteps;
typename AT::t_int_1d d_diagnosticCounterPerODEnFuncs;
HAT::t_int_1d h_diagnosticCounterPerODEnSteps;
HAT::t_int_1d h_diagnosticCounterPerODEnFuncs;
template <typename KokkosDeviceType>
struct KineticsType
@ -233,8 +235,8 @@ class FixRxKokkos : public FixRX {
// Need a dual-view and device-view for dpdThetaLocal and sumWeights since they're used in several callbacks.
DAT::tdual_efloat_1d k_dpdThetaLocal, k_sumWeights;
//typename ArrayTypes<DeviceType>::t_efloat_1d d_dpdThetaLocal, d_sumWeights;
typename DAT::t_efloat_1d d_dpdThetaLocal, d_sumWeights;
typename HAT::t_efloat_1d h_dpdThetaLocal, h_sumWeights;
typename AT::t_efloat_1d d_dpdThetaLocal, d_sumWeights;
HAT::t_efloat_1d h_dpdThetaLocal, h_sumWeights;
typename ArrayTypes<DeviceType>::t_x_array_randomread d_x ;
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_type ;

View File

@ -169,12 +169,12 @@ void PairDPDfdtEnergyKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
memory->destroy_kokkos(k_eatom,eatom);
memory->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
d_eatom = k_eatom.d_view;
d_eatom = k_eatom.template view<DeviceType>();
}
if (vflag_atom) {
memory->destroy_kokkos(k_vatom,vatom);
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom");
d_vatom = k_vatom.d_view;
d_vatom = k_vatom.template view<DeviceType>();
}
x = atomKK->k_x.view<DeviceType>();
@ -645,7 +645,7 @@ void PairDPDfdtEnergyKokkos<DeviceType>::allocate()
d_cutsq = k_cutsq.template view<DeviceType>();
k_params = Kokkos::DualView<params_dpd**,Kokkos::LayoutRight,DeviceType>("PairDPDfdtEnergy::params",n+1,n+1);
params = k_params.d_view;
params = k_params.template view<DeviceType>();
if (!splitFDT_flag) {
memory->destroy(duCond);

View File

@ -139,8 +139,8 @@ class PairDPDfdtEnergyKokkos : public PairDPDfdtEnergy {
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
DAT::t_efloat_1d d_eatom;
DAT::t_virial_array d_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;
typename AT::t_neighbors_2d d_neighbors;
typename AT::t_int_1d_randomread d_ilist;

View File

@ -153,12 +153,12 @@ void PairExp6rxKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
if (eflag_atom) {
memory->destroy_kokkos(k_eatom,eatom);
memory->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
d_eatom = k_eatom.d_view;
d_eatom = k_eatom.template view<DeviceType>();
}
if (vflag_atom) {
memory->destroy_kokkos(k_vatom,vatom);
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom");
d_vatom = k_vatom.d_view;
d_vatom = k_vatom.template view<DeviceType>();
}
x = atomKK->k_x.view<DeviceType>();
@ -582,7 +582,7 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxCompute<NEIGHFLAG,NEW
if(rmOld12_ij!=0.0 && rmOld21_ij!=0.0){
if(alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
// A3. Compute some convenient quantities for evaluating the force
rminv = 1.0/rmOld12_ij;
@ -676,7 +676,7 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxCompute<NEIGHFLAG,NEW
if(rm12_ij!=0.0 && rm21_ij!=0.0){
if(alpha21_ij == 6.0 || alpha12_ij == 6.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
// A3. Compute some convenient quantities for evaluating the force
rminv = 1.0/rm12_ij;
@ -953,7 +953,7 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxComputeNoAtomics<NEIG
if(rmOld12_ij!=0.0 && rmOld21_ij!=0.0){
if(alphaOld21_ij == 6.0 || alphaOld12_ij == 6.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
// A3. Compute some convenient quantities for evaluating the force
rminv = 1.0/rmOld12_ij;
@ -1047,7 +1047,7 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxComputeNoAtomics<NEIG
if(rm12_ij!=0.0 && rm21_ij!=0.0){
if(alpha21_ij == 6.0 || alpha12_ij == 6.0)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
// A3. Compute some convenient quantities for evaluating the force
rminv = 1.0/rm12_ij;
@ -1592,7 +1592,7 @@ void PairExp6rxKokkos<DeviceType>::vectorized_operator(const int &ii, EV_FLOAT&
}
if (hasError)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
if (UseAtomics)
{
@ -1887,7 +1887,7 @@ void PairExp6rxKokkos<DeviceType>::getMixingWeights(int id,double &epsilon1,doub
}
}
if(nTotal < MY_EPSILON || nTotalold < MY_EPSILON)
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
// Compute the mole fraction of molecules within the fluid portion of the particle (One Fluid Approximation)
fractionOFAold = nMoleculesOFAold / nTotalold;
@ -2042,28 +2042,28 @@ void PairExp6rxKokkos<DeviceType>::getMixingWeights(int id,double &epsilon1,doub
// Check that no fractions are less than zero
if(fraction1 < 0.0 || nMolecules1 < 0.0){
if(fraction1 < -MY_EPSILON || nMolecules1 < -MY_EPSILON){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
nMolecules1 = 0.0;
fraction1 = 0.0;
}
if(fraction2 < 0.0 || nMolecules2 < 0.0){
if(fraction2 < -MY_EPSILON || nMolecules2 < -MY_EPSILON){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
nMolecules2 = 0.0;
fraction2 = 0.0;
}
if(fractionOld1 < 0.0 || nMoleculesOld1 < 0.0){
if(fractionOld1 < -MY_EPSILON || nMoleculesOld1 < -MY_EPSILON){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
nMoleculesOld1 = 0.0;
fractionOld1 = 0.0;
}
if(fractionOld2 < 0.0 || nMoleculesOld2 < 0.0){
if(fractionOld2 < -MY_EPSILON || nMoleculesOld2 < -MY_EPSILON){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
nMoleculesOld2 = 0.0;
fractionOld2 = 0.0;

View File

@ -161,8 +161,8 @@ class PairExp6rxKokkos : public PairExp6rx {
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
DAT::t_efloat_1d d_eatom;
DAT::t_virial_array d_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;
DAT::tdual_int_scalar k_error_flag;

View File

@ -155,12 +155,12 @@ void PairMultiLucyRXKokkos<DeviceType>::compute_style(int eflag_in, int vflag_in
if (eflag_atom) {
memory->destroy_kokkos(k_eatom,eatom);
memory->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
d_eatom = k_eatom.d_view;
d_eatom = k_eatom.template view<DeviceType>();
}
if (vflag_atom) {
memory->destroy_kokkos(k_vatom,vatom);
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom");
d_vatom = k_vatom.d_view;
d_vatom = k_vatom.template view<DeviceType>();
}
x = atomKK->k_x.view<DeviceType>();
@ -328,7 +328,7 @@ void PairMultiLucyRXKokkos<DeviceType>::operator()(TagPairMultiLucyRXCompute<NEI
//if (rho[i]*rho[i] < tb->innersq || rho[j]*rho[j] < tb->innersq){
if (rho[i]*rho[i] < d_table_const.innersq(tidx) || rho[j]*rho[j] < d_table_const.innersq(tidx)){
k_error_flag.d_view() = 1;
k_error_flag.template view<DeviceType>()() = 1;
}
if (TABSTYLE == LOOKUP) {
@ -337,7 +337,7 @@ void PairMultiLucyRXKokkos<DeviceType>::operator()(TagPairMultiLucyRXCompute<NEI
//jtable = static_cast<int> (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta);
jtable = static_cast<int> (((rho[j]*rho[j]) - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx));
if (itable >= tlm1 || jtable >= tlm1){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
//A_i = tb->f[itable];
A_i = d_table_const.f(tidx,itable);
@ -355,7 +355,7 @@ void PairMultiLucyRXKokkos<DeviceType>::operator()(TagPairMultiLucyRXCompute<NEI
//jtable = static_cast<int> (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta);
jtable = static_cast<int> ((rho[j]*rho[j] - d_table_const.innersq(tidx)) * d_table_const.invdelta(tidx));
if (itable >= tlm1 || jtable >= tlm1){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
if(itable<0) itable=0;
if(itable>=tlm1) itable=tlm1;
@ -380,7 +380,7 @@ void PairMultiLucyRXKokkos<DeviceType>::operator()(TagPairMultiLucyRXCompute<NEI
fpair = 0.5*(A_i + A_j)*(4.0-3.0*rfactor)*rfactor*rfactor*rfactor;
fpair /= sqrt(rsq);
} else k_error_flag.d_view() = 3;
} else k_error_flag.template view<DeviceType>()() = 3;
if (isite1 == isite2) fpair = sqrt(mixWtSite1old_i*mixWtSite2old_j)*fpair;
else fpair = (sqrt(mixWtSite1old_i*mixWtSite2old_j) + sqrt(mixWtSite2old_i*mixWtSite1old_j))*fpair;
@ -411,14 +411,14 @@ void PairMultiLucyRXKokkos<DeviceType>::operator()(TagPairMultiLucyRXCompute<NEI
evdwl = d_table_const.e(tidx,itable);
} else if (TABSTYLE == LINEAR) {
if (itable >= tlm1){
k_error_flag.d_view() = 2;
k_error_flag.template view<DeviceType>()() = 2;
}
if(itable==0) fraction_i=0.0;
//else fraction_i = (((rho[i]*rho[i]) - tb->rsq[itable]) * tb->invdelta);
else fraction_i = (((rho[i]*rho[i]) - d_table_const.rsq(tidx,itable)) * d_table_const.invdelta(tidx));
//evdwl = tb->e[itable] + fraction_i*tb->de[itable];
evdwl = d_table_const.e(tidx,itable) + fraction_i*d_table_const.de(tidx,itable);
} else k_error_flag.d_view() = 3;
} else k_error_flag.template view<DeviceType>()() = 3;
evdwl *=(pi*d_cutsq(itype,itype)*d_cutsq(itype,itype))/84.0;
evdwlOld = mixWtSite1old_i*evdwl;

View File

@ -167,8 +167,8 @@ class PairMultiLucyRXKokkos : public PairMultiLucyRX {
DAT::tdual_efloat_1d k_eatom;
DAT::tdual_virial_array k_vatom;
DAT::t_efloat_1d d_eatom;
DAT::t_virial_array d_vatom;
typename AT::t_efloat_1d d_eatom;
typename AT::t_virial_array d_vatom;
typename AT::t_neighbors_2d d_neighbors;
typename AT::t_int_1d_randomread d_ilist;