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

Clear sharedsize for flat method

parent 0f9d8efe
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -219,12 +219,12 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
#endif

    if (GHOST) {
      NPairKokkosBuildFunctorGhost<DeviceType,HALF_NEIGH> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
      NPairKokkosBuildFunctorGhost<DeviceType,HALF_NEIGH> f(data);
      Kokkos::parallel_for(nall, f);
    } else {
      if (newton_pair) {
        if (SIZE) {
          NPairKokkosBuildFunctorSize<DeviceType,TRI?0:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
          NPairKokkosBuildFunctorSize<DeviceType,TRI?1:HALF_NEIGH,1,TRI> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
#ifdef KOKKOS_ENABLE_CUDA
          if (ExecutionSpaceFromDevice<DeviceType>::space == Device) {
            int team_size = atoms_per_bin*factor;
@@ -232,7 +232,10 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
            if (team_size <= team_size_max) {
              Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
              Kokkos::parallel_for(config, f);
            } else Kokkos::parallel_for(nall, f); // fall back to flat method
            } else { // fall back to flat method
              f.sharedsize = 0;
              Kokkos::parallel_for(nall, f);
            }
          } else
            Kokkos::parallel_for(nall, f);
#else
@@ -247,7 +250,10 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
            if (team_size <= team_size_max) {
              Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
              Kokkos::parallel_for(config, f);
            } else Kokkos::parallel_for(nall, f); // fall back to flat method
            } else { // fall back to flat method
              f.sharedsize = 0;
              Kokkos::parallel_for(nall, f);
            }
          } else
            Kokkos::parallel_for(nall, f);
#else
@@ -264,7 +270,10 @@ void NPairKokkos<DeviceType,HALF_NEIGH,GHOST,TRI,SIZE>::build(NeighList *list_)
            if (team_size <= team_size_max) {
              Kokkos::TeamPolicy<DeviceType> config((mbins+factor-1)/factor,team_size);
              Kokkos::parallel_for(config, f);
            } else Kokkos::parallel_for(nall, f); // fall back to flat method
            } else { // fall back to flat method
              f.sharedsize = 0;
              Kokkos::parallel_for(nall, f);
            }
          } else
            Kokkos::parallel_for(nall, f);
#else
+11 −14
Original line number Diff line number Diff line
@@ -379,11 +379,11 @@ struct NPairKokkosBuildFunctor {
  typedef DeviceType device_type;

  const NeighborKokkosExecute<DeviceType> c;
  const size_t sharedsize;
  size_t sharedsize;

  NPairKokkosBuildFunctor(const NeighborKokkosExecute<DeviceType> &_c,
                             const size_t _sharedsize):c(_c),
                             sharedsize(_sharedsize) {};
                             size_t _sharedsize):c(_c),
                             sharedsize(_sharedsize) {}

  KOKKOS_INLINE_FUNCTION
  void operator() (const int & i) const {
@@ -404,11 +404,11 @@ struct NPairKokkosBuildFunctor<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
  typedef LMPHostType device_type;

  const NeighborKokkosExecute<LMPHostType> c;
  const size_t sharedsize;
  size_t sharedsize;

  NPairKokkosBuildFunctor(const NeighborKokkosExecute<LMPHostType> &_c,
                             const size_t _sharedsize):c(_c),
                             sharedsize(_sharedsize) {};
                             size_t _sharedsize):c(_c),
                             sharedsize(_sharedsize) {}

  KOKKOS_INLINE_FUNCTION
  void operator() (const int & i) const {
@@ -423,11 +423,8 @@ struct NPairKokkosBuildFunctorGhost {
  typedef DeviceType device_type;

  const NeighborKokkosExecute<DeviceType> c;
  const size_t sharedsize;

  NPairKokkosBuildFunctorGhost(const NeighborKokkosExecute<DeviceType> &_c,
                             const size_t _sharedsize):c(_c),
                             sharedsize(_sharedsize) {};
  NPairKokkosBuildFunctorGhost(const NeighborKokkosExecute<DeviceType> &_c):c(_c) {}

  KOKKOS_INLINE_FUNCTION
  void operator() (const int & i) const {
@@ -440,10 +437,10 @@ struct NPairKokkosBuildFunctorSize {
  typedef DeviceType device_type;

  const NeighborKokkosExecute<DeviceType> c;
  const size_t sharedsize;
  size_t sharedsize;

  NPairKokkosBuildFunctorSize(const NeighborKokkosExecute<DeviceType> &_c,
                              const size_t _sharedsize): c(_c), sharedsize(_sharedsize) {};
                              size_t _sharedsize): c(_c), sharedsize(_sharedsize) {}

  KOKKOS_INLINE_FUNCTION
  void operator() (const int & i) const {
@@ -464,10 +461,10 @@ struct NPairKokkosBuildFunctorSize<LMPHostType,HALF_NEIGH,GHOST_NEWTON,TRI> {
  typedef LMPHostType device_type;

  const NeighborKokkosExecute<LMPHostType> c;
  const size_t sharedsize;
  size_t sharedsize;

  NPairKokkosBuildFunctorSize(const NeighborKokkosExecute<LMPHostType> &_c,
                              const size_t _sharedsize): c(_c), sharedsize(_sharedsize) {};
                              size_t _sharedsize): c(_c), sharedsize(_sharedsize) {}

  KOKKOS_INLINE_FUNCTION
  void operator() (const int & i) const {