File: errfatal.c

package info (click to toggle)
mpich 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 251,828 kB
  • sloc: ansic: 1,323,147; cpp: 82,869; f90: 72,420; javascript: 40,763; perl: 28,296; sh: 19,399; python: 16,191; xml: 14,418; makefile: 9,468; fortran: 8,046; java: 4,635; pascal: 352; asm: 324; ruby: 176; awk: 27; lisp: 19; php: 8; sed: 4
file content (46 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (C) by Argonne National Laboratory
 *     See COPYRIGHT in top-level directory
 */

#include <mpi.h>
#include <stdio.h>

/* FIXME: This behavior of this test is implementation specific. */

static int verbose = 0;

int main(int argc, char **argv)
{
    int MY_ERROR_CLASS;
    int MY_ERROR_CODE;
    char MY_ERROR_STRING[10];

    sprintf(MY_ERROR_STRING, "MY ERROR");

    MPI_Init(&argc, &argv);

    if (verbose)
        printf("Adding My Error Class\n");
    MPI_Add_error_class(&MY_ERROR_CLASS);
    if (verbose)
        printf("Adding My Error Code\n");
    MPI_Add_error_code(MY_ERROR_CLASS, &MY_ERROR_CODE);
    if (verbose)
        printf("Adding My Error String\n");
    MPI_Add_error_string(MY_ERROR_CODE, MY_ERROR_STRING);

    if (verbose)
        printf("Calling Error Handler\n");
    MPI_Comm_call_errhandler(MPI_COMM_WORLD, MY_ERROR_CODE);

    /* We should not get here, because the default error handler
     * is ERRORS_ARE_FATAL.  This makes sure that the correct error
     * handler is called and that no failure occurred (such as
     * a SEGV) in Comm_call_errhandler on the default
     * error handler. */
    printf("After the Error Handler Has Been Called\n");

    MPI_Finalize();
    return 0;
}