19 #ifdef HAVE_TEUCHOSCORE_KOKKOS
24 # include <type_traits>
25 #endif // HAVE_TEUCHOSCORE_KOKKOS
42 int globalSumSuccessInt = -1;
43 int localSuccessInt = (success ? 0 : 1);
44 MPI_Allreduce(&localSuccessInt, &globalSumSuccessInt, 1,
45 MPI_INT, MPI_SUM, MPI_COMM_WORLD);
55 ECHO(::MPI_Comm_size(MPI_COMM_WORLD, &numProcs));
58 ECHO(::MPI_Comm_rank(MPI_COMM_WORLD, &procRank));
71 out <<
"*** Just make sure the basic barrier does not hang or something.\n";
98 for (
int k = 0; k < numProcs; ++k) {
99 allInts_expected[k] = k+1;
108 #ifdef HAVE_TEUCHOSCORE_KOKKOS
117 auto argvCopy = GlobalMPISession::getArgv ();
118 const auto numArgs = argvCopy.size ();
119 static_assert (std::is_integral<std::decay<decltype (numArgs)>::type>::value,
120 "The return type of getArgv has a size() method, "
121 "but it does not return an integer.");
124 const auto arg0 = argvCopy[0];
125 static_assert (std::is_convertible<std::decay<decltype (arg0)>::type,
127 "The return type of getArgv must have an operator[](int) "
128 "that returns a type convertible to std::string.");
131 #endif // HAVE_TEUCHOSCORE_KOKKOS
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.