11#include "Teuchos_GlobalMPISession.hpp"
12#include "Teuchos_oblackholestream.hpp"
13#include "Kokkos_Core.hpp"
14#include "Tpetra_Details_checkLaunchBlocking.hpp"
19#include "KokkosKernels_EagerInitialize.hpp"
24class HideOutputExceptOnProcess0 {
26 HideOutputExceptOnProcess0(std::ostream& stream,
29 , originalBuffer_(stream.rdbuf()) {
31 stream.rdbuf(blackHole_.rdbuf());
35 ~HideOutputExceptOnProcess0() {
36 stream_.rdbuf(originalBuffer_);
40 std::ostream& stream_;
41 decltype(std::cout.rdbuf()) originalBuffer_;
42 Teuchos::oblackholestream blackHole_;
45void finalizeKokkosIfNeeded() {
46 if (!Kokkos::is_finalized()) {
52 if (!Kokkos::is_initialized()) {
53 HideOutputExceptOnProcess0
hideCerr(std::cerr, myRank);
54 HideOutputExceptOnProcess0
hideCout(std::cout, myRank);
58 std::vector<std::string>
args = Teuchos::GlobalMPISession::getArgv();
59 int narg =
static_cast<int>(
args.size());
62 std::vector<std::unique_ptr<char[]>>
args_;
63 for (
auto const&
x :
args) {
64 args_.emplace_back(
new char[
x.size() + 1]);
77 checkOldCudaLaunchBlocking();
79 std::atexit(finalizeKokkosIfNeeded);
82 Tpetra::Details::AddKokkosDeepCopyToTimeMonitor();
83 Tpetra::Details::AddKokkosFenceToTimeMonitor();
84 Tpetra::Details::AddKokkosFunctionsToTimeMonitor();
88 KokkosKernels::eager_initialize();
Declaration functions that use Kokkos' profiling library to add deep copies between memory spaces,...
Declaration of Tpetra::Details::initializeKokkos.
Struct that holds views of the contents of a CrsMatrix.
Implementation details of Tpetra.
void initializeKokkos(int *argc, char ***argv, int myRank)
Initialize Kokkos, using command-line arguments (if any) given to Teuchos::GlobalMPISession.
Namespace Tpetra contains the class and methods constituting the Tpetra library.