11 #include "Teuchos_GlobalMPISession.hpp"
12 #include "Kokkos_Core.hpp"
13 #include "Tpetra_Details_checkLaunchBlocking.hpp"
22 void finalizeKokkosIfNeeded() {
23 if(!Kokkos::is_finalized()) {
31 if (! Kokkos::is_initialized ()) {
32 std::vector<std::string> args = Teuchos::GlobalMPISession::getArgv ();
33 int narg =
static_cast<int> (args.size ());
35 std::vector<char*> args_c;
36 std::vector<std::unique_ptr<char[]>> args_;
37 for (
auto const& x : args) {
38 args_.emplace_back(
new char[x.size() + 1]);
39 char* ptr = args_.back().get();
40 strcpy(ptr, x.c_str());
41 args_c.push_back(ptr);
43 args_c.push_back(
nullptr);
45 Kokkos::initialize (narg, narg == 0 ?
nullptr : args_c.data ());
46 checkOldCudaLaunchBlocking();
48 std::atexit (finalizeKokkosIfNeeded);
52 Tpetra::Details::AddKokkosDeepCopyToTimeMonitor();
53 Tpetra::Details::AddKokkosFenceToTimeMonitor();
54 Tpetra::Details::AddKokkosFunctionsToTimeMonitor();
Declaration functions that use Kokkos' profiling library to add deep copies between memory spaces...
Declaration of Tpetra::Details::initializeKokkos.
void initializeKokkos()
Initialize Kokkos, using command-line arguments (if any) given to Teuchos::GlobalMPISession.