1 #ifndef TRANSPOSE_PARTICLES_HPP
2 #define TRANSPOSE_PARTICLES_HPP
6 template<
class DataType>
8 const std::size_t PTL_N_DBL =
sizeof( Cabana::Tuple<DataType>)/8;
14 int team_size = VEC_LEN;
18 int league_size = n_vec;
20 typedef Kokkos::View<double[VEC_LEN*PTL_N_DBL],ExSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>> PtlVec;
21 size_t shmem_size = PtlVec::shmem_size();
23 Kokkos::TeamPolicy<ExSpace> (league_size, team_size).set_scratch_size(
KOKKOS_TEAM_SCRATCH_OPT,Kokkos::PerTeam(shmem_size)),
24 KOKKOS_LAMBDA (Kokkos::TeamPolicy<ExSpace>::member_type team_member){
28 int ivec = team_member.league_rank();
29 int ith = team_member.team_rank();
32 for(
int idbl = ith; idbl<VEC_LEN*PTL_N_DBL; idbl+=team_size){
33 shmem_ptl_vec(idbl) = vptl[ivec].
data[idbl];
37 for(
int iptl = ith; iptl<VEC_LEN; iptl+=team_size){
38 for(
int iprop = 0; iprop<PTL_N_DBL; iprop++){
39 vptl[ivec].
data[iprop*VEC_LEN + iptl] = shmem_ptl_vec(iptl*PTL_N_DBL + iprop);
47 template<
class DataType>
49 const std::size_t PTL_N_DBL =
sizeof( Cabana::Tuple<DataType>)/8;
55 int team_size = VEC_LEN;
59 int league_size = n_vec;
61 typedef Kokkos::View<double[VEC_LEN*PTL_N_DBL],ExSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>> PtlVec;
62 size_t shmem_size = PtlVec::shmem_size();
64 Kokkos::TeamPolicy<ExSpace> (league_size, team_size).set_scratch_size(
KOKKOS_TEAM_SCRATCH_OPT,Kokkos::PerTeam(shmem_size)),
65 KOKKOS_LAMBDA (Kokkos::TeamPolicy<ExSpace>::member_type team_member){
69 int ivec = team_member.league_rank();
70 int ith = team_member.team_rank();
73 for(
int iptl = ith; iptl<VEC_LEN; iptl+=team_size){
74 for(
int iprop = 0; iprop<PTL_N_DBL; iprop++){
75 shmem_ptl_vec(iptl*PTL_N_DBL + iprop) = vptl[ivec].
data[iprop*VEC_LEN + iptl];
80 for(
int idbl = ith; idbl<VEC_LEN*PTL_N_DBL; idbl+=team_size){
81 vptl[ivec].
data[idbl] = shmem_ptl_vec(idbl);
Definition: particles.hpp:134
double data[T *VEC_LEN]
Definition: particles.hpp:135
void transpose_particles_from_AoSoA_to_AoS(Cabana::AoSoA< DataType, DeviceType, VEC_LEN > &local_particles, int ioffset, int n_vec)
Definition: transpose_particles.hpp:48
void transpose_particles_from_AoS_to_AoSoA(Cabana::AoSoA< DataType, DeviceType, VEC_LEN > &local_particles, int ioffset, int n_vec)
Definition: transpose_particles.hpp:7
#define KOKKOS_TEAM_SCRATCH_OPT
Definition: space_settings.hpp:77
void parallel_for(const std::string name, int n_ptl, Function func, Option option, HostAoSoA aosoa_h, DeviceAoSoA aosoa_d)
Definition: streamed_parallel_for.hpp:252