42 #include <Teuchos_DefaultMpiComm.hpp>
50 if (err == MPI_SUCCESS) {
54 char rawErrString[MPI_MAX_ERROR_STRING];
56 (void) MPI_Error_string (err, rawErrString, &len);
57 return std::string (rawErrString);
62 void safeCommFree (MPI_Comm* comm) {
64 const int err = MPI_Finalized (&finalized);
67 if (err == MPI_SUCCESS && ! finalized) {
71 (void) MPI_Comm_free (comm);
75 int setCommErrhandler (MPI_Comm comm, MPI_Errhandler handler) {
77 return MPI_Comm_set_errhandler (comm, handler);
79 return MPI_Errhandler_set (comm, handler);
80 #endif // MPI_VERSION >= 2
std::string mpiErrorCodeToString(const int err)
Human-readable string version of the given MPI error code.