51 #ifdef HAVE_TEUCHOSCORE_KOKKOSCORE
56 # include <type_traits>
57 #endif // HAVE_TEUCHOSCORE_KOKKOSCORE
74 int globalSumSuccessInt = -1;
75 int localSuccessInt = (success ? 0 : 1);
76 MPI_Allreduce(&localSuccessInt, &globalSumSuccessInt, 1,
77 MPI_INT, MPI_SUM, MPI_COMM_WORLD);
87 ECHO(::MPI_Comm_size(MPI_COMM_WORLD, &numProcs));
90 ECHO(::MPI_Comm_rank(MPI_COMM_WORLD, &procRank));
103 out <<
"*** Just make sure the basic barrier does not hang or something.\n";
130 for (
int k = 0; k < numProcs; ++k) {
131 allInts_expected[k] = k+1;
140 #ifdef HAVE_TEUCHOSCORE_KOKKOSCORE
149 auto argvCopy = GlobalMPISession::getArgv ();
150 const auto numArgs = argvCopy.size ();
151 static_assert (std::is_integral<std::decay<decltype (numArgs)>::type>::value,
152 "The return type of getArgv has a size() method, "
153 "but it does not return an integer.");
156 const auto arg0 = argvCopy[0];
157 static_assert (std::is_convertible<std::decay<decltype (arg0)>::type,
159 "The return type of getArgv must have an operator[](int) "
160 "that returns a type convertible to std::string.");
163 #endif // HAVE_TEUCHOSCORE_KOKKOSCORE
static int getRank()
The rank of the calling process in MPI_COMM_WORLD.
#define TEST_ASSERT(v1)
Assert the given statement is true.
static int getNProc()
The number of processes in MPI_COMM_WORLD.
#define ECHO(statement)
Echo the given statement before it is executed.
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
Initialize, finalize, and query the global MPI session.
TEUCHOS_UNIT_TEST(ConstNonconstObjectContainer, create)
void globalReduceSuccess(bool &success, FancyOStream &out)
static bool mpiIsFinalized()
Return whether MPI was already finalized.
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among ...
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
void resize(size_type new_size, const value_type &x=value_type())
static int sum(int localVal)
Sum a set of integers across processes.
Templated array class derived from the STL std::vector.
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
static void barrier()
Call MPI_Barrier() on MPI_COMM_WORLD.
static bool mpiIsInitialized()
Return whether MPI was initialized.
static void allGather(int localVal, const ArrayView< int > &allVals)
Global all-to-all of a set of integers across processes.