Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_Behavior.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_BEHAVIOR_HPP
11 #define TEUCHOS_BEHAVIOR_HPP
12 
13 #include "Teuchos_Behavior.hpp"
14 #include "Teuchos_EnvVariables.hpp"
16 
17 namespace Teuchos {
18 
19 constexpr const std::string_view FENCE_TIMERS = "TEUCHOS_FENCE_TIMERS";
20 
21 constexpr bool fenceTimersDefault() {
22 #ifdef HAVE_TEUCHOS_TIMER_KOKKOS_FENCE
23  return true;
24 #else
25  return false;
26 #endif // HAVE_TEUCHOS_TIMER_KOKKOS_FENCE
27 }
28 
29 
31  constexpr bool defaultValue = Teuchos::fenceTimersDefault();
32 
33  static bool value_ = defaultValue;
34  static bool initialized_ = false;
36  defaultValue);
37 }
38 
39 } // namespace Teuchos
40 
41 #endif
constexpr const std::string_view FENCE_TIMERS
T idempotentlyGetEnvironmentVariable(T &value, bool &initialized, const std::string_view environmentVariableName, const T defaultValue)
Read a variable from the environment. Example usage:
static bool fenceTimers()
constexpr bool fenceTimersDefault()
Standard test and throw macros.