In the event of a catastrophic error, the usual way out is call MPI_Abort(MPI_COMM_WORLD, errcode, ierr). In most implementations, this will kill all tasks. In less harsh situations, you can make sure that all tasks are aware of the state, and then all of them gracefully excite with MPI_Finalize.
source
share