Unverified Commit 5281dea6 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #2095 from stanmoore1/kk_snap_beta

Fix redundant computation in Kokkos Pair SNAP on GPUs
parents 58ca1dcf c67ca88b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public:
  void operator() (TagPairSNAPComputeDeidrjCPU,const typename Kokkos::TeamPolicy<DeviceType, TagPairSNAPComputeDeidrjCPU>::member_type& team) const;

  KOKKOS_INLINE_FUNCTION
  void operator() (TagPairSNAPBeta,const typename Kokkos::TeamPolicy<DeviceType, TagPairSNAPBeta>::member_type& team) const;
  void operator() (TagPairSNAPBeta,const int& ii) const;

  template<int NEIGHFLAG>
  KOKKOS_INLINE_FUNCTION
+3 −10
Original line number Diff line number Diff line
@@ -284,13 +284,8 @@ void PairSNAPKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
    }

    //Compute beta = dE_i/dB_i for all i in list
    {
      int vector_length = vector_length_default;
      int team_size = team_size_default;
      check_team_size_for<TagPairSNAPBeta>(chunk_size,team_size,vector_length);
      typename Kokkos::TeamPolicy<DeviceType,TagPairSNAPBeta> policy_beta(chunk_size,team_size,vector_length);
    typename Kokkos::RangePolicy<DeviceType,TagPairSNAPBeta> policy_beta(0,chunk_size);
    Kokkos::parallel_for("ComputeBeta",policy_beta,*this);
    }

    //ZeroYi
    {
@@ -424,10 +419,8 @@ void PairSNAPKokkos<DeviceType>::compute(int eflag_in, int vflag_in)

template<class DeviceType>
KOKKOS_INLINE_FUNCTION
void PairSNAPKokkos<DeviceType>::operator() (TagPairSNAPBeta,const typename Kokkos::TeamPolicy<DeviceType,TagPairSNAPBeta>::member_type& team) const {
void PairSNAPKokkos<DeviceType>::operator() (TagPairSNAPBeta,const int& ii) const {

  // TODO: use RangePolicy instead, or thread over ncoeff?
  int ii = team.league_rank();
  const int i = d_ilist[ii + chunk_offset];
  const int itype = type[i];
  const int ielem = d_map[itype];