43#include "Teuchos_GlobalMPISession.hpp"
44#include "Kokkos_Core.hpp"
45#include "Tpetra_Details_checkLaunchBlocking.hpp"
53void finalizeKokkosIfNeeded() {
54 if(!Kokkos::is_finalized()) {
62 if (! Kokkos::is_initialized ()) {
63 std::vector<std::string> args = Teuchos::GlobalMPISession::getArgv ();
64 int narg =
static_cast<int> (args.size ());
66 std::vector<char*> args_c;
67 std::vector<std::unique_ptr<char[]>> args_;
68 for (
auto const& x : args) {
69 args_.emplace_back(
new char[x.size() + 1]);
70 char* ptr = args_.back().get();
71 strcpy(ptr, x.c_str());
72 args_c.push_back(ptr);
74 args_c.push_back(
nullptr);
76 Kokkos::initialize (narg, narg == 0 ?
nullptr : args_c.data ());
77 checkOldCudaLaunchBlocking();
79 std::atexit (finalizeKokkosIfNeeded);
Declaration of Tpetra::Details::initializeKokkos.
Implementation details of Tpetra.
void initializeKokkos()
Initialize Kokkos, using command-line arguments (if any) given to Teuchos::GlobalMPISession.
Namespace Tpetra contains the class and methods constituting the Tpetra library.