tutorial/q02.err_handler.c
/* This program handles errors in an error handler, no need to check 
 * the return code of all MPI functions. Neat!. 
 *
 * Can you also make it print which ranks have caused the operation to
 * raise an error?
 */
This program handles errors in an error handler, no need to check
the return code of all MPI functions. Neat!.


This program handles errors in an error handler no need to check the return code of all MPI functions . Neat! .
static void verbose_errhandler(MPI_Comm* comm, int* err, ...) {
    int rank, size, len;
    char errstr[MPI_MAX_ERROR_STRING];
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Error_string( *err, errstr, &len );
    printf("Rank %d / %d: Notified of error %s\n",
           rank, size, errstr);
}
static void verbose_errhandler ( MPI_Comm * comm , int * err , ... ) { int rank , size , len ; char errstr [ MPI_MAX_ERROR_STRING ] ; MPI_Comm_rank ( MPI_COMM_WORLD , & rank ) ; MPI_Comm_size ( MPI_COMM_WORLD , & size ) ; MPI_Error_string ( * err , errstr , & len ) ; printf ( " \n " , rank , size , errstr ) ; }
This program handles errors in an error handler, no need to check
 the return code of all MPI functions.
This program handles errors in an error handler no need to check the return code of all MPI functions .