-
Notifications
You must be signed in to change notification settings - Fork 0
/
testinit.c
60 lines (43 loc) · 1.23 KB
/
testinit.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef NOWRAP
#include <mpi.h>
#else
#include "mpi.h"
#endif
int main(int argc, char* argv[])
{
int rc, flag;
rc = MPI_Initialized(&flag);
printf("is init? %d\n", flag);
int major, minor;
rc = MPI_Get_version(&major,&minor);
printf("BEFORE major=%d, minor=%d\n", major, minor);
int len;
char version[MPI_MAX_LIBRARY_VERSION_STRING];
rc = MPI_Get_library_version(version,&len);
printf("BEFORE version=%s\n", version);
rc = MPI_Init(&argc,&argv);
rc = MPI_Get_version(&major,&minor);
printf("AFTER major=%d, minor=%d\n", major, minor);
rc = MPI_Get_library_version(version,&len);
printf("AFTER version=%s\n", version);
double t0 = MPI_Wtime();
rc = MPI_Initialized(&flag);
printf("is init? %d\n", flag);
rc = MPI_Finalized(&flag);
printf("is final? %d\n", flag);
rc = MPI_Is_thread_main(&flag);
printf("is thread main? %d\n", flag);
double t1 = MPI_Wtime();
printf("dt=%lf\n",t1-t0);
rc = MPI_Finalize();
rc = MPI_Finalized(&flag);
printf("is final? %d\n", flag);
printf("all done\n");
return rc;
}