Skip to content

Kokkos Comparison

Sam Reeve edited this page May 15, 2023 · 2 revisions

Cabana is intended to be used alongside Kokkos and extends it in many ways. Kokkos is intended for scientific computing in general, while Cabana is focused on particle applications.

This section is intended to highlight subtle differences between Kokkos and Cabana.

Some Cabana algorithms explicitly require Cabana::AoSoA or Cabana::Slice; this is planned to be extended to also include Kokkos::View for better flexibility in the future.

AoSoA vs. View

size vs. extent

The Cabana::AoSoA extends the Kokkos::View with an additional vector length dimension. This means that an AoSoA of particles has a rank one higher than an equivalent View, with an extra extent() equal to the chosen vector length. The AoSoA::size() and Slice::size() functions are intended to be used rather than directly using extent() in most cases.

rank vs. viewRank

For the same reason, the Slice::rank member variable is not equal to the underlying View::rank (it includes the extra vector length dimension). If needed, the Slice::viewRank() provides the actual rank of the underlying View.

Resizing

In addition, calling resize() on a Cabana::AoSoA will only reallocate memory and copy if additional space is needed and will not reduce capacity to match the exact size requested unless shrinkToFit() is called. This is in contrast to the Kokkos::View, which does not retain unused space on a resize

Clone this wiki locally