10#include "Tpetra_Details_checkGlobalError.hpp"
12#include "Teuchos_CommHelpers.hpp"
13#include "Teuchos_TestForException.hpp"
20void checkGlobalError(std::ostream& globalOutputStream,
21 const bool localSuccess,
22 const char localErrorMessage[],
23 const char globalErrorMessageHeader[],
24 const Teuchos::Comm<int>& comm) {
26 using Teuchos::outArg;
27 using Teuchos::REDUCE_MIN;
28 using Teuchos::reduceAll;
30 int lclGood = localSuccess ? 1 : 0;
32 reduceAll(comm, REDUCE_MIN, lclGood, outArg(gblGood));
34 const int myRank = comm.getRank();
36 globalOutputStream << endl
37 << globalErrorMessageHeader
41 if (localSuccess || localErrorMessage ==
nullptr) {
44 std::ostringstream lclMsg;
46 constexpr int numStars = 60;
47 for (
int star = 0; star < numStars; ++star) {
51 <<
"Proc " << myRank <<
": "
52 << localErrorMessage << endl;
57 (void)MPI_Abort(MPI_COMM_WORLD, -1);
59 TEUCHOS_TEST_FOR_EXCEPTION(
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.