Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Kokkos::finalize

Jeff Miles edited this page May 1, 2020 · 1 revision

Kokkos::finalize

Header File: Kokkos_Core.hpp

Shut down all enabled Kokkos backends and free all associated resources. This function should be called after calling all other Kokkos API functions, including Kokkos object destructors.

Programs are ill-formed if they do not call this function after calling Kokkos::initialize.

Usage:

   Kokkos::finalize();

Interface

  Kokkos::finalize();

Parameters:

  • None

Requirements

  • Kokkos::finalize must be called before MPI_Finalize if Kokkos is used in an MPI context.
  • Kokkos::finalize must be called after user initialized Kokkos objects are out of scope.

Semantics

  • Kokkos::is_initialized() should return false after calling Kokkos::finalize

Example

int main(int argc, char** argv) {
  Kokkos::initialize(argc, argv);

  // add scoping to ensure my_view destructor is called before Kokkos::finalize  
  {
     Kokkos::View<double*> my_view("my_view", 10);
  }
 
  Kokkos::finalize();
  
}
Clone this wiki locally