Skip to content

Core Introduction

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

Cabana is an MPI+Kokkos performance portable library for particle-based simulations. The core Cabana library elements can be used by including Cabana_Core.hpp

Kokkos, as the underlying on-node runtime, must be initialized and finalized. If using MPI capabilities of Cabana, it should be initialized before Kokkos and finalized after Kokkos.

#include <Cabana_Core.hpp>
#include <iostream>

int main( int argc, char* argv[] )
{
    /* Kokkos::ScopeGuard initializes Kokkos and guarantees it is finalized. */
    Kokkos::ScopeGuard scope_guard(argc, argv);

    /* Any code using Cabana should be after the ScopeGuard is constructed. */
    std::cout << "Hello world from Cabana!" << std::endl;

    return 0;
}

See the Hello World Tutorial for an example of Kokkos initialization and finalization.

This is part of the Programming Guide series

Clone this wiki locally