summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/17 mpi/main.c
blob: e44357a974d547f15ae952c2bdcdfb2fab04517a (plain)
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
#include <stdio.h>
#include <mpi.h>

int main(int argc, char **argv)
{
    int ier, flag;
    ier = MPI_Init(&argc, &argv);
    if (ier) {
        printf("Unable to initialize MPI: %d\n", ier);
        return 1;
    }
    ier = MPI_Initialized(&flag);
    if (ier) {
        printf("Unable to check MPI initialization state: %d\n", ier);
        return 1;
    }
    if (!flag) {
        printf("MPI did not initialize!\n");
        return 1;
    }
    ier = MPI_Finalize();
    if (ier) {
        printf("Unable to finalize MPI: %d\n", ier);
        return 1;
    }
    return 0;
}