Skip to content

Cabana and Particle-Based Simulations

Cabana (GitHub repository) is a header-only, MPI-aware C++ library that contains data structures and algorithms for particle-based simulations. Particle-based simulations typically implement finite element, volume, or difference methods to model a physics phenomenon. More information about those methods can be found here. The following key benchmarks use Cabana:
1. Beatnik: An in-house code that uses the finite difference method to model the interface surface between two fluids mixing together.
2. CabanaGhost: Bulk synchronous computation and communication on a regular mesh using the Game of Life.
3. CabanaMD: A proxy application for molecular dynamics.
4. ExaMPM: A proxy-application for the Material Point Method.

The Design of Cabana

The Cabana wiki contains descriptions and code examples of the contents of the library. This page will give a high-level overview of the features in Cabana. For more detailed information, the respective page on the Cabana wiki or tutorial code in Cabana will be linked. Cabana is split into two sections, Grid and Core, and uses the Kokkos library (Bootcamp Kokkos wiki page) to support GPU acceleration of its algorithms. Many of the data structures in Cabana are built from Kokkos::View objects.

Cabana includes unit tests and usage examples for everything in the library. Tests and examples referenced in the following sections can be built by setting Cabana CMake variables Cabana_ENABLE_EXAMPLES=ON and Cabana_ENABLE_TESTING=ON.

Grid

The Grid section (namespace Cabana::Grid) contains code to create and operate on distributed, regular grid-based meshes in 2D or 3D. Values can be assigned to nodes, cells, faces, and/or edges in the mesh using Cabana::Grid::Array objects. When the mesh is distributed, the Cabana::Grid::Halo class can be used with these arrays to gather and scatter data from unowned portions of the mesh. To see a working example of Grid Arrays and Halos, see Cabana/example/grid_tutorial/12_halo/halo_example.cpp.

Core

The Core section (namespace Cabana::Core) contains algorithms and data structures useful for non-uniform meshes. The most useful data structure is an Array of Structures of Arrays (AoSoA) (Cabana::AoSoA). An AoSoA is built from tuples and Structures of Arrays (SoA) (Cabana wiki: AoSoA). Other important objects include the Cabana::Distributor for sending data to remote processes (wiki page) and the Cabana::Halo for performing irregular halo exchanges (gather/scatters) with data that is not from a regular mesh (wiki page). The following are tutorial examples in Cabana showing how to create and use these objects:

  1. AoSoA: Cabana/example/core_tutorial/04_aosoa/aosoa_example.cpp
  2. AoSoA slices: Cabana/example/core_tutorial/05_slice/slice_example.cpp
  3. Distributor: Cabana/example/core_tutorial/11_migration/migration_example.cpp
  4. Export-driven Halo exchange: Cabana/example/core_tutorial/12_export_halo_exchange/export_halo_exchange_example.cpp
  5. Import-driven Halo exchange: Cabana/example/core_tutorial/12_import_halo_exchange/import_halo_exchange_example.cpp