45 #ifdef HAVE_TEUCHOS_MPI
50 mpiErrorCodeToString (
const int errCode)
52 if (errCode == MPI_SUCCESS) {
56 char rawErrString[MPI_MAX_ERROR_STRING];
58 int err = MPI_Error_string (errCode, rawErrString, &len);
59 if (err != MPI_SUCCESS) {
63 if (MPI_MAX_ERROR_STRING > 0) {
64 rawErrString[0] =
'\0';
67 return std::string (rawErrString);
72 void safeCommFree (MPI_Comm* comm) {
80 const int err = MPI_Finalized (&finalized);
83 if (err == MPI_SUCCESS && ! finalized) {
87 (void) MPI_Comm_free (comm);
91 int setCommErrhandler (MPI_Comm comm, MPI_Errhandler handler) {
93 return MPI_Comm_set_errhandler (comm, handler);
95 return MPI_Errhandler_set (comm, handler);
96 #endif // MPI_VERSION >= 2
102 #endif // HAVE_TEUCHOS_MPI
Implementation of Teuchos wrappers for MPI.