Commit a062944d authored by Stan Moore's avatar Stan Moore
Browse files

Fix execution space issues

parent a641289d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
#ifdef ATOM_CLASS

AtomStyle(dpd/kk,AtomVecDPDKokkos)
AtomStyle(dpd/kk/device,AtomVecDPDKokkos)
AtomStyle(dpd/kk/host,AtomVecDPDKokkos)

#else

+6 −6
Original line number Diff line number Diff line
@@ -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;
}
+10 −10
Original line number Diff line number Diff line
@@ -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;
+8 −6
Original line number Diff line number Diff line
@@ -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    ;
+3 −3
Original line number Diff line number Diff line
@@ -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);
Loading