:orphan:
# SETERRMPI
Macro to be called when an error has been detected within an MPI callback function No Fortran Support


## Synopsis
```
#include <petscsys.h>
PetscErrorCode SETERRMPI(MPI_Comm comm,PetscErrorCode ierr,char *message,...)
```
Collective


## Input Parameters

- ***comm -*** A communicator, use `PETSC_COMM_SELF` unless you know all ranks of another communicator will detect the error
- ***ierr -*** nonzero error code, see the list of standard error codes in include/petscerror.h
- ***message -*** error message





## Notes
This macro is FOR USE IN MPI CALLBACK FUNCTIONS ONLY, such as those passed to `MPI_Comm_create_keyval()`. It always returns the error code `PETSC_MPI_ERROR_CODE`
which is registered with `MPI_Add_error_code()` when PETSc is initialized.


## See Also
 `SETERRQ()`, `PetscCall()`, `PetscCallMPI()`, `PetscTraceBackErrorHandler()`, `PetscPushErrorHandler()`, `PetscError()`, `CHKMEMQ`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscerror.h.html#SETERRMPI">include/petscerror.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscerror.h)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
