summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod/FindMPI/test_mpi.c
blob: b8a308a4b0ee0aed363a0cf8c1669974a937eeae (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
28
29
30
31
32
33
34
35
36
37
#include <mpi.h>

#ifdef __cplusplus
#include <cstdio>
#else
#include <stdio.h>
#endif

#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
const char mpiver_str[] = { 'I', 'N',
                            'F', 'O',
                            ':', 'M',
                            'P', 'I',
                            '-', 'V',
                            'E', 'R',
                            '[', ('0' + MPI_VERSION),
                            '.', ('0' + MPI_SUBVERSION),
                            ']', '\0' };
#endif

int main(int argc, char* argv[])
{
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
#ifdef __cplusplus
  std::puts(mpiver_str);
#else
  puts(mpiver_str);
#endif
#endif
#ifdef TEST_MPI_MPICXX
  MPI::MPI_Init(&argc, &argv);
  MPI::MPI_Finalize();
#else
  MPI_Init(&argc, &argv);
  MPI_Finalize();
#endif
}