24 #if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
25 #include "Kokkos_Core.hpp"
39 const int myRank = Teuchos::rank(*comm);
41 if ((myRank == 1) || (myRank == 2)) {
68 out <<
"\n### Printing default report ###" << std::endl;
70 options.output_proc_minmax=
true;
71 options.output_histogram=
true;
72 options.num_histogram=2;
73 options.output_fraction=
false;
74 timer.
report(out, comm, options);
76 std::ostringstream os;
77 timer.
report(os, comm, options);
79 TEST_ASSERT(os.str().find(
"min=1, max=2, proc min=1, proc max=2") != std::string::npos);
80 TEST_ASSERT(os.str().find(
"<1, 1>") != std::string::npos);
81 TEST_ASSERT(os.str().find(
"min=0, max=3, proc min=0, proc max=3") != std::string::npos);
83 constexpr
double tol = 10.0*std::numeric_limits<double>::epsilon();
104 int main(
int argc,
char* argv[] )
109 #if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
110 Kokkos::initialize(argc,argv);
119 #if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
120 if (Kokkos::is_initialized())
bool isTimer(const std::string &flat_timer_name)
#define TEST_ASSERT(v1)
Assert the given statement is true.
void stop(const std::string &name, const bool pop_kokkos_profiling_region=true)
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
static Teuchos::RCP< const Comm< OrdinalType > > getComm()
Return the default global communicator.
double getMpiAverageCount(const std::string &flat_timer_name)
Initialize, finalize, and query the global MPI session.
static int runUnitTestsFromMain(int argc, char *argv[])
Run the unit tests from main() passing in (argc, argv).
void start(const std::string name, const bool push_kokkos_profiling_region=true)
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among ...
The basic timer used internally, uses std::chrono::high_resolution_clock.
static void setGloballyReduceTestResult(const bool globallyReduceUnitTestResult)
Set if the unit tests should reduce pass/fail across processes.
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
Set the stream to print only on the (MPI) process with the given rank.
const BaseTimer * findBaseTimer(const std::string &name) const
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
Assert the relative floating-point equality of rel_error(v1,v2) <= tol.
int main(int argc, char *argv[])
double getMpiAverageTime(const std::string &flat_timer_name)
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
void report(std::ostream &os)
Scope guard for Teuchos::Time, with MPI collective timer reporting.
Smart reference counting pointer class for automatic garbage collection.
This class allows one to push and pop timers on and off a stack.