Commit 6b92826a authored by Stan Moore's avatar Stan Moore
Browse files

Remove Kokkos deprecated code

parent d5ec7629
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -113,14 +113,15 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
#ifdef KOKKOS_HAVE_CUDA
  if (ngpu <= 0)
    error->all(FLERR,"Kokkos has been compiled for CUDA but no GPUs are requested");

  Kokkos::HostSpace::execution_space::initialize(num_threads,numa);
  Kokkos::Cuda::SelectDevice select_device(device);
  Kokkos::Cuda::initialize(select_device);
#else
  LMPHostType::initialize(num_threads,numa);
#endif

  Kokkos::InitArguments args;
  args.num_threads = num_threads;
  args.num_numa = numa;
  args.device_id = device;

  Kokkos::initialize(args);

  // default settings for package kokkos command

  neighflag = FULL;
@@ -144,12 +145,7 @@ KokkosLMP::~KokkosLMP()
{
  // finalize Kokkos

#ifdef KOKKOS_HAVE_CUDA
  Kokkos::Cuda::finalize();
  Kokkos::HostSpace::execution_space::finalize();
#else
  LMPHostType::finalize();
#endif
  Kokkos::finalize();
}

/* ----------------------------------------------------------------------
+4 −1
Original line number Diff line number Diff line
@@ -111,7 +111,10 @@ void PairDPDfdtEnergyKokkos<DeviceType>::init_style()
#ifdef DPD_USE_RAN_MARS
  rand_pool.init(random,seed);
#else
  rand_pool.init(seed + comm->me,DeviceType::max_hardware_threads());
  typedef Kokkos::Experimental::UniqueToken<
    DeviceType, Kokkos::Experimental::UniqueTokenScope::Global> unique_token_type;
  unique_token_type unique_token;
  rand_pool.init(seed + comm->me,unique_token.size());
#endif
}

+12 −8
Original line number Diff line number Diff line
@@ -813,10 +813,10 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxComputeNoAtomics<NEIG
    return;
  }

  int tid = 0;
#ifndef KOKKOS_HAVE_CUDA
  tid = DeviceType::hardware_thread_id();
#endif
  typedef Kokkos::Experimental::UniqueToken<
    DeviceType, Kokkos::Experimental::UniqueTokenScope::Global> unique_token_type;
  unique_token_type unique_token;
  int tid = unique_token.acquire();

  int i,jj,jnum,itype,jtype;
  double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,evdwlOld,fpair;
@@ -1152,6 +1152,8 @@ void PairExp6rxKokkos<DeviceType>::operator()(TagPairExp6rxComputeNoAtomics<NEIG
  t_f(tid,i,2) += fz_i;
  t_uCG(tid,i) += uCG_i;
  t_uCGnew(tid,i) += uCGnew_i;

  unique_token.release(tid);
}

// Experimental thread-safe approach using duplicated data instead of atomics and
@@ -1181,10 +1183,10 @@ void PairExp6rxKokkos<DeviceType>::vectorized_operator(const int &ii, EV_FLOAT&
  Kokkos::View<E_FLOAT*, typename DAT::t_efloat_1d::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > a_uCG = uCG;
  Kokkos::View<E_FLOAT*, typename DAT::t_efloat_1d::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > a_uCGnew = uCGnew;

  int tid = 0;
#ifndef KOKKOS_HAVE_CUDA
  tid = DeviceType::hardware_thread_id();
#endif
  typedef Kokkos::Experimental::UniqueToken<
    DeviceType, Kokkos::Experimental::UniqueTokenScope::Global> unique_token_type;
  unique_token_type unique_token;
  int tid = unique_token.acquire();

  const int nRep = 12;
  const double shift = 1.05;
@@ -1612,6 +1614,8 @@ void PairExp6rxKokkos<DeviceType>::vectorized_operator(const int &ii, EV_FLOAT&
    t_uCG(tid,i) += uCG_i;
    t_uCGnew(tid,i) += uCGnew_i;
  }

  unique_token.release(tid);
}

template<class DeviceType>
+8 −4
Original line number Diff line number Diff line
@@ -55,11 +55,15 @@ class RandPoolWrap : protected Pointers {
#endif

    RandWrap rand_wrap;
    int tid = 0;
#ifndef KOKKOS_HAVE_CUDA
    tid = LMPDeviceType::hardware_thread_id();
#endif

    typedef Kokkos::Experimental::UniqueToken<
      LMPHostType, Kokkos::Experimental::UniqueTokenScope::Global> unique_token_type;

    unique_token_type unique_token;
    int tid = (int) unique_token.acquire();
    rand_wrap.rng = random_thr[tid];
    unique_token.release(tid);

    return rand_wrap;
  }