From: Wolfgang Bangerth Date: Tue, 23 May 2017 21:35:49 +0000 (-0600) Subject: Use MPI_Abort instead of std::abort. X-Git-Tag: v9.0.0-rc1~1572^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6651405eacd0f6856559890163e351ba2ab1517;p=dealii.git Use MPI_Abort instead of std::abort. --- diff --git a/source/base/exceptions.cc b/source/base/exceptions.cc index 456962a9d0..6f7c217dd0 100644 --- a/source/base/exceptions.cc +++ b/source/base/exceptions.cc @@ -410,9 +410,28 @@ namespace deal_II_exceptions { if (dealii::deal_II_exceptions::abort_on_exception) { - // Print the error message and bail out: + // first print the error std::cerr << exc.what() << std::endl; + + // then bail out. if in MPI mode, bring down the entire + // house by asking the MPI system to do a best-effort + // operation at also terminating all of the other MPI + // processes. this is useful because if only one process + // runs into an assertion, then that may lead to deadlocks + // if the others don't recognize this, or at the very least + // delay their termination until they realize that their + // communication with the job that died times out. +#ifdef DEAL_II_WITH_MPI + int is_initialized; + MPI_Initialized(&is_initialized); + if (is_initialized) + MPI_Abort (MPI_COMM_WORLD, + /* return code = */ 255); + else + std::abort (); +#else std::abort(); +#endif } else if (nothrow) {