10 #include "Tpetra_Details_checkGlobalError.hpp"
12 #include "Teuchos_CommHelpers.hpp"
13 #include "Teuchos_TestForException.hpp"
21 checkGlobalError(std::ostream& globalOutputStream,
22 const bool localSuccess,
23 const char localErrorMessage[],
24 const char globalErrorMessageHeader[],
25 const Teuchos::Comm<int>& comm)
27 using Teuchos::outArg;
28 using Teuchos::REDUCE_MIN;
29 using Teuchos::reduceAll;
32 int lclGood = localSuccess ? 1 : 0;
34 reduceAll(comm, REDUCE_MIN, lclGood, outArg(gblGood));
36 const int myRank = comm.getRank();
38 globalOutputStream << endl << globalErrorMessageHeader
42 if (localSuccess || localErrorMessage ==
nullptr) {
46 std::ostringstream lclMsg;
48 constexpr
int numStars = 60;
49 for (
int star = 0; star < numStars; ++star) {
52 lclMsg << endl <<
"Proc " << myRank <<
": "
53 << localErrorMessage << endl;
57 #ifdef HAVE_TPETRA_MPI
58 (void) MPI_Abort(MPI_COMM_WORLD, -1);
60 TEUCHOS_TEST_FOR_EXCEPTION
61 (
true, std::runtime_error,
"Tpetra reports a global error.");
62 #endif // HAVE_TPETRA_MPI
Declaration of a function that prints strings from each process.
void gathervPrint(std::ostream &out, const std::string &s, const Teuchos::Comm< int > &comm)
On Process 0 in the given communicator, print strings from each process in that communicator, in rank order.