This source file includes following definitions.
- MPI_Init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "ompi_config.h"
24
25 #include <stdlib.h>
26
27 #include "opal/util/show_help.h"
28 #include "ompi/runtime/ompi_spc.h"
29 #include "ompi/mpi/c/bindings.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/constants.h"
33
34 #if OMPI_BUILD_MPI_PROFILING
35 #if OPAL_HAVE_WEAK_SYMBOLS
36 #pragma weak MPI_Init = PMPI_Init
37 #endif
38 #define MPI_Init PMPI_Init
39 #endif
40
41 static const char FUNC_NAME[] = "MPI_Init";
42
43
44 int MPI_Init(int *argc, char ***argv)
45 {
46 int err;
47 int provided;
48 char *env;
49 int required = MPI_THREAD_SINGLE;
50
51
52
53
54
55 if (NULL != (env = getenv("OMPI_MPI_THREAD_LEVEL"))) {
56 required = atoi(env);
57 if (required < MPI_THREAD_SINGLE || required > MPI_THREAD_MULTIPLE) {
58 required = MPI_THREAD_MULTIPLE;
59 }
60 }
61
62
63
64
65
66 if (NULL != argc && NULL != argv) {
67 err = ompi_mpi_init(*argc, *argv, required, &provided, false);
68 } else {
69 err = ompi_mpi_init(0, NULL, required, &provided, false);
70 }
71
72
73
74
75
76
77 if (MPI_SUCCESS != err) {
78 return ompi_errhandler_invoke(NULL, NULL,
79 OMPI_ERRHANDLER_TYPE_COMM,
80 err <
81 0 ? ompi_errcode_get_mpi_code(err) :
82 err, FUNC_NAME);
83 }
84
85 OPAL_CR_INIT_LIBRARY();
86
87 SPC_INIT();
88
89 return MPI_SUCCESS;
90 }