-
Notifications
You must be signed in to change notification settings - Fork 15
Particle Data Structures
The following are descriptions of the current implementations of the ParticleStructure
interface. Note that all structures allocate at least 5% extra space to reduce the number of structure re-allocations. However, this percentage can be changed using each structure's associated Input
constructor.
Compressed Sparse Row (CSR) uses the compressed sparse row format to store particle data.
-
policy
:Kokkos::TeamPolicy
wherepolicy.team_size()
is used to determine the thread team size forparallel_for
loops -
num_elements
:int
number of mesh elements -
num_particles
:int
total initial number of particles -
particles_per_element
:Kokkos::View<int>
whereparticles_per_element(i)
is the initial number of particles in elementi
-
element_gids
:Kokkos::View<long int>
whereelement_gids(i)
is the global id of elementi
-
new_particle_elements
: [OPTIONAL]Kokkos::View<int>
wherenew_particle_elements(i)
is the index of the element to associate particlei
innew_particle_info
-
new_particle_info
: [OPTIONAL] apumipic::ParticleStructure::MTVs
(MemberTypeViews) containing data for new particles
CSR's initial parameters can be set directly through the use of its constructor.
namespace ps = particle_structs;
using T0 = int;
using T1 = double[3];
using Types = ps::MemberTypes<T0, T1>;
using ExeSpace = Kokkos::DefaultExecutionSpace;
using MemSpace = ExeSpace::memory_space;
typedef ps::ParticleStructure<Types, MemSpace> PS;
using pumipic::lid_t;
using PS::kkLidView;
using PS::kkGidView;
using PS::MTVs;
// setup for ParticleStructure
lid_t team_size = 4;
lid_t num_elems = 5;
lid_t num_ptcls = 20;
Kokkos::TeamPolicy<ExeSpace> policy(num_elems, team_size);
kkLidView particles_per_element("particles_per_element", num_elems);
kkGidView element_gids("element_gids", num_elems);
Kokkos::parallel_for(num_elems,
KOKKOS_LAMBDA(const int& i) {
particles_per_element(i) = 4; // 4 particles per element
element_gids(i) = i; // set global ids
});
// initialize ParticleStructure (CSR) (20 particles)
PS* csr = new ps::CSR<Types, MemSpace>(policy, num_elems, num_ptcls, element_gids, particles_per_element);
CSR's initial parameters can also be set indirectly through the use of a separate CSR_Input
class. This allows for easy copying of parameters to multiple CSR structures and editing of extra padding to be allocated.
[Not currently implemented]
Sell-C-Sigma (SCS) uses a rotated and sorted CSR-format structure to store particle data.
-
policy
:Kokkos::TeamPolicy
wherepolicy.team_size()
is used to determine the maximum chunk size -
sigma
:int
variable used to determine amount of sorting (1 is NO SORTING,INT_MAX
is FULL SORTING) -
vertical_size
:int
variable used to split chunks into smaller groups for multiple thread teams per chunk -
num_elements
:int
number of mesh elements -
num_particles
:int
total initial number of particles -
particles_per_element
:Kokkos::View<int>
whereparticles_per_element(i)
is the initial number of particles in elementi
-
element_gids
:Kokkos::View<long int>
whereelement_gids(i)
is the global id of elementi
-
new_particle_elements
: [OPTIONAL]Kokkos::View<int>
wherenew_particle_elements(i)
is the index of the element to associate particlei
innew_particle_info
-
new_particle_info
: [OPTIONAL] apumipic::ParticleStructure::MTVs
(MemberTypeViews) containing data for new particles
SCS's initial parameters can be set directly through the use of its constructor.
namespace ps = particle_structs;
using T0 = int;
using T1 = double[3];
using Types = ps::MemberTypes<T0, T1>;
using ExeSpace = Kokkos::DefaultExecutionSpace;
using MemSpace = ExeSpace::memory_space;
typedef ps::ParticleStructure<Types, MemSpace> PS;
using pumipic::lid_t;
using PS::kkLidView;
using PS::kkGidView;
using PS::MTVs;
// setup for ParticleStructure
lid_t sigma = 1; // No sorting
//lid_t sigma = INT_MAX; // Full sorting
lid_t V = 8; // vertical slice size
lid_t max_chunk_size = 4;
lid_t num_elems = 5;
lid_t num_ptcls = 20;
Kokkos::TeamPolicy<ExeSpace> policy(num_elems, max_chunk_size);
kkLidView particles_per_element("particles_per_element", num_elems);
kkGidView element_gids("element_gids", num_elems);
Kokkos::parallel_for(num_elems,
KOKKOS_LAMBDA(const int& i) {
particles_per_element(i) = 4; // 4 particles per element
element_gids(i) = i; // set global ids
});
// initialize ParticleStructure (SCS) (20 particles)
PS* scs = new ps::SellCSigma<Types, MemSpace>(policy, sigma, V, num_elems, num_ptcls, element_gids, particles_per_element);
SCS's initial parameters can also be set indirectly through the use of a separate SCS_Input
class. This allows for easy copying of parameters to multiple SCS structures and editing of extra padding to be allocated. See scs_input.hpp for full list of editable variables.
namespace ps = particle_structs;
using T0 = int;
using T1 = double[3];
using Types = ps::MemberTypes<T0, T1>;
using ExeSpace = Kokkos::DefaultExecutionSpace;
using MemSpace = ExeSpace::memory_space;
typedef ps::ParticleStructure<Types, MemSpace> PS;
using pumipic::lid_t;
using PS::kkLidView;
using PS::kkGidView;
using PS::MTVs;
// setup for ParticleStructure
lid_t sigma = 1; // No sorting
//lid_t sigma = INT_MAX; // Full sorting
lid_t V = 8; // vertical slice size
lid_t max_chunk_size = 4;
lid_t num_elems = 5;
lid_t num_ptcls = 20;
Kokkos::TeamPolicy<ExeSpace> policy(num_elems, max_chunk_size);
kkLidView particles_per_element("particles_per_element", num_elems);
kkGidView element_gids("element_gids", num_elems);
Kokkos::parallel_for(num_elems,
KOKKOS_LAMBDA(const int& i) {
particles_per_element(i) = 4; // 4 particles per element
element_gids(i) = i; // set global ids
});
// initialize ParticleStructure (SCS) (20 particles)
pumipic::SCS_Input<Types> input(policy, sigma, V, num_elems, num_ptcls, element_gids, particles_per_element);
//input.extra_padding = 0.5; // set extra padding to 50% (default 5%)
PS* scs1 = new ps::SellCSigma<Types, MemSpace>(input);
PS* scs2 = new ps::SellCSigma<Types, MemSpace>(input);
CabanaM (CabM) uses a Cabana AoSoA to store particle data, and uses a CSR-style offset array to denote which SoAs are allocated for which mesh element.
-
policy
:Kokkos::TeamPolicy
-
num_elements
:int
number of mesh elements -
num_particles
:int
total initial number of particles -
particles_per_element
:Kokkos::View<int>
whereparticles_per_element(i)
is the initial number of particles in elementi
-
element_gids
:Kokkos::View<long int>
whereelement_gids(i)
is the global id of elementi
-
new_particle_elements
: [OPTIONAL]Kokkos::View<int>
wherenew_particle_elements(i)
is the index of the element to associate particlei
innew_particle_info
-
new_particle_info
: [OPTIONAL] apumipic::ParticleStructure::MTVs
(MemberTypeViews) containing data for new particles
CabM's initial parameters can be set directly through the use of its constructor.
namespace ps = particle_structs;
using T0 = int;
using T1 = double[3];
using Types = ps::MemberTypes<T0, T1>;
using ExeSpace = Kokkos::DefaultExecutionSpace;
using MemSpace = ExeSpace::memory_space;
typedef ps::ParticleStructure<Types, MemSpace> PS;
using pumipic::lid_t;
using PS::kkLidView;
using PS::kkGidView;
using PS::MTVs;
// setup for ParticleStructure
lid_t num_elems = 5;
lid_t num_ptcls = 20;
Kokkos::TeamPolicy<ExeSpace> policy(num_elems, 4); // team_size is arbitrary
kkLidView particles_per_element("particles_per_element", num_elems);
kkGidView element_gids("element_gids", num_elems);
Kokkos::parallel_for(num_elems,
KOKKOS_LAMBDA(const int& i) {
particles_per_element(i) = 4; // 4 particles per element
element_gids(i) = i; // set global ids
});
// initialize ParticleStructure (CSR) (20 particles)
PS* cabm = new ps::CabM<Types, MemSpace>(policy, num_elems, num_ptcls, element_gids, particles_per_element);
CabM's initial parameters can also be set indirectly through the use of a separate CabM_Input
class. This allows for easy copying of parameters to multiple CabM structures and editing of extra padding to be allocated. See cabm_input.hpp for full list of editable variables.
namespace ps = particle_structs;
using T0 = int;
using T1 = double[3];
using Types = ps::MemberTypes<T0, T1>;
using ExeSpace = Kokkos::DefaultExecutionSpace;
using MemSpace = ExeSpace::memory_space;
typedef ps::ParticleStructure<Types, MemSpace> PS;
using pumipic::lid_t;
using PS::kkLidView;
using PS::kkGidView;
using PS::MTVs;
// setup for ParticleStructure
lid_t num_elems = 5;
lid_t num_ptcls = 20;
Kokkos::TeamPolicy<ExeSpace> policy(num_elems, 4); // team_size is arbitrary
kkLidView particles_per_element("particles_per_element", num_elems);
kkGidView element_gids("element_gids", num_elems);
Kokkos::parallel_for(num_elems,
KOKKOS_LAMBDA(const int& i) {
particles_per_element(i) = 4; // 4 particles per element
element_gids(i) = i; // set global ids
});
// initialize ParticleStructure (CabM) (20 particles)
pumipic::CabM_Input<Types> input(policy, num_elems, num_ptcls, element_gids, particles_per_element);
//input.extra_padding = 0.5; // set extra padding to 50% (default 5%)
PS* cabm1 = new ps::CabM<Types, MemSpace>(input);
PS* cabm2 = new ps::CabM<Types, MemSpace>(input);