Actual source code: ex74.c

  1: static char help[] = "Check MPI error strings. Crashes with known error with MPICH.\n";

  3: #include <petscsys.h>

  5: int main(int argc, char **argv)
  6: {
  7:   PetscFunctionBeginUser;
  8:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));

 10:   for (PetscMPIInt err = 1; err <= MPI_ERR_LASTCODE; err++) {
 11:     PetscMPIInt len;
 12:     char        errorstring[MPI_MAX_ERROR_STRING];

 14:     MPI_Error_string(err, (char *)errorstring, &len);
 15:     PetscCheck(len < MPI_MAX_ERROR_STRING, PETSC_COMM_WORLD, PETSC_ERR_LIB, "Error excessive string length from MPI_Error_string()");
 16:     // PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Error code %d length %d string %s\n", err, len, errorstring));
 17:   }

 19:   PetscCall(PetscFinalize());
 20:   return 0;
 21: }

 23: /*TEST

 25:    test:
 26:      requires: defined(PETSC_HAVE_OPENMPI)

 28: TEST*/