13 #ifdef HAVE_TEUCHOS_MPI
18 mpiErrorCodeToString (
const int errCode)
20 if (errCode == MPI_SUCCESS) {
24 char rawErrString[MPI_MAX_ERROR_STRING];
26 int err = MPI_Error_string (errCode, rawErrString, &len);
27 if (err != MPI_SUCCESS) {
31 if (MPI_MAX_ERROR_STRING > 0) {
32 rawErrString[0] =
'\0';
35 return std::string (rawErrString);
40 void safeCommFree (MPI_Comm* comm) {
48 const int err = MPI_Finalized (&finalized);
51 if (err == MPI_SUCCESS && ! finalized) {
55 (void) MPI_Comm_free (comm);
59 int setCommErrhandler (MPI_Comm comm, MPI_Errhandler handler) {
61 return MPI_Comm_set_errhandler (comm, handler);
63 return MPI_Errhandler_set (comm, handler);
64 #endif // MPI_VERSION >= 2
70 #endif // HAVE_TEUCHOS_MPI
Implementation of Teuchos wrappers for MPI.