Clear sharedsize for flat method

This commit is contained in:
Stan Moore
2020-04-24 09:59:29 -06:00
parent 0f9d8efe69
commit cb2a9e4329
2 changed files with 25 additions and 19 deletions

View File

@ -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

View File

@ -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 {