Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_Profiling.cpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
12// I don't like including everything, but currently (as of 19 Apr
13// 2017), Kokkos does not provide a public header file to get just the
14// Profiling hooks. Users are just supposed to include
15// Kokkos_Core.hpp.
16#include "Kokkos_Core.hpp"
17
18namespace Tpetra {
19namespace Details {
20
22 : kokkos_region_active_(false) {
23}
24
26 kokkos_region_active_ = false;
28 kokkos_region_active_ = true;
29 ::Kokkos::Profiling::pushRegion(name);
30 }
32 tm = Teuchos::rcp(new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(name)));
33}
34
35ProfilingRegion::ProfilingRegion(const char name[], const char group[]) {
36 kokkos_region_active_ = false;
37 const bool timeit = Behavior::timing(group);
38 if (timeit) {
40 kokkos_region_active_ = true;
41 ::Kokkos::Profiling::pushRegion(name);
42 }
44 tm = Teuchos::rcp(new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(name)));
45 }
46}
47
49 if (Behavior::profilingRegionUseKokkosProfiling() && kokkos_region_active_) {
50 ::Kokkos::Profiling::popRegion();
51 }
52}
53
54} // namespace Details
55} // namespace Tpetra
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.
Declaration of Tpetra::Details::Profiling, a scope guard for Kokkos Profiling.
Struct that holds views of the contents of a CrsMatrix.
static bool timing()
Whether Tpetra is in timing mode.
static bool profilingRegionUseTeuchosTimers()
Use Teuchos::Timer in Tpetra::ProfilingRegion.
static bool profilingRegionUseKokkosProfiling()
Use Kokkos::Profiling in Tpetra::ProfilingRegion.
ProfilingRegion()
Default constructor does not construct a region.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.