PETSc version 3.17.4
Fix/Edit manual page

PetscCallMPI

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

Synopsis

#include <petscerror.h>
void PetscCallMPI(PetscErrorCode ierr)
Not Collective

Input Parameters

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

Notes

Always returns the error code PETSC_ERR_MPI; 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. Due to limitations of the preprocessor this can unfortunately not easily be enforced, so the user should take care to check this themselves.

Example Usage

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

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

See Also

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

Level

beginner

Location

src/sys/error/../../../include/petscerror.h

Examples

src/sys/classes/random/tutorials/ex1.c.html
src/sys/classes/random/tutorials/ex2.c.html
src/sys/tutorials/ex1.c.html
src/sys/tutorials/ex2.c.html
src/sys/tutorials/ex3.c.html
src/sys/tutorials/ex4.c.html
src/sys/tutorials/ex16.c.html
src/vec/vec/tutorials/ex2.c.html
src/vec/vec/tutorials/ex3.c.html
src/vec/vec/tutorials/ex5.c.html
src/vec/vec/tutorials/ex6.c.html

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