42#include "Tpetra_Details_checkGlobalError.hpp"
44#include "Teuchos_CommHelpers.hpp"
45#include "Teuchos_TestForException.hpp"
53checkGlobalError(std::ostream& globalOutputStream,
54 const bool localSuccess,
55 const char localErrorMessage[],
56 const char globalErrorMessageHeader[],
57 const Teuchos::Comm<int>& comm)
59 using Teuchos::outArg;
60 using Teuchos::REDUCE_MIN;
61 using Teuchos::reduceAll;
64 int lclGood = localSuccess ? 1 : 0;
66 reduceAll(comm, REDUCE_MIN, lclGood, outArg(gblGood));
68 const int myRank = comm.getRank();
70 globalOutputStream << endl << globalErrorMessageHeader
74 if (localSuccess || localErrorMessage ==
nullptr) {
78 std::ostringstream lclMsg;
80 constexpr int numStars = 60;
81 for (
int star = 0; star < numStars; ++star) {
84 lclMsg << endl <<
"Proc " << myRank <<
": "
85 << localErrorMessage << endl;
90 (void) MPI_Abort(MPI_COMM_WORLD, -1);
92 TEUCHOS_TEST_FOR_EXCEPTION
93 (
true, std::runtime_error,
"Tpetra reports a global error.");
Declaration of a function that prints strings from each process.
Implementation details of Tpetra.
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,...
Namespace Tpetra contains the class and methods constituting the Tpetra library.