ECP-copa / Cabana

Performance-portable library for particle-based simulations
Other
188 stars 51 forks source link

Integration of Constants into AoSoA Arrays: Seeking Guidance on Approach #750

Open dineshadepu opened 2 weeks ago

dineshadepu commented 2 weeks ago

Hi all,

Is there a way to add constants to the AoSoA array? Currently, when creating an AoSoA, we assign a property to each particle. However, I have a few properties that apply to the entire group of particles and have a length of 3, such as the center of mass. If these constants were stored in the AoSoA and passed around to functions, it would simplify the computation of interactions among the particles using these constants. Otherwise, I have to create these arrays separately on the GPU and pass them to the function for computing interactions.

Does my approach seem sensible? Or is passing these arrays separately a more idiomatic way to approach this in Cabana?

Thank you very much for your help!

streeve commented 2 weeks ago

For now, you could certainly build a Kokkos::Array or Kokkos::View for those parameters as you mentioned. I think it's reasonable to consider a particle type-mapping being included in a new Cabana object, but I don't think the AoSoA is the right place. That new class would just hold both the AoSoA particle data and the type map and a few convenience functions to enable treating those just like other particle data. I'll link to this issue if I make any progress on this

dineshadepu commented 2 weeks ago

Thank you. I will keep an eye out.