diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.h b/src/KOKKOS/atom_vec_dpd_kokkos.h index d108e58ae7..372404cc7d 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.h +++ b/src/KOKKOS/atom_vec_dpd_kokkos.h @@ -14,6 +14,8 @@ #ifdef ATOM_CLASS AtomStyle(dpd/kk,AtomVecDPDKokkos) +AtomStyle(dpd/kk/device,AtomVecDPDKokkos) +AtomStyle(dpd/kk/host,AtomVecDPDKokkos) #else diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp index 8487fd4c4f..552141ced2 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.cpp +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.cpp @@ -197,7 +197,7 @@ void FixEOStableRXKokkos::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()() = 1; energy_lookup(i,dpdTheta[i],tmp); uCond[i] = 0.0; uMech[i] = tmp; @@ -239,7 +239,7 @@ void FixEOStableRXKokkos::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()() = 1; } } @@ -387,11 +387,11 @@ void FixEOStableRXKokkos::temperature_lookup(int id, double ui, doub // Apply the Secant Method for(it=0; it()() = 2; temp = t1; temp = MAX(temp,lo); temp = MIN(temp,hi); - k_warning_flag.d_view() = 1; + k_warning_flag.template view()() = 1; break; } temp = t2 - f2*(t2-t1)/(f2-f1); @@ -404,9 +404,9 @@ void FixEOStableRXKokkos::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()() = 2; else - k_error_flag.d_view() = 3; + k_error_flag.template view()() = 3; } thetai = temp; } diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index f04b1a3a49..b1cfd20be2 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -1403,7 +1403,7 @@ void FixRxKokkos::operator()(Tag_FixRxKokkos_solveSystemsone(FLERR,"Computed concentration in RK solver is < -1.0e-10"); - k_error_flag.d_view() = 2; + k_error_flag.template view()() = 2; // This should be an atomic update. } else if (y[ispecies] < MY_EPSILON) @@ -1444,10 +1444,10 @@ void FixRxKokkos::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().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(); this->h_dpdThetaLocal = k_dpdThetaLocal.h_view; } @@ -1514,8 +1514,8 @@ void FixRxKokkos::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(); + d_diagnosticCounterPerODEnFuncs = k_diagnosticCounterPerODEnFuncs.template view(); Kokkos::parallel_for ( Kokkos::RangePolicy(0,nlocal), *this); //Kokkos::parallel_for ( nlocal, @@ -1619,7 +1619,7 @@ void FixRxKokkos::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()() = 2; // This should be an atomic update. } else if (y[ispecies] < MY_EPSILON) @@ -1907,7 +1907,7 @@ void FixRxKokkos::operator()(Tag_FixRxKokkos_firstPairOperator::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::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().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(); h_sumWeights = k_sumWeights.h_view; } @@ -2083,7 +2083,7 @@ void FixRxKokkos::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; diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 169a87a2f9..92b715f34d 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -74,6 +74,8 @@ typedef struct s_CounterType CounterType; template class FixRxKokkos : public FixRX { public: + typedef ArrayTypes 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::t_int_1d d_diagnosticCounterPerODEnSteps; //typename ArrayTypes::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 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::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::t_x_array_randomread d_x ; typename ArrayTypes::t_int_1d_randomread d_type ; diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp index 03bf1a8b61..c559ab412f 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp @@ -169,12 +169,12 @@ void PairDPDfdtEnergyKokkos::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(); } 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(); } x = atomKK->k_x.view(); @@ -645,7 +645,7 @@ void PairDPDfdtEnergyKokkos::allocate() d_cutsq = k_cutsq.template view(); k_params = Kokkos::DualView("PairDPDfdtEnergy::params",n+1,n+1); - params = k_params.d_view; + params = k_params.template view(); if (!splitFDT_flag) { memory->destroy(duCond); diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h index fcf4b33a7a..424779f839 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h @@ -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; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index b3e413428d..8d65be23af 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -153,12 +153,12 @@ void PairExp6rxKokkos::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(); } 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(); } x = atomKK->k_x.view(); @@ -582,7 +582,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxCompute()() = 1; // A3. Compute some convenient quantities for evaluating the force rminv = 1.0/rmOld12_ij; @@ -676,7 +676,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxCompute()() = 1; // A3. Compute some convenient quantities for evaluating the force rminv = 1.0/rm12_ij; @@ -953,7 +953,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxComputeNoAtomics()() = 1; // A3. Compute some convenient quantities for evaluating the force rminv = 1.0/rmOld12_ij; @@ -1047,7 +1047,7 @@ void PairExp6rxKokkos::operator()(TagPairExp6rxComputeNoAtomics()() = 1; // A3. Compute some convenient quantities for evaluating the force rminv = 1.0/rm12_ij; @@ -1592,7 +1592,7 @@ void PairExp6rxKokkos::vectorized_operator(const int &ii, EV_FLOAT& } if (hasError) - k_error_flag.d_view() = 1; + k_error_flag.template view()() = 1; if (UseAtomics) { @@ -1887,7 +1887,7 @@ void PairExp6rxKokkos::getMixingWeights(int id,double &epsilon1,doub } } if(nTotal < MY_EPSILON || nTotalold < MY_EPSILON) - k_error_flag.d_view() = 1; + k_error_flag.template view()() = 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::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()() = 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()() = 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()() = 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()() = 2; } nMoleculesOld2 = 0.0; fractionOld2 = 0.0; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.h b/src/KOKKOS/pair_exp6_rx_kokkos.h index 4c35c76851..5e44048ae2 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.h +++ b/src/KOKKOS/pair_exp6_rx_kokkos.h @@ -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; diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index 08e0f5096e..d9a4f1ab83 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -155,12 +155,12 @@ void PairMultiLucyRXKokkos::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(); } 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(); } x = atomKK->k_x.view(); @@ -328,7 +328,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXComputeinnersq || 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()() = 1; } if (TABSTYLE == LOOKUP) { @@ -337,7 +337,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); jtable = static_cast (((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()() = 2; } //A_i = tb->f[itable]; A_i = d_table_const.f(tidx,itable); @@ -355,7 +355,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute (((rho[j]*rho[j]) - tb->innersq) * tb->invdelta); jtable = static_cast ((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()() = 2; } if(itable<0) itable=0; if(itable>=tlm1) itable=tlm1; @@ -380,7 +380,7 @@ void PairMultiLucyRXKokkos::operator()(TagPairMultiLucyRXCompute()() = 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::operator()(TagPairMultiLucyRXCompute= tlm1){ - k_error_flag.d_view() = 2; + k_error_flag.template view()() = 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()() = 3; evdwl *=(pi*d_cutsq(itype,itype)*d_cutsq(itype,itype))/84.0; evdwlOld = mixWtSite1old_i*evdwl; diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h index 8556319531..b8ced4c847 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h @@ -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;