Skip to main content
`Ctrl`+`K`

# PetscCallMPINull

Checks error code returned from MPI calls, if non-zero it calls the error handler and then returns a `NULL`

## Synopsis

    #include <petscerror.h>
    void PetscCallMPINull(MPI_Function(args))

Not Collective; No Fortran Support

## Input Parameter

- MPI_Function - an MPI function that returns an MPI error code

## Notes

Always passes the error code `PETSC_ERR_MPI` to the error handler `PetscError()`; the MPI error code and string are embedded in the string error message. Do not use this to call any other routines (for example PETSc routines), it should only be used for direct MPI calls.

This routine can only be used in functions returning anything that can be returned as a `NULL` themselves. If the calling function returns a different type, use `PetscCallMPIAbort()` instead.

## Example Usage

      PetscCallMPINull(MPI_Comm_size(...)); // OK, calling MPI function

      PetscCallMPI(PetscFunction(...)); // ERROR, use PetscCall() instead!

## See Also

`SETERRMPI()`, `PetscCall()`, `SETERRQ()`, `SETERRABORT()`, `PetscCallAbort()`, `PetscCallMPIAbort()`, `PetscTraceBackErrorHandler()`, `PetscPushErrorHandler()`, `PetscError()`, `CHKMEMQ`, `PetscCallMPI()`

## Level

beginner

## Location

include/petscerror.h

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