Skip to main content
`Ctrl`+`K`

# PETSCABORT

Call `MPI_Abort()` with an informative error code

## Synopsis

    #include <petscsys.h>
    PETSCABORT(MPI_Comm comm, PetscErrorCode ierr)

Collective; No Fortran Support

## Input Parameters

- comm - An MPI communicator, so that the error can be collective

- ierr - nonzero error code, see the list of standard error codes in include/petscerror.h

## Notes

If the option `-start_in_debugger` was used then this calls `abort()` to stop the program in the debugger.

if `PetscCIEnabledPortableErrorOutput` is set, which means the code is running in the PETSc test harness (make test), and `comm` is `MPI_COMM_WORLD` it strives to exit cleanly without calling `MPI_Abort()` and instead calling `MPI_Finalize()`.

This is currently only used when an error propagates up to the C `main()` program and is detected by a `PetscCall()`, `PetscCallMPI()`, or is set in `main()` with `SETERRQ()`. Abort calls such as `SETERRABORT()`, `PetscCheckAbort()`, `PetscCallMPIAbort()`, and `PetscCallAbort()` always call `MPI_Abort()` and do not have any special handling for the test harness.

## Developer Note

Should the other abort calls also pass through this call instead of calling `MPI_Abort()` directly?

## See Also

`PetscError()`, `PetscCall()`, `SETERRABORT()`, `PetscCheckAbort()`, `PetscCallMPIAbort()`, `PetscCall()`, `PetscCallMPI()`, `PetscCallAbort()`, `MPI_Abort()`, `PetscErrorCode`

## Level

advanced

## Location

include/petscerror.h

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages