Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_Behavior.cpp
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
17namespace Teuchos {
18
19constexpr const std::string_view FENCE_TIMERS = "TEUCHOS_FENCE_TIMERS";
20
21constexpr 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
30bool Behavior::fenceTimers() {
31 constexpr bool defaultValue = Teuchos::fenceTimersDefault();
32
33 static bool value_ = defaultValue;
34 static bool initialized_ = false;
35 return Teuchos::idempotentlyGetEnvironmentVariable(value_, initialized_, Teuchos::FENCE_TIMERS,
36 defaultValue);
37}
38
39} // namespace Teuchos
40
41#endif
Standard test and throw macros.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
T idempotentlyGetEnvironmentVariable(T &value, bool &initialized, const std::string_view environmentVariableName, const T defaultValue)
Read a variable from the environment. Example usage: