#include <petscerror.h> void PetscCallAbort(MPI_Comm comm, PetscErrorCode ierr)Collective on comm
| comm | - the MPI communicator on which to abort | |
| ierr | - nonzero error code, see the list of standard error codes in include/petscerror.h |
As per MPI_Abort semantics the communicator passed must be valid, although there is currently no attempt made at handling any potential errors from MPI_Abort(). Note that while MPI_Abort() is required to terminate only those processes which reside on comm, it is often the case that MPI_Abort() terminates *all* processes.
PetscErrorCode boom(void) { return PETSC_ERR_MEM; }
void foo(void)
{
PetscCallAbort(PETSC_COMM_WORLD,boom()); // OK, does not return a type
}
double bar(void)
{
PetscCallAbort(PETSC_COMM_WORLD,boom()); // OK, does not return a type
}
PetscCallAbort(MPI_COMM_NULL,boom()); // ERROR, communicator should be valid
struct baz
{
baz()
{
PetscCallAbort(PETSC_COMM_SELF,boom()); // OK
}
~baz()
{
PetscCallAbort(PETSC_COMM_SELF,boom()); // OK (in fact the only way to handle PETSc errors)
}
};