From 4591f55b9b9f0716a675efe5ae942a0f0763b30a Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 5 Jan 2017 18:10:03 +0100 Subject: [PATCH] Workaround OpenMPI problem in mpi_exceptions --- source/base/exceptions.cc | 28 +++++---- tests/base/mpi_exceptions.mpirun=1.output | 2 +- .../base/mpi_exceptions.mpirun=1.output.mpich | 32 +++++----- .../mpi_exceptions.mpirun=1.output.mpich3-2 | 61 +++++++++++++++++++ ...pi_exceptions.mpirun=1.output.openmpi1-6-5 | 61 +++++++++++++++++++ 5 files changed, 156 insertions(+), 28 deletions(-) create mode 100644 tests/base/mpi_exceptions.mpirun=1.output.mpich3-2 create mode 100644 tests/base/mpi_exceptions.mpirun=1.output.openmpi1-6-5 diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index 7f32809772..3a795cbb6b 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -357,18 +357,24 @@ namespace StandardExceptions error_name[0] = '\0'; int resulting_length = MPI_MAX_ERROR_STRING; - // get the string name of the error code by first converting it to an error - // class. - int error_class = 0; - int ierr = MPI_Error_class (error_code, &error_class); - - // Check the output of the error printing functions. If either MPI function - // fails we should just print a less descriptive message. - bool error_name_known = ierr == MPI_SUCCESS; - if (error_name_known) + bool error_name_known = false; + // workaround for Open MPI 1.6.5 not accepting + // MPI_ERR_LASTCODE in MPI_Error_class + if (error_code < MPI_ERR_LASTCODE) { - ierr = MPI_Error_string (error_class, error_name, &resulting_length); - error_name_known = error_name_known && (ierr == MPI_SUCCESS); + // get the string name of the error code by first converting it to an + // error class. + int error_class = 0; + int ierr = MPI_Error_class (error_code, &error_class); + error_name_known = (ierr == MPI_SUCCESS); + + // Check the output of the error printing functions. If either MPI + // function fails we should just print a less descriptive message. + if (error_name_known) + { + ierr = MPI_Error_string (error_class, error_name, &resulting_length); + error_name_known = error_name_known && (ierr == MPI_SUCCESS); + } } out << "deal.II encountered an error while calling an MPI function." diff --git a/tests/base/mpi_exceptions.mpirun=1.output b/tests/base/mpi_exceptions.mpirun=1.output index dcd5592654..aecd6bbaaa 100644 --- a/tests/base/mpi_exceptions.mpirun=1.output +++ b/tests/base/mpi_exceptions.mpirun=1.output @@ -57,5 +57,5 @@ The description of the error provided by MPI is "MPI_ERR_INTERN: internal error" The numerical value of the original error code is 17. DEAL:: deal.II encountered an error while calling an MPI function. -The description of the error provided by MPI is "MPI_ERR_UNKNOWN: unknown error". +This error code is not equal to any of the standard MPI error codes. The numerical value of the original error code is 92. diff --git a/tests/base/mpi_exceptions.mpirun=1.output.mpich b/tests/base/mpi_exceptions.mpirun=1.output.mpich index 8da187c170..9b369cabaa 100644 --- a/tests/base/mpi_exceptions.mpirun=1.output.mpich +++ b/tests/base/mpi_exceptions.mpirun=1.output.mpich @@ -2,60 +2,60 @@ DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid buffer pointer". -The numerical value of the original error code was 1. +The numerical value of the original error code is 1. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid count". -The numerical value of the original error code was 2. +The numerical value of the original error code is 2. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid datatype". -The numerical value of the original error code was 3. +The numerical value of the original error code is 3. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid tag". -The numerical value of the original error code was 4. +The numerical value of the original error code is 4. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid communicator". -The numerical value of the original error code was 5. +The numerical value of the original error code is 5. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid rank". -The numerical value of the original error code was 6. +The numerical value of the original error code is 6. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid MPI_Request". -The numerical value of the original error code was 19. +The numerical value of the original error code is 19. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid root". -The numerical value of the original error code was 7. +The numerical value of the original error code is 7. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid group". -The numerical value of the original error code was 8. +The numerical value of the original error code is 8. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid MPI_Op". -The numerical value of the original error code was 9. +The numerical value of the original error code is 9. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Invalid topology". -The numerical value of the original error code was 10. +The numerical value of the original error code is 10. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Unknown error. Please file a bug report.". -The numerical value of the original error code was 13. +The numerical value of the original error code is 13. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Other MPI error". -The numerical value of the original error code was 15. +The numerical value of the original error code is 15. DEAL:: deal.II encountered an error while calling an MPI function. The description of the error provided by MPI is "Internal MPI error!". -The numerical value of the original error code was 16. +The numerical value of the original error code is 16. DEAL:: deal.II encountered an error while calling an MPI function. -The description of the error provided by MPI is "Unknown error class". -The numerical value of the original error code was 1073741823. +This error code is not equal to any of the standard MPI error codes. +The numerical value of the original error code is 1073741823. diff --git a/tests/base/mpi_exceptions.mpirun=1.output.mpich3-2 b/tests/base/mpi_exceptions.mpirun=1.output.mpich3-2 new file mode 100644 index 0000000000..72ae6090e4 --- /dev/null +++ b/tests/base/mpi_exceptions.mpirun=1.output.mpich3-2 @@ -0,0 +1,61 @@ + +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid buffer pointer". +The numerical value of the original error code is 1. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid count". +The numerical value of the original error code is 2. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid datatype". +The numerical value of the original error code is 3. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid tag". +The numerical value of the original error code is 4. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid communicator". +The numerical value of the original error code is 5. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid rank". +The numerical value of the original error code is 6. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Request pending due to failure". +The numerical value of the original error code is 19. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid root". +The numerical value of the original error code is 7. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid group". +The numerical value of the original error code is 8. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid MPI_Op". +The numerical value of the original error code is 9. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Invalid topology". +The numerical value of the original error code is 10. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Unknown error. Please file a bug report.". +The numerical value of the original error code is 13. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Other MPI error". +The numerical value of the original error code is 15. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "Internal MPI error!". +The numerical value of the original error code is 16. +DEAL:: +deal.II encountered an error while calling an MPI function. +This error code is not equal to any of the standard MPI error codes. +The numerical value of the original error code is 1073741823. diff --git a/tests/base/mpi_exceptions.mpirun=1.output.openmpi1-6-5 b/tests/base/mpi_exceptions.mpirun=1.output.openmpi1-6-5 new file mode 100644 index 0000000000..0fa56b7365 --- /dev/null +++ b/tests/base/mpi_exceptions.mpirun=1.output.openmpi1-6-5 @@ -0,0 +1,61 @@ + +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_BUFFER: invalid buffer pointer". +The numerical value of the original error code is 1. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_COUNT: invalid count argument". +The numerical value of the original error code is 2. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_TYPE: invalid datatype". +The numerical value of the original error code is 3. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_TAG: invalid tag". +The numerical value of the original error code is 4. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_COMM: invalid communicator". +The numerical value of the original error code is 5. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_RANK: invalid rank". +The numerical value of the original error code is 6. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_REQUEST: invalid request". +The numerical value of the original error code is 7. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_ROOT: invalid root". +The numerical value of the original error code is 8. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_GROUP: invalid group". +The numerical value of the original error code is 9. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_OP: invalid reduce operation". +The numerical value of the original error code is 10. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_TOPOLOGY: invalid communicator topology". +The numerical value of the original error code is 11. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_UNKNOWN: unknown error". +The numerical value of the original error code is 14. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_OTHER: known error not in list". +The numerical value of the original error code is 16. +DEAL:: +deal.II encountered an error while calling an MPI function. +The description of the error provided by MPI is "MPI_ERR_INTERN: internal error". +The numerical value of the original error code is 17. +DEAL:: +deal.II encountered an error while calling an MPI function. +This error code is not equal to any of the standard MPI error codes. +The numerical value of the original error code is 54. -- 2.39.5