Skip to content

Inner Array Layout

Slattery, Stuart requested to merge (removed):array_layout into master

Adds the ability to assign a layout to the inner arrays for multidimensional particle data. For example, within a Struct-of-Arrays the velocity array could by as layout left ux,ux,ux,...,uy,uy,uy,...,uz,uz,uz,... or as layout right ux,uy,uz,ux,uy,uz,....

Instead of specifying an inner array size as a template parameter to the Cabana::AoSoA a user now specifies a Cabana::InnerArrayLayout. For example, to create an inner array of size 10 with layout left a user would do Cabana::InnerArrayLayout<10,Kokkos::LayoutLeft>

The previous implementation only allowed for layout right (C row-major ordering). It was found that running the performance test with CUDA gave a 2x speedup using layout left vs. layout right per the original results in #4 (closed) bringing the AoSoA speed up to 3x vs using the standard 1-d SoA for GPU implementations. Some sensible defaults have been added to Cabana::PerformanceTraits but more testing is needed.

This may also have implications for ease of linking with Fortran as a user could force layout left (at potentially the cost of performance) and then each array in the struct-of-arrays would appear as a Fortran array.

Edited by Slattery, Stuart

Merge request reports

Loading