All PETSc 2.0 routines return an integer indicating whether an error has occurred during the call. The PETSc macro CHKERRQ(ierr) checks the value of ierr and calls the PETSc 2.0 error handler upon error detection. CHKERRQ(ierr) should be used in all subroutines to enable a complete error traceback. A variant of this macro, CHKERRA(ierr), should be used in the main program to enable correct termination of all processes when an error is encountered. In Figure 4 we indicate a traceback generated by error detection within a sample PETSc program. The error occurred on line 858 of the file ${}PETSC_DIR/src/mat/impls/aij/seq/aij.c and was caused by trying to allocate too large an array in memory. The routine was called in the program ex3.c on line 49. See Section Error Checking for details regarding error checking when using the PETSc Fortran interface.
eagle>mpirun -np 1 ex3 -m 10000 [0]PETSC ERROR: MatCreateSeqAIJ() line 1673 in src/mat/impls/aij/seq/aij.c [0]PETSC ERROR: Out of memory. This could be due to allocating [0]PETSC ERROR: too large an object or bleeding by not properly [0]PETSC ERROR: destroying unneeded objects. [0]PETSC ERROR: Try running with -trdump for more information. [0]PETSC ERROR: MatCreate() line 99 in src/mat/utils/gcreate.c [0]PETSC ERROR: main() line 71 in src/sles/examples/tutorials/ex3.c [0] MPI Abort by user Aborting program ! [0] Aborting program! p0_28969: p4_error: : 1