14 #ifdef HAVE_TEUCHOS_MPI
16 #endif // HAVE_TEUCHOS_MPI
24 using Teuchos::outArg;
27 using Teuchos::reduceAll;
28 using Clock = std::chrono::high_resolution_clock;
32 const int numProcs = comm->getSize ();
35 out <<
"This test requires at least 4 MPI processes." << std::endl;
39 const int myRank = comm->getRank();
43 Clock::time_point start_time = Clock::now();
48 std::this_thread::sleep_for (std::chrono::seconds(1));
50 time = std::chrono::duration_cast<std::chrono::duration<double>>(Clock::now() - start_time).count();
53 std::ostringstream out1;
55 std::string outStr = out1.str();
56 int test = (outStr.find(
"myTimer") != std::string::npos);
58 int test2 = (time >= 1.0);
59 test = std::min(test, test2);
71 using Teuchos::outArg;
74 using Teuchos::reduceAll;
78 const int numProcs = comm->getSize ();
81 out <<
"This test requires at least 4 MPI processes." << std::endl;
85 const int myRank = comm->getRank();
93 throw std::runtime_error(
"Test");
96 }
catch (
const std::runtime_error& e) {
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#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.
A TimeMonitor that waits at a MPI barrier before destruction.
static RCP< Time > getNewTimer(const std::string &name)
Return a new timer with the given name (class method).
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
Print summary statistics for all timers on the given communicator.
Implementation of Teuchos wrappers for MPI.
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
Abstract interface for distributed-memory communication.
Scope guard for Teuchos::Time, with MPI collective timer reporting.
Smart reference counting pointer class for automatic garbage collection.
Ptr< T > outArg(T &arg)
create a non-persisting (required or optional) output argument for a function call.